This document outlines the process of installing WordPress in a web development setting. The steps include setting up necessary software, configuring databases, and completing the installation of WordPress. Ensure that PHP, NGINX and MariaDB are installed before proceeding.
Step 1: Prepare Your VPS Environment
Ensure that PHP, NGINX and MariaDB are installed in your development environment.
Create a separate user from the root user for usage and run this command to switch users:
su - <your_user>
Run the curl command to install WP-CLI and use
chmod +x wp-cli.phar
to make the file executable.
curl -O http://githubusercontent.com/wp-cli/gh-pages/phar/wp-cli.phar
Step 2: Set Up WP-CLI and Configure Access
Move the WP-CLI file to an appropriate directory with
sudo mv wp-cli.phar /usr/local/bin/wp
to use as a
wp
command. Check the WP-CLI version by running
wp cli info
Log in to MariaDB using
sudo mysql -u root -p
to proceed with database creation. Enter the root password when prompted
Step 3: Set Up and Organize Your WordPress Database
Execute the SQL command
CREATE DATABASE <your_database>;
to create the database. These commands are case sensitive so be be sure to type them as-is.
Grant necessary privileges to the WordPress user with
GRANT ALL PRIVILEGES on <your_database>.* TO '<new_user>'@'localhost' IDENTIFIED BY '<strong_password>'
Step 4: Create and Configure the WordPress Database
After granting privileges, exit MariaDB by typing EXIT;
Navigate to the directory /var/www/html using
cd /var/www/html
Step 5: Prepare the WordPress Installation Directory
Install and download WP-Core using
wp core download --locale-en_[your-language]
Please note when downloading WP-Core make sure to adjust the language when installing e.g.
wp core download --locale-en_GB (English) or wp core download --locale-en_NL (Dutch)
If permission errors occur, identify your user by typing whoami and adjust permissions using
sudo chown -R <your_user> /var/www/html
for the necessary access.
Step 6: Download and Install WordPress Core Files
Once downloaded, execute
wp config create --dbname=<your_wp_database> --dbuser=<your_user> --dbpass=<strong_password> --dbhost=localhost
to set up the wp-config.php configuration file.
Step 7: Run the WordPress Configuration Command
Run Command:
wp core install --url="<your_domain_name>" --title="<your_site_title>" --admin_user="<your_user>" --admin_password="<another_strong_password>" --admin_email="<your_email>"
Run this command to install WordPress:
Step 8: Configure PHP-FPM for WordPress
Verify the PHP-FPM version you have installed, and update the server configuration file to match this version. Here, we're using PHP 8.3.
Check the status of PHP FastCGI Process Manager with
sudo systemctl status php8.3-fpm.
If it is not installed use
sudo apt install php8.3-fpm
to install it.
If the PHP-FPM service is not running, start it with
sudo systemctl start php8.3-fpm
Enable it to start on boot with
sudo systemctl enable php8.3-fpm
Step 9: Configure NGINX for WordPress
Configure NGINX by navigating to /etc/nginx/sites-available with
cd /etc/nginx/sites-available
Create a new file for your domain using the
sudo nano <your_domain_name>
command and add the server configuration.
Enter your root domain and fully qualified domain name in the server name section as
server_name <your_domain_name>;
Save the file after editing.
Step 10: Configure and Activate NGINX for WordPress
Update your system by typing:
sudo apt update
Step 11: Add Server Names to Your NGINX Configuration
Create a symbolic link from sites-available to sites-enabled running this command:
sudo ln -s /etc/nginx/sites-available/<your_domain_name> /etc/nginx/sites-enabled/
to ensure the configuration loads correctly.
Step 12: Test and Apply NGINX Changes with PHP-FPM
Test the NGINX configuration with
sudo nginx -t
to ensure it works properly.
Apply the new changes by restarting NGINX with systemctl restart nginx You may be prompted to input a password to restart nginx.service
Step 13: Set Up DNS Records for Your VPS Domain
Access your domain provider's settings to change DNS records, add an A record that points to your VPS.
Frequently Asked Questions
What software is required before installing WordPress on a VPS?
Ensure PHP, NGINX (or NGINX), MariaDB, a DBMS, and a web server are installed before starting.
How do I create a database for WordPress?
Log in to MariaDB, execute SQL commands to create a database, and grant user privileges with a password.
What should I do if I encounter permission errors during the installation?
Use the whoami command to identify your user and adjust permissions with chown for proper access.
How do I test and apply NGINX server configuration changes?
Use the command sudo nginx -t to test the NGINX configuration. If there are no errors, apply the changes by restarting NGINX with this command:
sudo systemctl restart nginx
How can I connect my domain to the WordPress VPS?
Update DNS settings with your domain provider by adding an A record pointing to your VPS IP address.