目录
一.Discz搭建
1.准备工作
(1)下载php*,mariadb-server
(2)上传Discuz3.5压缩包并解压
2.搭建过程
(1)开启数据库服务
(2)初始化数据库(里面需要选择的内容可以直接回车跳过)
(3)登录数据库,-u指定用户,-p指定密码
(4)查看当前的数据库信息,并新建启用自己的数据库
(5)exit退出
(6)更改httpd相关配置文件
(7)重启服务完成后到浏览器访问/upload
(8)同意安装向导
(9)更改所示文件和目录权限问题
二.postfix+mailx部署
1.准备工作
2.配置
(1)本地
(2)网络
一.Discz搭建
1.准备工作
(1)下载php*,mariadb-server
[root@redhat9 aaa]# yum install -y php*
[root@redhat9 aaa]# yum install -y mariadb-server
(2)上传Discuz3.5压缩包并解压
链接:https://pan.baidu.com/s/1CJDiVh-QuezT0aRLWd5YxQ
提取码:axzs
[root@redhat9 aaa]# unzip Discuz_X3.5_SC_UTF8_20230316.zip
#/aaa目录是我用于存放Discuz的目录
[root@redhat9 aaa]# ll
总用量 11620
#解压后内容
-rw-r--r--. 1 root root 11766137 3月 25 11:40 Discuz_X3.5_SC_UTF8_20230316.zip
-rw-r--r--. 1 root root 4 3月 25 11:42 index.html
-rw-r--r--. 1 root root 8181 3月 17 09:42 LICENSE
-rw-r--r--. 1 root root 33294 12月 21 03:42 qqqun.png
drwxr-xr-x. 2 root root 124 3月 17 09:52 readme
-rw-r--r--. 1 root root 70226 3月 16 19:54 readme.html
drwxrwxrwx. 12 root root 4096 3月 17 09:52 upload
-rw-r--r--. 1 root root 140 2月 12 15:13 utility.html
2.搭建过程
(1)开启数据库服务
[root@redhat9 ~]# systemctl start mariadb
(2)初始化数据库(里面需要选择的内容可以直接回车跳过)
[root@redhat9 ~]# mysql_secure_installation
简单参考信息
[root@redhat9 ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.
Enter current password for root (enter for none): #输入根的当前密码
OK, successfully used password, moving on...
Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] #切换到unix_socket身份验证
Enabled successfully!
Reloading privilege tables..
... Success!
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] #是否更改根用户密码
New password:
Re-enter new password:
Sorry, you can't use an empty password here.
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] #是否删除匿名用户
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] #是否禁止远程root登录
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] #是否删除测试数据库并访问它
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] #是否立即重新加载权限表
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
(3)登录数据库,-u指定用户,-p指定密码
[root@redhat9 ~]# mysql -uroot -p123
(4)查看当前的数据库信息,并新建启用自己的数据库
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.003 sec)
MariaDB [(none)]> create database luntan;
Query OK, 1 row affected (0.000 sec)
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| luntan |
| mysql |
| performance_schema |
+--------------------+
4 rows in set (0.000 sec)
MariaDB [(none)]> use luntan;
Database changed
(5)exit退出
MariaDB [(none)]> exit
Bye
[root@redhat9 ~]# systemctl restart mariadb.service
(6)更改httpd相关配置文件
将/etc/httpd/conf.d/下的自己的配置文件改到你解压Discuz压缩包的目录,并在这个目录下新建一个index.html文件并写入内容,更改完成后重启服务
[root@redhat9 ~]# vim /etc/httpd/conf.d/work.conf
<VirtualHost 192.168.2.135>
servername www.openlab.com
documentroot /aaa
<Directory /aaa>
allowoverride none
require all granted
</Directory>
</VirtualHost>
[root@redhat9 ~]# cd /aaa
[root@redhat9 aaa]# ll
total 11620
-rw-r--r-- 1 root root 11766137 Mar 25 11:40 Discuz_X3.5_SC_UTF8_20230316.zip
-rw-r--r-- 1 root root 555 Mar 26 19:52 index.html #自己新建
-rw-r--r-- 1 root root 8181 Mar 17 09:42 LICENSE
-rw-r--r-- 1 root root 33294 Dec 21 03:42 qqqun.png
drwxr-xr-x 2 root root 124 Mar 17 09:52 readme
-rw-r--r-- 1 root root 70226 Mar 16 19:54 readme.html
drwxrwxrwx 12 root root 4096 Mar 17 09:52 upload #主要是要访问这个目录
-rw-r--r-- 1 root root 140 Feb 12 15:13 utility.html
[root@redhat9 aaa]# vim /aaa/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
.openlab{
font-size: 66px;
color: red;
text-align: center;
text-decoration: none;
}
</style>
</head>
<body>
<div class="openlab"><a href="http://192.168.2.135/upload">点击进入论坛!!!</div>
</body>
</html>
(7)重启服务完成后到浏览器访问/upload
[root@redhat9 aaa]# systemctl restart httpd
(8)同意安装向导
(9)更改所示文件和目录权限问题
[root@redhat9 aaa]# cd upload/
[root@redhat9 upload]# ll
total 72
-rw-r--r-- 1 root root 2869 Mar 17 09:52 admin.php
drwxr-xr-x 10 root root 149 Mar 17 09:52 api
-rw-r--r-- 1 root root 727 Mar 17 09:52 api.php
drwxr-xr-x 2 root root 23 Mar 17 09:52 archiver
drwxr-xr-x 2 root root 90 Mar 17 09:52 config
-rw-r--r-- 1 root root 1040 Mar 17 09:52 connect.php
-rw-r--r-- 1 root root 106 Mar 17 09:52 crossdomain.xml
drwxr-xr-x 12 root root 178 Mar 17 09:52 data
-rw-r--r-- 1 root root 5558 Mar 17 09:42 favicon.ico
-rw-r--r-- 1 root root 2357 Mar 17 09:52 forum.php
-rw-r--r-- 1 root root 906 Mar 17 09:52 group.php
-rw-r--r-- 1 root root 1325 Mar 17 09:52 home.php
-rw-r--r-- 1 root root 6912 Mar 17 09:52 index.php
drwxr-xr-x 5 root root 64 Mar 17 09:52 install
-rw-r--r-- 1 root root 998 Mar 17 09:52 member.php
-rw-r--r-- 1 root root 2410 Mar 17 09:52 misc.php
-rw-r--r-- 1 root root 1790 Mar 17 09:52 plugin.php
-rw-r--r-- 1 root root 1086 Mar 17 09:52 portal.php
-rw-r--r-- 1 root root 639 Mar 17 09:52 robots.txt
-rw-r--r-- 1 root root 1755 Mar 17 09:52 search.php
drwxr-xr-x 10 root root 168 Mar 17 09:52 source
drwxr-xr-x 7 root root 86 Mar 17 09:52 static
drwxr-xr-x 3 root root 38 Mar 17 09:52 template
drwxr-xr-x 8 root root 146 Mar 17 09:52 uc_client
drwxr-xr-x 13 root root 4096 Mar 17 09:52 uc_server
[root@redhat9 upload]# chmod +777 -R config/ data/ uc*
全新安装
填写好你自己的信息
之后就可以以管理员身份登录或者注册新用户了
二.postfix+mailx部署
1.准备工作
下载mailx和postfix
[root@localhost ~]# yum install -y postfix
[root@localhost ~]# yum install -y mailx
[root@localhost ~]# systemctl start postfix
2.配置
(1)本地
直接使用echo 配合mail进行发送
echo 内容 | mail -s 主题 用户,邮件一般放在/var/spool/mail
部分参数:
-a 添加附件
-b 邮件的秘密抄送列表,后面跟邮箱地址,邮箱地址使用逗号隔开
-c 邮件的抄送列表
-s 邮件的主题,也就是这封邮件的标题
[root@localhost ~]# echo nihao | mail -s "nihao" sulibao@localhost
[root@localhost ~]# cd /var/spool/mail/
[root@localhost mail]# ll
total 8
-rw-------. 1 root root 1704 Apr 5 16:45 root
-rw-rw----. 1 rpc mail 0 Apr 5 13:33 rpc
-rw-rw----. 1 sulibao mail 846 Apr 5 16:47 sulibao
[root@localhost mail]# cat sulibao
From root@localhost.localdomain Wed Apr 5 16:47:42 2023
Return-Path: <root@localhost.localdomain>
Received: from localhost.localdomain (localhost [127.0.0.1])
by localhost.localdomain (8.15.2/8.15.2) with ESMTPS id 3358lgOR039176
(version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT)
for <sulibao@localhost.localdomain>; Wed, 5 Apr 2023 16:47:42 +0800
Received: (from root@localhost)
by localhost.localdomain (8.15.2/8.15.2/Submit) id 3358lgpM039175
for sulibao; Wed, 5 Apr 2023 16:47:42 +0800
From: root <root@localhost.localdomain>
Message-Id: <202304050847.3358lgpM039175@localhost.localdomain>
Date: Wed, 05 Apr 2023 16:47:42 +0800
To: sulibao@localhost.localdomain
Subject: nihao
User-Agent: Heirloom mailx 12.5 7/5/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
nihao
(2)网络
- 需要修改配置文件/etc/mail.rc
[root@localhost ~]# vim /etc/mail.rc
#最后添加配置文件
set ssl-verify=ignore
set nss-config-dir=/etc/pki/nssdb
set smtp=smtps://smtp.163.com:465
set smtp-auth=login
set smtp-auth-user=sulibao2003@163.com
set smtp-auth-password=xxxxxx
set from=sulibao2003@163.com
#开启ssl
#set ssl-verify=ignore
#输入证书目录,下方为centos系统证书默认位置,也自行生成证书并指定
#set nss-config-dir=/etc/pki/nssdb
# 下方填入你配置的第三方smtp服务器的地址及端口,如果使用的是云服务器,安全组需要开放465端口(入口和出口)
#set smtp=smtps://smtp.163.com:465 #填写官方网址
# 认证方式
#set smtp-auth=login
# 下方输入用于发送邮件的邮箱账号
#set smtp-auth-user=
# 下方输入上方邮箱的客户端授权码
#set smtp-auth-password=
# 设置发信人邮箱和昵称
#set from=
- 获取客户端授权码(以163为例)
后将授权码写上即可
- 仍然使用echo配合mail发送
-a指定附件
[root@localhost mail]# echo hello | mail -a /aaa/ade.txt -s "hello" sulibao2003@163.com
[root@localhost ~]# cat /aaa/ade.txt
666
- 163测试
[root@localhost ~]# echo hello | mail -a /aaa/ade.txt -s "hello" sulibao2003@163.com
文章来源:https://www.toymoban.com/news/detail-412270.html
- qq邮箱测试
[root@localhost ~]# echo hello | mail -a /aaa/ade.txt -s "hello" 241075207@qq.com
文章来源地址https://www.toymoban.com/news/detail-412270.html
到了这里,关于Linux上搭建Discuz论坛的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!