centos安装lnmp

Linux 2016-08-23

这种部署文真没意思- -

起步

最后还是买了海外服务器,一个月才10块,比国内某云好太多了,配置除了硬盘比较小外,内存反正可以手动弄swap分区倒不是很大问题。用ubuntu系统对配置要求较高,后面还是换回centos6,还是这个系统比较适合服务器。

lnmp安装

nginx

刚登陆服务器第一件事就是更新下软件源:yum update;而后yum install nginx竟然没有这个包:

Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: centos-distro.1gservers.com
 * extras: centos.sonn.com
 * updates: mirrors.evowise.com
No package nginx available.

Excuse me? 什么情况。

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-5-4.noarch.rpm

再次执行 yum install nginx,则会提示安装成功了.epel的安装跟centos的系统版本.我的是6,如果不是要找一下http://fedoraproject.org/wiki/EPEL

php

20160823095302.png

什么!版本是5.3?换换换。 CentOS/RHEL 7.x:

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

CentOS/RHEL 6.x:

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

然后再来安装:yum install php70w php70w-opcache php-fpm模式:yum install php70w-fpm php70w-opcache

安装其他插件(选装): php70w php70w-bcmath php70w-cli php70w-common php70w-dba php70w-devel php70w-embedded php70w-enchant php70w-fpm php70w-gd php70w-imap php70w-interbase php70w-intl php70w-ldap php70w-mbstring php70w-mcrypt php70w-mysql php70w-mysqlnd php70w-odbc php70w-opcache php70w-pdo php70w-pdo_dblib php70w-pear php70w-pecl-apcu php70w-pecl-imagick php70w-pecl-xdebug php70w-pgsql php70w-phpdbg php70w-process php70w-pspell php70w-recode php70w-snmp php70w-soap php70w-tidy php70w-xml php70w-xmlrpc

贴一贴,占了这么多篇幅,我真机智,其实可以看这里:https://webtatic.com/packages/php70/,喂,童鞋,别扔拖鞋呀。

mysql

20160823102834.png

centos的源怎么都这么老啊= =

rpm -Uvh http://dev.mysql.com/get/mysql57-community-release-el6-8.noarch.rpm

默认 root 密码为空,其实不为空,使用 mysql -u root -p 进行登录失败。 我还是重置吧= =,重置密码的方法:https://www.hongweipeng.com/index.php/archives/758/

phpmyadmin

CentOS/RHEL 7:
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

CentOS/RHEL 6:
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

CentOS/RHEL 5:
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm

Fedora 20:
# rpm -Uvh http://rpms.famillecollet.com/remi-release-20.rpm

Fedora 19:
# rpm -Uvh http://rpms.famillecollet.com/remi-release-19.rpm

Fedora 18:
# rpm -Uvh http://rpms.famillecollet.com/remi-release-18.rpm

yum --enablerepo=remi,remi-test install phpMyAdmin

后续问题

老调重谈的你会发现访问php文件变成了下载,因为ng并未配置响应处理。

location ~ \.php$ {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

本文由 hongweipeng 创作,采用 知识共享署名 3.0,可自由转载、引用,但需署名作者且注明文章出处。

如果对您有用,您的支持将鼓励我继续创作!