lnmp+wordpress之博客部署

用本地yum源
1、跑lnmp脚本
确定有脚本
脚本下载地址
http://soft.vpser.net/lnmp/

[root@localhost ~]# ll
total 4228268
-rw-------. 1 root root       1390 Nov  6 16:14 anaconda-ks.cfg
-rw-r--r--. 1 root root 4329570304 Jun  7  2019 CentOS-7-x86_64-DVD-1511.iso
-rw-r--r--. 1 root root     168639 Nov 17  2020 lnmp1.7.tar.gz

解压

[root@localhost ~]# tar -zxvf lnmp1.7.tar.gz

解压后会有一个lnmp1.7的目录,进入目录,会有install.sh 的脚本,运行脚本

[root@localhost ~]# ll
total 4228272
-rw-------. 1 root root       1390 Nov  6 16:14 anaconda-ks.cfg
-rw-r--r--. 1 root root 4329570304 Jun  7  2019 CentOS-7-x86_64-DVD-1511.iso
drwxr-xr-x. 7 root root       4096 Jul 15 11:52 lnmp1.7
-rw-r--r--. 1 root root     168639 Nov 17  2020 lnmp1.7.tar.gz
[root@localhost ~]# cd lnmp1.7
[root@localhost lnmp1.7]# ll
total 104
-rwxr-xr-x. 1 root root 10193 Oct 10 18:03 addons.sh
-rw-r--r--. 1 root root 15429 May 31 14:35 ChangeLog
drwxr-xr-x. 4 root root  4096 Oct 15 14:35 conf
drwxr-xr-x. 2 root root  4096 Oct 22 17:49 include
drwxr-xr-x. 2 root root  4096 Sep 30 08:10 init.d
-rwxr-xr-x. 1 root root  5458 Jul 14 16:39 install.sh
-rw-r--r--. 1 root root   209 Jul  3  2016 License
-rwxr-xr-x. 1 root root   375 Jan  4  2019 lnmp.conf
-rwxr-xr-x. 1 root root  5282 May 13 10:47 pureftpd.sh
-rw-r--r--. 1 root root  7263 May 31 12:12 README
drwxr-xr-x. 3 root root    18 Jul  9  2015 src
drwxr-xr-x. 2 root root  4096 Apr  1  2017 tools
-rwxr-xr-x. 1 root root  6918 Oct 13 14:10 uninstall.sh
-rwxr-xr-x. 1 root root 16050 Oct 20 08:17 upgrade1.x-1.7.sh
-rwxr-xr-x. 1 root root  2976 Oct 13 14:10 upgrade.sh
[root@localhost lnmp1.7]# ./install.sh 
+------------------------------------------------------------------------+
|          LNMP V1.7 for CentOS Linux Server, Written by Licess          |
+------------------------------------------------------------------------+
|        A tool to auto-compile & install LNMP/LNMPA/LAMP on Linux       |
+------------------------------------------------------------------------+
|           For more information please visit https://lnmp.org           |
+------------------------------------------------------------------------+
You have 11 options for your DataBase install.
1: Install MySQL 5.1.73
2: Install MySQL 5.5.62 (Default)
3: Install MySQL 5.6.48
4: Install MySQL 5.7.30
5: Install MySQL 8.0.20
6: Install MariaDB 5.5.68
7: Install MariaDB 10.1.45
8: Install MariaDB 10.2.32
9: Install MariaDB 10.3.23
10: Install MariaDB 10.4.13
0: DO NOT Install MySQL/MariaDB
Enter your choice (1, 2, 3, 4, 5, 6, 7, 8, 9, 10 or 0):    ## 回车默认
No input,You will install MySQL 5.5.62
===========================
Please setup root password of MySQL.
Please enter:000000    ## 此处不要忘了输入mysql密码!!
#### 往下可都默认

出现下图的样子即可以了
在这里插入图片描述

跑完后进入数据库,创建用户,给权限,然后退出

[root@localhost ~]# mysql -uroot -p000000
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.62-log Source distribution

Copyright (c) 2000, 2018, 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> 
mysql> create database wordpress;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on *.* to root@'%' identified by '000000';
Query OK, 0 rows affected (0.01 sec)

mysql> grant replication slave  on *.* to root@'localhost' identified by '000000';
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye

2、用CRT上传WordPress压缩包

[root@localhost ~]# ll
total 4239804
-rw-------. 1 root root       1390 Nov  6 16:14 anaconda-ks.cfg
-rw-r--r--. 1 root root 4329570304 Jun  7  2019 CentOS-7-x86_64-DVD-1511.iso
drwxr-xr-x. 7 root root       4096 Jul 15 11:52 lnmp1.7
-rw-r--r--. 1 root root     168639 Nov 17 08:19 lnmp1.7.tar.gz
-rw-r--r--. 1 root root    2592347 Dec 18 10:24 lnmp-install.log
-rw-r--r--. 1 root root    9210722 Nov 17 09:22 wordpress-4.7.3-zh_CN.zip

解压

[root@localhost ~]# unzip wordpress-4.7.3-zh_CN.zip 

进入目录 /home/wwwroot/default/删除原有的配置文件 index.html

[root@localhost ~]# cd /home/wwwroot/default/
[root@localhost default]# ll
total 88
-rw-r--r--.  1 root root  3196 Dec 18 10:24 index.html
-rw-r--r--.  1 root root  5683 Dec 18 10:24 lnmp.gif
-rw-r--r--.  1 root root 20256 Dec 18 10:24 ocp.php
-rw-r--r--.  1 root root    20 Dec 18 10:24 phpinfo.php
drwxr-xr-x. 14 www  www   4096 Dec 18 10:24 phpmyadmin
-rw-r--r--.  1 root root 42609 Dec 18 10:24 p.php
[root@localhost default]# rm -rvf index.html 
removed ‘index.html’

然后把WordPress的复制到 /home/wwwroot/default/ 下

[root@localhost default]# cp -rvf /root/wordpress/* .
[root@localhost default]# ll
total 268
-rw-r--r--.  1 root root   418 Dec 18 10:44 index.php
-rw-r--r--.  1 root root 19935 Dec 18 10:44 license.txt
-rw-r--r--.  1 root root  5683 Dec 18 10:24 lnmp.gif
-rw-r--r--.  1 root root 20256 Dec 18 10:24 ocp.php
-rw-r--r--.  1 root root    20 Dec 18 10:24 phpinfo.php
drwxr-xr-x. 14 www  www   4096 Dec 18 10:24 phpmyadmin
-rw-r--r--.  1 root root 42609 Dec 18 10:24 p.php
-rw-r--r--.  1 root root  6956 Dec 18 10:44 readme.html
-rw-r--r--.  1 root root  5447 Dec 18 10:44 wp-activate.php
drwxr-xr-x.  9 root root  4096 Dec 18 10:44 wp-admin
-rw-r--r--.  1 root root   364 Dec 18 10:44 wp-blog-header.php
-rw-r--r--.  1 root root  1627 Dec 18 10:44 wp-comments-post.php
-rw-r--r--.  1 root root  2930 Dec 18 10:44 wp-config-sample.php
drwxr-xr-x.  5 root root    65 Dec 18 10:44 wp-content
-rw-r--r--.  1 root root  3286 Dec 18 10:44 wp-cron.php
drwxr-xr-x. 18 root root  8192 Dec 18 10:44 wp-includes
-rw-r--r--.  1 root root  2422 Dec 18 10:44 wp-links-opml.php
-rw-r--r--.  1 root root  3301 Dec 18 10:44 wp-load.php
-rw-r--r--.  1 root root 33939 Dec 18 10:44 wp-login.php
-rw-r--r--.  1 root root  8048 Dec 18 10:44 wp-mail.php
-rw-r--r--.  1 root root 16250 Dec 18 10:44 wp-settings.php
-rw-r--r--.  1 root root 29896 Dec 18 10:44 wp-signup.php
-rw-r--r--.  1 root root  4513 Dec 18 10:44 wp-trackback.php
-rw-r--r--.  1 root root  3065 Dec 18 10:44 xmlrpc.php

把配置文件模板复制一份并改名

[root@localhost default]# cp wp-config-sample.php wp-config.php

配置文件

[root@localhost default]# vi wp-config.php
[root@localhost default]# cat wp-config.php
cat wp-config.php
<?php
/**
 * WordPress基础配置文件。
 *
 * 这个文件被安装程序用于自动生成wp-config.php配置文件,
 * 您可以不使用网站,您需要手动复制这个文件,
 * 并重命名为“wp-config.php”,然后填入相关信息。
 *
 * 本文件包含以下配置选项:
 *
 * * MySQL设置
 * * 密钥
 * * 数据库表名前缀
 * * ABSPATH
 *
 * @link https://codex.wordpress.org/zh-cn:%E7%BC%96%E8%BE%91_wp-config.php
 *
 * @package WordPress
 */

// ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
/** WordPress数据库的名称 */
define('DB_NAME', 'wordpress');

/** MySQL数据库用户名 */
define('DB_USER', 'root');

/** MySQL数据库密码 */
define('DB_PASSWORD', '000000');

/** MySQL主机 */
define('DB_HOST', 'localhost');

/** 创建数据表时默认的文字编码 */
define('DB_CHARSET', 'utf8');

/** 数据库整理类型。如不确定请勿更改 */
define('DB_COLLATE', '');

/**#@+
 * 身份认证密钥与盐。
 *
 * 修改为任意独一无二的字串!
 * 或者直接访问{@link https://api.wordpress.org/secret-key/1.1/salt/
 * WordPress.org密钥生成服务}
 * 任何修改都会导致所有cookies失效,所有用户将必须重新登录。
 *
 * @since 2.6.0
 */
define('AUTH_KEY',         'put your unique phrase here');
define('SECURE_AUTH_KEY',  'put your unique phrase here');
define('LOGGED_IN_KEY',    'put your unique phrase here');
define('NONCE_KEY',        'put your unique phrase here');
define('AUTH_SALT',        'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT',   'put your unique phrase here');
define('NONCE_SALT',       'put your unique phrase here');

/**#@-*/

/**
 * WordPress数据表前缀。
 *
 * 如果您有在同一数据库内安装多个WordPress的需求,请为每个WordPress设置
 * 不同的数据表前缀。前缀名只能为数字、字母加下划线。
 */
$table_prefix  = 'wp_';

/**
 * 开发者专用:WordPress调试模式。
 *
 * 将这个值改为true,WordPress将显示所有用于开发的提示。
 * 强烈建议插件开发者在开发环境中启用WP_DEBUG。
 *
 * 要获取其他能用于调试的信息,请访问Codex。
 *
 * @link https://codex.wordpress.org/Debugging_in_WordPress
 */
define('WP_DEBUG', false);

/**
 * zh_CN本地化设置:启用ICP备案号显示
 *
 * 可在设置→常规中修改。
 * 如需禁用,请移除或注释掉本行。
 */
define('WP_ZH_CN_ICP_NUM', true);

/* 好了!请不要再继续编辑。请保存本文件。使用愉快! */

/** WordPress目录的绝对路径。 */
if ( !defined('ABSPATH') )
        define('ABSPATH', dirname(__FILE__) . '/');

/** 设置WordPress变量和包含文件。 */
require_once(ABSPATH . 'wp-settings.php');

最后可进入浏览器查看
在这里插入图片描述
输入站点标题,用户名,密码,电子邮件,点击安装
例如:
在这里插入图片描述
进去后
在这里插入图片描述
在这里插入图片描述
https://support.huaweicloud.com/bestpractice-ecs/zh-cn_topic_0130142475.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值