Centos7安装LAMP+PHPmyadmin

1、更新Centos7下载源
更新之前记得备份!!!
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
参考:http://mirrors.aliyun.com/help/centos
163的源参考:http://mirrors.163.com/.help/centos.html
2、更新本地缓存
yum clean all
yum makecache
3、安装网络工具
yum install net-tools
如果你要用ifconfig等命令的话
4、关闭firewall
systemctl stop firewalld.service
systemctl disable firewalld.service
5、关闭selinux
vi /etc/selinux/config
注释#SELINUX=enforcing
注释#SELINUXTYPE=targeted
添加SELINUX=disabled
保存退出:wq
setenforce 0#关闭selinux
6、安装apache
yum install httpd
7、安装Mariadb
yum install mariadb mariadb-server
拷贝配置文件覆盖原配置文件
cp /usr/share/mysql/my-huge.cnf /etc/my.cnf
8、安装PHP
yum install php php-mysql php-gd php-odbc php-pear php-mbstring php-mcrypt
9、下载PHPmyadmin
wget https://files.phpmyadmin.net/phpMyAdmin/4.0.0/phpMyAdmin-4.0.0-all-languages.zip
解压到/var/www/html/phpmyadmin

10、配置站点
vi /etc/httpd/conf/httpd.conf
文件最后加入

Include vhost/*.conf
mkdir /etc/httpd/vhost
touch test.conf

DocumentRoot /var/www/html/test
ServerName test

Options FollowSymLinks
AllowOverride All


touch phpmyadmin.conf

DocumentRoot /var/www/html/phpmyadmin
ServerName phpmyadmin

Options FollowSymLinks
AllowOverride All


重启apache和mariadb
11、安装epel源
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm
如果版本不一样就去这里找http://dl.fedoraproject.org/pub/epel/
rpm -ivh rpm epel-release-7-8.noarch.rpm
yum clean all
yum update
以下步骤都是在安装了epel源下进行的
12、安装mcrypt扩展
yum install php-mcrypt
13、安装redis、memcache以及扩展
yum install redis
vi /etc/redis.conf
daemonize yes#守护进程运行
redis-server /etc/redis.conf
yum install php-redis
yum install memcached
yum install php-memcached

附录:
启动|停止|重启apache systemctl start|stop|restart httpd.service
开机启动apache systemctl enable httpd.service
启动|停止|重启mariadb systemctl start|stop|restart mariadb.service
开启启动mariadb systemctl enable mariadb.service