How To Install WordPress on AlmaLinux 10

Installing WordPress on AlmaLinux 10 provides a robust, enterprise-grade foundation for your website or blog. This comprehensive tutorial will guide you through every step of the process, from initial system setup to final optimization. Whether you’re a system administrator, developer, or business owner looking to deploy WordPress on a reliable Linux distribution, this guide ensures a secure and optimized installation.
AlmaLinux 10 offers exceptional stability, security, and performance characteristics that make it an ideal choice for hosting WordPress sites. As a community-driven, open-source alternative to CentOS, AlmaLinux provides enterprise-level features without licensing costs, making it perfect for both small businesses and large-scale deployments.
This guide covers complete installation processes for both LAMP (Linux, Apache, MySQL, PHP) and LEMP (Linux, Nginx, MySQL, PHP) stacks, SSL certificate implementation, security hardening, and performance optimization techniques. By following these detailed instructions, you’ll have a production-ready WordPress installation that’s secure, fast, and scalable.
Prerequisites and System Requirements
Hardware Requirements
Before beginning the WordPress installation process, ensure your AlmaLinux 10 server meets the minimum hardware specifications. For basic WordPress installations, you’ll need at least 1GB of RAM, though 2GB or more is recommended for better performance. Storage requirements vary depending on your content needs, but allocate at least 20GB of disk space for the operating system, web server, database, and WordPress files.
CPU requirements are relatively modest for most WordPress sites. A single-core processor can handle light to moderate traffic, but multi-core processors provide better performance for database-intensive operations and concurrent user sessions. Consider your expected traffic volume when selecting hardware specifications.
Software Prerequisites
Your AlmaLinux 10 server should have a fresh installation with root access or sudo privileges. Ensure SSH access is properly configured for secure remote administration. You’ll also need a registered domain name pointed to your server’s IP address, though you can use the IP address directly for testing purposes.
A stable internet connection is essential for downloading packages, updates, and WordPress files. Configure your DNS settings to point your domain to the server’s IP address before beginning the installation process.
User Permissions and Access
Root access or sudo privileges are mandatory for installing system packages and configuring services. If you’re using a non-root user account, ensure it has sudo privileges by adding it to the wheel group. SSH key authentication is recommended over password authentication for enhanced security.
Consider creating a dedicated user account for WordPress file management separate from the root user. This practice improves security by limiting the scope of potential security breaches and follows the principle of least privilege.
Initial System Setup and Preparation
System Updates and Package Management
Begin by updating your AlmaLinux 10 system to ensure all packages are current and security patches are applied. Execute the following commands to perform a comprehensive system update:
sudo dnf update -y
sudo dnf upgrade -yInstall the EPEL (Extra Packages for Enterprise Linux) repository, which provides additional packages not included in the default AlmaLinux repositories:
sudo dnf install epel-release -yThe DNF package manager is AlmaLinux’s default package management tool, offering improved performance and dependency resolution compared to older package managers. Always verify package integrity and authenticity by checking GPG signatures when installing from third-party repositories.
Firewall and Security Configuration
Configure the firewalld service to allow HTTP and HTTPS traffic while maintaining security. Start by enabling the firewall service:
sudo systemctl enable firewalld
sudo systemctl start firewalldOpen the necessary ports for web traffic:
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --permanent --add-port=22/tcp
sudo firewall-cmd --reloadSELinux (Security-Enhanced Linux) is enabled by default on AlmaLinux 10 and provides mandatory access control security. Configure SELinux to allow web server operations:
sudo setsebool -P httpd_can_network_connect 1
sudo setsebool -P httpd_can_network_connect_db 1These basic security measures establish a foundation for a secure WordPress installation while allowing necessary network communications.
Installing Web Server (Apache vs Nginx)
Option A: Installing Apache HTTP Server
Apache HTTP Server remains one of the most popular web server choices for WordPress installations due to its extensive module support and .htaccess compatibility. Install Apache using the DNF package manager:
sudo dnf install httpd -yStart and enable the Apache service to ensure it starts automatically on system boot:
sudo systemctl start httpd
sudo systemctl enable httpdConfigure Apache for optimal WordPress performance by editing the main configuration file:
sudo nano /etc/httpd/conf/httpd.confCreate a virtual host configuration for your WordPress site by creating a new configuration file:
sudo nano /etc/httpd/conf.d/wordpress.confAdd the following virtual host configuration:
<VirtualHost *:80>
    ServerName your-domain.com
    ServerAlias www.your-domain.com
    DocumentRoot /var/www/html/wordpress
    ErrorLog /var/log/httpd/wordpress_error.log
    CustomLog /var/log/httpd/wordpress_access.log combined
    
    <Directory /var/www/html/wordpress>
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>Test the Apache configuration syntax before restarting the service:
sudo httpd -t
sudo systemctl restart httpdOption B: Installing Nginx Web Server
Nginx offers superior performance for high-traffic WordPress sites and better resource utilization. Install Nginx using the following command:
sudo dnf install nginx -yStart and enable the Nginx service:
sudo systemctl start nginx
sudo systemctl enable nginxCreate a server block configuration for your WordPress site:
sudo nano /etc/nginx/conf.d/wordpress.confAdd the following Nginx configuration:
server {
    listen 80;
    server_name your-domain.com www.your-domain.com;
    root /var/www/html/wordpress;
    index index.php index.html index.htm;
    
    location / {
        try_files $uri $uri/ /index.php?$args;
    }
    
    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php-fpm/www.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
    
    location ~ /\.ht {
        deny all;
    }
}Test the Nginx configuration and restart the service:
sudo nginx -t
sudo systemctl restart nginxPHP Installation and Configuration
Installing PHP and Required Extensions
WordPress requires PHP with specific extensions for optimal functionality. Install PHP and essential extensions using DNF:
sudo dnf install php php-fpm php-mysql php-gd php-xml php-mbstring php-curl php-zip php-intl php-json php-opcache -yFor Nginx installations, configure PHP-FPM for better performance:
sudo systemctl start php-fpm
sudo systemctl enable php-fpmVerify the PHP installation and version:
php -vCheck installed PHP modules:
php -mPHP Configuration Optimization
Configure PHP settings for WordPress requirements by editing the php.ini file:
sudo nano /etc/php.iniModify the following settings for optimal WordPress performance:
memory_limit = 256M
max_execution_time = 300
max_input_vars = 3000
upload_max_filesize = 64M
post_max_size = 64M
max_file_uploads = 20For enhanced security, configure additional PHP settings:
expose_php = Off
display_errors = Off
log_errors = On
allow_url_fopen = OffRestart your web server and PHP-FPM (if using Nginx) to apply the configuration changes:
sudo systemctl restart httpd  # For Apache
sudo systemctl restart php-fpm  # For NginxCreate a PHP info file to verify the configuration:
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.phpDatabase Installation and Setup
Installing MariaDB/MySQL
MariaDB serves as the database backend for WordPress, storing all content, user data, and configuration information. Install MariaDB server and client packages:
sudo dnf install mariadb-server mariadb -yStart and enable the MariaDB service:
sudo systemctl start mariadb
sudo systemctl enable mariadbVerify the MariaDB installation:
sudo systemctl status mariadbSecuring MariaDB Installation
Run the security script to improve MariaDB security:
sudo mysql_secure_installationFollow the prompts to:
- Set a root password
- Remove anonymous users
- Disable remote root login
- Remove test database
- Reload privilege tables
These security measures protect your database from unauthorized access and remove potential security vulnerabilities.
Creating WordPress Database and User
Connect to MariaDB as the root user:
mysql -u root -pCreate a dedicated database for WordPress:
CREATE DATABASE wordpress_db;Create a database user with appropriate privileges:
CREATE USER 'wordpress_user'@'localhost' IDENTIFIED BY 'secure_password';
GRANT ALL PRIVILEGES ON wordpress_db.* TO 'wordpress_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;Test the database connection:
mysql -u wordpress_user -p wordpress_dbWordPress Download and Installation
Downloading WordPress
Download the latest WordPress version using curl:
cd /tmp
curl -O https://wordpress.org/latest.tar.gzExtract the WordPress archive:
tar xzf latest.tar.gzVerify the download integrity by checking the WordPress signature (optional but recommended):
curl -O https://wordpress.org/latest.tar.gz.sha1
sha1sum -c latest.tar.gz.sha1WordPress File Management
Copy WordPress files to the web directory:
sudo cp -R wordpress/* /var/www/html/wordpress/Set proper ownership and permissions:
sudo chown -R apache:apache /var/www/html/wordpress/  # For Apache
sudo chown -R nginx:nginx /var/www/html/wordpress/   # For Nginx
sudo chmod -R 755 /var/www/html/wordpress/Configure SELinux contexts for WordPress files:
sudo setsebool -P httpd_can_network_connect 1
sudo setsebool -P httpd_can_network_connect_db 1
sudo semanage fcontext -a -t httpd_exec_t "/var/www/html/wordpress(/.*)?"
sudo restorecon -R /var/www/html/wordpressWordPress Configuration File Setup
Create the WordPress configuration file:
cd /var/www/html/wordpress
sudo cp wp-config-sample.php wp-config.phpEdit the configuration file with your database credentials:
sudo nano wp-config.phpUpdate the database configuration section:
define('DB_NAME', 'wordpress_db');
define('DB_USER', 'wordpress_user');
define('DB_PASSWORD', 'secure_password');
define('DB_HOST', 'localhost');Generate and add security keys and salts from the WordPress API:
curl -s https://api.wordpress.org/secret-key/1.1/salt/Copy the generated keys and replace the placeholder values in wp-config.php.
SSL Certificate Installation
Installing Let’s Encrypt SSL Certificate
Install Certbot for automated SSL certificate management:
sudo dnf install certbot python3-certbot-apache -y  # For Apache
sudo dnf install certbot python3-certbot-nginx -y   # For NginxObtain an SSL certificate for your domain:
sudo certbot --apache -d your-domain.com -d www.your-domain.com  # For Apache
sudo certbot --nginx -d your-domain.com -d www.your-domain.com   # For NginxConfigure automatic certificate renewal:
sudo systemctl enable certbot-renew.timer
sudo systemctl start certbot-renew.timerSSL Configuration and Security
Test SSL certificate installation:
sudo certbot certificatesConfigure strong SSL/TLS security settings by adding security headers to your web server configuration. For Apache, add to your virtual host:
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
Header always set X-Frame-Options "SAMEORIGIN"
Header always set X-Content-Type-Options "nosniff"For Nginx, add to your server block:
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;WordPress Setup Wizard and Initial Configuration
Running WordPress Installation Wizard
Navigate to your domain in a web browser to access the WordPress installation wizard:
https://your-domain.comComplete the installation wizard by providing:
- Site title and description
- Admin username and password
- Admin email address
- Privacy settings
Choose a strong admin password and avoid common usernames like “admin” or “administrator” for security purposes.

Post-Installation WordPress Configuration
After completing the installation wizard, access the WordPress admin dashboard:
https://your-domain.com/wp-adminConfigure essential settings:
- Update permalink structure for SEO-friendly URLs
- Configure user roles and permissions
- Install essential security plugins
- Set up automated backups
- Configure email settings
Post-Installation Security and Optimization
WordPress Security Hardening
Implement additional security measures to protect your WordPress installation:
Install and configure security plugins like Wordfence or Sucuri Security. Change the default WordPress login URL using plugins or .htaccess modifications.
Configure file permissions properly:
sudo find /var/www/html/wordpress/ -type d -exec chmod 755 {} \;
sudo find /var/www/html/wordpress/ -type f -exec chmod 644 {} \;
sudo chmod 600 /var/www/html/wordpress/wp-config.phpSet up regular automated backups using plugins like UpdraftPlus or BackWPup.
Performance Optimization
Install caching plugins like W3 Total Cache or WP Rocket to improve page load times. Configure database optimization plugins to maintain database performance.
Enable gzip compression in your web server configuration. For Apache, add to .htaccess:
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript
</IfModule>For Nginx, add to server block:
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json;Troubleshooting Common Issues
Installation Problems
Database Connection Errors: Verify database credentials in wp-config.php and ensure MariaDB service is running. Check firewall rules and SELinux contexts.
File Permission Issues: Ensure proper ownership and permissions are set for WordPress files. Use the find commands provided earlier to reset permissions.
PHP Module Missing Errors: Install required PHP extensions using DNF. Restart web server after installing new modules.
Web Server Configuration Problems: Check configuration syntax using httpd -t for Apache or nginx -t for Nginx. Review error logs for specific issues.
Post-Installation Issues
WordPress Admin Access Problems: Clear browser cache and cookies. Check .htaccess file for redirect loops. Verify SSL certificate installation.
Plugin Compatibility Issues: Deactivate plugins one by one to identify conflicts. Check plugin compatibility with your WordPress version.
Theme Loading Errors: Ensure theme files have proper permissions. Switch to default theme temporarily to isolate issues.
Performance Issues: Monitor server resources and optimize database queries. Implement caching solutions and content delivery networks.
Maintenance and Best Practices
Regular Maintenance Tasks
Establish a routine maintenance schedule including:
- Weekly WordPress core and plugin updates
- Monthly database optimization
- Quarterly security audits
- Regular log file cleanup
Monitor system resources and performance metrics to identify potential issues before they impact users.
Backup and Recovery
Implement comprehensive backup strategies:
- Daily database backups
- Weekly full site backups
- Monthly offsite backup verification
- Quarterly disaster recovery testing
Store backups in multiple locations and test restoration procedures regularly to ensure data integrity and recovery capabilities.
Congratulations! You have successfully installed WordPress. Thanks for using this tutorial for installing WordPress content management system (CMS) on your AlmaLinux OS 10 system. For additional help or useful information, we recommend you check the official WordPress website.
