Ali cloud using ECS to rapidly deploy WordPress blog system

Today on Ali cloud has deployed a Lamp ECS system, build a WordPress site, the operation recorded script listed in the text can be directly applied.

Ado direct start, ECS can purchase cloud services click Ali cloud host Elastic Compute Cloud ECS new discount

 

Install Nginx

Log in elastic cloud servers.

Execute the following command to download the corresponding version of the current system Nginx package.

wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

 

Execute the following command to establish the Nginx yum repository.

rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm

 

Execute the following command to install Nginx.

yum -y install nginx

 

Execute the following command to start Nginx and set the boot.

systemctl start nginx
systemctl enable nginx

 

Using the browser to access the " HTTP: // server IP address", following page, indicating that the installation was successful Nginx

Installing MySQL

In turn execute the following command to install MySQL.

rpm -Uvh http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

yum -y install mysql-community-server

 

In turn execute the following command to start the MySQL service and set the boot from the start.
systemctl start mysqld
systemctl enable mysqld

 

Execute the following command to get the root user password is automatically set when installing MySQL.

grep 'temporary password' /var/log/mysqld.log

 

Echo similar information as follows.

2018-08-29T07:27:37.541944Z 1 [Note] A temporary password is generated for root@localhost: 2YY?3uHUA?Ys

 

Execute the following command, and follow the prompts echoing, reinforcing MySQL.
mysql_secure_installation

 

Then follow the prompts:

Securing the MySQL server deployment.

Password the Enter for User the root: # automatically set the root user password input MySQL installed acquired in the previous step
The existing password for the user account root has expired. Please set a new password.

New password: # set a new root password

Re -ENTER new new password: # Enter the password again
The 'validate_password' plugin is installed on the server.
The subsequent steps will run with the existing configuration of the plugin.
Using existing password for root.

At The strength of password Estimated: 100 
Change at The password for root ((the y-Press | the Y-? For Yes, the any OTHER Key for No): N # whether to change the root user password, enter N

 ... skipping.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Anonymous the Users the Remove (the y-Press | Y? For Yes, the any OTHER Key for No): Y # Delete the anonymous user, enter Y
Success.

Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.

The Login remotely root Disallow (the y-Press | Y? For Yes, the any OTHER Key for No): Y # prohibit root remote login, enter Y
Success.

By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.

Access to the Test Database and the Remove IT (the y-Press | the Y-? For Yes, the any OTHER Key for No): # Delete the Y-access library and its test, enter the Y-
  - Dropping the Test Database ...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Now the Tables Privilege Reload (the y-Press | Y? For Yes, the any OTHER Key for No): Y # whether to reload the grant tables, enter Y
Success.

All done!

 

Installing PHP

In turn execute the following command to install PHP 7 and some of the required PHP extension.

rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum -y install php70w-tidy php70w-common php70w-devel php70w-pdo php70w-mysql php70w-gd php70w-ldap php70w-mbstring php70w-mcrypt php70w-fpm

 

Execute the following command to verify that the installed version of PHP.
php -v

 

Execute the following command to start the service and set PHP boot from the start.

systemctl start php-fpm
systemctl enable php-fpm

 

Nginx configuration file to modify the PHP support

Execute the following command to open the configuration file "default.conf".

vim /etc/nginx/conf.d/default.conf

Press i to enter edit mode.

Modify open "default.conf" file.
Add the home php formats supported by the main page format, as follows:

 location / {
        root   /usr/share/nginx/html;
        index index.php index.html index.htm;
    }

 

Cancel the following notes and set to the default font bold portion of Nginx path, as shown below:

 location ~ \.php$ {
        root           html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
        include        fastcgi_params;
    }

 

Press Esc to exit edit mode, and enter: After wq save and exit.
Execute the following command, nginx reload configuration file.

service nginx reload

 

Browser to access test

Create a "info.php" test page in / usr / share / nginx / html directory.
Execute the following command to create and open "info.php" test file.

vim /usr/share/nginx/html/info.php

 

Press i to enter edit mode.

Modify open "info.php" file, write the following file.

<?php
 phpinfo();
?>

 

Press Esc to exit edit mode, and enter: After wq save and exit.
Using the browser to access the " HTTP: // server IP address /info.php", following page, indicating that environment to build success.

Create a database

Execute the following command and follow the prompts for the root MySQL, and MySQL to log in to the command line.

mysql -u root -p

 

Execute the following command to create a new database.

CREATE DATABASE wordpress;

 

Which, "wordpress" is the database name, you can set your own.

Execute the following command to create the database and assign user full access to the database for the user.

GRANT ALL ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY 'PASSWORD123';

 

Which, "wordpressuser" for the database user name, "PASSWORD123" corresponding password for the account, you can set your own.

Execute the following command to exit the MySQL command line.

exit

 

Install WordPress

Get WordPress WordPress package from the official website and upload it to / usr / share / nginx / html directory.
Command-Line Reference Download

wget http://wordpress.org/latest.tar.gz

由于WordPress官方网站被攻击,导致国内用户访问WordPress网站的时候会提示429 Too Many Requests错误,
所以使用国内服务器的朋友很难从官网下载新版版本的WordPress安装包,这里给大家分享一下从官网下载下来的新版版的WordPress安装文件,有需要的可以自己下载了。

可以使用SCP的方式上传,

scp /Users/bingyue/Downloads/wordpress-5.3.2.tar.gz [email protected]:/opt  

 

后续操作软件包以“wordpress-5.3.2-zh_CN.tar.gz”为例。

执行以下命令,解压缩软件包。

tar -xvf wordpress-5.3.2-zh_CN.tar.gz

 

解压后生成一个“wordpress”的文件夹。

执行以下命令,设置解压后的文件权限。

chmod -R 777 wordpress

 

浏览器访问“http://服务器IP地址/wordpress”进入安装向导。

 

接下来使用配置好的MySQL进行创建即可。

 

 

Guess you like

Origin www.cnblogs.com/binyue/p/12160198.html