Here’s a complete step-by-step guide to install and run WordPress (blog) on a Linux server (CentOS, Ubuntu, or similar). This assumes you have root SSH access

Tech
5. Jul 2025
979 views
Here’s a complete step-by-step guide to install and run WordPress (blog) on a Linux server (CentOS, Ubuntu, or similar). This assumes you have root SSH access

✅ Step-by-Step: Install WordPress Blog

? Prerequisites:

  • A Linux server (like CentOS, Ubuntu, etc.)

  • A domain (e.g., example.com)

  • LAMP or LEMP stack (we'll use Apache (LAMP) here)

  • SSH access


? STEP 1: Install Apache, MySQL, PHP

For Ubuntu:

bash
 
apt update apt install apache2 mysql-server php php-mysql libapache2-mod-php php-cli php-curl php-gd php-mbstring php-xml php-xmlrpc php-zip unzip -y

For CentOS/RHEL:

bash
 
yum install httpd mariadb-server php php-mysqlnd php-cli php-curl php-gd php-mbstring php-xml php-zip unzip -y

Then enable and start services:

bash
 
systemctl enable --now httpd systemctl enable --now mysqld

? STEP 2: Secure MySQL

bash
 
mysql_secure_installation

Answer prompts (set root password, remove test DB, etc.)


?️ STEP 3: Create WordPress Database

Login to MySQL:

bash
 
mysql -u root -p

Then run:

sql
 
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'strongpassword'; GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost'; FLUSH PRIVILEGES; EXIT;

? STEP 4: Download and Extract WordPress

bash
 
cd /var/www/html wget https://wordpress.org/latest.zip unzip latest.zip mv wordpress/* . rm -rf wordpress latest.zip

⚙️ STEP 5: Configure WordPress

bash
 
cp wp-config-sample.php wp-config.php

Edit the config:

bash
 

Update the database lines:

php
 
define( 'DB_NAME', 'wordpress' ); define( 'DB_USER', 'wpuser' ); define( 'DB_PASSWORD', 'strongpassword' ); define( 'DB_HOST', 'localhost' );

You can also generate secure salts from: https://api.wordpress.org/secret-key/1.1/salt/ and paste them in wp-config.php.


? STEP 6: Set Permissions

bash
 
chown -R apache:apache /var/www/html chmod -R 755 /var/www/html

For Ubuntu, use www-data:

bash
 
chown -R www-data:www-data /var/www/html

? STEP 7: Configure Apache Virtual Host (if needed)

Create /etc/httpd/conf.d/wordpress.conf (CentOS) or /etc/apache2/sites-available/wordpress.conf (Ubuntu):

apache
 
ServerAdmin admin@example.com DocumentRoot /var/www/html ServerName example.com ServerAlias www.example.com AllowOverride All ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined

Enable config:

bash
 
a2ensite wordpress.conf a2enmod rewrite systemctl reload apache2

For CentOS:

bash
 
systemctl restart httpd

? STEP 8: Open Website in Browser

Go to:
http://your-server-ip/ or http://your-domain.com/

You will see the WordPress install screen. Choose language, site title, username, and password.


? DONE!

You now have a fully working WordPress blog. You can log in to the dashboard at:

pgsql
 
http://your-domain.com/wp-admin

Comments

No comments has been added on this post

Add new comment

You must be logged in to add new comment. Log in