php博客程序typecho,Typecho搭建个人博客

安装Mariadb

安装mariadb

yum install mariadb mariadb-server mariadb-devel

启动mariadb服务

systemctl start mariadb.service

登陆mariadb

# mysql -u root -p

Enter password:

Welcome to the MariaDB monitor. Commands end with ; or \g.

Your MariaDB connection id is 2

Server version: 5.5.52-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

注意:安装好mariadb并启动之后,初始登陆密码为空,直接回车即可成功登陆到mariadb。

设置mariadb的root用户密码

set password=password('123456');

配置Mariadb字符集

查看/etc/my.cnf文件内容,最后一行 !includedir /etc/my.cnf.d 存在,说明在该配置文件中引入/etc/my.cnf.d 目录下的配置文件。

使用vim /etc/my.cnf.d/server.cnf命令编辑server.cnf文件,在[mysqld]标签下添加以下内容:

init_connect='SET collation_connection = utf8_unicode_ci'

init_connect='SET NAMES utf8'

character-set-server=utf8

collation-server=utf8_unicode_ci

skip-character-set-client-handshake

说明:如果/etc/my.cnf.d 目录下无server.cnf文件,则直接在/etc/my.cnf文件的[mysqld]标签下添加以上内容。

用vim /etc/my.cnf.d/client.cnf命令编辑client.cnf文件,在[client]标签下添加

default-character-set=utf8

用vim /etc/my.cnf.d/mysql-clients.cnf命令编辑mysql-clients.cnf文件,在[mysql]标签下添加

default-character-set=utf8

配置完成后,重启mariadb服务

systemctl restart mariadb.service

设置mariadb服务开机启动

systemctl enable mariadb.service

查看mariadb字符集

# mysql -uroot -p

Enter password:

Welcome to the MariaDB monitor. Commands end with ; or \g.

Your MariaDB connection id is 2

Server version: 5.5.52-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show variables like "%character%";

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

| Variable_name | Value |

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

| character_set_client | utf8 |

| character_set_connection | utf8 |

| character_set_database | utf8 |

| character_set_filesystem | binary |

| character_set_results | utf8 |

| character_set_server | utf8 |

| character_set_system | utf8 |

| character_sets_dir | /usr/share/mysql/charsets/ |

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

8 rows in set (0.00 sec)

MariaDB [(none)]> show variables like "%collation%";

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

| Variable_name | Value |

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

| collation_connection | utf8_unicode_ci |

| collation_database | utf8_unicode_ci |

| collation_server | utf8_unicode_ci |

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

3 rows in set (0.00 sec)

创建数据库实例

# mysql -u root -p

Enter password:123456

MariaDB [(none)]> create database typecho;

MariaDB [(none)]> grant all privileges on typecho.* to typecho@localhost identified by '123456';

MariaDB [(none)]> flush privileges;

MariaDB [(none)]> exit

安装PHP

安装php和关联模块

yum install php php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc curl

重启httpd服务

systemctl restart httpd.service

设置http服务开机启动

systemctl enable httpd.service

建立php测试文件

vim /var/www/html/info.php

输入内容:Thanks for using Typecho!

说明:在默认目录下建立php测试文件,在新打开的vim编辑器中输入:Thanks for using typecho!,然后使用esc键后输入:wq保存退出。在浏览器中输入 http://localhost/info.php 查看是否有php相关信息输出。测试成功后,将info.php文件删除。

安装Typecho

下载Typecho

将下载的安装包上传到服务器并解压到 /var/www/html/ 目录下,截图如下:

0818b9ca8b590ca3270a3433284dd417.png

安装Typecho

0818b9ca8b590ca3270a3433284dd417.png

点击“我准备好了,开始下一步”

0818b9ca8b590ca3270a3433284dd417.png

0818b9ca8b590ca3270a3433284dd417.png

0818b9ca8b590ca3270a3433284dd417.png

页面会自动获取并填充选项。手动输入“数据库密码”和“登陆密码”选项值,然后将界面中默认的数据库用户名root改为已经创建好的typecho(如果在创建数据库时指定root为typecho库的所有权,则可以不修改。总之所有选项值须跟实际设置的一致),其它选项保持默认。最后点击“确认,开始安装”

0818b9ca8b590ca3270a3433284dd417.png

0818b9ca8b590ca3270a3433284dd417.png

此时界面中提示,需要创建一个名为”config.inc.php“文件,且文件内容已给出。复制文件内容,在 /var/www/html/ 目录下创建一个 config.inc.php 文件。创建完成后,在界面中点击”创建完毕,继续安装“

0818b9ca8b590ca3270a3433284dd417.png

Tyepcho安装完成,然后点击控制面板,进入管理后台,即可管理并创作了。

登陆和管理

访问博客

管理博客

0818b9ca8b590ca3270a3433284dd417.png

使用admin账户登陆,即可进行管理。建议登陆后,进入“设置”--“基本”,将“站点地址”中默认的 http://localhost 改为 http://xxx.xxx.xxx.xxx 类型的IP地址。

你可能感兴趣的:(php博客程序typecho)