Bash function for installing WordPress
wp() {
# Needs two parameters
# Parameter 1 is the account name, or install directory
# Parameter 2 will set the database password
cd ~/../home/${1}/public_html # go to install directory
wget http://wordpress.org/latest.tar.gz # get latest WordPress
tar xfz latest.tar.gz # unpack
chown -R ${1} wordpress # change all files in wordpress to be owned by user (solves a problem when installing as root)
chgrp -R ${1} wordpress # change associated group (solves a problem when installing as root)
mv wordpress/* ./ # move all files from /wordpress to the root directory
rmdir wordpress # remove the wordpress folder
rm -f latest.tar.gz # remove the tar package
# Set up the database ...
pass=$rootmysqlpassword
mysql -uroot -p$pass -e "create database $1_wrdp"
mysql -uroot -p$pass -e "grant all on $1_wrdp.* to '$1'@'localhost' identified by '$2'"
}