After the first blog, let’s describe how to build a WordPress site.
As you guys know, we usually choose a delicate or neat theme to build a WordPress site. So am I, I chose the theme of “Minimal Lite” which suits my taste of the beautiful thing. And It’s so great enough that I think that even though I have a great programming skill, I don’t need to change the code of the theme a lot to fit my taste.
In spite of having some shortage of programming skill, I want to build a blog to record my life as I said on the introduction of the author info. Cut the crap, let’s start to see how I build my blog site. I hope this experience will be helpful to you.
Step one: Basic configuration
I chose to base the LAMP construction to establish the site on my 2G server. And I have found some reference articles to help me build.
the basic configuration of the server:
- 2G RAM
- 1 CPU
- 50G storages
- OS ubuntu 16.04 LTS
- Mysql 5.7.25
Step two: Server establishment
（-y is mean that when you install the components or software, there will be a hint whether you want to install or not. Choose to use by your case.）
1.system upgrade and update the source
sudo apt-get update sudo apt-get upgrade
apt-get install apache2 –y
(If you can access the “it works” page, It means the installation of the apache2 is OK)
3.install the PHP component
You can see there is a php7.0 in apt-get, so we can install the php7.0 directly.
sudo apt-get install php7.0 -y
And then to install a component to associate the PHP and apache:
sudo apt-get install libapache2-mod-php7.0
4.install the MySQL database.
sudo apt-get install mysql-server -y
Then install a component to associate the PHP and MySQL.
sudo apt-get install php7.0-mysql
We can install the PHPMyAdmin to easily manage the MySQL database.
(p.s. There will be a pop-up window appear that you will need to choose the apache2 and then input the root password when you install the PHPMyAdmin using the apt-get. So It’s necessary to install MySQL database in advance before you get into this step)
sudo apt-get install phpmyadmin –y
6.setup the soft connection below /var/www/html
(You can access all the files of /www directly when you set up the soft connection to associate the MySQL and PHPMyAdmin files.)
sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin
7.restart MySQL and apache2
sudo service mysql restart sudo systemctl restart apache2.service
8.create a database for the WordPress and add a new user for it.
Use your root account to enter the database
mysql -u root -p
And then create a new database and user.
mysql>CREATE DATABASE wordpress; mysql>CREATE USER wordpressuser; mysql>SET PASSWORD FOR wordpressuser= PASSWORD("password123");
At last, grant database operation permissions for new users
mysql>GRANT ALL PRIVILEGES ON wordpress.* TO wordpress user IDENTIFIED BY"password123";
mysql>FLUSH PRIVILEGES; mysql>exit;
Ok, the LAMP establishment is done, and it almost will be Ok in a one-time. But well I’m not on the almost cases. I have encountered a lot of issues. And I will list some of the issues I have met on my next blog.
Now let’s move to step three: Wordpress site-building.
1.upload the WordPress files.
In most of the cases, we usually download the WordPress installation through the terminal. But I suggest uploading the code repository decompressed from the tar file.
2.move the repository to default root folder.
Wherever you upload the repository, just run the command below to move the repository to the apache2 default root folder which we can access your public IP address to open the WordPress index page.
sudo mv wordpress/* /var/www/html/
3.modify the permissions of HTML.
We need to give Higher permission to HTML for modifying WordPress repository easily.
sudo chmod -R 777 /var/www/html/
4.Specify apache to index.html
sudo mv /var/www/html/index.html /var/www/html/index~.html
5.Restart the Apache service
sudo systemctl restart apache2.service
Now, the installation of the WordPress site has already been done. It will be OK in most of the cases. You can access the WordPress index page through inputting the public IP address and use your new MySQL user and database to set up your WordPress site online. At last, have a look at my first WordPress version page. 👇