Web Strategy & Beyond.

Bash Script to Install WordPress on Vesta CP

The Vesta control panel (VestaCP) is an open source hosting control panel, which can be used to manage multiple websites, create and manage email accounts, FTP accounts, and MySQL databases, manage DNS records and more.

There are a lot of tutorials on how to install WordPress on VestaCP. The Vesta Control Panel comes with Softaculous, but you’ve to pay for the license to auto-install WordPress on your server using Softaculous.

If you’re looking for a free option, an auto install bash script would be the right choice to install WordPress on your server.

Note:

  1. You’ve to add a domain first (using the Vesta CP web interface).
  2. The script is only applicable to the admin group. i.e. username:admin.

Major features of the WordPress auto install bash script

I edited the bash script posted by @jetonr on GitHubGist. I modified a little bit for VestaCP admin group. The main features of the script include:

  1. Downloads the latest.tar.gz to the public_html of the user and domain you enter.
  2. Removes unnecessary files ( wp-config-sample.php, readme.html, license.txt and latest.tar.gz )
  3. Creates a secure .htaccess file & set correct permissions for the file.
  4. Generates a robots.txt file with right ownership.
  5. Creates a database with user and password you enter. Which will go to the wp-config file.
  6. Creates a wp-config.php file with generated configuration and SALT included.

How to use the WordPress auto install bash script for VestaCP

How to Automate WordPress Installs

Choose from the two methods below:

Method 1: Add this line your Bashrc file.

Stick with this method if you plan to set up a lot of WordPress sites. This method will make things easier the next time when you want to install WordPress.

What is Bashrc?

bashrc is a shell script that Bash runs whenever it is started interactively. It initializes an interactive shell session. You can put any command in that file that you could type at the command prompt.

On CentOS, you’ll find the bashrc file inside the /etc directory. Visit this thread if you can’t locate the file.

Edit the file bashrc file and add this line:

alias wpinstall="curl -L -o 'vesta-wp.sh' https://gist.githubusercontent.com/mighildotcom/7205442783534792a606df39629e22d3/raw/a02564e5eb9931da31e3f4988717b6119a82ea6e/vesta-wp.sh && bash vesta-wp.sh"

Save the file and run:

source ~/.bashrc

That’s about it. Just type

wpinstall

anywhere to begin the installation process.

Method 2: Download the script and run it

This is pretty straight-forward also.

curl -O https://gist.githubusercontent.com/mighildotcom/7205442783534792a606df39629e22d3/raw/a02564e5eb9931da31e3f4988717b6119a82ea6e/vesta-wp.sh

and

bash vesta-wp.sh

The script will do the rest. Good luck!

Hire me to optimize your WordPress site

Leave a Reply