1.安装httpd服务

[root@VM_0_13_centos ~]# yum install -y httpd
[root@VM_0_13_centos ~]# systemctl start httpd   #启动
[root@VM_0_13_centos ~]# systemctl status httpd  #查看运行状态
[root@VM_0_13_centos ~]# systemctl enable httpd  #设置为开机启动

2.防火墙设置

[root@VM_0_13_centos ~]# systemctl status firewalld.service
#让防火墙放行http,https服务和80端口
[root@VM_0_13_centos ~]# firewall-cmd --permanent --add-service=http
[root@VM_0_13_centos ~]# firewall-cmd --permanent --add-service=https
[root@VM_0_13_centos ~]# firewall-cmd --permanent --zone=public --add-port=80/tcp
[root@VM_0_13_centos ~]# firewall-cmd --reload   #使更改生效
[root@VM_0_13_centos ~]# firewall-cmd --permanent --zone=public --list-ports   #查看开放的端口
[root@VM_0_13_centos ~]# firewall-cmd --permanent --zone=public --list-services #查看开放的服务
#这里通过ip地址就能访问Apache的默认界面

3.安装php及相关插件

[root@VM_0_13_centos ~]# yum install -y php
[root@VM_0_13_centos ~]# yum install -y php-mysql
[root@VM_0_13_centos ~]# yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel 

4.测试php安装是否成功

[root@VM_0_13_centos ~]# cd /var/www/html/
[root@VM_0_13_centos ~]# vi test.php
<?php
   phpinfo();
?>

5.重启httpd服务

systemctl restart httpd
#通过ip+test.php访问到php的版本信息界面则安装成功

6.安装mysql数据库

[root@VM_0_13_centos ~]# mkdir Typecho_file
[root@VM_0_13_centos ~]# cd Typecho_file
[root@VM_0_13_centos Typecho_file]# wget http://dev.mysql.com/get/mysql57-community-release-el7- 
8.noarch.rpm   #下载mysql源安装包
[root@VM_0_13_centos Typecho_file]# rpm -ivh mysql57-community-release-el7-8.noarch.rpm   #安装mysql源

7.检查mysql安装是否成功

[root@VM_0_13_centos Typecho_file]# yum repolist enabled |grep mysql
mysql-connectors-community/x86_64    MySQL Connectors Community              131
mysql-tools-community/x86_64         MySQL Tools Community                   100
mysql57-community/x86_64             MySQL 5.7 Community Server              384

8.安装mysql-community-server

[root@VM_0_13_centos ~]# yum install mysql-community-server
[root@VM_0_13_centos ~]# systemctl start mysqld   #启动数据库
[root@VM_0_13_centos ~]# systemctl enable mysqld   #设置开机启动

9.查看数据库默认密码

[root@VM_0_13_centos ~]# grep 'temporary password' /var/log/mysqld.log
2019-12-28T06:39:20.135351Z 1 [Note] A temporary password is generated for root@localhost: 
wc&r7442>Nx<

10.修改root密码

[root@VM_0_13_centos ~]# mysql -uroot -p   #输入上一步获得的密码,则成功登录数据库
mysql> ALTER USER root@localhost IDENTIFIED BY 'password';

11.创建typecho数据库和用并给typecho数据库所有表的权限

mysql> create database typecho;
mysql> grant all privileges on typecho.* to typecho@localhost identified by 'password';
mysql> flush privileges;   #立即生效

12.安装typecho

[root@VM_0_13_centos Typecho_file]# wget http://typecho.org/downloads/1.1-17.10.30-release.tar.gz #下 
载安装包
[root@VM_0_13_centos Typecho_file]# tar -zxvf 1.1-17.10.30-release.tar.gz  #解压缩
[root@VM_0_13_centos Typecho_file]# cd build
[root@VM_0_13_centos build]# cp -rf ./* /var/www/html/   #将build目录下所有文件cp值网站根目录

13.通过ip地址在浏览器访问,按照typecho的安装提示一步一步进行安装即可,需要在网站根目录下新建config.inc.php

[root@VM_0_13_centos build]# cd /var/www/html/
[root@VM_0_13_centos html]# vi config.inc.php