환경: 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
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
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 installmysql 스크립트 설치
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.cnfmysql 관련 작업
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' //设置密码
위 내용을 포함해 linux, nginx, mysql, php의 lnmp 환경 구축과 소스코드 패키지 설치에 대해 소개하고 있으니 PHP 튜토리얼에 관심이 있는 친구들에게 도움이 되었으면 좋겠습니다.