一键搭建个人博客

一键搭建个人博客

一、要求

使用LNMP架构和wordpress,LNMP架构可以自己手动搭建,之前随笔中有写过。本随笔教大家一键搭建

1、软件包
lnmp1.7.tar.gz 1.7 165kB
wordpress-5.8-zh_CN.tar.gz 4.7.3 15.0 MB
CentOS-7-x86_64-DVD-1804.iso 1511 4.16 GB
2、环境准备

创建好一台Centos7的虚拟机;

上传软件包到虚拟机的/usr/local/src/下

配置网络yum源(使用wget,也可以自己手敲);

[root@antong ~]# wget -O /etc/yum.repos.d/Centos-7.repo https://mirrors.aliyun.com/repo/Centos-7.repo

二、案例实施

1、解压两个软件包
[root@antong ~]# cd /usr/local/src/
[root@antong src]# tar -zxvf wordpress-5.8-zh_CN.tar.gz 
[root@antong src]# tar -zxvf lnmp1.7.tar.gz
2、运行LNMP包
[root@antong src]# cd lnmp1.7/
[root@antong lnmp1.7]# ./install.sh 
Enter your choice (1, 2, 3, 4, 5, 6, 7, 8, 9, 10 or 0):  //默认回车就可以
Please setup root password of MySQL.
Please enter:    //配置mysql的密码,自己起
Default enable,Enter your choice [Y/n]: y
Enter your choice (1, 2, 3, 4, 5, 6, 7, 8, 9, 10):    //默认回车就可以
Enter your choice (1, 2 or 3):       //默认回车就可以
//按任意键开始,等待安装完毕自动退出
Install lnmp takes 26 minutes.
Install lnmp V1.7 completed! enjoy it.    //安装成功
3、配置MySQL
[root@antong ~]# mysql -uroot -p
Enter password:    //之前配置的密码
mysql> create database wordpress;
Query OK, 1 row affected (0.00 sec)

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

mysql> grant all privileges on *.* to root@"%" identified by '000000' with grant option;
Query OK, 0 rows affected (0.00 sec)
mysql> Ctrl-C
4、配置wordpress
[root@antong lnmp1.7]# rm -rf /home/wwwroot/default/index.html
[root@antong src]# cp -rvf wordpress/* /home/wwwroot/default/
[root@antong src]# chmod 777 /home/wwwroot/default/*
[root@antong src]# cd /home/wwwroot/default/
[root@antong default]# cp wp-config-sample.php wp-config.php 
define( 'DB_NAME', 'wordpress' );    //数据库名称

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

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

/** MySQL hostname */
define( 'DB_HOST', '10.0.8.16' );    //本地IP地址

/** Database charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );     //默认的文字编码
5、浏览器访问IP地址

访问地址进行安装,查看效果

posted @ 2021-09-09 11:42  殇黯瞳  阅读(180)  评论(0编辑  收藏  举报