Centos7部署typecho


  • 本教程使用centos 7 1804安装,其他版本不保证也可以使用。
  • 软件源使用的是opsx

安装apache

使用如下命令安装,并启动服务

1
2
3
yum -y install httpd
systemctl start httpd.service
systemctl enable httpd.service

检查是否可以访问
打开浏览器输入服务器IP地址
如果打不开可以使用如下命令检查防火墙是否已经放行80端口

1
firewall-cmd --list-all

放行防火墙的80端口

1
2
firewall-cmd --add-service=http
firewall-cmd --add-service=http --permanent

正确操作后的结果

安装php

使用如下命令安装php,并且启动

1
2
yum -y install php-* --skip-broken php-mysqlnd
systemctl restart httpd.service

通过安装探针的方式来检查php是否成功工作

1
2
cd /var/www/html/
wget http://dl.kn007.net/directlink/yhtz.php

浏览器访问刚刚下载的yhtz.php文件
如果显示一下界面则安装成功

Mariadb安装

使用如下命令安装Mariadb,并且启动

1
2
3
yum -y install mariadb mariadb-server
systemctl start mariadb
systemctl enable mariadb

初始化数据库

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
[root@localhost html]# 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
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 # '建议这个地方设置一个数据库的root密码,所以输入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] # '直接回车,保持默认'
... 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] # '直接回车,保持默认'
... 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!

可以使用刚刚的探针测试数据库是否可以连接
如果检测结果是无法连接,请确保之前的操作都正确,并且无报错!
如果还是无法连接,请尝试关闭selinux

1
setenforce 0

也可以永久关闭selinux

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@localhost html]# vi /etc/selinux/config 
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# 上面这一行改成disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted

请确保数据安装成功再进入下一步操作

安装图形化数据库管理工具

1
2
3
4
5
6
cd /var/www/html
mkdir phpmyadmin
cd phpmyadmin
wget http://mirrors.eagleslab.com:8889/phpmyadmin.zip
yum -y install unzip
unzip phpmyadmin.zip

检查是否可以正常访问

尝试登陆,并且创建数据库

安装typecho

下载源码并解压

1
2
3
4
cd /var/www/html/
wget http://mirrors.eagleslab.com:8889/typecho.zip
unzip typecho.zip
chmod -R 777 ../html/

开始安装过程

注意,这边如果排版异常,请勿使用IE浏览器,或者IE内核的浏览器。

安装成功页面

默认的页面

评论
加载中,最新评论有1分钟缓存...