Home  >  Article  >  Backend Development  >  lnmp environment construction source code package installation linux, nginx, mysql, php

lnmp environment construction source code package installation linux, nginx, mysql, php

WBOY
WBOYOriginal
2016-08-08 09:22:161008browse

Environment: contos 6.5

Description:

Source code directory:/data/software/soft

Installation directory:/usr/local/webserver/

Source code package: http://pan.baidu.com/s /1kTy3UXh

Preparation:

yum -y install gcc automake autoconf libtool make

yum -y install gcc gcc-c++ glibc

yum -y install libmcrypt-devel mhash-devel libxslt-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-de
vel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb
5 krb5-devel libidn libidn-devel openssl openssl-devel

Install php script:
spath=/data/software/soft
cd ${spath}
tar zvxf php-5.6.9.tar.gz
cd php-5.6.9


webpath=/usr/local/webserver

./configure --prefix=${webpath}/php  --enable-fpm  --with-openssl  --with-mcrypt --enable-mbstring --with-curl --disable-debug  --disable-rpa
th --enable-inline-optimization --with-bz2  --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --
with-mhash --enable-zip --with-pcre-regex --with-mysql --with-mysqli --with-gd --with-jpeg-dir

make all install

Prepare to install nginx, install zlib, openssl, pcre script:

spath=/data/software/soft
cd ${spath}
tar -xzvf pcre-8.34.tar.gz 
tar -xzvf openssl-1.0.1c.tar.gz 
tar -xzvf zlib-1.2.8.tar.gz
cd ${spath}/zlib-1.2.8
./configure
make && make install

cd ${spath}/openssl-1.0.1c
./config 
./config -t
make && make install

cd ${spath}/pcre-8.34
./configure
make
make install

Install nginx script (including echo and realip modules):
webpath=/usr/local/webserver
spath=/data/software/soft
cd ${spath}
tar xzvf nginx-1.4.2.tar.gz
tar xzvf echo-nginx-module-0.57.tar.gz
cd nginx-1.4.2
./configure --sbin-path=${webpath}/nginx/nginx --conf-path=${webpath}/nginx/nginx.conf --pid-path=${webpath}/nginx/nginx.pid --with-http_ssl_
module --with-pcre=${spath}/pcre-8.34 --with-zlib=${spath}/zlib-1.2.8 --with-openssl=${spath}/openssl-1.0.1c --add-module=/data/software/soft
/echo-nginx-module-0.57 --with-http_realip_module
make && make install
install mysql script
yum install ncurses-devel
groupadd mysql
useradd -r -g mysql mysql
spath=/data/software/soft
cd ${spath}
tar zvxf mysql-5.6.16.tar.gz
cd mysql-5.6.16
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/webserver/mysql -DMYSQL_UNIX_ADDR=/usr/local/webserver/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFA
ULT_COLLATION=utf8_general_ci -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DMYSQL_DATA
DIR=/data/mysqldb -DMYSQL_TCP_PORT=3306 -DENABLE_DOWNLOADS=1
make && make install
chown mysql.mysql -R /usr/local/webserver/mysql
chown mysql.mysql -R /data/mysqldb
/usr/local/webserver/mysql/scripts/mysql_install_db --user=mysql --datadir=/data/mysqldb
cp /usr/local/webserver/mysql/support-files/my-default.cnf /etc/my.cnf
mysql related operations
cp support-files/mysql.server /etc/init.d/mysqld 

vim /etc/profile //加入到$PATH中

      PATH=/usr/local/webserver/mysql/bin:/usr/local/webserver/mysql/lib:$PATH

      export PATH

source /etc/profile //使生效

service mysqld start //启动mysql
chkconfig --level 35 mysqld on //设置开机启动

netstat -tulnp | grep 3306 //查看端口
mysql -u root -p //登录

mysqladmin -u root password '123456' //设置密码


The above introduces the lnmp environment construction and source code package installation of linux, nginx, mysql, php, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn