当前位置:Gxlcms > PHP教程 > lnmp环境搭建源代码包安装linux,nginx,mysql,php

lnmp环境搭建源代码包安装linux,nginx,mysql,php

时间:2021-07-01 10:21:17 帮助过:6人阅读

环境:contos 6.5

说明:

源代码目录:/data/software/soft

安装目录:/usr/local/webserver/

源代码包: http://pan.baidu.com/s/1kTy3UXh

准备:

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

安装php脚本:
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

安装nginx准备,安装zlib,openssl,pcre 脚本:

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

安装nginx脚本(包含echo 和 realip 模块 ):
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
安装mysql脚本
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相关操作
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' //设置密码


以上就介绍了lnmp 环境搭建 源代码包安装 linux,nginx,mysql,php,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

人气教程排行