centos6.5编译安装LNMP环境

本文详细介绍了在CentOS 6.5 32位系统上,如何从源码编译安装LNMP(Linux + Nginx + MySQL + PHP)环境,并进一步配置和安装Redis及PHP的Redis扩展。涵盖了从安装编译工具、配置端口到各个组件的安装步骤,以及最后的测试验证。
摘要由CSDN通过智能技术生成

安装编译工具及库文件

yum install -y  yasm apr* autoconf automake bison bzip2 bzip2* cloog-ppl compat* cpp curl curl-devel fontconfig fontconfig-devel freetype freetype* freetype-devel gcc gcc-c++ gtk+-devel gd gettext gettext-devel glibc kernel kernel-headers keyutils keyutils-libs-devel krb5-devel libcom_err-devel libpng libpng* libpng-devel libjpeg* libsepol-devel libselinux-devel libstdc++-devel libtool* libgomp libxml2 libxml2-devel libXpm* libX* libtiff libtiff* make mpfr ncurses* ntp openssl nasm nasm* openssl-devel patch pcre-devel perl php-common php-gd policycoreutils ppl telnet t1lib t1lib* wget zlib-devel

配置端口

[root@localhost vagrant]vi /etc/sysconfig/iptables 

粘贴如下:

# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

重启使生效

[root@localhost vagrant]#service iptables restart 

查看已开启的端口

[root@localhost vagrant]# /etc/init.d/iptables status

关闭SELINUX

[root@localhost vagrant]# vi /etc/selinux/config

注释掉:

SELINUXTYPE=targeted 

新增:

SELINUX=disabled 

关闭selinux防火墙:

[root@localhost vagrant]# setenforce 0 

系统约定

软件源代码包存放位置:/usr/local/src
源码包编译安装位置:/usr/local/软件名字

下载软件包

1、下载nginx

[root@localhost src]# wget http://nginx.org/download/nginx-1.6.2.tar.gz

2、下载MySQL

[root@localhost src]# wget  http://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.21.tar.gz

3、下载php

[root@localhost src]# wget http://cn2.php.net/distributions/php-5.6.3.tar.gz

4、下载pcre (支持nginx伪静态)

[root@localhost src]# wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.36/pcre-8.36.tar.gz

5、下载openssl(nginx扩展)

[root@localhost src]# wget http://www.openssl.org/source/openssl-1.0.1j.tar.gz

6、下载zlib(nginx扩展)

[root@localhost src]# wget zlib.net/fossils/zlib-1.2.8.tar.gz

7、下载cmake(MySQL编译工具)

[root@localhost src]# wget http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz

8、下载libmcrypt(php扩展)

[root@localhost src]# wget http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz

9、下载yasm(php扩展)

[root@localhost src]# wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz

10、t1lib(php扩展)

http://download.csdn.net/download/sunkaivg/9696064

11、下载gd库安装包

http://download.csdn.net/detail/long712905/9391234

12、libvpx(gd库需要)

http://download.csdn.net/download/huaweichina/8485159

13、tiff(gd库需要)

http://download.csdn.net/download/damys/9326943

14、libpng(gd库需要)

http://download.csdn.net/download/damys/9326857

15、freetype(gd库需要)

[root@localhost src]# wget http://ring.u-toyama.ac.jp/archives/graphics/freetype/freetype2/freetype-2.5.4.tar.gz

16、jpegsrc(gd库需要)

[root@localhost src]# wget http://www.ijg.org/files/jpegsrc.v9a.tar.gz

安装MySQL

1、安装cmake

[root@localhost vagrant]# cd /usr/local/src/
[root@localhost src]# tar zxvf cmake-3.0.2.tar.gz
[root@localhost src]# cd cmake-3.0.2
[root@localhost cmake-3.0.2]# ./configure
[root@localhost cmake-3.0.2]# 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值