Step 1. First, let’s start by ensuring your system is up-to-date.
sudo dnf update
sudo dnf install epel-release
==================== Step 2. Installing a LAMP server.================================
# sudo dnf install httpd httpd-tools
sudo systemctl enable httpd
sudo systemctl start httpd
sudo systemctl status httpd
http://your-server-ipadress
# sudo dnf install mariadb-server mariadb
sudo systemctl restart mariadb
sudo systemctl status mariadb
sudo systemctl enable mariadb
# mysql_secure_installation
Configure it like this:
– Set root password? [Y/n] y
– Remove anonymous users? [Y/n] y
– Disallow root login remotely? [Y/n] y
– Remove test database and access to it? [Y/n] y
– Reload privilege tables now? [Y/n] y
To log into MariaDB, use the following command :
# mysql -u root -p
This will prompt you for a password, so enter your MariaDB root password and hit Enter.
MariaDB [(none)]> CREATE DATABASE WP_database;
MariaDB [(none)]> CREATE USER ‘wp_user’@’localhost’ IDENTIFIED BY ‘your-password’;
MariaDB [(none)]> GRANT ALL ON WP_database.* TO ‘wp_user’@’localhost’ IDENTIFIED BY ‘your-password’ WITH GRANT OPTION;
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT
# sudo dnf install php-mysqlnd php-dom php-simplexml php-xml php-curl php-exif php-ftp php-gd php-iconv php-json php-mbstring php-posix
# sudo systemctl restart httpd
# sudo nano /var/www/html/info.php
Add the following line:
<?php
phpinfo ();
?>
Step 5. Configure Firewall.
sudo firewall-cmd –permanent –zone=public –add-service=http
sudo firewall-cmd –permanent –zone=public –add-service=https
sudo firewall-cmd –reload
========================================================================================
Step 3. Installing WordPress on AlmaLinux 8.
# w!get https://wordpress.org/latest.tar.gz –output wordpress.tar.gz
# unzip -q latest.zip -d /var/www/html/
# cd wordpress cp -a * ..
chown -R apache:apache /var/www/html/
chcon -t httpd_sys_rw_content_t /var/www/html/wordpress -R
Step 4. Configuring WordPress.
# mv wp-config-sample.php wp-config.php
# nano wp-config.php
Add the following line:
define(‘DB_NAME’, ‘WP_database’);
define(DB_USER’, ‘wp_user’);
define(DB_PASSWORD’, ‘your-password’);
Step 5. Configuring Apache for WordPress.
# nano /etc/apache/conf.d/vhosts.conf
IncludeOptional vhosts.d/*.conf
–> Next, create the virtual host:
# mkdir /etc/apache/vhosts.d/
# nano /etc/apache/vhosts.d/your-domain.com.conf
Add the following lines:
<VirtualHost YOUR_SERVER_IP:80>
ServerAdmin webmaster@your-domain.com
DocumentRoot “/var/www/html/”
ServerName yourdomain.com
ServerAlias www.yourdomain.com
ErrorLog “/var/log/httpd/your-domain.com-error_log”
CustomLog “/var/log/httpd/your-domain.com-access_log” combined
<Directory “/var/www/html/”>
DirectoryIndex index.html index.php
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Save and close the file. Restart the Apache service for the changes to take effect:
# sudo systemctl restart httpd.service
# sudo systemctl enable httpd.service
Step 6. Configure Firewall.
# sudo firewall-cmd –permanent –zone=public –add-service=http
# sudo firewall-cmd –permanent –zone=public –add-service=https
# sudo firewall-cmd –reload
Step 7. Accessing a WordPress Site.
WordPress will be available on HTTP port 80 by default. Open your favorite browser and navigate to http://your-domain.com
============== WordPress Easy way ===========
Host WordPress on LiteSpeed in CentOS 8 With CyberPanel
Add the swap to server
# sudo fallocate -l 1G /swapfile
# sudo dd if=/dev/zero of=/swapfile bs=1024 count=1048576
# sudo chmod 600 /swapfile
# sudo mkswap /swapfile
# sudo swapon /swapfile
# echo ‘/swapfile swap swap defaults 0 0’ | sudo tee -a /etc/fstab
Only for CentOS
# sudo yum update
# sudo yum upgrade
# sh <(curl https://cyberpanel.net/install.sh || wget -O – https://cyberpanel.net/install.sh)
1. Please enter the number[1-3]: 1
2. Please enter the number[1-3]: 1
3. Full installation [Y/n]: Y
4. Please choose to use default admin password 1234567, randomly generate one (recommended) or specify the admin password?
Choose [d]fault, [r]andom or [s]et password: [d/r/s] s
5. Do you wish to install Memcached extension and backend?
Please select [Y/n]: y
6. Do you wish to install Redis extension and backend?
Please select [Y/n]: y