WordPress install script


We like wordpress, a lot of our customers love it too. WordPress is web software you can use to create a beautiful website or blog, it is normally called a CMS too.
We have created a script for automating the install of the last version of wordpress, even though installing wordpress is quite a trivial job, here are Rimu we love to automate tasks. The script is located for download at:

http://proj.ri.mu/installwordpress.sh

It has been tested in Ubuntu 12.04, Debian Squeeze and Centos 6, but should work in older systems too. It features options to try to be compatible with Virtualmin control panels installs (and it may work with Plesk too).

It is easy use to install multiples instances of wordpress. It assumes that common packages such as apache, php, are already installed. Our VPSs already come with these packages installed. Script will normally stop and prompt if it encounters problems or is about to rewrite something. It will check if mysql running and install it, configure wordpress databases and users (it will generate random ones for you), configure wordpress config file and configure an apache virtual host for the wordpress install. It tries to do its best to detect existing files or configurations.

To use the script, with common options, installing it in domain.com, run as root:

wget http://proj.ri.mu/installwordpress.sh
chmod +x installwordpress.sh
./installwordpress.sh -d domain.com

Installing multiple instances, in different domains and databases:

./installwordpress.sh -d domain1.com -l /var/www/domain1.com -j domain1 -i domain1
./installwordpress.sh -d domain2.com -l /var/www/domain2.com -j domain2 -i domain2

Here is the little man:

# ./installwordpress.sh -h

Usage: installwordpress.sh [OPTION...]
installwordpress.sh will attempt to install all configurations for wordpress by default,
it will generate random passwords and the relevant ones will be informed. This script is provided as
it is, no warraties implied.

Options:
-d domain where wordpress will operate. DEFAULT: ${hostname}
-l location path where to install wordpress. DEFAULT: ${distro common html path}/wordpress
-j mysql database username to be setup. DEFAULT: wordpress
-k password to be assigned to the mysql database user. DEFAULT: RANDOM
-i mysql Database name. DEFAULT: wordpress
-u set default install location path ownership to the defined user. DEFAULT: ${distro apache user}
-a set ownership in specific paths in the location path to webserver user (wordpress requires to write here). DEFAULT: ${distro apache user}
-f force the install, prompts in error/warnings are disabled.
-h this Help

Advanced Options:
-t Comma separated of tasks to execute manually, may depend on the above
options. DEFAULT: all
Possible Tasks:
install_deps installs wordpress dependencies
install_wordpress downloads and installs wordpress package
configure_wordpress_database configures wordpress database
configure_wordpress configures wordpress
configure_apache configures apache virtual host

For example, Virtual min users using mod_php, to install in a home user location, and set default permissions as the “user”:

./installwordpress.sh -d domain.com -l /home/user/public_html -u user -t install_wordpress,configure_wordpress_database,configure_wordpress

(note that install_deps, or configure apache is not required, this is provided by the panel install)

Or VirtualMin users, that are using suexec + mod_fcgi will invocate the install script as follows, to install over the user:

./installwordpress.sh -d domain.com -l /home/user/public_html -u user -a user -t install_wordpress,configure_wordpress_database,configure_wordpress

Any bugreports, comments or questions do not hesitate to use the comments section below, or just shoot us an email in support (at) rimuhosting.com.
If you are a rimuhosting customer (or you would like to be) and you require wordpress installed for you in your server just let us know too.

,

3 responses to “WordPress install script”

  1. Hi, thank you for this. Before relying on it, I need to ask: Does it work for subdomains too? May I run two instances of the script at the same time?

    I’m asking because we want to create a blogger platform, where they enter the username, which will be the subdomainname and a password, so the script creates a blog for them and says “finished”, your admin login is here …

    • it will work with any domain, do not run script more than once at the same time, it will work one after the other, it does not set any wordpress admin password, it will leave wordpress for ready for the “5 minute install”, where you set the admin password, password set by the script is for the database only.