Use EC2, VPC build a blog system detailed Step-4

4. Install WordPress

step

4.1 Create a database users and database installation WordPress

[ec2-user@ip-172-15-1-131 ~]$ tar -xzf latest.tar.gz -C /home/ec2-user
[ec2-user@ip-172-15-1-131 ~]$ ls
latest.tar.gz wordpress
[ec2-user@ip-172-15-1-131 ~]$ sudo systemctl start mariadb
[ec2-user@ip-172-15-1-131 ~]$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 188
Server version: 10.2.10-MariaDB MariaDB Server

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

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

MariaDB [(none)]> CREATE USER 'XXXXXXXX'@'localhost' IDENTIFIED BY 'XXXXXXXXX';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> CREATE DATABASE `wordpress-db`;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON `wordpress-db`.* TO "XXXXXXXX"@"localhost";
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit
Bye
[ec2-user@ip-172-15-1-131 ~]$

 

4.2 Creating and Editing wp-config.php file

We were created in the previous step wordpress database, database user, password condemnation.

[ec2-user@ip-172-15-1-131 ~]$ cp wordpress/wp-config-sample.php wordpress/wp-config.php
[ec2-user@ip-172-15-1-131 ~]$ vim wordpress/wp-config.php

查找名为 Authentication Unique Keys and Salts 的一节。这些 KEY 和 SALT 值为 WordPress 用户存储在其本地计算机上的浏览器 Cookie 提供了加密层。总而言之,添加长的随机值将使您的站点更安全。访问 https://api.wordpress.org/secret-key/1.1/salt/ 随机生成一组密钥值,将这些密钥值复制并粘贴到 wp-config.php 文件中。

类似

4.3 将 WordPress 文件安装到 Apache 文档根目录下

现在,已解压了安装文件夹、创建了 MySQL 数据库和用户并自定义了 WordPress 配置文件,也就准备好将安装文件复制到 Web 服务器文档根目录,以便可以运行安装脚本完成安装。这些文件的位置取决于希望 WordPress 博客位于 Web 服务器的实际根目录还是位于根目录下的某个子目录或文件夹 

如果希望 WordPress 在文档根目录下运行,请复制 wordpress 安装目录的内容 (但不包括目录本身),如下所示:

[ec2-user@ip-172-15-1-131 ~]$ cp -r wordpress/* /var/www/html/
如果希望 WordPress 在文档根目录下的其他目录中运行,请先创建该目录,然后将文件复制到其中。在此示例中,WordPress 将从目录 blog 运行:

[ec2-user@ip-172-15-1-131 ~]$ mkdir /var/www/html/blog
[ec2-user@ip-172-15-1-131 ~]$ cp -r wordpress/* /var/www/html/blog/

WordPress permalink need to use Apache .htaccess file to work properly, but by default these files is disabled on the Amazon Linux. Use this procedure to allow all cover the Apache document root directory.

 Click here to Expand ...

[ec2-user@ip-172-15-1-131 ~]$ sudo vim /etc/httpd/conf/httpd.conf


Apache Web server 4.5 fix file permissions, run the install script WordPress

[ec2-user@ip-172-15-1-131 ~]$ sudo vim /etc/httpd/conf/httpd.conf
[ec2-user@ip-172-15-1-131 ~]$ sudo chown -R apache /var/www
[ec2-user@ip-172-15-1-131 ~]$ sudo chgrp -R apache /var/www
[ec2-user@ip-172-15-1-131 ~]$ sudo chmod 2775 /var/www
[ec2-user@ip-172-15-1-131 ~]$ find /var/www -type d -exec sudo chmod 2775 {} \;
[ec2-user@ip-172-15-1-131 ~]$ sudo systemctl restart httpd
[ec2-user@ip-172-15-1-131 ~]$

[ec2-user@ip-172-15-1-131 ~]$ sudo systemctl enable httpd && sudo systemctl enable mariadb

5. build WordPress blog outcome

 

 

 

Guess you like

Origin www.cnblogs.com/gunxiaoshi/p/11735978.html