1.启动实例
(1).选择Ubuntu Server 18.04 LTS
(2).选择t2.micro
(3).下一步
(4).配置合适大小的硬盘
(5).下一步
(6).配置HTTP端口号 #只安装HTTP,没有安装HTTPS
(7).选择或创建密钥,启动实例
2.实例创建完成后,使用ssh登录实例
密钥权限设置为400
使用ssh登录实例:
3.安装WordPress
安装WordPress所需环境:apache2,php7.2,mysql-server,php-mysql
sudo -i apt-get update apt-get install php7.2 mysql-server php-mysql -y #安装php7.2时自动安装apache2
2.使用MySQL客户端创建WordPress数据库和一个用户
$ mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5340 to server version: 3.23.54 Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> CREATE DATABASE 数据库名; Query OK, 1 row affected (0.00 sec) mysql> GRANT ALL PRIVILEGES ON 数据库名.* TO "用户名"@"localhost" -> IDENTIFIED BY "密码"; Query OK, 0 rows affected (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.01 sec) mysql> EXIT Bye $ ##设置自己的数据库名,用户名和密码
3.设置wp-config.php文件
wget https://cn.wordpress.org/wordpress-4.9.4-zh_CN.tar.gz #下载中文版WordPress tar -xzvf wordpress-4.9.4-zh_CN.tar.gz cd wordpress mv wp-config-sample.php wp-config.php #将wp-config-sample.php重命名为wp-config.php
vim wp-config.php ------------------------------------------------------------------------------------------- 把database_name_here,username_here,password_here分别替换成自己设置的数据库,用户名和密码。 // ** MySQL 设置 - 具体信息来自您正在使用的主机 ** // /** WordPress数据库的名称 */ define('DB_NAME', 'database_name_here'); /** MySQL数据库用户名 */ define('DB_USER', 'username_here'); /** MySQL数据库密码 */ define('DB_PASSWORD', 'password_here'); -------------------------------------------------------------------------------------------- 保存退出 wp-config.php
4.把WordPress内文件复制到默认网站根目录
cp -Rv /root/wordpress/* /var/www/html/ rm /var/www/html/index.thml chown -R www-data:www-data /var/www/ systemctl restart apache2
使用浏览器访问 http://替换成你实例的IPv4公有IP或你设置的域名/wp-admin/install.php
成功则如下图:
转载于:https://blog.51cto.com/13662945/2314452