These days, an idea produced to build a website for our research echelon and party branch. Actually, it is because my friend want to build a website for his girl friend to commemorate their love for a hundred days and these works should be finished by himself, so I write this article to instruct him to finish it.

These works contain Four parts:

  1. Deploy the LAMP environment
  2. Install the WordPress software package
  3. Set domain name resolution
  4. Build a private network disk

Deploy the LAMP environment

You should learn how to use SSH protocol to access cloud server such as Aliyun, Huawei Cloud,  Tencent Cloud and Baidu Cloud. You can download software ' putty ' to achieve server access. I have upload it and you can download it: putty.exe(Password:LmLbw).

You need type your ip address in ' Host Name (or IP address) ', and click open tab. Here, you can watch a 'blackborad', type your user name and password e.g. name: root passwd: toor (Here I will simply give an example.)

Now you can install your LAMP environment (Linux, Apache, MariaDB, and PHP)on your server.

  • Install Apache

yum -y install httpd    # install Apache

systemctl start httpd.service    # open apache service

systemctl enable httpd.service    # set boot

You should open your 80 port in your server's control panel (Security group rules section). And add a permission in firewall. If your server's firewall is stoped in default, you can skip this step:

firewall-cmd --permanent --zone=public --add-service=http

firewall-cmd --permanent --zone=public --add-service=https

firewall-cmd --reload

Enter the server's ip address in your browser and you will find a page with 'Testing 123...' , which means your success.

  • Install PHP

yum -y install php    # install PHP

systemctl restart httpd.service    # restart apache

Here you can write a text to test php:

nano /var/www/html/info.php    

# if you don't have nano you can type ' yum install nano '.

<?php phpinfo(); ?>    # type this text in info.php

If you have finished it, you can use 'Ctrl + O' and 'Enter'to save it.  Type 'Ctrl + X' to exit nano. You will find some information about PHP when you type ' yourIP/info.php ' in your broswer's Address Bar and it means that php have been installed.

  • Intsall MariaDB

yum -y install mariadb mariadb-server    # install mariadb

systemctl start mariadb.service    # start mariadb

systemctl enable mariadb.service    # set boot

systemctl restart httpd.service    # restart apache

mysql_secure_installation    #  tpye 'Enter' to next step and type 'y' to the end

mysql -u root -p    # login MariaDB to create a database

create database wordpress;    # create a database for wordpress

Establish a relationship between PHP and MariaDB

yum -y install php-mysql    # establish a relationship

Reatart apache

systemctl restart httpd.service

Install the WordPress software package

Install wget package in your server:

yum -y install wget

Download wordpress package:

wget https://cn.wordpress.org/latest-zh_CN.zip

Extract this package:

unzip latest-zh_CN.zip

If you don't have unzip package, you can install it:

yum install unzip

Copy all the files under wordprss to the root directory under the apache server:

cp -r wordpress/* /var/www/html/

Configure WordPress configuration file:

cd /var/www/html/

cp wp-config-sample.php wp-config.php

nano wp-config.php

Change DB_NAME, DB_USER, DB_PASSWORD to what you configured before:

define('DB_NAME', 'wordpress');

define('DB_USER', 'root');

define('DB_PASSWORD', 'your password');

define('DB_HOST', 'localhost');

define('DB_CHARSET', 'utf8');

Open your browser, and type your IP in address bar. Now, you can configure your wordpress. If you need to set up FTP during the process of installing the theme and plugin, you can configure it like this.

Enter the wordpress root directory:

cd /var/www/html

Find a wp-config.php in the wordpress root directory and add the following code:

define("FS_METHOD","direct");

define("FS_CHMOD_DIR", 0777);

define("FS_CHMOD_FILE", 0777);

Set directory permissions:

chmod -R 777 /var/www/html

Set domain name resolution

Login cloud resolution DNS console.Go to the domain name resolution page, select the domain name, and enter the resolution settings page.Click the Add Record button. Details can be found here (record A).

How to add records:

Host record: Generally refers to the prefix of the subdomain (if you need to create a subdomain of www.lixin.fun, the host record enters "www"; if you need to implement lixin.fun, the host record enters "@")

Record value: record value is IP address, fill in IPv4 address

Click OK to access the domain name. There will be something abnormal after a period of time that you can't access your website. It means you should apply for an ICP number for this domain name.Details can be found here.

Build a private network disk

cd  /var/www/html

mkdir cloud

wget http://static.kodcloud.com/update/download/kodexplorer4.40.zip

unzip kodexplorer4.40.zip

chmod -Rf 777 ./*

You can access your private network disk in the following way:

http://your domain name/cloud/

A tag which links this URL can be set in your Home page maually. It will help you access this network disk easily.

Finally, I want to say that I really envy them.

Last modified: 2020年2月14日

Comments

Great benefits

lihao进行回复 取消回复

Your email address will not be published.