一、yum安装apache2.2
1、查看yum源Apache各个版本
yum list | grep httpd
2、选择需要的Apache版本进行安装
yum install httpd(默认安装目录:/etc/httpd )
3、修改apache配置文件httpd.conf
去掉#ServerName前面的#
看情况修改监听端口
4、启动Apache服务
service httpd start
二、编译安装php5.6
1、下载php5.6安装源文件并解压
wget http://cn2.php.net/distributions/php-5.6.30.tar.gz
tar -xzvf php-5.6.30.tar.gz
2、配置
进入解压目录执行一下代码进行配置,若出现未安装的扩展的报错,直接yum安装后再次执行配置
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql -with-mysql --disable-debug --disable-ipv6 --with-iconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --with-bz2 --with-pdo-mysql --enable-opcache=no --with-gd --enable-gd-native-ttf --with-libxml-dir=/usr --enable-xml --with-gettext --enable-bcmath
3、编译并安装
make && make install
4、配置Apache对php的支持
编辑httpd.conf
(1)添加:AddType application/x-httpd-php .php
(2)DirectoryIndex index.html index.html.var后面追加index.php
(3)加载php模块:添加LoadModule php5_module /etc/httpd/modules/libphp5.so(具体路径以Apache模块路径为准)
5、重启Apache
service httpd restart
三、yum安装MySQL5.6
1、先卸载原有的rpm包 --nodeps(不验证依赖关系)
[root@zabbixclient ~]# rpm -qa |grep mysql mysql-5.1.73-8.el6_8.x86_64
mysql-libs-5.1.73-8.el6_8.x86_64
mysql-server-5.1.73-8.el6_8.x86_64
[root@zabbixclient ~]# rpm -e --nodeps mysql-5.1.73-8.el6_8.x86_64
[root@zabbixclient ~]# rpm -e --nodeps mysql-libs-5.1.73-8.el6_8.x86_64
[root@zabbixclient ~]# rpm -e --nodeps mysql-server-5.1.73-8.el6_8.x86_64
2、下载yum的mysql更新包并安装
[root@zabbixclient ~]# wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
[root@zabbixclient ~]# rpm -ivh mysql-community-release-el6-5.noarch.rpm
[root@zabbixclient ~]# yum -y install mysql-community-server
3、启动MySQL
[root@zabbixclient ~]# service mysqld start
[root@zabbixclient ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2Server version: 5.6.36 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
4、mysql登录报错提示:ERROR 1045 (28000)的解决方法
(1)停用mysql服务
service mysqld stop
(2)输入命令
mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
(3)登入数据库
mysql -u root mysql
(4)查询用户
mysql> use mysql;
mysql> select user,host,password from user;
(5)将上面查询出来的空用户删除
mysql> delete from user where user='';
(6)退出并重启mysql
mysql> quit
# service mysql start
(7)重新登录
mysq -u root -p