CentOS 6.5 builds LNMP production environment
Preparation before installation:
1. software package Download:
Mysql5.6.5-m8 |
Http://downloads.mysql.com/archives/get/file/mysql-5.6.5-m8.tar.gz |
Cmake-2.8.8 |
Http://www.cmake.org/files/v2.8/cmake-2.8.8.tar.gz |
php-5.4.29 |
Http://cn2.php.net.get/php-5.4.29.tar.gz/from/this/mirror |
libiconv-1.14 |
Http://ftp.gun.org/gnu/libiconv/libiconv-1.14.tar.gz |
nginx-1.2.9 |
Http://nginx.org/downlload/nginx-1.2.9.tar.gz |
2. Install MySQL database: Since MySQL starts with version 5.5, it is no longer used by open source software./configure scripts Configure compilation options instead of using the CMake command to compile, and CMake is not installed on the system by default, so We first install the CMake package:
A, CMake installation
[Email protected]_server ~]# tar-zxvf cmake-2.8.8.tar.gz[[email protected]_server ~]# CD Cmake-2.8.8[[email protected] _server ~]#./bootstrap[[email protected]_server ~]# gmake[[email protected]_server ~]# gmake Install
3. Install MySQL
[[Email protected]_server ~]# tar -zxvf mysql-5.6.5-m8.tar.gz[[email protected]_ Server ~]# cd mysql-5.6.5-m8[[email protected]_server ~]# cmake -dcmake_ Install_prefix=/opt/mysql -dmysql_unix_addr=/tmp/mysql.sock -ddefault_charset=utf8 -ddefault_ collation=utf8_general_ci -dwith_extra_charsets:string=all -dwith_innodb_storage_engine=1 - Dwith_archive_storage_engine=1 -dwith_readline=1 -denabled_local_infile=1 -dmysql_user=mysql -DMYSQL_TCP_PORT=3306[[email protected]_Server ~]# make #编辑 [[email protected]_server ~]# make install #安装 [[Email protected]_server ~]# useradd -s /sbin/nologin mysql #添加mysql用户 [[Email protected]_Server ~]# cp support-files/my-large.cnf /etc/my.cnf #复制配置文件 [[email protected]_server ~]# cd /usr/local/server/mysql[[email protected]_server ~]# mkdir -p /data/mysql/data #创建mysql数据目录 [[Email protected]_server ~]# scripts/mysql_install_ Db --datadir=/data/mysql/data \ --defaults-file=/etc/my.cnf --user=mysql #初始化数据库 [[email protected]_server ~]# cp support-files/mysql.server /etc/ init.d/ #复制启动脚本 [[email protected]_server ~]# chkconfig --add mysql.server #添加启动服务 [[email protected]_server ~]# service mysql.server start [[email protected]_Server ~]# echo "Path=/opt/mysql/bin" >>/ etc/profile #设置环境变量 [[email protected]_server ~]# echo "export PATH ">>/etc/profile
4. Install PHP
Before installing PHP, you need to install the Libconv package, and other PHP required packages are already in use with Yum installation, so there is no need to repeat the installation.
A. Install the LIBICONV package
[[Email protected]_server ~]# tar-zxvf libiconv-1.14.tar.gz[[email protected]_server ~]# cd Libiconv-1.14[[email Protected]_server ~]#./configure--prefix=/usr/local[[email protected]_server ~]# make && make Install[[email Protected]_server ~]# Ldconfig #执行ldconfig命令更新动态库缓存
B, install PHP
[[Email protected]_server ~]# tar -zxvf php-5.4.5.tar.gz[[email protected]_ server ~]# cd php-5.4.5[[email protected]_server ~]# ./configure --prefix=/ Opt/php --disable-debug --disable-ipv6 --disable-rpath --enable-bcmath --enable-exif --enable-gd-native-ttf --enable-mbregex --enable-mbstring=all --enables-pcntl -- enable-sage-mode --enable-shmop --enable-soap --enable-sockets --enable-xml -- with-config-file-path=/opt/php/etc --with-curl --with-curlwrappers --with-freetype-dir -- with\-gd --with-gettext --with-iconv-dir=/usr/local --with-jpeg-dir --with-ldap -- with-ldap-sasl --with-libdir=lib --with-libxml-dir=/usr --with-mcrypt --with-mhash -- with-openssl --with-pdo-mysql --with-pear --with-png-dir --with-xmlrpc -- With-zlib-dir --with-mysqlli=/opt/mysql/bin/mysql_config --with-mysql=/opt/mysql --enable-fastcgi --enable-fpm -- Enable-force-cgi-redirect[[email protected]_server ~]# make zend_extra_libs= '-liconv ' [[EMAIL PROTECTED]_SERVER ~]# MAKE INSTALL[[EMAIL PROTECTED]_SERVER ~]# CP php.ini-production /opt/php/etc/php.ini [[email protected]_server ~]# cp / op/php/etc/php-fpm.conf.default /opt/php/etc/php-fpm.conf[[email protected]_server ~]#
5. Installing Nginx
[Email protected]_server ~]# tar-zxvf nginx-1.2.9.tar.gz[[email protected]_server ~]# CD Nginx-1.2.9[[email protected] _server ~]#./configure--prefix=/opt/nginx--user=nobody--group=nobody--with-poll_module--with-http_ssl_module-- With-http_sub_module--with-http_perl_module--with-mail--with-pcre[[email protected]_server ~]# make [email Protected]_server ~]# make Install
6. Start the service
[Email protected]_server ~]#/opt/php/sbin/php-fpm[[email protected]_server ~]# killall-php-fpm[[email protected]_ Server ~]#/opt/nginx/sbin/nginx[[email protected]_server ~]#/opt/nginx/sbin/nginx-s Stop
This article is from the "Elephant" blog, make sure to keep this source http://zlyang.blog.51cto.com/1196234/1745996
CentOS 6.5 builds LNMP production environment