ruochen's blog - Linux
type: channel
link: https://ruochen.net/tag/Linux/
items: LNMP搭建typecho

LNMP搭建typecho
type: item
date: 2022-02-22T10:13:00+00:00
description: Nginx(v1.18.0) 安装下载rpm -ivh http://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.18.0-1.el7.ngx.x86_64.rpm相关命令# 启动 systemctl start nginx # 查看状态 systemctl status nginx # 开机自启 systemctl enable nginxMySQL(v5.7) 安装下载安装wget http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm && yum -y install mysql57-community-release-el7-10.noarch.rpm && yum -y install mysql-community-server # 若报错 GPG 验证不通过，使用下面命令安装 yum install mysql-community-server --nogpgcheck如果下载太慢，手动到镜像网站下载相关文件，放到 /var/cache/yum/x86_64/7/mysql57-community/packages 目录即可中科大镜像站网易镜像站报错 GPG 验证不通过也可参考此文章：yum 安装软件出现 gpg keys 相关问题相关命令# 启动 systemctl start mysql # 查看初始密码 grep "password" /var/log/mysqld.log # 登录 msyql -uroot -p修改密码(登录后)# 安全策略 set global validate_password_policy=0; # 长度校验 set global validate_password_length=4; # 修改 roor 初始密码 ALTER USER 'root'@'localhost' IDENTIFIED BY 'root'; # 授权 root 用户远程管理权限 GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root';MySQL 卸载教程使用 rpm -qa | grep -i mysql 查看是否装有 MySQLrpm -ev xxx 删除 MySQL如果提示依赖包错误，则使用以下命令尝试 rpm -ev xxx --nodeps如果提示错误：error: %preun(xxxxxx) scriptlet failed, exit status 1，则用以下命令尝试：rpm -e --noscripts xxxx查找之前老版本 MySQL 的目录、并且删除老版本 MySQL 的文件和库：find / -name mysql删除对应的 mysql 目录注意： 卸载后/etc/my.cnf不会删除，需要进行手工删除：rm -rf /etc/my.cnf再次查找机器是否安装mysql：rpm -qa | grep -i mysqlPHP(v7.3) 安装安装 EPEL(Extra Packages for Enterprise Linux)源yum install epel-release安装 WEBTATIC 源rpm -ivh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm安装 PHP 及其扩展yum install php71w php71w-fpm \ php71w-cli php71w-common php71w-devel php71w-gd \ php71w-pdo php71w-mysql php71w-mbstring php71w-bcmath \ php71w-pecl-redis相关命令# 启动 systemctl start php-fpm # 查看状态 systemctl status php-fpm # 开机自启 systemctl enable php-fpmTypecho# 创建网站目录 mkdir -p /var/www/iruochen.net # 下载 typecho cd /var/www/iruochen.net wget http://typecho.org/downloads/1.1-17.10.30-release.tar.gz # 解压 tar -xzvf 1.1-17.10.30-release.tar.gz # 解压后移至根目录 mv /var/www/iruochen.net/build/* /var/www/iruochen.net # 删除多余文件 rmdir bu…