A personal blog can let others know more about you on the Internet, and having a personal blog is a cool thing, isn’t it? WordPress is open source software you can use to create a beautiful website, blog, or app. Now I’ll tell you how to build your personal blog by WordPress on Ubuntu.
First, you need to have your own VPS
Maybe you can use the service provided by GoDaddy, web.com, bluehost and so on, they can help you install all the environment which is necessary to run WordPress. If you just want to have your personal blog, you can pay for the service and use it easily. But if you have a server, you can do many things in your server, such as build your own file hosting services such as Nextcloud and owncloud, build your own mail server, and you can even build a Counter Strike Global Offensive Server! By the way, it’s the best way to learn Linux by practice.
What is VPS? VPS means “Virtual Private Server”, which is a virtual server that the user perceives as a private server even though it is installed on a physical computer running multiple operating systems. There are many products we can choose, such as AWS, Azure, Google Cloud, Linode, Vultr and so on. I choose the vultr because the VPS in vultr is cheap and good. You can have unlimited free snapshots in Vultr, which others don’t have.If you use the vultr, you can use my refer link to get $10 free credit.
For a personal blog,I think choose the “$5/month” is OK. You can see the video to choose the server size and OS, which shows how I choose them.
Manage your VPS
After you deploy a server, maybe you’ll think how to manage it. Don’t worry, let me tell you a useful tool — Xshell.
Xshell is a software created by NetSarang, which is the industry’s most powerful SSH client. It can be used to manage your personal servers, and what’s the most important is that the Xshell is free for home use and school use. You just need to write down your name and E-mail address, and then you can Download it by the link send to your E-mail.
You can get Xshelll by: https://www.netsarang.com/en/free-for-home-school/
After you install the Xshell, open it and check where the arrow points in the picture.
Then you will see it:
Log in your Vultr account, and you will see the servers you rent, and you can see the ip for the server(e.g: 18.104.22.168). Copy it to the “Host” Textbox in Xshell.
Then click the “Authentication”, and you’ll see the User name textbox and Password textbox.
You need to input “root”(no “”) in the “User Name” textbox, and then return to the browser you open the Vultr, click the server you rent, and you will see it:
Copy the password to the “Password” textbox in vultr.
After do that, you can connect to your server now!
Second, you need to have a domain name
You can register a domain name in many domain registrars such as GoDaddy, Namecheap, Hosting Speed and so on. I register my domain name in GoDaddy, and I’ll use a video to show you how to add DNS records in GoDaddy to point your domain name to your server’s ip.
You can use “cmd” in Windows or “Terminal” in Linux to check whether the domain name point to your server’s ip.
run this command
Third, you need to install the environment which is necessary to run WordPress
There are two environment we often use: LAMP(Linux+Apache+MySQL+PHP) and LNMP(Linux+Nginx+MySQL+PHP)
I choose the LAMP, and let me tell you how to install it to your server.
Open Xshell, connect to your server. First you can update the software in your server to the new version.
run these commands below:(the first is used to update Ubuntu system, and the second is used to update the software in your server)
apt-get update apt-get upgrade
Then install the Apache, ftp server, MySQL database and php 7.2:
apt-get install apache2 #install the Apache apt-get install ftpd #install the ftp server apt-get install mysql-server #install the MySQL database apt-get install php libapache2-mod-php php-mysql #install PHP7.2 and the modules necessary systemctl restart apache2.service #restart the Apache service
(Attention: it’s “apache2”, not “apache”)
The WordPress need ftp server to upload some files such as picture, video and so on, so we need ftp server.
Apache web server is the most popular server in use today and WordPress requires a web server, after you install it, you can open your browser and input your server’s ip. If you can see the example page created by Apache, congratulation, you are successful.
MySQL is a database server which the WordPress need. You can get the administrator account and password in /etc/mysql/debian.cnf.
You can run this command to see it:
In order to manage your database easily, you can install phpMyAdmin. You can run these commands to install it.
cd /var/www/html wget https://files.phpmyadmin.net/phpMyAdmin/4.8.5/phpMyAdmin-4.8.5-all-languages.zip unzip phpMyAdmin-4.8.5-all-languages.zip service apache2 restart
Then you can visit http://(your domain)/phpMyAdmin-4.8.5-all-languages to use phpMyAdmin to manage your database. (use your administrator account to log in.)
WordPress is a blog system use php, so php environment is very important. You need to install PHP and related PHP modules on the new server in order to run WordPress in your server.
Finally, we start to install the WordPress
We have installed all the necessary things to run WordPress, then we start to install WordPress.
First, build a blank WordPress database
Log in the phpMyAdmin, click the “Databases”, input the database name, then click the “create” button. OK, you create a blank database, which the WordPress will use.
Second, download WordPress from wordpress.org
Run these command to download and install the WordPress:
cd /var/www/html wget https://wordpress.org/latest.zip unzip wordpress-5.0.3.zip #(file name, now is wordpress-5.0.3.zip)
After you download it, you need to change the owner and modify about all the files in /wordpress, it will help you to use WordPress conveniently and safely
Run these commands to change the owner and modify
chown -R www-data:www-data /var/www/html/wordpress/ chmod -R 755 /var/www/html/wordpress/
Then you can visit http://(your domain name)/wordpress to finish the famous “5 minutes” WordPress installation.