# Update CentOS
yum update -y

# Install Apache
yum install httpd -y

# Start Apache
systemctl start httpd

# Enable Apache to start on boot
systemctl enable httpd

# Install WGET
yum install wget -y

# Install PHP 8.0 and required modules
yum install epel-release -y
yum install http://rpms.remirepo.net/enterprise/remi-release-$(rpm -E '%{rhel}').rpm -y
yum-config-manager --enable remi-php80
yum install php php-common php-fpm php-gd php-intl php-json php-mbstring php-mysqlnd php-opcache php-pecl-imagick php-pecl-redis php-pecl-zip php-process php-xml -y

# Restart Apache
systemctl restart httpd

# Install MySQL 8.0
cd /tmp/

wget https://repo.mysql.com//mysql80-community-release-el7-7.noarch.rpm

yum -y localinstall mysql80-community-release-el7-7.noarch.rpm 

yum-config-manager --enable mysql80-community

yum install -y mysql-community-server mysql-community-libs-compat mysql-community-client

# Start MySQL and enable it to start on boot
systemctl start mysqld
systemctl enable mysqld

# Get temporary MySQL root password
grep 'temporary password' /var/log/mysqld.log | awk '{print $NF}' > /tmp/mysql-root-pw

# Download and extract the latest version of WordPress into /var/www/html
cd /var/www/html/
wget https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
rm latest.tar.gz

# Set the correct permissions for WordPress
chown -R apache:apache /var/www/html/wordpress
chmod -R 755 /var/www/html/wordpress

# Configure WordPress to use /var/www/html directory
cp -a /var/www/html/wordpress/. /var/www/html/
rm -rf /var/www/html/wordpress

# Configure WordPress
cp /var/www/html/wp-config-sample.php /var/www/html/wp-config.php

# Restart Apache
systemctl restart httpd

This is a Bash script for setting up a web server on a CentOS system. It updates the system, installs Apache web server, PHP 8.0, and MySQL 8.0. Then, it downloads and extracts the latest version of WordPress into the /var/www/html directory, sets the correct permissions for WordPress, and configures WordPress to use the same directory. Finally, it restarts Apache to ensure that the changes take effect.

Here are the main steps the script performs:

#Update the CentOS system.

#Install Apache web server and start it.

#Install WGET utility.

#Install PHP 8.0 and its required modules.

#Install MySQL 8.0 and start it.

#Download and extract the latest version of WordPress into /var/www/html.

#Set the correct permissions for WordPress.

#Configure WordPress to use /var/www/html directory.

#Restart Apache to apply the changes.

The script also sets up MySQL root password and creates a wp-config.php file for configuring WordPress. It assumes that the script is run with root or sudo privileges.