1.下载软件源码包 nginx-1.4.2.tar.gz mysql-5.5.12.tar.gz php-5.4.12.tar.bz2
2.解压源码包
tar -zxf nginx-1.4.2.tar.gz tar -zxf mysql-5.5.12.tar.gz tar -jxf php-5.4.12.tar.bz2
3.安装Mysql
安装mysql依赖包
yum install -y gcc gcc-c++ make cmake ncurses-devel bison openssl-devel zlib-devel
安装MySQL数据库
cd mysql-5.5.12 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/lnmp/mysql \ -DMYSQL_DATADIR=/usr/local/lnmp/mysql/data \ -DMYSQL_UNIX_ADDR=/usr/local/lnmp/mysql/data/mysql.sock \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DEXTRA_CHARSETS=all \
然后执行
make && make install
添加mysql用户
useradd mysql
更改mysql目录文件及目录用户,组为mysql
cd /usr/local/lnmp/mysql chown -R mysql.mysql *
如图
更改目录执行
cd /usr/local/lnmp/mysql/scripts/ ./mysql_install_db --user=mysql --basedir=/usr/local/lnmp/mysql --datadir=/usr/local/lnmp/mysql/data
编辑文件bash_profile,添加usr/local/lnmp/mysql
vim /root/.bash_profile usr /local/lnmp/mysql/bin source /root/.bash_profile
更改文件及目录的用户,组
cd /usr/local/lnmp/mysql/ chown -R root * chown -R mysql data cd support-files cp mysql.server /etc/init.d/mysqld cp my-medium.cnf /etc/my.cnf
开启MySQL数据库服务
/etc/init.d/mysqld start
初始化MySQL数据库添加密码
mysql_secure_installation
4.安装nginx
cd nginx-1.4.2
编辑文件gcc
vim auto/cc/gcc
注释CFLAGS="$CFLAGS -g"
安装nginx依赖软件包
yum install pcre-devel openssl-devel -y
添加nginx
useradd nginx
安装nginx
./configure --prefix=/usr/local/lnmp/nginx/ --with-http_ssl_module --with-http_stub_status_module --user=nginx --group=nginx make && make install
添加软连接
ln -s /usr/local/lnmp/nginx/sbin/nginx /usr/local/sbin/ /usr/local/lnmp/nginx/sbin/nginx -c /usr/local/lnmp/nginx/conf/nginx.conf(若nginx重启时出错运行)
编辑文件nginx.conf
vim /usr/local/lnmp/nginx/conf/nginx.conf 添加 use epoll ; location /nginxstatus { stub_status on; access_log off; allow 192.168.0.1; deny all; } location ~ \.php${ root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; }
如图
关于PHP的那个nginx.conf文件里面只要去掉注释,更改为图上的
5.安装PHP
下载php模块源码包
libiconv-1.13.1.tar.gz
mcrypt-2.6.8.tar.gz
libmcrypt-2.5.8.tar.bz2
mhash-0.9.9.9.tar.bz2
解压源码包
tar zxf libiconv-1.13.1.tar.gz tar zxf mcrypt-2.6.8.tar.gz tar jxf libmcrypt-2.5.8.tar.bz2 tar jxf mhash-0.9.9.9.tar.bz2
创建php模块安装目录
mkdir /usr/local/lnmp/phpmodule
安装php模块
安装libiconv-1.13.1 cd libiconv-1.13.1 ./configure --prefix=/usr/local/lnmp/phpmodule/libiconv make && make install 安装mhash-0.9.9.9 cd mhash-0.9.9.9 ./configure --prefix=/usr/local/lnmp/phpmodule/mhash make && make install 安装libmcrypt-2.5.8 cd libmcrypt-2.5.8 ./configure --prefix=/usr/local/lnmp/phpmodule/libmcrypt make && make install 安装libltdl cd libmcrypt-2.5.8/libltdl ./configure --prefix=/usr/local/lnmp/phpmodule/libmcrypt --enable-ltdl-install make && make install
编辑文件/etc/ld.so.conf
vim /etc/ld.so.conf 添加 /usr/local/lnmp/phpmodule/mhash/lib /usr/local/lnmp/phpmodule/libmcrypt/lib /usr/local/lib ldconfig
添加软连接
ln -s /usr/local/lnmp/phpmodule/mhash/lib/* /usr/local/lib ln -s /usr/local/lnmp/phpmodule/mhash/include/* /usr/local/include
添加mcypt-2.6.8
cd mcrypt-2.6.8 ./configure --prefix=/usr/local/lnmp/phpmodule/mcrypt -–with-libmcrypt-prefix=/usr/local/lnmp/phpmodule/libmcrypt --with-libiconv-prefix=/usr/local/lnmp/phpmodule/libiconv make && make install
安装php依赖软件
yum install net-snmp-devel curl-devel libxml2-devel libpng-devel libjpeg-devel freetype-devel gmp-devel openldap-devel gd-devel -y
安装PHP
cd php-5.4.12 ./configure --prefix=/usr/local/lnmp/php --with-config-file-path=/usr/local/lnmp/php/etc --with-mysql=/usr/local/lnmp/mysql/ --with-openssl --with-snmp --with-gd --with-zlib --with-curl --with-libxml-dir --with-png-dir --with-jpeg-dir --with-freetype-dir --without-pear --with-gettext --with-gmp --enable-inline-optimization Please delete install/index.php via FTP! --enable-soap --enable-ftp --enable-sockets --enable-mbstring --with-mysqli=/usr/local/lnmp/mysql/bin/mysql_config --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --with-mcrypt=/usr/local/lnmp/phpmodule/libmcrypt --with-mhash=/usr/local/lnmp/phpmodule/mhash/ --with-iconvdir=/usr/local/lnmp/phpmodule/libiconv/ make && make install cd /usr/local/lnmp/php/etc/ cp php-fpm.conf.default php-fpm.conf cd php-5.4.12/sapi/fpm cp init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm cd php-5.4.12 cp php.ini-production /usr/local/lnmp/php/etc/php.ini
编辑文件php-fpm.conf 去掉注释pid=run/php-fpm.pid
编辑文件php.ini 添加date.timezone=Asia/Shanghai
开启php服务
/etc/init.d/php-fpm start
下载Dicuz_x2.5_sc_UTF8.zip
安装linux下的zip解压软件
yum install -y unzip
解压论坛压缩包
unzip Dicuz_x2.5_sc_UTF8.zip mv upload/ /usr/local/lnmp/nginx/html/bbs cd /usr/local/lnmp/nginx/html/bbs
更改文件权限
chmod 777 config/ data/ uc_client/ uc_server/ 给提示的所有文件都赋予权限
创建discuz数据库,进入MySQL数据库
mysql -pwestos create database discuz; Grant all on discuz.* to discuz@localhost identified by 'westos';
浏览器访问
192.168.0.2/bbs/install/index.php
接下来按照页面安装