Deploy WordPress is a Bash script that automates the deployment of the latest WordPress release on Linux. It downloads, extracts, configures, and sets up the necessary permissions, making WordPress ready to use in seconds.
Features
- Automatically downloads the latest stable version of WordPress.
- Deploys WordPress to the specified directory.
- Configures file ownership and permissions for security.
- Creates necessary writable directories for caching and uploads.
- Generates and secures the
wp-config.phpfile with user-provided database credentials.
Requirements
Before running the script, ensure that:
- You have
curlinstalled for downloading WordPress. - You have
tarinstalled for extracting files. - You have
sudoprivileges (required for setting ownership and permissions). - You have a MariaDB/MySQL database and user ready.
Usage
Run the script with the deployment directory as an argument:
./deploy-wordpress.sh -d <deployment_directory>Example:
./deploy-wordpress.sh -d /var/www/domain.com/wwwroot/Configuration
During execution, the script will ask for:
- Database Name
- Username
- Password (entered securely)
These values will be written to wp-config.php, which will then be secured with restrictive permissions.
Important Notes
- Ensure the specified deployment directory exists or can be created by the script.
- The webserver user (
www-databy default) must have the correct permissions to access the WordPress files. wp-config.phpis secured withchmod 400to prevent unauthorized access.
Get the Script
Categories: Scripts