您现在的位置是:首页 > 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
图文教程
ecshop怎么和discuz整合
在做一个电子商务网站,需要在上面挂一个论坛,discuz无疑是较佳的选择,自然就得需要实现ecshop与discuz的同步登陆,否则空挂一个论坛在上面毫无意义。
discuz3.4特殊字符乱的怎么解决
下面discuz栏目给大家介绍一下discuz3.4特殊字符乱码的解决方案。有的参考价值,有需要的朋友可以参考一下,希望对大家有所帮助。
为discuzx2.5添加mp4播放附件的方法
最近要做手机客户端,需要和论坛数据同步,因为iphone和andriod 能都支持的格式是mp3,mp4。所以论坛版块的音视频附件就限制为mp3,mp4格式。论坛本身支持mp3,可mp4不支持
DISCUZX2更换域名需要注意的问题
最近经常遇到几个由于网站更换域名,而导致网站访问出问题。这几天都凑在一块了,所以无忧主机( .51php.com)小编就常用的php开源cms系统更换域名是否“敏感”的问题整理了下
相关源码
-
pbootcms模板(PC+WAP)火锅加盟餐饮美食类带留言源码基于PbootCMS内核深度开发,为火锅、餐饮品牌打造的营销型解决方案。采用红色主题传递行业活力,实现PC与WAP端适配。查看源码 -
(自适应)绿色宠物门诊兽医行业网站模板该绿色清爽风格网站模板专为宠物门诊与兽医诊所设计,基于PbootCMS内核开发,采用响应式布局确保手机、PC等多端体验一致,帮助宠物医疗机构高效构建线上服务平台。查看源码 -
(自适应响应式)水墨风白酒酿制酒业酒文化酒类产品网站源码下载本模板基于PbootCMS内核开发,为酒类企业打造的水墨风响应式网站解决方案。采用传统东方美学设计语言,呈现白酒文化底蕴,自适应移动端展示效果,数据实时同步更新,助力酒企建立专业数字化形象。查看源码 -
粉色家政月嫂保姆公司pbootcms网站模板(PC+WAP)为家政服务、月嫂保姆企业打造的营销型解决方案,基于PbootCMS内核开发,采用温馨粉色主题传递行业温度。PHP7.0+高性能架构支持SQLite/MySQL双数据库查看源码 -
(响应式)wordpress模板VieuV4.5主题资讯自媒体博客源码Vieu主题专注于个人博客与企业展示场景,采用响应式设计确保在手机、电脑、平板等多设备上的展示。主题集成会员中心、投稿系统、内容保护等实用功能,满足现代博客网站的建设需求。查看源码 -
(自适应)代理记账财务会计咨询服务个人公司网站模板该响应式网站模板为代理记账、财政咨询及财务会计类企业设计,基于PbootCMS内核开发。通过自适应手机端的HTML5技术,帮助企业高效构建专业财税服务平台查看源码
| 分享笔记 (共有 篇笔记) |
