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.php
file with user-provided database credentials.
Requirements
Before running the script, ensure that:
- You have
curl
installed for downloading WordPress. - You have
tar
installed for extracting files. - You have
sudo
privileges (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-data
by default) must have the correct permissions to access the WordPress files. wp-config.php
is secured withchmod 400
to prevent unauthorized access.
Get the Script
Categories: Scripts