目录
1. 编译安装Apache HTTP服务
[root@localhost ~]#systemctl stop firewalld.service
[root@localhost ~]#setenforce 0
[root@localhost ~]#kill 2585
[root@localhost ~]#yum install gcc gcc-c++ make pcre-devel expat-devel perl pcre -y
[root@localhost ~]#cd /opt
[root@localhost opt]#rz -E
[root@localhost opt]#tar xf apr-util-1.6.0.tar.gz
[root@localhost opt]#tar xf apr-1.6.2.tar.gz
[root@localhost opt]#tar xf httpd-2.4.29.tar.bz2
[root@localhost opt]#ls
[root@localhost opt]#mv apr-1.6.2 /opt/httpd-2.4.29/srclib/apr
[root@localhost opt]#mv apr-util-1.6.0 /opt/httpd-2.4.29/srclib/apr-util
[root@localhost opt]#cd /opt/httpd-2.4.29/
[root@localhost httpd-2.4.29]#./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-charset-lite --enable-cgi
[root@localhost httpd-2.4.29]#make -j2 && make install
[root@localhost httpd-2.4.29]#cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
[root@localhost httpd-2.4.29]#ln -s /usr/local/httpd/conf/httpd.conf /etc/
[root@localhost httpd-2.4.29]#ln -s /usr/local/httpd/bin/* /usr/local/bin/
[root@localhost httpd-2.4.29]#ls /usr/local/httpd
[root@localhost httpd-2.4.29]#httpd -t
[root@localhost httpd-2.4.29]#vi /etc/init.d/httpd
#开头加入
# chkconfig: 35 85 21 //35级别自动运行 第85个启动 第21个关闭
# description: Apache is a World Wide Web server
[root@localhost httpd-2.4.29]#chkconfig --add httpd
[root@localhost httpd-2.4.29]#service httpd start
[root@localhost httpd-2.4.29]#vim /etc/httpd.conf
51 Listen 192.168.91.100:80 #将你的地址加入
52 #Listen #52注释掉
199 ServerName www.example.com #写入域名
[root@localhost httpd-2.4.29]#service httpd start
[root@localhost httpd-2.4.29]#ss -natp | grep 80
浏览器192.168.8.100
2. 编译安装MySQL
[root@localhost ~]#cd /data
[root@localhost data]#
[root@localhost data]#rz -E
rz waiting to receive.
[root@localhost data]#tar xf mysql-boost-5.7.20.tar.gz
[root@localhost data]#ls
mysql-5.7.20 mysql-boost-5.7.20.tar.gz
[root@localhost data]#cd mysql-5.7.20/
[root@localhost mysql-5.7.20]#ls
boost config.h.cmake extra libmysql mysys_ssl scripts testclients
BUILD configure.cmake include libmysqld packaging sql unittest
client COPYING INSTALL libservices plugin sql-common VERSION
cmake dbug libbinlogevents man rapid storage vio
CMakeLists.txt Docs libbinlogstandalone mysql-test README strings win
cmd-line-utils Doxyfile-perfschema libevent mysys regex support-files zlib
[root@localhost mysql-5.7.20]#yum install -y ncurses-devel autoconf cmake
[root@localhost mysql-5.7.20]#cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/usr/local/mysql \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DWITH_BOOST=boost \
-DWITH_SYSTEMD=1
[root@localhost mysql-5.7.20]#make -j2 && make install
[root@localhost mysql-5.7.20]#useradd -s /sbin/nologin mysql
[root@localhost mysql-5.7.20]#chown -R mysql:mysql /usr/local/mysql/
[root@localhost mysql-5.7.20]#vim /etc/my.cnf
[client]
port = 3306
default-character-set=utf8
socket = /usr/local/mysql/mysql.sock
[mysql]
port = 3306
default-character-set=utf8
socket = /usr/local/mysql/mysql.sock
[mysqld]
user = mysql
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
port = 3306 #mysq数据库端口号
character_set_server=utf8
pid-file = /usr/local/mysql/mysqld.pid
socket = /usr/local/mysql/mysql.sock
server-id = 1 #主从
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,PIPES_AS_CONCAT,ANSI_QUOTES
[root@localhost mysql-5.7.20]#chown mysql:mysql /etc/my.cnf
[root@localhost mysql-5.7.20]#echo 'PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH' >> /etc/profile
[root@localhost mysql-5.7.20]#echo 'export PATH' >> /etc/profile
[root@localhost mysql-5.7.20]#. /etc/profile
[root@localhost mysql-5.7.20]#echo $PATH
/usr/local/mysql/bin:/usr/local/mysql/lib:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[root@localhost mysql-5.7.20]#cd /usr/local/mysql
[root@localhost mysql]#ls
bin COPYING COPYING-test docs include lib man mysql-test README README-test share support-files usr
[root@localhost mysql]#bin/mysqld \
> --initialize-insecure \
> --user=mysql \
> --basedir=/usr/local/mysql \
> --datadir=/usr/local/mysql/data
[root@localhost mysql]#ls
bin COPYING-test docs lib mysql-test README-test support-files
COPYING data include man README share usr
[root@localhost mysql]#ls data/
auto.cnf ib_buffer_pool ibdata1 ib_logfile0 ib_logfile1 mysql performance_schema sys
[root@localhost mysql]#cp usr/lib/systemd/system/mysqld.service /usr/lib/systemd/system/
[root@localhost mysql]#systemctl daemon-reload
[root@localhost mysql]#systemctl start mysqld.service
[root@localhost mysql]#ss -natp | grep 3306
LISTEN 0 80 :::3306 :::* users:(("mysqld",pid=105954,fd=21))
[root@localhost mysql]#mysqladmin -u root -p password "abc123"
Enter password:
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
[root@localhost mysql]#mysql -uroot -p"abc123"
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 18
Server version: 5.7.20 Source distribution
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
mysql> exit
Bye
[root@localhost mysql]#
[root@localhost mysql]#yum -y install \
> gd \
> libjpeg libjpeg-devel \
> libpng libpng-devel \
> freetype freetype-devel \
> libxml2 libxml2-devel \
> zlib zlib-devel \
> curl curl-devel \
> openssl openssl-devel
[root@localhost mysql]#cd /data
[root@localhost data]#ls
mysql-5.7.20 mysql-boost-5.7.20.tar.gz
[root@localhost data]#
[root@localhost data]#rz -E
rz waiting to receive.
[root@localhost data]#rz -E
rz waiting to receive.
[root@localhost data]#ls
Discuz_X3.4_SC_UTF8.zip mysql-5.7.20 mysql-boost-5.7.20.tar.gz php-7.1.10.tar.bz2
[root@localhost data]#tar xf php-7.1.10.tar.bz2
[root@localhost data]#ls
Discuz_X3.4_SC_UTF8.zip mysql-5.7.20 mysql-boost-5.7.20.tar.gz php-7.1.10 php-7.1.10.tar.bz2
[root@localhost data]#cd php-7.1.10/
[root@localhost php-7.1.10]#ls
[root@localhost php-7.1.10]#./configure \
--prefix=/usr/local/php7 \
--with-apxs2=/usr/local/httpd/bin/apxs \
--with-mysql-sock=/usr/local/mysql/mysql.sock \
--with-config-file-path=/usr/local/php7 \
--with-mysqli \
--with-zlib \
--with-curl \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-openssl \
--enable-mbstring \
--enable-xml \
--enable-session \
--enable-ftp \
--enable-pdo \
--enable-tokenizer \
--enable-zip
[root@localhost php-7.1.10]#make -j2 && make install
[root@localhost php-7.1.10]#cp /data/php-7.1.10/php.ini-development /usr/local/php7/php.ini
[root@localhost php-7.1.10]#vim /usr/local/php7/php.ini
mysqli.default_socket = /usr/local/mysql/mysql.sock --1170行--修改 1170 G,大写的G,直接跳转
date.timezone = Asia/Shanghai --939行--修改
[root@localhost php-7.1.10]#ln -s /usr/local/php7/bin/* /usr/local/bin/
[root@localhost php-7.1.10]#php -m
[root@localhost php-7.1.10]#vim /etc/httpd.conf
# --393行修改 393G
# AddType application/x-httpd-php .php
#这里的点前面空格一定要加,否则报错 AddType application/x-httpd-php-source .phps
# --255行修改
#<IfModule dir_module>
# DirectoryIndex index.html index.php
#</IfModule>
[root@localhost php-7.1.10]#httpd -t
Syntax OK
[root@localhost php-7.1.10]#service httpd restart
[root@localhost php-7.1.10]#vim /usr/local/httpd/htdocs/index.php
<?php
phpinfo();
?>
3. 安装论坛
[root@localhost php-7.1.10]#cd /data
[root@localhost data]#mysql -uroot -p"abc123"
mysql> CREATE DATABASE oop; #创建一个数据库
Query OK, 1 row affected (0.00 sec)
mysql> GRANT all ON oop.* TO 'oopuser'@'%' IDENTIFIED BY 'admin123';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| oop |
| performance_schema |
| sys |
+--------------------+
5 rows in set (0.00 sec)
mysql> select user,host from mysql.user;
+---------------+-----------+
| user | host |
+---------------+-----------+
| oopuser | % |
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+---------------+-----------+
4 rows in set (0.00 sec)
mysql> flush privileges; #刷新数据库
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
![](/i/l/?n=23&i=blog/2937119/202308/2937119-20230822194052399-491376772.png)
[root@localhost data]#
[root@localhost data]#unzip Discuz_X3.4_SC_UTF8.zip
[root@localhost data]#ls
dir_SC_UTF8 mysql-5.7.20 php-7.1.10 说明.htm
Discuz_X3.4_SC_UTF8.zip mysql-boost-5.7.20.tar.gz php-7.1.10.tar.bz2
[root@localhost data]#cd dir_SC_UTF8/
[root@localhost dir_SC_UTF8]#ls
readme upload utility
[root@localhost dir_SC_UTF8]#cp -r upload/ /usr/local/httpd/htdocs/oop
[root@localhost dir_SC_UTF8]#cd /usr/local/httpd/
[root@localhost httpd]#ls
bin build cgi-bin conf error htdocs icons include lib logs man manual modules
[root@localhost httpd]#cd htdocs/
[root@localhost htdocs]#ll
总用量 12
-rw-r--r--. 1 root root 45 6月 12 2007 index.html
-rw-r--r--. 1 root root 20 8月 22 17:10 index.php
drwxr-xr-x. 13 root root 4096 8月 22 19:05 oop
[root@localhost htdocs]#cd oop
[root@localhost oop]#chown -R daemon ./config
[root@localhost oop]#chown -R daemon ./data
[root@localhost oop]#chown -R daemon ./uc_client
[root@localhost oop]#chown -R daemon ./uc_server/data
[root@localhost ddh]#ll
[root@localhost oop]#cd -
/usr/local/httpd/htdocs
[root@localhost htdocs]#chown -R daemon oop/
[root@localhost htdocs]#ll oop
192.168.8.100/oop/install
192.168.8.100/oop/
4. 安装wordpress
[root@localhost htdocs]#cd /data
[root@localhost data]#ls
dir_SC_UTF8 mysql-5.7.20 php-7.1.10 说明.htm
Discuz_X3.4_SC_UTF8.zip mysql-boost-5.7.20.tar.gz php-7.1.10.tar.bz2 [root@localhost data]#rz -E
rz waiting to receive.
[root@localhost data]#ls
dir_SC_UTF8 mysql-5.7.20 php-7.1.10 说明.htm
Discuz_X3.4_SC_UTF8.zip mysql-boost-5.7.20.tar.gz php-7.1.10.tar.bz2 wordpress-6.3-zh_CN.zip
[root@localhost data]#unzip wordpress-6.3-zh_CN.zip
[root@localhost data]#ls
dir_SC_UTF8 mysql-5.7.20 php-7.1.10 wordpress 说明.htm
Discuz_X3.4_SC_UTF8.zip mysql-boost-5.7.20.tar.gz php-7.1.10.tar.bz2 wordpress-6.3-zh_CN.zip
[root@localhost data]#cp -a wordpress /usr/local/httpd/htdocs/
[root@localhost data]#cd /usr/local/httpd/
[root@localhost httpd]#ls
bin build cgi-bin conf error htdocs icons include lib logs man manual modules
[root@localhost httpd]#cd htdocs/
[root@localhost htdocs]#ls
index.html index.php oop wordpress
[root@localhost htdocs]#chown -R daemon wordpress/
[root@localhost htdocs]#ll
总用量 16
-rw-r--r--. 1 root root 45 6月 12 2007 index.html
-rw-r--r--. 1 root root 20 8月 22 17:10 index.php
drwxr-xr-x. 13 daemon root 4096 8月 22 19:05 oop
drwxr-xr-x. 5 daemon root 4096 8月 17 23:00 wordpress
[root@localhost htdocs]#ll wordpress/
[root@localhost htdocs]#cd /data
[root@localhost data]#mysql -uroot -p"abc123"
mysql> CREATE DATABASE blog;
Query OK, 1 row affected (0.00 sec)
mysql> GRANT all ON blog.* TO 'bloguser'@'%' IDENTIFIED BY 'admin123';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| blog |
| mysql |
| oop |
| performance_schema |
| sys |
+--------------------+
6 rows in set (0.00 sec)
mysql> select user,host from mysql.user;
+---------------+-----------+
| user | host |
+---------------+-----------+
| bloguser | % |
| oopuser | % |
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+---------------+-----------+
5 rows in set (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> exit
Bye
http://192.168.8.100/wordpress/wp-admin/setup-config.php