前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >搭建Discuz! 论坛

搭建Discuz! 论坛

作者头像
胡齐
发布2019-09-23 18:40:03
6.9K1
发布2019-09-23 18:40:03
举报
文章被收录于专栏:运维猫

LAMP架构:

Linux+Apache+Mysql+PHP

官方网站:

http://www.mysql.com/

http://dev.mysql.com/downloads/mysql/

CentOS 7.0中,已经使用MariaDB替代了MySQL数据库,原因你懂的,MYSQL被Oracle收购以后,前景堪忧,所以MYSQL兄弟MariaDB就出来了,继续开源事业。

以rpm包的方式安装LAMP。

一、安装需要的软件包

[root@docker-04 ~]# yum -y install httpd mariadb-server mariadb php php-mysql

centos6.5执行以下

[root@docker-04 ~]# yum install httpd mysql-server mysql php php-mysql -y

httpd # web服务器

mariadb-server #mysql数据库

mariadb # mysql服务器linux下客户端

php #php相关文件

php-mysql #??? #php程序连接mysql使用的模块

查看某个命令由哪个包安装

[root@docker-04 ~]# rpm -qf `which mysql`

mariadb-5.5.60-1.el7_5.x86_64

启动服务LAMP相关服务:

[root@docker-04 ~]# systemctl start httpd

[root@docker-04 ~]# systemctl enable httpd

[root@docker-04 ~]# systemctl start mariadb

[root@docker-04 ~]# systemctl enable mariadb

[root@docker-04 ~]# systemctl status mariadb

测试数据库连接:

连接mysql数据库,连接本机可以去掉-h

#mysql

或:

# mysql -h IP -u USER -pPASS

Mysql的超级管理员是root拥有最mysql数据库的最高权限。

例:

# mysql -u root –p123456 –h 10.10.10.68

mysql> exit; #退出mysql

MySQL安全配置向导

安装完mysql-server 会提示可以运行mysql_secure_installation。运行mysql_secure_installation会执行几个设置:

a)为root用户设置密码

b)删除匿名账号

c)取消root用户远程登录

d)删除test库和对test库的访问权限

e)刷新授权表使修改生效

通过这几项的设置能够提高mysql库的安全。建议生产环境中mysql安装这完成后一定要运行一次mysql_secure_installation,详细步骤请参看下面的命令:

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL

SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current

password for the root user. If you've just installed MySQL, 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 MySQL

root user without the proper authorisation.

Set root password? [Y/n] <– 是否设置root用户密码, 刚才我已设置密码,我们输n

... skipping

By default, a MySQL installation has an anonymous user, allowing anyone

to log into MySQL 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] <–是否禁止root远程登录,根据自己的需求选择Y/n并回车,建议禁止

… Success!

By default, MySQL 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] <– 是否删除test数据库,直接回车或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] <– 是否重新加载权限表,直接回车

… Success!

Cleaning up…

All done! If you've completed all of the above steps, your MySQL

installation should now be secure.

Thanks for using MySQL!

如果不做安全配置root密码

[root@docker-03 ~]# mysqladmin -u root password “123456"

测试:登录mysql

[root@docker-03 ~]# mysql -u root -p

或:

[root@docker-03 ~]# mysql -u root -p123456

测试:

[root@docker-04 ~]# mysql -u root -p123456

mysql> show databases; #没有test数据库#执行时,所有命令以;号结尾

+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| ucenter |

+--------------------+

3 rows in set (0.00 sec)

mysql> exit #退出命令可以加分号,也可以不加分号。

测试网站是否支持PHP

# cd /var/www/html/

[root@docker-04 html]# vim index.php

<?php

phpinfo();

?>

测试:

[root@docker-04 html]# systemctl restart httpd 重启web

http://172.17.120.53/index.php

搭建LAMP环境部署Ucenter和Ucenter-home网站,搭建一个人人网的社交网站

www.renren.com

UCenter 用户中心,实现用户的统一登录登出,积分的兑换,TAG的互通等,在安装UCenter Home、Discuz!、SupeSite、X-Space 等应用前必须先安装UCenter。本教程讲解的即是如何全新安装UCenter 3.2.0。

http://www.discuz.net

Discuz! 论坛,百万站长的选择,定会给您带来非凡的论坛体验。Discuz! 7.0.0 的推出使Discuz! 的用户体验又上升到了一个新的高度。本教程讲解的即是如何全新安装Discuz! 7.0.0 FULL(集成了UCenter 安装的版本)。

UCenter Home 个人家园,给社区中的会员一个可以安家的地方,在这里会员可以交朋友,写记录,发日志,贴照片,玩游戏...使会员可以牢牢的黏在你的社区里。本教程讲解的即是如何全新安装UCenter Home 3.2。

SupeSite 社区门户,实现CMS 的功能,拥有强大的模型功能,对Discuz! 和UCenter Home 的完美聚合,是您将社区中所有信息进行整合展示的最佳平台。本教程讲解的即是如何全新安装SupeSite

到服务器上/opt目录下:

[root@docker-04 opt]# wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_UTF8.zip

[root@docker-04 opt]# unzip -d ./ucenter Discuz_X3.2_SC_UTF8.zip # 解压缩到./ucenter

[root@docker-04 opt]# cd ./ucenter

[root@docker-04 ucenter]# ls

readme upload utility

[root@docker-04 ucenter]# mkdir /var/www/html/ucadmin #创建目录

[root@docker-04 ucenter]# mv upload/* /var/www/html/ucadmin

[root@docker-04 ucenter]# cd /var/www/html/ucadmin

[root@docker-04 ucadmin]# ls

admin.php connect.php forum.php member.php search.php uc_server

api cp.php group.php misc.php source userapp.php

api.php crossdomain.xml home.php plugin.php static

archiver data index.php portal.php template

config favicon.ico install robots.txt uc_client

# robots.txt 网站根目录下,robots.txt 文件作用。

Robots协议(也称为爬虫协议、机器人协议等)全称是“网络爬虫排除标准”(Robots Exclusion Protocol),网站通过Robots协议告诉搜索引擎哪些页面可以抓取,哪些页面不能抓取。

robots.txt文件是一个文本文件,使用任何一个常见的文本编辑器,比如Windows系统自带的Notepad,就可以创建和编辑它[1] 。robots.txt是一个协议,而不是一个命令。robots.txt是搜索引擎中访问网站的时候要查看的第一个文件。robots.txt文件告诉蜘蛛程序在服务器上什么文件是可以被查看的。

但robots.txt不是命令,也不是防火墙,如同守门人无法阻止窃贼等恶意闯入者。

修改文件权限:

[root@docker-04 ucadmin]# ls -ld data

drwxr-xr-x. 13 root root 216 5月 31 2016 data

[root@docker-04 ucadmin]# ps -aux | grep httpd

root 18277 0.0 0.1 410156 13540 ? Ss 14:46 0:00 /usr/sbin/http-DFOREGROUND

apache 18279 0.0 0.0 410288 9156 ? S 14:46 0:00 /usr/sbin/http-DFOREGROUND

apache 18280 0.0 0.0 410288 7860 ? S 14:46 0:00 /usr/sbin/http-DFOREGROUND

[root@docker-04 ucadmin]# id apache

uid=48(apache) gid=48(apache) 组=48(apache)

[root@docker-04 ucadmin]# chown apache:apache data/ -R

或:

[root@docker-04 ucadmin]# chmod -R 777 data #

为安全正确做法应该是chown –R apache:apache data。后面安装好后测试。

安装网站模版:

安装UCenter:

打开:http://172.17.120.53/ucadmin/install/

要安这个打开:

[root@docker-04 ucadmin]# vim /etc/php.ini #php运用程序的配置文件

改:211 short_open_tag = Off

为:211 short_open_tag = On

开启PHP短标签功能。

决定是否允许使用,代码开始标志的缩写形式(<? 。。。?>)

PHP 代码开始标志的完整形式为:<?php。。。?>

#重新加载配置文件

[root@docker-04 ucadmin]# systemctl restart httpd.service

测试:http://172.17.120.53/ucadmin/install/

需要这个data目录可写:

注:这个注册码很不清楚,多按F5刷新几次就可以了

要记录创始人用户名:admin 密码:123456

关于运维学习、分享、交流,笔者开通了微信公众号【运维猫】,感兴趣的朋友可以关注下,欢迎加入,建立属于我们自己的小圈子,一起学运维知识。

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2019-08-27,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 运维猫 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
容器镜像服务
容器镜像服务(Tencent Container Registry,TCR)为您提供安全独享、高性能的容器镜像托管分发服务。您可同时在全球多个地域创建独享实例,以实现容器镜像的就近拉取,降低拉取时间,节约带宽成本。TCR 提供细颗粒度的权限管理及访问控制,保障您的数据安全。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档