- 1. What you need before you install WordPress on VPS CentOS
- 1.1. Preparing your VPS
- 1.2. Installing the LAMP (or LEMP) stack
- 1.3. Domain, SSH, and Firewall
- 2. How to install WordPress on VPS CentOS
- 2.1. Install and configure the web server, PHP, and database
- 2.2. Download and configure WordPress files
- 2.3. Run the WordPress installation wizard and choose theme
- 2.4. Post-installation steps: tuning and security
- 3. Common issues when you install WordPress on VPS CentOS and best practices
- 3.1. Database connection error
- 3.2. Permission or ownership issues
- 3.3. Slow loading
- 3.4. SELinux/Firewall misconfiguration
- 3.5. Updates and backups
- 4. Q&A – Common Questions About How to Install WordPress on VPS CentOS
- 4.1. Do I need to use Apache to install WordPress on VPS CentOS?
- 4.2. Can I install the free theme Rabbit Lite later after installing WordPress on VPS CentOS?
- 4.3. What VPS resources (CPU/RAM) should I choose when I plan to install WordPress on VPS CentOS?
- 5. Conclusion
You’ve opted for a VPS and chosen CentOS as your operating system because you want full control, performance, and flexibility.
But setting up your own environment for WordPress on a VPS can feel overwhelming — choosing and configuring Apache or Nginx, PHP, databases, permissions, security, and theme optimization.
If you’re here, you want to install WordPress on VPS CentOS without missing a step. By the end of this complete guide, you’ll have a fully working WordPress site — using the fast-loading free theme Rabbit Lite, properly secured, and optimized for speed and stability.
What you need before you install WordPress on VPS CentOS
Before diving into commands, let’s make sure you’re fully prepared. CentOS is stable and secure, but a small misstep can break your setup. Preparation is key.
Preparing your VPS
You’ll need a CentOS 7 or CentOS 8 system ready. Most VPS providers (like DigitalOcean, Vultr, or Linode) allow you to choose CentOS during server creation.
Create a non-root user with sudo privileges for security. This user will handle installations and configurations safely.
Installing the LAMP (or LEMP) stack
To run WordPress on VPS CentOS, your server needs three core components working in harmony — the web server, the database, and PHP. These elements form the essential LAMP or LEMP stack that allows WordPress to store, process, and display content dynamically. Without them, WordPress cannot function properly or serve pages to visitors.
- A web server (Apache or Nginx): Handles incoming requests and delivers your website’s content to users. Apache is beginner-friendly and widely supported, while Nginx offers higher performance and efficiency under heavy traffic.
- A database (MariaDB or MySQL): Stores all WordPress data, including posts, users, and settings. MariaDB is the modern, open-source replacement for MySQL and is fully compatible with WordPress.
- PHP with the required extensions: Processes WordPress scripts and connects the web server with the database. You’ll need extensions like
php-mysql,php-gd,php-xml, andphp-mbstringto ensure full compatibility.
Once these components are installed, your VPS CentOS is ready to host a fully functional WordPress site.
For Apache (LAMP stack), run:
sudo yum install httpd mariadb-server php php-mysql php-gd php-xml php-mbstring -y
Start and enable the services:
sudo systemctl start httpd
sudo systemctl enable httpd
sudo systemctl start mariadb
sudo systemctl enable mariadb
/etc/nginx/nginx.conf instead of /etc/httpd/conf/httpd.conf.Domain, SSH, and Firewall
To make your WordPress site accessible through your own domain, you first need to point your domain name to your VPS IP by creating an A record in your domain’s DNS settings. This tells the internet that all traffic for your domain should go to your VPS. DNS propagation may take several hours, so be patient while it updates globally.
Once that’s done, access your VPS via SSH using a terminal or tool like PuTTY. Connect with the command ssh user@your_server_ip to log in securely. SSH access allows you to install software, upload WordPress files, and configure your CentOS server directly from the command line.
ssh youruser@your_server_ip
Enable the firewall:
sudo systemctl enable firewalld
sudo systemctl start firewalld
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
Also check SELinux status using sestatus. You may need to adjust permissions later.
Once everything is ready, you’re set to move on to the installation.
How to install WordPress on VPS CentOS
Now it’s time to bring your WordPress site to life. This section walks you through every step — installing the necessary components, configuring files, and running the setup wizard.
Install and configure the web server, PHP, and database
To begin setting up your environment and install WordPress on VPS CentOS, you’ll need to install the required software packages. These include Apache or Nginx, PHP, and MariaDB, which together power WordPress. Run the command below to install all dependencies: this ensures your server has every component needed for WordPress to function smoothly and securely.
sudo yum install httpd mariadb-server php php-mysql php-gd php-xml php-mbstring -y
Then start and enable services:
sudo systemctl start httpd
sudo systemctl enable httpd
sudo systemctl start mariadb
sudo systemctl enable mariadb
To secure MariaDB, run:
sudo mysql_secure_installation
Set a strong root password, remove anonymous users, and disable remote root login.
Now create a WordPress database and user:
mysql -u root -p
CREATE DATABASE wordpress;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'secure_pass';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Download and configure WordPress files
Once your server stack is ready, the next step in the process to install WordPress on VPS CentOS is to obtain the latest version of WordPress from the official source. Download the latest WordPress package: this ensures you get the most stable and secure release with all recent updates, bug fixes, and performance improvements for your site.
cd ~
wget https://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
Move files to the web directory:
sudo rsync -avP ~/wordpress/ /var/www/html/
Then adjust ownership:
sudo chown -R apache:apache /var/www/html/*
Copy the configuration file and set your database details:
cd /var/www/html
cp wp-config-sample.php wp-config.php
Edit it using vi or nano:
define('DB_NAME', 'wordpress');
define('DB_USER', 'wpuser');
define('DB_PASSWORD', 'secure_pass');
define('DB_HOST', 'localhost');
Save and close the file.
Your WordPress files are now ready to run.
wp-content/uploads, ensure ownership is correct (apache:apache or nginx:nginx).Run the WordPress installation wizard and choose theme
After completing the setup and moving the WordPress files to your web root, it’s time to start the installation wizard. Visit your domain or IP address in the browser: this will launch the WordPress setup screen, allowing you to choose your language, site title, and admin credentials. This step finalizes the process to install WordPress on VPS CentOS successfully.
http://your_server_ip_or_domain
You’ll see the WordPress installation wizard. Choose your language, site title, username, password, and admin email.
After installation, log in to your WordPress dashboard:
http://your_server_ip_or_domain/wp-admin
Go to:
Appearance → Themes → Add New → Search for "Rabbit Lite"
Install and activate Rabbit Lite, a fast, free, and minimalist theme optimized for speed.
Post-installation steps: tuning and security
You now have a working WordPress site! But before launching publicly, let’s fine-tune performance and safety.
- Permalinks: Go to Settings → Permalinks and select “Post name”.
- Install essential plugins:
- WP Super Cache (speed)
- Wordfence Security (protection)
- UpdraftPlus (backup)
- Optimize PHP settings by editing
/etc/php.ini:memory_limit = 256M max_execution_time = 300 upload_max_filesize = 64M - Enable HTTPS using Let’s Encrypt:
sudo yum install certbot python3-certbot-apache sudo certbot --apache - Harden SSH and firewall:
- Disable root SSH login
- Change the default port (22)
- Use fail2ban to block brute-force attempts
Common issues when you install WordPress on VPS CentOS and best practices
Even careful setups sometimes face issues. Below are the most common problems and how to fix them efficiently.
Database connection error
You may see the message:
“Error establishing a database connection.”
Check your wp-config.php credentials, database name, and privileges.
Run:
mysql -u wpuser -p
to confirm access.
sudo journalctl -xe to view recent Apache or Nginx errors if you suspect a service crash.Permission or ownership issues
Uploads may fail or your site may show a blank page. Verify ownership:
sudo chown -R apache:apache /var/www/html/
sudo find /var/www/html -type d -exec chmod 755 {} \;
sudo find /var/www/html -type f -exec chmod 644 {} \;
Slow loading
Heavy themes or too many plugins often cause performance drops.
Rabbit Lite already helps by minimizing unnecessary scripts and CSS.
You can further speed up your VPS by:
- Installing caching
- Compressing images (with Smush)
- Using a CDN like Cloudflare
SELinux/Firewall misconfiguration
If pages don’t load, SELinux might be blocking web access.
Run:
sudo chcon -R -t httpd_sys_content_t /var/www/html
or temporarily disable it:
sudo setenforce 0
Updates and backups
Keep everything up to date:
- WordPress Core
- Rabbit Lite Theme
- Plugins
Use a daily or weekly backup schedule and test your restore procedure at least once.
Q&A – Common Questions About How to Install WordPress on VPS CentOS
This section answers some of the most frequent questions users have when they install WordPress on VPS CentOS. Whether you’re unsure about web server choices, theme setup, or VPS requirements, these answers will help you avoid common mistakes and confidently manage your own WordPress environment on a CentOS server.
Do I need to use Apache to install WordPress on VPS CentOS?
No — both Apache (LAMP) and Nginx (LEMP) work. Apache is beginner-friendly and integrates easily with PHP. Nginx offers better performance under high traffic. Choose the one you’re comfortable maintaining — WordPress will function equally well on either.
Can I install the free theme Rabbit Lite later after installing WordPress on VPS CentOS?
Absolutely.
Once your site is running, go to Appearance → Themes → Add New → Search for “Rabbit Lite”.
Install and activate it at any time.
Rabbit Lite is lightweight and optimized, making it an excellent choice for VPS users who value speed and clean design.
What VPS resources (CPU/RAM) should I choose when I plan to install WordPress on VPS CentOS?
For a simple blog or business site, start with 1 vCPU and 1–2 GB RAM. If you expect high traffic or use many plugins, go for 2 vCPU and 4 GB RAM or more. Your main resource drivers are PHP workers and caching — fine-tune them for better performance.
Conclusion
By following this complete guide to install WordPress on VPS CentOS, you’ve built a robust foundation:
- Installed and secured a LAMP/LEMP stack
- Configured your database and PHP environment
- Set up WordPress manually and tuned performance
- Activated a clean, high-speed theme — Rabbit Lite
Now you have a site that’s not only functional but optimized, stable, and secure.
You’ve learned the essential Linux commands, directory structures, and configurations that give you control over your environment.
You’re no longer relying on shared hosting limitations — your CentOS VPS is now your digital home, built by your own hands.
Publish, grow, and keep learning. The world of WordPress is yours to shape.









