1.安装Apache
1.使用yum安装apache
yum install httpd -y
2.启动apache
service httpd start
3.上一步启动会有报错信息,然后我们查看hostname主机名,并将该主机名添加到apache配置文件的ServerName参数中
[tong@tong /]$ hostname
tong
[tong@tong /]$ cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=tong
[tong@tong /]$ vim /etc/httpd/conf/httpd.conf
添加 ServerName tong
4.重启apache服务
service httpd restart
5.开启启动apache
chkconfig httpd on
2.安装Mysql 5.6
1.检查系统是否自带mysql
yum list installed | grep mysql
2.删除系统自带的mysql及其依赖命令
yum -y remove mysql*
3.安装mysql
rpm -ivh http://repo.mysql.com/yum/mysql-5.5-community/el/6/x86_64/mysql-community-release-el6-5.noarch.rpm
4.修改yum源
vim /etc/yum.repos.d/mysql-community.repo
将5.5版本的enabled改为0,5.6版本的enabled改为1
5.安装mysql-5.6
yum install mysql-community-client mysql-community-devel mysql-community-server
6.启动mysql
service mysqld start
7.查看mysql是否开机自启,并且设置开机自启
chkconfig --list |grep mysqld
chkconfig mysqld on
8.mysql安全设置
mysql_secure_installation
3.安装PHP
rpm -Uvh http://download.Fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
yum install --enablerepo=remi,remi-php56 php php-opcache php-pecl-apcu php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof php-pdo php-pear php-fpm php-cli php-xml php-bcmath php-process php-gd php-common
php -v
4.安装Nginx
1.yum安装
yum -y install nginx
2.启动服务
service nginx start
会报错,80端口已占用,这是因为我们上面已经安装了apach,占用了80端口,我这里是修改了apache的端口改为8080,然后再开启nginx就可以了
3.开机启动
chkconfig nginx on