在LAMP环境下部署Discuz! X论坛
前期准备
[[email protected] 桌面]# yum -y install openssl-devel ncurses-devel libtermcap-devel libxml2-devel
[[email protected] 桌面]# yum -y remove httpd mysql-server mysql php-mysql
1. 安装 httpd源码包
[[email protected] 桌面]# tar -zxvf httpd-2.2.25.tar.gz
[[email protected] 桌面]# cd httpd-2.2.25
[[email protected] httpd-2.2.25]# ./configure --prefix=/usr/local/httpd \
--enable-so --enable-rewrite --enable-cgi \
--enable-charset-lite --enable-ssl \
--enable-suexec --with-suexec-caller=daemon \
--with-suexec-docroot=/usr/local/httpd/htdocs
[[email protected] httpd-2.2.25]# make && make intsall
建立 httpd 控制脚本,添加启动参数
[[email protected] httpd-2.2.25]# cp -f /usr/local/httpd/bin/apachectl /etc/init.d/httpd
[[email protected] httpd-2.2.25]# vim /etc/init.d/httpd
#!/bin/bash
# chkconfig: 35 85 15
# description: Apache is a World Wide Web Server
......
[[email protected] httpd-2.2.25]# chmod +x /etc/init.d/httpd
[[email protected] httpd-2.2.25]# chkconfig --add httpd
2. 安装 mysql源码包
准备mysql运行账户(不创建家目录 uid为49 不能登录),安装
[[email protected] httpd-2.2.25]# useradd -M -u 49 -s /sbin/nologin mysql
[[email protected] httpd-2.2.25]# cd /root/桌面
[[email protected] 桌面]# tar-zxvf mysql-5.1.62.tar.gz
[[email protected] 桌面]# cd /usr/src/mysql-5.1.62/
[[email protected] mysql-5.1.62]# ./configure --prefix=/usr/local/mysql \
--with-charset=utf8 --with-collation=utf8_general_ci --with-extra-charset=gbk,gb2312
[[email protected] mysql-5.1.62]# make && make install
调整目录权限,建立mysql配置文件
[[email protected] mysql-5.1.62]#chown -R root:mysql /usr/local/mysql/
[[email protected] mysql-5.1.62]#chown -R mysql /usr/local/mysql/var/ #若无此目录需自行创建mkdir
[[email protected] mysql-5.1.62]#cp -f /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
[[email protected] mysql-5.1.62]# vim /etc/my.cnf
[mysqld]
port = 3306
socket = /tmp/mysql.sock
#skip-locking
skip-external-locking
key_buffer_size = 16M
......
添加库链接,建立 mysqld控制脚本,添加启动参数
[[email protected] mysql-5.1.62]# ln -sf /usr/local/mysql/bin/* /usr/local/bin/
[[email protected] mysql-5.1.62]# vim /etc/ld.so.conf.d/mysql-64.conf
/usr/local/mysql/lib/mysql
[[email protected] mysql-5.1.62]# ldconfig
[[email protected] mysql-5.1.62]#cp -f /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
[[email protected] mysql-5.1.62]#chmod +x /etc/init.d/mysqld
[[email protected] mysql-5.1.62]#chkconfig --add mysqld
[[email protected] mysql-5.1.62]# /usr/local/mysql/bin/mysql_install_db --user=mysql
3. 编译安装 php
[[email protected] mysql-5.1.62]# cd /root/桌面
[[email protected] 桌面]# tar -zxvf php-5.4.19.tar.gz
[[email protected] 桌面]# cd php-5.4.19
[[email protected] php-5.4.19]# ./configure --prefix=/usr/local/php \
--enable-mbstring --enable-sockets \
--with-apxs2=/usr/local/httpd/bin/apxs --with-mysql=/usr/local/mysql \
--with-config-file-path=/usr/local/php
[[email protected] php-5.4.19]# make && make install
启用httpd的PHP网页支持
[[email protected] php-5.4.19]# vim /usr/local/httpd/conf/httpd.conf
......
LoadModule php5_module modules/libphp5.so
......
ServerName localhost:80
......
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
......
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
......
启动mysql 和httpd
[[email protected] php-5.4.19]# service mysqld restart
[[email protected] php-5.4.19]# service httpd restart
修改mysql密码,创建mysql数据库
[[email protected] php-5.4.19]# mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost'=PASSWORD('123456');
mysql> CREATE DATABASE bbsdb;
mysql> GRANT all ON bbsdb.* TO [email protected] IDENTIFIED BY 'admin123';
mysql> quit
4.安装Discuz! X 论坛程序
[[email protected] php-5.4.19]#cd /root/桌面
[[email protected] 桌面]# unzip Discuz_X3.0_SC_UTF8.zip -d luntan
[[email protected] 桌面]# cp -rf luntan/upload/ /usr/local/httpd/htdocs/bbs
[[email protected] bbs]# cd /usr/local/httpd/htdocs/bbs
[[email protected] bbs]# chown -R daemon template/ config/ data/ uc_server/ uc_client/
[[email protected] bbs]# firefox &
访问: localhost/bbs/install
......
数据库服务器:localhost
数据库用户名:root
数据库密码:123456
数据库名:bbsdb
......
善后处理
[[email protected] bbs]# mv install/ install.lock
[[email protected] bbs]# chmod 600 install.lock/
[[email protected] bbs]# ls -ld install.lock/
firefox访问:localhost/bbs
效果图如下:
转载于:https://blog.51cto.com/yaoyuechengfeng/1569671