Deploying a WordPress Site on Your VPS
WordPress is a widely-used platform for creating websites, blogs, and online stores. This guide will take you through each step to install WordPress on your VPS, from setting up a web server to finalizing your site’s installation.
Step 1: Access Your VPS via SSH
- Open an SSH client (e.g., Terminal for macOS/Linux or PuTTY for Windows).
- Connect to your VPS:
- Press Enter, then input your VPS password when prompted.
Step 2: Update System Packages
Before installing WordPress, make sure your server's packages are up to date:
Step 3: Install a Web Server (Apache or Nginx)
You’ll need a web server to host your WordPress site.
To Install Apache:
Start and enable Apache to run at startup:
To Install Nginx:
Start and enable Nginx to run at startup:
Step 4: Install PHP and Necessary Extensions
WordPress requires PHP, so install PHP along with common extensions:
Step 5: Install a Database Server (MySQL or MariaDB)
To Install MySQL:
Run MySQL’s secure installation script:
Step 5A: Create a Database and User for WordPress
- Log into MySQL:
- Create a new database for WordPress:
- Create a user and grant permissions:
Step 6: Download WordPress
- Navigate to the web directory (Apache:
/var/www/html
or Nginx:/usr/share/nginx/html
): - Download the latest WordPress version:
- Extract the downloaded file:
- Move WordPress files to the root web directory:
- Remove unnecessary files:
Step 7: Configure WordPress
-
Copy the sample WordPress configuration file:
-
Open the
wp-config.php
file to edit: -
Find the following lines and update them with your database details:
-
Save and exit the editor (in Nano, press
CTRL+X
, thenY
to confirm, andEnter
).
Step 8: Set File Permissions
Set correct permissions for WordPress files to ensure they’re accessible:
Step 9: Complete the Installation in Your Web Browser
- Open your web browser and navigate to your VPS IP address (e.g.,
http://your-server-ip
). - You’ll be guided through the WordPress setup. Select your language, create an admin account, and enter your site information.
- After completing the steps, click Install WordPress.
Step 10: Log In to WordPress
Once installation is complete, log into your WordPress dashboard by visiting:
Use the credentials you created during the setup to log in.
Your WordPress site is now live on your VPS! You can start adding content, install plugins, and customize the appearance of your site from the WordPress dashboard.