安装typecho

操作系统版本介绍

在这里插入图片描述

更新apt-get

apt-get update

安装mysql

apt-get --purge remove mysql-server mysql-common mysql-client #卸载以前的依赖
apt-get install mysql-server mysql-common mysql-client # 安装

设置密码

使用这个方法安装的mysql是没有密码的,即输入mysql -u root -p就可以回车直接登录。所以需要人为设置密码。

root@ilocalhost:~# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.27-0ubuntu0.18.04.1 (Ubuntu)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> update user set authentication_string=PASSWORD("yourpassword") where user='root';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 1

mysql> update user set plugin="mysql_native_password";
Query OK, 1 row affected (0.00 sec)
Rows matched: 4  Changed: 1  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit;
Bye

重启mysql

service  mysql  restart

设置编码

安装中文语言包

这里我们会遇到一个坑,就是在后面程序启动保存数据的时候会出现中文乱码,但是我们明明已经编辑过默认编码了呀。这里我发现是阿里云服务器本身没有安装中文包,我们需要进行安装。

安装中文语言包

sudo apt-get -y install language-pack-zh-hans

修改语言环境设置

echo "LC_ALL=zh_CN.utf8" >> /etc/profile
echo "export LC_ALL" >> /etc/profile

查看语言

source /etc/profile

locale
看到zh_CN.UTF-8就成功了。接着需要重启服务器。

安装nginx

apt-get install nginx

安装php

apt-get install php-fpm 

安装成功后,会自动运行php-fpm,php-fpm默认使用的unix socket,修改配置文件,配置文件路径在/etc/php/7.2/fpm/pool.d/www.conf。(注意,我这里安装的是7.2你们可能并不一样)

在这里插入图片描述

 service php7.2-fpm restart

使用nginx 查看php是否安装成功

写一个index.php

vi /var/www/html/index.php

输入以下内容

<?php
phpinfo();
?>
vi /etc/nginx/sites-enabled/php.conf

输入以下内容

server {
       listen 80;
       listen [::]:80;

       server_name xx.xx.xx.xx;

       root /var/www/html;
       index index.html;

    location ~ \.php$ {
             root /home/typecho; #指定php的根目录
             fastcgi_pass 127.0.0.1:9000;#php-fpm的默认端口是9000
             fastcgi_index index.php;
             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
             include fastcgi_params;
    }
}

重启nginx

 service nginx restart

在这里插入图片描述
说明安装成功

安装其他组件

 apt-get install -y php-mysql php-gd  php-ldap php-odbc php-pear  php-xml  php-xmlrpc php-mbstring php-snmp php-soap curl 

现在平台已经搭建好了,进行typecho的安装

安装typecho

  1. 下载typecho
  2. 将typecho解压后放在/home/typecho
  3. 设置typecho文件夹权限
  4. 重启nginx
  5. 访问浏览器
  6. 安装完成
    在这里插入图片描述

推荐插件

在这里插入图片描述

推荐主题

在这里插入图片描述

效果:奇葩秋

发布了67 篇原创文章 · 获赞 36 · 访问量 7万+

猜你喜欢

转载自blog.csdn.net/qq_41861526/article/details/101277686
今日推荐