lanmp
1、安装mysql
安装mysql时,需要有mysql-boost-5.7.11.tar.gz
在安装时,有大量的依赖性,根据报错,安装所需要的依赖性。
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_INNOBASE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DWITH_BOOST=/root/mysql-5.7.11/boost/boost_1_59_0/
基本需要的操作都有:
yum install cmake-2.8.12.2-4.el6.x86_64.rpm -y
yum install -y gcc gcc-c++rm -f
CMakeCache.txt
yum install ncurses-devel -y
yum install bison -y
make && make install
在安装好后,需要进行用户的添加,还有一些权限的问题
groupadd -g 27 mysql
useradd -u 27 -g 27 -M -d /usr/local/lnmp/mysql/ mysql
usermod -s /sbin/nologin mysql
vim .bash_profile
source .bash_profile
cp /etc/my.cnf /etc/my.cnf.bak
vim /etc/my.cnf
cd /usr/local/lnmp/mysql/
chown mysql.mysql . -R
cd support-files/
cp mysql.server /etc/init.d/mysqld
mysqld --initialize --user=mysql(此步骤中,注意要将系统出使化给的密码保存好,如果不慎丢失,则只有重新编译)
cd /usr/local/lnmp/mysql/
chown root . -R
chown mysql data -R
/etc/init.d/mysqld start
设置密码:mysql_secure_installation
2、php的安装
安装时需要大量的依赖性
yum install libxml2-devel-2.7.6-14.el6.x86_64 -y
yum install openssl-devel -y
yum install libcurl-devel-7.19.7-37.el6_4.x86_64 -y
yum install libjpeg-turbo-devel-1.2.1-1.el6.x86_64 -y
yum install -y libpng-devel-1.2.49-1.el6_2.x86_64
yum install freetype-devel-2.3.11-14.el6_3.1.x86_64 -y
yum install -y gmp-devel-4.3.1-7.el6_2.2.x86_64
yum install libmcrypt-devel-2.5.8-9.el6.x86_64.rpm libmcrypt-2.5.8-9.el6.x86_64.rpm -y
yum install -y net-snmp-devel-5.5-49.el6.x86_64
yum install re2c-0.13.5-1.el6.x86_64.rpm -y
安装三部曲
./configure --prefix=/usr/local/lnmp/php --with-config-file-path=/usr/local/lnmp/php/etc --enable-mysqlnd --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-openssl --with-snmp --with-gd --with-zlib --with-curl --with-libxml-dir --with-png-dir --with-jpeg-dir --with-freetype-dir --with-pear --with-gettext --with-gmp --enable-inline-optimization --enable-soap --enable-ftp --enable-sockets --enable-mbstring --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --with-mcrypt --with-mhash
make
make install
[[email protected] fpm]# pwd
/root/php-5.6.20/sapi/fpm
cd init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
cd /usr/local/lnmp/php/etc/
vim php-fpm.conf
vim php.ini
useradd -u 800 -M -d /usr/local/lnmp/nginx nginx
/etc/init.d/php-fpm start
3、安装nginx
yum install pcre-devel -y
./configure --prefix=/usr/local/lnmp/nginx --with-http_ssl_module --with-http_stub_status_module --with-file-aio --with-threads --user=nginx --group=nginx
make && make install
设置nginx中的相关参数:
vim /usr/local/lnmp/nginx/conf/nginx.conf
在nginx的html目录中,加入要写的index.php,重启nginx服务
vim /usr/local/lnmp/php/etc/php.ini
重启php服务,在访问端做好本地解析:
测试:
4、使用上述所装的软件,实现一个小型论坛,集合了上述所有的软件。
使用包:Discuz_X3.2_SC_UTF8.zip
vim /usr/local/lnmp/nginx/conf/nginx.conf
测试页面:
给相应目录对应的权限:[[email protected] bbs]# chmod 777 config/ data -R
[[email protected] bbs]# chmod 777 uc_client/ uc_server/ -R
给数据库中data目录相应的权限:
注意:进入论坛后,即将论坛全部安装完毕时,要将bbs/install/index.php文件进行删除,以防下次访问时,再次进入安装界面:
测试,是否与数据库进行了连接,并将所要的数据连接进入了数据库;