Most guides don’t even have a list of commands, and instead, they tell you just the prerequisites *cough* *cough* how2shout *cough* *cough*. So, in this post, you will know how to fully install and configure WordPress. It’s only fitting that the first post is a post on how to install the software that is being used here, so here you go.
You will need a Debian (or a derivative) VM with PHP, MySQL, and Apache installed. Don’t worry, as there will be instructions for those too. You will also need SSH keys and an SSH/FTP client. I recommend Termius, but if you can’t install it because of using a Chromebook, I recommend Sshwifty, a web-based SSH/Telnet client. This doesn’t have FTP, but you can use Termius’ FTP portion on mobile.
You will also need a PaaS provider unless you are hosting it on your server. Oracle Cloud has the most generous free trial so I will be using Oracle Cloud for this, but if you are using another PaaS provider like Google Cloud, AWS, Vultr, or DigitalOcean, the process is still the same except instance creation.
The first thing you want to do is create your instance. You can do this by opening the hamburger menu then selecting Compute in the left area. Select Instances, then “Create instance”. Choose a name, I recommend “wordpress”, then select Edit near “Placement”. At the top of the area, there should be a purple box with the following text.
You can create Ampere A1 compute instances in any availability domain. You can create instances using the VM.Standard.E2.1.Micro shape in the (availability domain) availability domain.
If you want to save the high-powered Ampere instance for an actual server, select the availability domain stated above, then scroll down and press Edit near “Image and shape”. Press “Change image”, choose “Canonical Ubuntu” and press “Select image”.
For the shape, if you decided to select the Ampere A1 instance, press “Change shape”, then the instance is the only one listed under the Ampere category. Select it, then modify the specs to your liking. If you use fewer specs, you can create more instances, but if you use more, they are better. Web servers don’t need too much, so I recommend 4 vCPU cores and 8GB memory. Once you selected your shape, press “Select shape” to close the menu, then press Edit near “Networking”.
Choosing a subnet name isn’t very important, but you do want to make sure this instance is on its own as you have to open other ingress rules. You can pick a custom name, but it doesn’t matter.
Lastly, download the public and private SSH keys. You can not find these again, so you must download them now. Once done, press Create at the bottom and wait a bit for the instance to create.
If you are using Sshwifty, you have to wait for the instance to finish creating and power on to connect. Sshwifty tries to connect first, then asks for authentication as opposed to Termius which saves the info then connects with authentication. So, this part will assume you are using Termius.
First, open Settings and go to Identities. Create a new one with the username “ubuntu” and no password. Click Keys, click Add New, now drag and drop the .key file you just downloaded into the Termius window, then click the newly created key.
Now, go back to your instance. Copy the public IP, then create a new connection and paste it in. Leave all settings to default, then select your new identity, then go back and connect to the instance.
Click your Subnet Name in your Cloud Dashboard, then go to the default rules. Add a new CIDN rule with the IP range as 0.0.0.0/0, set the protocol to TCP, and set the source and destination port ranges to All. Save that, then go to your instance and add the IPTable rule with
sudo iptables -I INPUT 6 -m state --state NEW -p tcp --dport 80 -j ACCEPT, then save it with
sudo netfilter-persistent save.
First, you want to update your package list, then you will have to install Apache and enable it. Use the 3 commands below then connect to your server in a browser.
sudo apt update sudo apt -y install apache2 sudo systemctl restart apache2
Now, connect to your server in a browser. Just type your IP address, then press Enter, and you should see your default Apache page. It should have a header saying “It works!”.
To add yourself to the www-data group, run the command
sudo adduser ubuntu www-data.
You don’t need to update your package list now, so just run
sudo apt -y install php to install PHP and
sudo apt -y install php-mysql php-curl php-gd php-zip php-xml for other goodies. Now, verify the installation with
php -v and restart Apache with
sudo systemctl restart apache2. You can add a test file with PHP version info if you want, but it’s not necessary.
sudo nano /var/www/html/info.php to open a new file called info.php in your website directory. You do not own the directory, so you need to do run all commands as root for everything you do. Do NOT change the owner of the folder as it will break WordPress, and if you do, change it back to www-data:www-data using
sudo chown -R www-data:www-data /var/www/html. Instead, add yourself to the www-data group using
sudo adduser ubuntu www-data. Add the following lines to it, then open it by going to <IP>/info.php.
<?php phpinfo(); ?>
Install MySQL using
sudo apt -y install mysql-server. Wait for it to finish, then set it up using
sudo mysql_secure_installation. To connect to MySQL by just running
mysql as opposed to
sudo mysql, press N at the next step. Type a password and confirm it, then continue. Otherwise, press Y, select a password security level, create a password, then press Y for the remaining options. Log in using
sudo mysql for the first run, then run these commands.
CREATE USER 'ubuntu'@'localhost' IDENTIFIED BY ''; GRANT ALL PRIVILEGES ON *.* TO 'ubuntu'@'localhost'; CREATE DATABASE wordpress; FLUSH PRIVILEGES; exit
or if you chose a password requirement:
CREATE USER 'ubuntu'@'localhost' IDENTIFIED BY '<password>'; GRANT ALL PRIVILEGES ON *.* TO 'ubuntu'@'localhost'; CREATE DATABASE wordpress; FLUSH PRIVILEGES exit
Install, unzip, and move the WordPress files using these commands.
wget https://wordpress.org/latest.tar.gz tar xvfz <download-file-name>.gz cp -R /home/ubuntu/wordpress/* /var/www/html cd /var/www/html mv index.html index.html.bk mv wp-config-sample.php wp-config.php nano wp-config.php
In the new NANO window, fill in the new details for the MySQL database. Save it using ^X -> Y -> Enter. If nothing was copied, go back to your user folder (/home/ubuntu) and run the third through seventh command with sudo leading the command.
Connect to your instance by going to the IP in a browser tab, and finish setup there. You now have a WordPress installation, but there is a couple more things you need to do.
First, you will need a domain. Get one from a registrar like Namecheap or GoDaddy. This part is completely optional, but create a Cloudflare account and set up the nameservers. Not needed, but nice. Then, add an A record with the name as * and the content as your IP address. Wait 1-2 hours, and once it redirects to your WordPress site, go to your settings and change the WordPress domain (not the Site Domain) from your IP address to your custom domain.
It can be decently annoying to set up the WordPress app with your IP, but Jetpack makes it easier. Install and set up Jetpack, then link it to your WordPress.com account. If you don’t have one, you probably should for features like Gravatar and Akismet. Once it’s linked, open the mobile app and sign in via your WordPress.com account. You can manage most things here, but not everything.
That’s it! You have a working WordPress installation with your own domain managable anywhere! If this was helpful, let me know, or if you need help with this, tell me as well. There will be new posts daily, so stay tuned for that!