+
vscode
+
+
hapi
rubymine
+
rider
+
+
+
elasticsearch
+
elementary
haskell
vb
dns
keras
+
+
tls
junit
elementary
prettier
+
::
+
+
โˆฉ
+
rocket
โ‰ˆ
argocd
+
+
vue
toml
alpine
+
+
sails
โ‰ˆ
+
+
couchdb
prometheus
+
+
+
+
+
julia
r
+
+
+
#
@
lit
+
express
+
+
+
+
c#
jenkins
+
+
!==
sails
+
+
pycharm
+
0x
pnpm
+
+
+
saml
!==
+
+
echo
+
+
intellij
+
rest
Back to Blog
๐ŸŒ Installing WordPress on AlmaLinux: Complete LAMP Stack Guide
WordPress Installation LAMP Stack AlmaLinux Web Server

๐ŸŒ Installing WordPress on AlmaLinux: Complete LAMP Stack Guide

Published Sep 14, 2025

Learn how to install WordPress on AlmaLinux with Apache, MySQL, and PHP. This beginner-friendly guide covers everything from LAMP stack setup to WordPress optimization for your website or blog.

15 min read
0 views
Table of Contents

๐ŸŒ Installing WordPress on AlmaLinux: Complete LAMP Stack Guide

Ready to launch your website or blog? ๐Ÿš€ Today weโ€™ll install WordPress on AlmaLinux with a complete LAMP stack (Linux, Apache, MySQL, PHP)! Whether youโ€™re creating a personal blog, business website, or online store, this guide makes it super easy - even if youโ€™ve never done it before! ๐ŸŽฏ

๐Ÿค” Why is WordPress on AlmaLinux Important?

Running WordPress on AlmaLinux delivers amazing benefits:

  • ๐Ÿ“Œ Rock-solid stability - Enterprise-grade Linux for reliable hosting
  • ๐Ÿ”ง Complete control - Your server, your rules, no limitations
  • ๐Ÿš€ Blazing fast performance - Optimized stack for speed
  • ๐Ÿ” Enhanced security - Full control over security settings
  • โญ Cost-effective - No hosting fees, just your server costs

๐ŸŽฏ What You Need

Before starting your WordPress journey:

  • โœ… AlmaLinux 8 or 9 server (fresh installation preferred)
  • โœ… Root or sudo access to your server
  • โœ… Domain name pointed to your server (optional but recommended)
  • โœ… At least 1GB RAM and 10GB disk space
  • โœ… Basic terminal knowledge (weโ€™ll guide you!)

๐Ÿ“ Step 1: Install Apache Web Server

Letโ€™s start with Apache, your web server! ๐ŸŒŸ

Install and Configure Apache

# Update your system first
sudo dnf update -y

# Install Apache web server
sudo dnf install httpd -y

# Start and enable Apache to run at boot
sudo systemctl start httpd
sudo systemctl enable httpd

# Check Apache status
sudo systemctl status httpd
# You should see "active (running)" in green!

# Allow HTTP and HTTPS through firewall
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload

echo "โœ… Apache installed successfully!"

Test Apache Installation

# Get your server's IP address
ip addr show | grep inet

# Open your browser and visit:
# http://YOUR_SERVER_IP
# You should see the Apache test page!

# Create a test page
echo "<h1>Apache is working! ๐ŸŽ‰</h1>" | sudo tee /var/www/html/test.html

# Visit http://YOUR_SERVER_IP/test.html to confirm

Pro tip: ๐Ÿ’ก If you canโ€™t access Apache, check your cloud providerโ€™s firewall settings - they might block HTTP/HTTPS by default!

๐Ÿ”ง Step 2: Install MySQL/MariaDB Database

WordPress needs a database to store your content:

Install MariaDB

# Install MariaDB (MySQL compatible database)
sudo dnf install mariadb-server mariadb -y

# Start and enable MariaDB
sudo systemctl start mariadb
sudo systemctl enable mariadb

# Secure your MariaDB installation
sudo mysql_secure_installation

# Follow the prompts:
# - Enter current password (press Enter for none)
# - Set root password: Y (Choose a strong password!)
# - Remove anonymous users: Y
# - Disallow root login remotely: Y
# - Remove test database: Y
# - Reload privilege tables: Y

echo "โœ… MariaDB secured and ready!"

Create WordPress Database

# Log into MariaDB
sudo mysql -u root -p
# Enter the root password you just created

# Create database and user for WordPress
CREATE DATABASE wordpress_db;
CREATE USER 'wordpress_user'@'localhost' IDENTIFIED BY 'StrongPassword123!';
GRANT ALL PRIVILEGES ON wordpress_db.* TO 'wordpress_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

# Verify database creation
mysql -u wordpress_user -p -e "SHOW DATABASES;"
# You should see wordpress_db in the list!

Security note: ๐Ÿ”’ Always use strong passwords! Replace โ€˜StrongPassword123!โ€™ with your own secure password!

๐ŸŒŸ Step 3: Install PHP and Required Modules

WordPress is built with PHP, so letโ€™s install it:

Install PHP 8.0 and Extensions

# Enable EPEL and Remi repositories for PHP 8
sudo dnf install epel-release -y
sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm -y

# Reset PHP module and enable PHP 8.0
sudo dnf module reset php -y
sudo dnf module enable php:remi-8.0 -y

# Install PHP and required extensions for WordPress
sudo dnf install php php-mysqlnd php-fpm php-opcache php-gd php-xml php-mbstring php-json php-zip php-curl -y

# Check PHP version
php -v
# Should show PHP 8.0.x

# Restart Apache to load PHP
sudo systemctl restart httpd

Test PHP Installation

# Create a PHP info file
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php

# Visit http://YOUR_SERVER_IP/info.php
# You should see PHP configuration page!

# Remove the info file for security
sudo rm /var/www/html/info.php

echo "โœ… PHP installed and configured!"

Configure PHP for WordPress

# Optimize PHP settings for WordPress
sudo tee /etc/php.d/wordpress.ini << 'EOF'
; WordPress Optimizations
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
max_input_time = 300
memory_limit = 256M
EOF

# Restart Apache to apply changes
sudo systemctl restart httpd

โœ… Step 4: Download and Install WordPress

Now for the main event - WordPress installation! ๐ŸŽ‰

Download WordPress

# Navigate to temporary directory
cd /tmp

# Download latest WordPress
wget https://wordpress.org/latest.tar.gz

# Extract WordPress archive
tar -xzvf latest.tar.gz

# Move WordPress to web root
sudo mv wordpress /var/www/html/

# Set proper ownership
sudo chown -R apache:apache /var/www/html/wordpress

# Set proper permissions
sudo chmod -R 755 /var/www/html/wordpress

# SELinux context (if SELinux is enabled)
sudo semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/wordpress(/.*)?"
sudo restorecon -Rv /var/www/html/wordpress

echo "โœ… WordPress files ready!"

Configure WordPress Database Connection

# Navigate to WordPress directory
cd /var/www/html/wordpress

# Copy sample configuration file
sudo cp wp-config-sample.php wp-config.php

# Edit configuration file
sudo nano wp-config.php

# Update these lines with your database details:
# define('DB_NAME', 'wordpress_db');
# define('DB_USER', 'wordpress_user');
# define('DB_PASSWORD', 'StrongPassword123!');
# define('DB_HOST', 'localhost');

# Generate security keys (copy the output)
curl -s https://api.wordpress.org/secret-key/1.1/salt/

# Paste the security keys in wp-config.php
# (Replace the existing dummy keys)

Configure Apache for WordPress

# Create Apache configuration for WordPress
sudo tee /etc/httpd/conf.d/wordpress.conf << 'EOF'
<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/wordpress
    ServerName your-domain.com
    ServerAlias www.your-domain.com

    <Directory /var/www/html/wordpress/>
        Options FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog /var/log/httpd/wordpress_error.log
    CustomLog /var/log/httpd/wordpress_access.log combined
</VirtualHost>
EOF

# Enable .htaccess for permalinks
sudo tee /var/www/html/wordpress/.htaccess << 'EOF'
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
EOF

# Set ownership for .htaccess
sudo chown apache:apache /var/www/html/wordpress/.htaccess

# Restart Apache
sudo systemctl restart httpd

Whatโ€™s happening: ๐Ÿ”„

  • WordPress files are placed in the web directory
  • Database connection is configured
  • Apache is set up to serve WordPress
  • Permalinks are enabled for SEO-friendly URLs

๐ŸŽฎ Quick Examples

Example 1: Complete WordPress Setup with SSL ๐Ÿ”

# Install Certbot for Let's Encrypt SSL
sudo dnf install certbot python3-certbot-apache -y

# Obtain SSL certificate (replace with your domain)
sudo certbot --apache -d your-domain.com -d www.your-domain.com

# Follow the prompts:
# - Enter email address
# - Agree to terms
# - Choose whether to redirect HTTP to HTTPS (recommended: yes)

# Auto-renewal setup
sudo systemctl enable certbot-renew.timer
sudo systemctl start certbot-renew.timer

echo "โœ… WordPress with SSL ready at https://your-domain.com"

Example 2: WordPress Performance Optimization โšก

# Install caching and optimization tools
sudo dnf install memcached php-pecl-memcached -y

# Start memcached
sudo systemctl start memcached
sudo systemctl enable memcached

# Configure memcached for WordPress
echo "extension=memcached.so" | sudo tee /etc/php.d/25-memcached.ini

# Enable Apache caching modules
sudo dnf install mod_cache mod_cache_disk -y

# Configure Apache caching
sudo tee /etc/httpd/conf.d/cache.conf << 'EOF'
<IfModule mod_cache_disk.c>
    CacheEnable disk /
    CacheRoot /var/cache/httpd
    CacheDirLevels 2
    CacheDirLength 1
    CacheMaxFileSize 1000000
</IfModule>
EOF

# Restart services
sudo systemctl restart httpd
sudo systemctl restart php-fpm

echo "โœ… Performance optimizations applied!"

Example 3: Automated WordPress Backup ๐Ÿ’พ

# Create backup script
sudo tee /usr/local/bin/backup-wordpress.sh << 'EOF'
#!/bin/bash
# WordPress Backup Script

BACKUP_DIR="/backup/wordpress"
DATE=$(date +%Y%m%d_%H%M%S)
SITE_DIR="/var/www/html/wordpress"
DB_NAME="wordpress_db"
DB_USER="wordpress_user"
DB_PASS="StrongPassword123!"

# Create backup directory
mkdir -p $BACKUP_DIR

# Backup database
mysqldump -u $DB_USER -p$DB_PASS $DB_NAME > $BACKUP_DIR/db_$DATE.sql

# Backup WordPress files
tar -czf $BACKUP_DIR/files_$DATE.tar.gz $SITE_DIR

# Keep only last 7 days of backups
find $BACKUP_DIR -type f -mtime +7 -delete

echo "Backup completed: $DATE"
EOF

# Make script executable
sudo chmod +x /usr/local/bin/backup-wordpress.sh

# Add to cron for daily backups
echo "0 2 * * * /usr/local/bin/backup-wordpress.sh" | sudo tee -a /etc/crontab

echo "โœ… Automated daily backups configured!"

๐Ÿšจ Fix Common Problems

Problem 1: Cannot Access WordPress Site โŒ

Symptoms:

  • Browser shows โ€œThis site canโ€™t be reachedโ€
  • Connection timeout errors

Try this:

# Check if Apache is running
sudo systemctl status httpd

# Check firewall rules
sudo firewall-cmd --list-all

# Check SELinux status
getenforce

# If SELinux is enforcing, allow httpd network connect
sudo setsebool -P httpd_can_network_connect 1

# Restart Apache
sudo systemctl restart httpd

Problem 2: Database Connection Error โŒ

Try this:

# Test database connection
mysql -u wordpress_user -p -D wordpress_db

# If connection fails, recreate user
mysql -u root -p
DROP USER 'wordpress_user'@'localhost';
CREATE USER 'wordpress_user'@'localhost' IDENTIFIED BY 'StrongPassword123!';
GRANT ALL PRIVILEGES ON wordpress_db.* TO 'wordpress_user'@'localhost';
FLUSH PRIVILEGES;

# Verify wp-config.php settings
grep DB_ /var/www/html/wordpress/wp-config.php

Problem 3: File Upload Issues โŒ

Check these things:

# Fix permissions
sudo chown -R apache:apache /var/www/html/wordpress/wp-content
sudo chmod -R 755 /var/www/html/wordpress/wp-content

# Increase PHP limits
sudo sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 64M/' /etc/php.ini
sudo sed -i 's/post_max_size = 8M/post_max_size = 64M/' /etc/php.ini

# Restart services
sudo systemctl restart httpd
sudo systemctl restart php-fpm

๐Ÿ“‹ Simple Commands Summary

TaskCommand
๐Ÿ‘€ Check Apache statussudo systemctl status httpd
๐Ÿ”ง Restart Apachesudo systemctl restart httpd
๐Ÿš€ Check PHP versionphp -v
๐Ÿ›‘ View error logssudo tail -f /var/log/httpd/error_log
โ™ป๏ธ Update WordPress permssudo chown -R apache:apache /var/www/html/wordpress
๐Ÿ“Š Check databasemysql -u wordpress_user -p
โœ… Test sitecurl -I http://localhost

๐Ÿ’ก Tips for Success

  1. Always backup first ๐ŸŒŸ - Before updates or changes, backup your site
  2. Use strong passwords ๐Ÿ” - Weak passwords are the #1 security risk
  3. Keep everything updated ๐Ÿš€ - Regular updates prevent security issues
  4. Monitor resources ๐Ÿ“ - Watch CPU and memory usage as your site grows
  5. Use caching plugins ๐Ÿ”„ - W3 Total Cache or WP Super Cache for speed

๐Ÿ† What You Learned

Congratulations! Now you can:

  • โœ… Install and configure Apache web server on AlmaLinux
  • โœ… Set up MariaDB database for WordPress
  • โœ… Install PHP with all required extensions
  • โœ… Deploy WordPress and configure it properly
  • โœ… Implement SSL, caching, and backup solutions

๐ŸŽฏ Why This Matters

Your WordPress on AlmaLinux setup provides:

  • ๐Ÿš€ Full control over your website and server environment
  • ๐Ÿ” Enhanced security with enterprise-grade Linux
  • ๐Ÿ“Š Unlimited scalability as your site grows
  • โšก Superior performance compared to shared hosting

Remember: Running WordPress on your own AlmaLinux server gives you the power and flexibility that shared hosting can never match - youโ€™re now a true webmaster! โญ

Youโ€™ve successfully installed WordPress on AlmaLinux! Your website is now running on a professional, enterprise-grade platform that can handle anything from a simple blog to a high-traffic business site! ๐Ÿ™Œ