VPSs are a logical step up from shared hosting, but the name – virtual private server – makes them sound hard to grasp, especially considering WordPress installation in this context. However, installing WordPress on a VPS server is easier done than said.
We’ll explain how to do so manually in this guide:
1. Connect to the VPS via a secure shell
To install WordPress, you need your VPS root password to run the respective commands and Putty or another Secure Shell (SSH) client. Install the SSH and open the app. You’ll see a section where you can specify your target destination.
Enter your virtual private server’s IP address in the IP address or hostname field. The Port option should be set to 22. Under Connection type, choose SSH, then click Open. A popup window will appear, asking what user you want to log in as. Enter “root” followed by your password when asked.
If you did all this correctly, you should see the name of your VPS pop up.
2. Install the software to run WP
You need a database and an HTTP server to run WordPress. The content management system uses the language PHP, so you need support for that as well. It’s recommended that you install the latest version. You also need Apache and MariaDB or the equivalent.
You need a single command to do all of this, which is “sudo yum install httpd mariadb mariadb-server php php-common php-mysql php-gd php-xml php-mbstring php-mcrypt php-xmlrpc unzip wget -y“. It tells the VPS to download and install all the files needed. The process will take very little time if you have fast VPS hosting.
You can enter more commands once everything’s ready. Initialize the software and instruct the server to reboot the software every time. The next step is to configure your database.
3. Configure and create a WordPress database
Secure MariaDB to stop users from gaining remote access to it before you proceed to create a database. To do this, enter “sudo mysql_secure_installation“. Press enter when MariaDB asks for its root user password (leave it blank.) You can set a new root password after that. For the remaining four options, press Y, including for the third one, which prevents remote logins.
Use the command mysql -u root -p to log into your MariaDB account. You’ll be asked for the new root password you just set.
4. Install WordPress
The last step is to download, install, and configure WordPress now that you’ve set up your infrastructure. Get the latest version of the content management system, extract the files, and copy them to your root directory.
It’s great you’ve made it this far! It’s important not to give up in the middle of the process. You need two simple commands to create a folder and assign permission. The folder is for files uploaded for your installation, and the permissions involve the required files and folders. The commands are sudo chown -R apache:apache /var/www/html/ and sudo mkdir /var/www/html/wp-content/uploads.
5. Configure WordPress
The last step is to rename the system file wp-config-sample.php and configure it to connect to your database. The last command will direct the nano editor to open the file within the command line. Enter the same data as in step three in the fields. The file is navigated using the arrows on the keyboard.
After you enter that data, type CTRL+O and CTRL+X. CTRL+O saves the changes made to the file, and CTRL+X shuts down nano. The final stage of the process involves configuring the server to enable HTTP and HTTPS connections.