centos下安装lnmp各个版本的几种方法
首先我们用一种yum的方法安装,我们需要rpm源
默认的版本太低了,手动安装有一些麻烦,想采用Yum安装的可以使用下面的方案:
1.检查当前安装的PHP包
yum list installed | grep php
如果有安装的PHP包,先删除他们
yum remove php.x86_64 php-cli.x86_64 php-common.x86_64 php-gd.x86_64 php-ldap.x86_64 php-mbstring.x86_64 php-mcrypt.x86_64 php-mysql.x86_64 php-pdo.x86_64
2.Centos 5.X
rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm
CentOs 6.x
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
CentOs 7.X
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
CentOs 6.x
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
CentOs 7.X
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
如果想删除上面安装的包,重新安装
rpm -qa | grep webstatic
rpm -e 上面搜索到的包即可
3.运行yum install
rpm -qa | grep webstatic
rpm -e 上面搜索到的包即可
3.运行yum install
yum install php55w.x86_64 php55w-cli.x86_64 php55w-common.x86_64 php55w-gd.x86_64 php55w-ldap.x86_64 php55w-mbstring.x86_64 php55w-mcrypt.x86_64 php55w-mysql.x86_64 php55w-pdo.x86_64
注:如果想升级到5.6把上面的55w换成56w就可以了。
yum install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64
yum install php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64 php56w-gd.x86_64 php56w-ldap.x86_64 php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64
注:如果想升级到5.6把上面的55w换成56w就可以了。
yum install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64
然后安装另外几个扩展
yum install php56w-xml
yum insatll php56w-pear//pecl扩展安装
yum install php56w-devel(各个版本换一下)
4.安装PHP FPM
yum install php55w-fpm
yum install php56w-fpm
yum install php70w-fpm(安装后默认不开启php支持,需要手动开启security.limit_extensions)
yum install php56w-fpm
yum install php70w-fpm(安装后默认不开启php支持,需要手动开启security.limit_extensions)
5.安装nginx,如果有yum源的时候直接安装,没有的话运行命令
rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
然后运行命令
yum install nginx
彩蛋:编辑response header头部的server http://silencegg.iteye.com/blog/2103426
//安装zip unzip(有的系统里面没有带着)
yum install zip unzip
//查看端口占用
netstat -tnulp | grep php
//centos 用户管理
http://blog.csdn.net/u014066037/article/details/55505116
6.安装memcached扩展
https://help.aliyun.com/knowledge_detail/38644.html
7.安装redis扩展
http://yanshisan.blog.51cto.com/7879234/1377992
http://www.jb51.net/article/62507.htm
http://www.laozuo.org/5755.html
redis安装完成后需要修改一下
protected-mode改为no,
#bind 127.0.0.1用以外网连接
8.mysql5.7安装
9.yum安装的mysql
yum install mysql
yum install mysql-server
yum install mysql-devel
#上面是安装MYSQL
chgrp -R mysql /var/lib/mysql
chmod -R 770 /var/lib/mysql
#上面2步是设置运行权限和用户
mysql -u root
#登陆
service mysqld start mysql SET PASSWORD FOR 'root'@'localhost' = PASSWORD('secret_password');
#修改行密码
完全卸载mysql
http://www.linuxidc.com/Linux/2016-12/137941.htm
注:如果想升级到5.6把上面的55w换成56w就可以了。
还有一种方法,直接用集成的shell命令
预装lnmp一键安装包环境,官方地址:lnmp一键安装包