CentOS 6.4系统安装配置LNMP及搭建PHP服务器运行环境

CentOS 6.4系统如何配置安装LNMP以及搭建PHP服务器运行环境?

安装lnmp步骤1,准备工作

上pkgs.org下载rmpforge。rpmforge是一个第三方yum源。

选择相应的版本下载安装。

CentOS 6.4系统安装配置LNMP及搭建PHP服务器运行环境

----------------------------------------分割线----------------------------------------

----------------------------------------分割线----------------------------------------

// 安装成功后,清空yum list 并 重新获取

[root@pangou Desktop]# yum clean all

Loaded plugins: fastestmirror, refresh-packagekit, security

Cleaning repos: base extras rpmforge updates

Cleaning up Everything

Cleaning up list of fastest mirrors

[root@pangou Desktop]# yum -y list

Loaded plugins: fastestmirror, refresh-packagekit, security

Determining fastest mirrors

// ……

卸载已存在的apache服务和php

[root@pangou Desktop]# yum remove httpd php*

安装development Tools

[root@pangou Desktop]# yum -y groupinstall “Development Tools”

步骤2安装nginx

创建nginx目录,下载nginx,并解压缩

[root@pangou Downloads]# mkdir nginx

[root@pangou Downloads]# cd nginx/

[root@pangou nginx]# pwd

/root/Downloads/nginx

[root@pangou nginx]# wget http://nginx.org/download/nginx-1.4.0.tar.gz

–2013-04-30 23:13:44– http://nginx.org/download/nginx-1.4.0.tar.gz

Resolving nginx.org… 206.251.255.63

Connecting to nginx.org|206.251.255.63|:80… connected.

HTTP request sent, awaiting response… 200 OK

Length: 773451 (755K) [application/octet-stream]

Saving to: “nginx-1.4.0.tar.gz”

100%[================================================================>] 773,451 184K/s in 4.5s

2013-04-30 23:13:48 (166 KB/s) – “nginx-1.4.0.tar.gz” saved [773451/773451]

[root@pangou nginx]# ls

nginx-1.4.0.tar.gz

[root@pangou nginx]# tar -zxvf nginx-1.4.0.tar.gz

[root@pangou nginx]# ls

nginx-1.4.0 nginx-1.4.0.tar.gz

编译安装nginx

// 编译 安装路径/opt/nginx

[root@pangou nginx-1.4.0]# ./configure –prefix=/opt/nginx/

编译中如出现报错如:

./configure: error: the HTTP rewrite module requires the PCRE library.

You can either disable the module by using –without-http_rewrite_module

option, or install the PCRE library into the system, or build the PCRE library

statically from the source with nginx by using –with-pcre= option.

就是用yum自行结局依赖关系

[root@pangou nginx-1.4.0]# yum install pcre pcre-devel

然后重新上面的编译

// 编译 安装路径/opt/nginx

[root@pangou nginx-1.4.0]# ./configure –prefix=/opt/nginx/

// 编译成功后

[root@pangou nginx-1.4.0]# make && make install

// 最后安装完成

启动nginx服务

[root@pangou nginx]# cd /opt/nginx/sbin/

[root@pangou sbin]# ./nginx

访问127.0.0.1

CentOS 6.4系统安装配置LNMP及搭建PHP服务器运行环境

服务启动成功。

相关推荐