Chaos' Blog

Centos6.8搭建lamp环境

2019-01-23

Centos6.8也是服务器标配,这里重点介绍怎样搭建lamp环境的步骤。
老规矩,有空再更!

Apache

安装

1
sudo yum install httpd -y

开启

1
service httpd start

PHP

更新源

1
2
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

安装扩展

1
2
yum  install epel-release
yum install libmcrypt libmcrypt-devel mcrypt mhash

安装PHP7.0

1
yum -y install php70w php70w-fpm php70w-mysql php70w-mbstring php70w-mcrypt php70w-gd php70w-imap php70w-ldap php70w-odbc php70w-pear php70w-xml php70w-xmlrpc php70w-pdo php70w-apcu php70w-pecl-redis php70w-pecl-memcached php70w-devel

查看版本及扩展

1
2
php -v
php -m

mysql

下载源文件

1
wget https://dev.mysql.com/get/mysql57-community-release-el6-9.noarch.rpm

配置rpm

1
rpm -Uvh mysql57-community-release-el6-9.noarch.rpm

或者(推荐)

1
yum localinstall -y mysql57-community-release-el6-9.noarch.rpm

安装

1
yum install mysql-community-server

开启

1
service mysqld start

查看密码

1
grep 'temporary password' /var/log/mysqld.log

修改

1
2
3
mysql -u root -p
//输入密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

后续

重启apache,lamp环境即安装完毕,后续服务器端口开放等不再涉及,以上命令均在centos6.8上测试通过!

参考链接:

  1. https://www.cnblogs.com/yoke/p/7257184.html
  2. https://www.cnblogs.com/jimboi/p/6405560.html