您现在的位置是:首页 > cms教程 > Discuz教程Discuz教程
CentOs7搭建论坛Discuz_X3.2的步骤方法
千青2025-06-28Discuz教程已有人查阅
导读由于公司项目需要一个互动平台,可以发起活动,发消息留言,讨论过后发现这竟然是一个论坛的功能。
于是就不打算耗费功夫开发相关功能,直接另外搭一套BBS算球。。。
一直觉得搭建B
由于公司项目需要一个互动平台,可以发起活动,发消息留言,讨论过后发现这竟然是一个论坛的功能。于是就不打算耗费功夫开发相关功能,直接另外搭一套BBS算球。
一直觉得搭建BBS不是一件难事,目前有很多成熟的产品都支持直接建站,找了一些资料看了后发现还是需要很多知识和架构的,下面是详细的搭建过程重新安装了一台CentOs 7虚拟机,安装过程资料很多,大家去搜索下
系统配置相关
系统版本:CentOS-7-x86_64-Minimal-1503-01.iso
主机名: BBS
IP: 192.168.1.1 这是虚拟机自动分配
防火墙: firewall 已经关闭
关闭 SELINUX
下面列出建站需要的服务支持
1. Apache 服务
2. Mysql 安装
3. Php 安装
4. 服务配置
5. Discuz! 安装
--------------------------------------------------------------------------------
服务安装
--------------------------------------------------------------------------------
1、安装 Apache
a、使用 yum 搜索相关软件
c、安装成功后查看 httpd 状态
d、进行服务器相关配置,很多资料建议修改 Listen 端口为 8080,默认是 80,其实不需要修改,如果有修改配置需要重启服务。此处默认端口配置。
本机是 192.168.1.1,所以我的地址为:http://192.168.1.1/
如果想要地址栏显示为网址形式的话,同样可以修改配置文件的数据项 ServerName,我设置成公司缩写luoan,保存重启服务生效。
OK,这下服务器就安装完成了。2、安装 Mysql
进入系统搜索时才发现 CentOs 7 里面的库已经不支持 mysql 安装了,由于下载又要到官网很麻烦,就大概看了下库里面存在哪种数据库,经过查资料找到了一个叫 mariadb 的东西,据说是 mysql 原班人马出来另立的数据库,由于担心sun 会将 mysql 闭源什么的,这都是好人啊
那就暂定用这个数据库了
软件包 1:mariadb-libs-5.5.44-1.el7_1.x86_64 已安装并且是较新版本
等待他一直安装完成后就可以启动 mariadb 服务了。
下面还要设置 mysql 的密码权限,默认密码为空,此处新密码设置为 root
3、安装 PHP
同样的模式,先搜索一下看看存在哪些包
当然你可以选择 yum -y php* 全部安装,应该没问题。
a、编辑 Apache 服务器的配置文件
5、安装 discuz
a、这个程序系统没有集成,需要自己下载,去官方论坛上找了个discuz3.2x的中文简体版下载地址
产品介绍
Discuz! X3.2 在继承和完善 Discuz! X3.1 的基础上,针对社区移动端进行了新的尝试。推出微信登录、微社区等功能。安全稳定的程序为站长提供更加可靠的保障。
下面我们就直接使用 wget 下载下来安装,如果没有这个命令,使用 yum 安装就行了,我下载的是GBK的包,如果出现乱码请下载UTF8的。
正在连接download.ebingou.cn (download.ebingou.cn)|101.227.130.115|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:12402802 (12M) [application/zip]
正在保存至: “Discuz_X3.2_SC_GBK.zip”
100%[==========================================================================================>] 12,402,802 7.74MB/s 用时 1.5s
2015-11-06 17:45:43 (7.74 MB/s) - 已保存 “Discuz_X3.2_SC_GBK.zip” [12402802/12402802])
OK 下载完成。
直接解压文件,由于是个zip包 ,坑爹 linux 肯定没工具解,直接安装 yum -y install unzip
b、将 upload 目录转移到web请求目录下
又去查看资料具体入口跳转的php页面,发现是forum.php,这下简单了,在upload 目录下有这个页面。直接访问果然出来。看浏览器的解析结果分析,如果自己在根目录下的一层文件夹需要添加在路径上。
一直觉得搭建BBS不是一件难事,目前有很多成熟的产品都支持直接建站,找了一些资料看了后发现还是需要很多知识和架构的,下面是详细的搭建过程重新安装了一台CentOs 7虚拟机,安装过程资料很多,大家去搜索下
系统配置相关
系统版本:CentOS-7-x86_64-Minimal-1503-01.iso
主机名: BBS
IP: 192.168.1.1 这是虚拟机自动分配
防火墙: firewall 已经关闭
关闭 SELINUX
下面列出建站需要的服务支持
1. Apache 服务
2. Mysql 安装
3. Php 安装
4. 服务配置
5. Discuz! 安装
--------------------------------------------------------------------------------
服务安装
--------------------------------------------------------------------------------
1、安装 Apache
a、使用 yum 搜索相关软件
[root@BBS ~]# yum search httpd
已加载插件:
fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: mirrors.163.com
=============N/S matched: httpd ===========
libmicrohttpd-devel.i686 : Development files for libmicrohttpd
libmicrohttpd-devel.x86_64 : Development files for libmicrohttpd
libmicrohttpd-doc.noarch : Documentation for libmicrohttpd
httpd.x86_64 : Apache HTTP Server
httpd-devel.x86_64 : Development interfaces for the Apache HTTP server
httpd-manual.noarch : Documentation for the Apache HTTP server
httpd-tools.x86_64 : Tools for use with the Apache HTTP Server
libmicrohttpd.i686 : Lightweight library for embedding a webserver in applications
libmicrohttpd.x86_64 : Lightweight library for embedding a webserver in applications
mod_auth_mellon.x86_64 : A SAML 2.0 authentication module for the Apache Httpd Server
mod_dav_svn.x86_64 : Apache httpd module for Subversion server
b、进行 httpd 软件安装
yum install httpd.x86_64
系统就会开始安装,这时下面会列举很多 httpd 服务的依赖,直接 y 同意安装,这个安装看网速,一般会很快c、安装成功后查看 httpd 状态
[root@BBS ~]# systemctl status httpd.service
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled)
Active: inactive (dead)
dead 说明服务没有启动,启动这个服务:
systemctl start httpd.service
[root@BBS ~]# systemctl status httpd.service
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled)
Active: active (running) since 四 2015-11-05 17:47:08 CST; 6s ago
Main PID: 19288 (httpd)
Status: "Processing requests..."
Loaded-disabled不是随机启动状态,这个需要修改:systemctl enable httpd.serviced、进行服务器相关配置,很多资料建议修改 Listen 端口为 8080,默认是 80,其实不需要修改,如果有修改配置需要重启服务。此处默认端口配置。
vi /etc/httpd/conf/httpd.conf
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
e、测试我们的服务器是否安装完成,打开 IE,输入本机 IP 加上端口号即可访问服务器管理页面 。本机是 192.168.1.1,所以我的地址为:http://192.168.1.1/
如果想要地址栏显示为网址形式的话,同样可以修改配置文件的数据项 ServerName,我设置成公司缩写luoan,保存重启服务生效。
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName bbs.luoan.com:80
这样是不是更像那么回事了,哈哈,对了,上面网址要浏览器能解析的话需要另外配置DNS服务器或者修改本地hosts,详细后续会将搭建DNS服务器篇发布出来。OK,这下服务器就安装完成了。2、安装 Mysql
进入系统搜索时才发现 CentOs 7 里面的库已经不支持 mysql 安装了,由于下载又要到官网很麻烦,就大概看了下库里面存在哪种数据库,经过查资料找到了一个叫 mariadb 的东西,据说是 mysql 原班人马出来另立的数据库,由于担心sun 会将 mysql 闭源什么的,这都是好人啊
那就暂定用这个数据库了
[root@bbs ~]# yum install MariaDB-server MariaDB-client已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: mirrors.163.com
软件包 1:mariadb-5.5.44-1.el7_1.x86_64 已安装并且是较新版本软件包 1:mariadb-libs-5.5.44-1.el7_1.x86_64 已安装并且是较新版本
等待他一直安装完成后就可以启动 mariadb 服务了。
[root@bbs ~]# systemctl start mariadb.service
[root@bbs ~]# systemctl enable mariadb.service
执行完这个命令下面就可以直接使用 mysql 命令了,跟 mysql 操作完全一样,至于里面细节就不去管他了,也用不到。
[root@bbs ~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.44-MariaDB MariaDB Server
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)下面还要设置 mysql 的密码权限,默认密码为空,此处新密码设置为 root
[root@bbs ~]# mysql_secure_installation
/usr/bin/mysql_secure_installation:行379: find_mysql_client: 未找到命令
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 you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation.
Set root password? [Y/n] y
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] y
... 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] n
... skipping.
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] y
- 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] y
... 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!
是不是so easy!!!3、安装 PHP
同样的模式,先搜索一下看看存在哪些包
[root@bbs ~]# yum search php
已加载插件:
fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: mirrors.163.com
========================================================= N/S matched: php =========================================================
graphviz-php.x86_64 : PHP extension for graphviz
php.x86_64 : PHP scripting language for creating dynamic web sites
php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
php-cli.x86_64 : Command-line interface for PHP
php-common.x86_64 : Common files for PHP
php-dba.x86_64 : A database abstraction layer module for PHP applications
php-devel.x86_64 : Files needed for building PHP extensions
php-embedded.x86_64 : PHP library for embedding in applications
php-enchant.x86_64 : Enchant spelling extension for PHP applications
php-fpm.x86_64 : PHP FastCGI Process Manager
php-gd.x86_64 : A module for PHP applications for using the gd graphics library
php-intl.x86_64 : Internationalization extension for PHP applications
php-ldap.x86_64 : A module for PHP applications that use LDAP
php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
php-mysql.x86_64 : A module for PHP applications that use MySQL databases
php-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases
php-odbc.x86_64 : A module for PHP applications that use ODBC databases
php-pdo.x86_64 : A database access abstraction module for PHP applications
php-pear.noarch : PHP Extension and Application Repository framework
php-pgsql.x86_64 : A PostgreSQL database module for PHP
php-process.x86_64 : Modules for PHP script using system process interfaces
php-pspell.x86_64 : A module for PHP applications for using pspell interfaces
php-recode.x86_64 : A module for PHP applications for using the recode library
php-snmp.x86_64 : A module for PHP applications that query SNMP-managed devices
php-soap.x86_64 : A module for PHP applications that use the SOAP protocol
php-xml.x86_64 : A module for PHP applications which use XML
php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
rrdtool-php.x86_64 : PHP RRDtool bindings
uuid-php.x86_64 : PHP support for Universally Unique Identifier library
php-pecl-memcache.x86_64 : Extension to work with the Memcached caching daemon
查看后面的一些注释发现我们可能需要这几个包,不要问我为什么知道这些报需要装,因为知道,所以知道,这是男人的直觉 额当然你可以选择 yum -y php* 全部安装,应该没问题。
[root@bbs ~]# yum -y install php php-bcmath php-cli php-common php-gd php-ldap php-mbstring php-mysql php-mysqlnd php-pear php-pdo php-xml php-xmlrpc
执行命令发现有冲突发现确实引用了两个连接数据库的包那就去掉一个。因为官方建议用后面一个包 mysqlnd。
[root@bbs ~]# yum -y install php php-bcmath php-cli php-common php-gd php-ldap php-mbstring php-mysqlnd php-pear php-pdo php-xml php-xmlrpc
OK 安装完成。
#重启MariaDB:systemctl restart mariadb.service
#重启apache:systemctl restart httpd.service
4、服务配置a、编辑 Apache 服务器的配置文件
[root@bbs ~]# vi /etc/httpd/conf/httpd.conf
修改下面这些属性
#修改允许
.htaccess
AllowOverride All
# 修改页面支持属性
DirectoryIndex index.html index.htm Default.html Default.htm index.php
# 新增支持 . pl 脚本
AddHandler cgi-script .cgi .pl
systemctl restart httpd.service #重启apache
b、配置 php
[root@bbs ~]# vi /etc/php.ini
修改下面参数:
# 改为 date.timezone = PRC
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = RPC
# 新增禁用的函数,需要使用时再放开
; This directive allows you to disable certain functions for security reasons.
; It receives a comma-delimited list of function names. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
; http://php.net/disable-functions
disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname
# 支持php短标签
; short_open_tag
; Default Value: On
; Development Value: Off
; Production Value: Off
short_open_tag = On
# 设置表示允许访问当前目录(即PHP脚本文件所在之目录)和/tmp/目录,可以防止php木马跨站,如果改了之后安装程序有问题(例如:织梦内容管理系统),可以注销此行,或者直接写上程序的目录/data/ .osyunwei.com/:/tmp/
open_basedir = .:/tmp/
#重启MariaDB:systemctl restart mariadb.service
#重启apache:systemctl restart httpd.service
c、进行php页面测试
[root@bbs html]# cd /var/ /html
[root@bbs html]# vi index.php
里面的内容很简单,但是我看到别人的教程还是写错了,我也被坑了,出了个空白页面 - -
<?php
phpinfo();
?>
在客户端浏览器输入服务器IP地址,可以看到如下图所示相关的配置信息5、安装 discuz
a、这个程序系统没有集成,需要自己下载,去官方论坛上找了个discuz3.2x的中文简体版下载地址
产品介绍
Discuz! X3.2 在继承和完善 Discuz! X3.1 的基础上,针对社区移动端进行了新的尝试。推出微信登录、微社区等功能。安全稳定的程序为站长提供更加可靠的保障。
下面我们就直接使用 wget 下载下来安装,如果没有这个命令,使用 yum 安装就行了,我下载的是GBK的包,如果出现乱码请下载UTF8的。
[root@bbs download]# yum -y install wget
[root@bbs download]# wget http://download.ebingou.cn/DiscuzX/3.2/Discuz_X3.2_SC_GBK.zip
--2015-11-06 17:45:41-- http://download.ebingou.cn/DiscuzX/3.2/Discuz_X3.2_SC_GBK.zip
正在解析主机download.ebingou.cn (download.ebingou.cn)... 101.227.130.115正在连接download.ebingou.cn (download.ebingou.cn)|101.227.130.115|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:12402802 (12M) [application/zip]
正在保存至: “Discuz_X3.2_SC_GBK.zip”
100%[==========================================================================================>] 12,402,802 7.74MB/s 用时 1.5s
2015-11-06 17:45:43 (7.74 MB/s) - 已保存 “Discuz_X3.2_SC_GBK.zip” [12402802/12402802])
OK 下载完成。
直接解压文件,由于是个zip包 ,坑爹 linux 肯定没工具解,直接安装 yum -y install unzip
[root@bbs download]# unzip Discuz_X3.2_SC_GBK.zip
[root@bbs download]# ls -l
总用量 12120
-rw-r--r--. 1 root root 12402802 6月 9 10:58 Discuz_X3.2_SC_GBK.zip
drwxr-xr-x. 2 root root 97 6月 9 10:21 readme
drwxr-xr-x. 12 root root 4096 6月 9 10:21 upload
drwxr-xr-x. 4 root root 68 6月 9 10:21 utility
OK,解压成功,出来了3个目录。b、将 upload 目录转移到web请求目录下
[root@bbs download]# cp -R ./upload /var/ /html
c、进去upload给予几个目录权限访问
[root@bbs download]# chown apache:apache -R ./upload [root@bbs upload]# chmod -R 777 config
[root@bbs upload]# chmod -R 777 data
[root@bbs upload]# chmod -R 777 uc_client
[root@bbs upload]# chmod -R 777 uc_server
d、打开浏览器开始安装论坛,这一步网上都是说什么站点的根目录,然后域名加上 install 就可以访问了,我根本没有站点,所以尝试了很久未知所以然,找不到入口该是多蛋疼,蛋碎了又去查看资料具体入口跳转的php页面,发现是forum.php,这下简单了,在upload 目录下有这个页面。直接访问果然出来。看浏览器的解析结果分析,如果自己在根目录下的一层文件夹需要添加在路径上。
http://192.168.1.1/upload/forum.php
e、开始安装论坛,点击“我同意”后,进去系统检测页面。如果一切提示OK,就继续下一步,如果提示有错误,就先去解决,一般都是上面第【c】步让你给文件权限的问题,既然上面都执行了 这里一般不会报错。一直下一步,下一步设置管理员密码,就成功安装了。
本文标签:
很赞哦! ()
下一篇:discuz验证过程介绍
相关教程
- android4.4+linuxdeploy+centos7+php-fpm+mysql+frp安装shopxo
- Centos7搭建discuz论坛步骤教程
- Centos7环境怎么部署搭建discuz论坛
- centos7环境搭建Discuz论坛的方法
- centos7搭建discuz的方法
- centos7安装部署Discuz论坛的方法
- centos7上安装phpcms的步骤方法
- 基于Centos7详细安装wordpress的方法
- Centos7怎么安装WordPress
- centos7系统yum搭建lnmp环境及配置wordpress
- CentOS7安装WordPress的步骤方法
- centos7.3怎么安装wordpress
图文教程
Discuz模板更新后样式错乱的解决方法
1. 清空浏览器缓存或使用无痕模式浏览网站;2. 检查并确保css文件路径正确;3. 使用ftp工具确认所有模板文件已上传并覆盖原文件;4. 禁用所有插件,然后逐一启用并测试,找出问题插件。
Discuz实现NT跨站缓存同步的方法
在之前的文章中,提到了在DiscuzNT中进行缓存分层的概念。之前在产品中也实现了其中的构想,但该方案有一个问题,就是如果将产品进行分布式布署之后,如果某一站点发生数据变化时
discuz网站结构和工作原理
1、首先,介绍网站最主要的三个文件夹:root\source\、root\template\、root\static\,分别是代码文件夹、模版文件夹、静态文件夹(js、css、image等)。
Discuz代码效果介绍
我如何使用Discuz代码“[tr=颜色]” 定义行背景“[td=宽度]” 定义列宽“[td=列跨度,行跨度,宽度]” 定义行列跨度
相关源码
-
(自适应)帝国cms7.5文章新闻博客整站源码( 带会员中心)本模板基于帝国CMS内核开发,为新闻资讯、个人博客及作品展示类网站设计。采用响应式布局技术,确保在手机、平板和电脑等不同设备上都能获得良好的浏览体验。查看源码 -
(自适应响应式)教育培训机构集团网站pbootcms源码下载本模板基于PbootCMS系统开发,为教育培训机构设计,特别适合展示课程体系、师资团队和教学成果。采用响应式技术,确保在各类设备上都能提供良好的浏览体验。查看源码 -
(响应式H5)帝国cms7.5文章新闻博客模板带会员中心本模板基于帝国CMS内核开发,为新闻资讯、个人博客及作品展示类网站设计。采用响应式布局技术,确保在手机、平板和电脑等不同设备上都能获得良好的浏览体验。查看源码 -
(自适应响应式)APP应用程序软件介绍落地页源码免费下载该模板为营销技术从业者设计,提供专业的内容展示平台。采用响应式布局,适配软件介绍、APP推广等营销场景,通过可视化后台可快速搭建符合行业特性的展示网站。查看源码 -
响应式茶叶茶道pbootcms网站模板源码(自适应手机端)棕色复古茶具主题的响应式网站模板,为茶叶茶道企业设计,同时支持古玩字画、艺术文化等行业的快速适配,通过替换文字图片即可转型为其他行业官网,大幅降低开发成本。查看源码 -
(自适应响应式)绿色环保防腐木材轻钢别墅建材pbootcms模板下载本模板为环保防腐木材、轻钢别墅建材类企业设计开发,基于PbootCMS内核构建,充分考虑了建材行业的展示需求与产品特点。模板设计风格自然环保,布局清晰合理,呈现建材产品特性与专业优势,帮助访客直观了解产品特点并建立信任感。查看源码
| 分享笔记 (共有 篇笔记) |
