Linux_使用yum快速安装、配置amp环境

一、安装Apache:

yum -y install httpd httpd-manual mod_ssl mod_perl mod_auth_mysql

测试:

1.关闭防火墙:service iptables stop

2.尝试启Apache:service httpd start

3.输入服务器IP,出现如下界面成功:

完善apache配置:

1.关闭apache:service httpd stop

2.打开apache的配置文件 : vim /etc/httpd/conf/httpd.conf

3.修改 ServerName  选项 ,值为:localhost:80

4.重启 apache :service httpd restart ,并再次输入服务器IP进行测试
5.把apache的启动加入开机脚本:chkconfig httpd on  

二、安装MySql

yum -y install mysql mysql-server mysql-devel

使用上面指令安装成功后,进行配置:
1:把mysql的启动加入开机脚本:chkconfig mysqld on

2.启动mysql:service mysqld start 

3.设置mysql的root账号和密码,否则mysql是随便进入的:mysqladmin –uroot password [你的密码]

4.测试进入mysql:mysql -uroot -p123456

如果能成功进入,还需要配置字符集,否则会乱码

 完善mysql的乱码配置,需要使用mysql的补丁包(文末有下载地址):

1.把补丁包上传到Linux的/usr/local/src下,有mysql.sh 和 mysql.zip 两个文件

2.将两个文件的权限设置成 777 ,然后运行 mysql.sh  文件即可

3.重启mysql ,指令:service mysqld start ,再看文字编码是否变为utf8 ,两个指令如上图。

三、安装PHP5.6.x

Centos 默认yum源的php版本太低了,采用yum安装最新版,需要配置yum源。

1.配置yum源,依次执行下面两个命令

rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

2.安装PHP5.6.x

yum -y install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-pecl-xdebug php-pecl-xhprof

3.重启 apache :service httpd restart,在根目录 /var/www/html/ 编辑index.php (或自定义一个文件)文件:

<?php
phpinfo();

4.访问这个文件,出现 phpinfo 相关信息则表示配置成功

5.或者使用  php -v 指令也可以测试:

注:Linux下修改字符集文件下载分享:

链接:http://pan.baidu.com/s/1jHPm8GQ 密码:aiy5
原文地址:https://www.cnblogs.com/bk233/p/7347332.html