WordPress Installation Script

This script automates the installation and configuration of a WordPress environment on various Linux distributions. It handles the following:

  • System update and upgrade
  • Installation of necessary packages
  • Web server setup (Apache for Ubuntu, HTTPD for CentOS/AlmaLinux/RHEL)
  • MariaDB server installation and configuration
  • PHP 8.3 installation
  • WordPress installation and configuration
  • Database setup and configuration

Supported Operating Systems

  • Ubuntu
  • CentOS
  • AlmaLinux
  • RHEL

Prerequisites

  • A Linux-based operating system (one of the supported distributions)
  • Root or sudo access

Features

  • Update and Upgrade: Updates and upgrades the system packages.
  • Web Server: Installs Apache on Ubuntu/Debian or HTTPD on CentOS/AlmaLinux/RHEL.
  • Database Server: Installs MariaDB and configures it for WordPress.
  • PHP 8.3: Installs PHP 8.3 and necessary extensions.
  • WordPress: Downloads, installs, and configures WordPress.
  • Permissions: Sets appropriate file permissions for the web server.

Usage

Clone the Repository

git clone https://github.com/SysNestor/WordPress-AutoInstaller.git
cd WordPress-AutoInstaller
Clone the Repository WordPress AutoInstaller

Make the Script Executable

chmod +x WordPress-AutoInstaller.sh

Run the Script

sudo ./WordPress-AutoInstaller.sh
Run the WordPress AutoInstaller Script

After running the script, you will be provided with the essential MySQL/MariaDB credentials required for your WordPress setup. These details include:

  • MySQL/MariaDB Root Password: The password generated for the root user of your database.
  • WordPress Database Name: The name of the database created specifically for your WordPress installation.
  • WordPress Database User: The user created for WordPress to access the database.
  • WordPress Database Password: The password associated with the WordPress database user.

These credentials will be displayed on the terminal once the script is completed. Make sure to securely save this information as it is important for managing your database and WordPress installation. If lost, you may have to reset the database credentials manually.

Next Steps After Installation:
Once the script completes the installation process, you’ll need to complete the WordPress setup in your browser.

  1. Open your browser and navigate to either:
    • Your Domain Name (if already configured), or
    • Your Server’s IP Address (if you haven’t set up a domain yet).
  2. The WordPress installation wizard will guide you through the final steps to configure your site (language selection, site title, admin user setup, etc.).

Ensure that your domain or IP is properly pointed to the server where WordPress was installed. If you encounter any issues, check your server configuration and firewall settings.

complete the WordPress setup in your browser

Script Details

Update and Upgrade

The script updates and upgrades the system packages based on the detected OS:

  • Ubuntu: Uses apt for package management.
  • CentOS/AlmaLinux/RHEL: Uses dnf for package management.

Web Server Installation

  • Ubuntu: Installs and configures Apache.
  • CentOS/AlmaLinux/RHEL: Installs and configures HTTPD.

Database Server Installation

  • Ubuntu: Installs and configures MariaDB.
  • CentOS/AlmaLinux/RHEL: Installs and configures MariaDB.

PHP 8.3 Installation

Installs PHP 8.3 along with required extensions:

  • php8.3-mysql
  • php8.3-gd
  • php8.3-xml

WordPress Installation

  • Downloads and extracts the latest WordPress.
  • Moves the files to the web server’s root directory.
  • Sets appropriate ownership based on the detected OS.

Permissions and Configuration

  • Ubuntu: Sets file ownership to www-data:www-data.
  • CentOS/AlmaLinux/RHEL: Sets file ownership to apache:apache.

Configures wp-config.php with generated database credentials.

Troubleshooting

  • chown: invalid user Error: Ensure the correct user and group for the web server are used (e.g., apache for CentOS/AlmaLinux/RHEL).
  • FTP Credentials Prompt: Ensure WordPress has direct access to the file system by setting FS_METHOD to direct in wp-config.php.