In this blog, we’ll show you how to streamline the WordPress installation process with a custom script. By automating the download, installation, and configuration of WordPress, you can save time and simplify the site creation process.
#!/bin/bash
# Define the WordPress version to download
version="5.7.2"
# Define the directory where WordPress will be installed
install_dir="/var/www/html/wordpress"
# Define the URL to download WordPress
download_url="https://wordpress.org/wordpress-$version.tar.gz"
# Define the themes and plugins to be installed
themes=("twentynineteen" "twentytwenty")
plugins=("akismet" "jetpack")
# Download and extract WordPress
file="/tmp/wordpress-$version.tar.gz"
curl -LJO "$download_url"
tar -xzf "$file" -C "/var/www/html/"
mv "/var/www/html/wordpress-$version" "$install_dir"
# Download and install themes and plugins
for theme in "${themes[@]}"; do
wp theme install "$theme" --path="$install_dir"
done
for plugin in "${plugins[@]}"; do
wp plugin install "$plugin" --path="$install_dir"
done
# Configure WordPress
wp config create --dbname=wordpress --dbuser=wordpress --dbpass=password --path="$install_dir"
wp core install --url=http://localhost/wordpress --title=My+WordPress+Site --admin_user=admin --admin_password=password [email protected] --path="$install_dir"
In conclusion, by using a custom script to automate the installation and configuration of WordPress, you can save time and make the process of creating a new site much simpler. Whether you’re a developer, designer, or just someone who wants to quickly create a new WordPress site, this approach will make your life a lot easier. With just a few lines of code, you can have a fully configured WordPress site up and running in no time.
Leave a reply