博客系统部署
下载软件:
wget http://mirror.bjtu.edu.cn/apache/httpd/httpd-2.4.57.tar.gz
wget http://mirror.bjtu.edu.cn/apache/apr/apr-1.6.5.tar.gz
wget http://mirror.bjtu.edu.cn/apache/apr/apr-util-1.6.3.tar.gz
wget http://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.11.tar.gz
curl -O http://cn.php.net/distributions/php-5.6.23.tar.gz
解压软件包:
tar -xzvf httpd-2.4.57.tar.gz -C /usr/src
tar -xzf apr-1.6.5.tar.gz -C /usr/src
tar -xzf apr-util-1.6.3.tar.gz -C /usr/src
tar -xzf mysql-5.6.11.tar.gz -C /usr/src
tar -xzf php-5.6.23.tar.gz -C /usr/src
wget http://cn.php.net/distributions/php-5.6.23.tar.gz --no-check-certificate
安装依赖包:
yum install gcc gcc-c++ autoconf automake make cmake \
> pcre pcre-devel openssl openssl-devel ncurses-devel libxml2-devel bison \
> zlib-devel libtool-ltdl-devel libtool flex expat-devel
安装apache HTTP Server软件
cd /usr/src/apr-1.6.5/
make && make install
cd /usr/src/apr-util-1.6.3/
[root@localhost apr-util-1.6.3]# ./configure --with-apr=/usr/local/apr/
make && make install
[root@localhost apr-util-1.6.3]# cd /usr/src/httpd-2.4.57/
[root@localhost httpd-2.4.57]# ./configure --prefix=/usr/local/apache2 \
--enable-so --enable-ssl --enable-rewrite \
--with-mpm=worker --with-suexec-bin \
--with-apr=/usr/src/httpd-2.4.57/srclib/apr --with-apr-util=/usr/src/httpd-2.4.57/srclib/apr-util
解决:
错误为:apr,apr-util缺失,需要下载并解压到./srclib/目录下
./configure --prefix=/usr/local/apache2 --with-apr=/usr/src/httpd-2.4.57/srclib/apr --with-apr-util=/usr/src/httpd-2.4.57/srclib/apr-util --with-included-apr
##############################################
安装mysql数据库管理系统
cd /usr/src/mysql-5.6.11
groupadd mysql
[root@localhost mysql-5.6.11]# cat /etc/group |grep mysql
mysql:x:1005:
#添加mysql用户:
[root@localhost mysql-5.6.11]# useradd -r -s /sbin/nologin -g mysql mysql
[root@localhost mysql-5.6.11]# cat /etc/passwd |grep mysql
mysql:x:997:1005::/home/mysql:/sbin/nologin
[root@localhost mysql-5.6.11]# id mysql
uid=997(mysql) gid=1005(mysql) 组=1005(mysql)
cmake . -DENABLE_DOWNLOADS=1
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DMYSQL_DATADIR=/data/mysql/data-DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1
537 sed -i "/ADD_SUBDIRECTORY(sql\/share)/d" CMakeLists.txt
538 sed -i "s/ADD_SUBDIRECTORY(libmysql)/&\nADD_SUBDIRECTORY(sql\/share)/" CMakeLists.txt
539 sed -i "s@data/test@\${INSTALL_MYSQLSHAREDIR}@g" sql/CMakeLists.txt
540 sed -i "s@data/mysql@\${INSTALL_MYSQLTESTDIR}@g" sql/CMakeLists.txt
541 sed -i "s/srv_buf_size/srv_sort_buf_size/" storage/innobase/row/row0log.cc
542 make
make install
更改 目录主属组:
chown -R mysql.mysql /usr/local/mysql
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
cp /usr/local/mysql/my.cnf /etc/my.cnf
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@localhost mysql-5.6.11]# chkconfig --add mysqld
[root@localhost mysql-5.6.11]# chkconfig mysqld on
[root@localhost mysql-5.6.11]# echo "/usr/local/mysql/lib" >>/etc/ld.so.conf
[root@localhost mysql-5.6.11]# ldconfig
[root@localhost mysql-5.6.11]#
为论坛创建论坛数据库,并创建数据库管理账号及密码:
/usr/local/mysql/bin/mysql -u root
创建bbs数据库
mysql> create database bbs;
Query OK, 1 row affected (0.00 sec)
mysql> drop database bss;
Query OK, 0 rows affected (0.01 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| bbs |
| mysql |
| performance_schema |
| test |
+--------------------+
5 rows in set (0.00 sec)
mysql> grant all on bbs.* to 'bbs_admin'@'localhost' identified by 'admin123';
Query OK, 0 rows affected (0.00 sec)
mysql>
#####################################
安装php程序
./configure --prefix=/usr/local/php5 --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache2/bin/apxs --enable-mbstring --enable-sockets
make
make install
cp php.ini-development /usr/local/php5/lib/php.ini
启动apache Http服务
ls /usr/local/apache2/bin/apachectl
/usr/local/apache2/bin/apachectl
/usr/local/apache2/bin/apachectl start
[root@localhost init.d]# firewall-cmd --permanent --add-port 80/tcp
success
[root@localhost init.d]# firewall-cmd --reload
success
[root@localhost php-5.6.23]# echo "<?php phpinfo() ; ?>" >/usr/local/apache2/htdocs/index.php
初始化论坛页面
#编辑虚拟主机的配置文件:
[root@localhost extra]# vi httpd-vhosts.conf
[root@localhost extra]# pwd
/usr/local/apache2/conf/extra
<VirtualHost *:80>
ServerAdmin Jacob_test@gmail.com
DocumentRoot "/usr/local/apache2/htdocs/bbs"
ServerName bbs.example.com
ErrorLog "logs/bss.example.com-error_log"
CustomLog "logs/bss.example.com-access_log" common
</VirtualHost>
[root@localhost extra]# mkdir -p /usr/local/apache2/conf/htdocs/bbs/logs
[root@localhost extra]#
mkdir /usr/src/discuz
unzip Discuz_X3.4_SC_UTF8_20230520.zip -d /usr/src/discuz/
[root@localhost upload]# mkdir /usr/local/apache2/htdocs
mkdir: 无法创建目录"/usr/local/apache2/htdocs": 文件已存在
[root@localhost upload]# mkdir /usr/local/apache2/htdocs/bbs
[root@localhost upload]# pwd
/usr/src/discuz/upload
cd upload
[root@localhost upload]# cp -r * /usr/local/apache2/htdocs/bbs
[root@localhost upload]# chmod -R 777 /usr/local/apache2/htdocs/bbs/{config/,data/}
[root@localhost upload]# chmod -R 777 /usr/local/apache2/htdocs/bbs/uc_client/data/cache
[root@localhost upload]# chmod -R 777 /usr/local/apache2/htdocs/bbs/uc_server/data/
重启服务
访问:http://bbs.example.com/install/
192.168.8.246/install
bbs_admin管理员登陆成功
删除安装时的index.php文件