#!/bin/sh -x # script by Stephanie Booth aka bunny http://stephanie-booth.com/ to install wordpress automatically (geeky, but useful for mass installs), with help from many people: drauh, io_error, zedrdave, roddie... and all those I've forgotten to mention. # variables: $1 whatever, $2 wp_user, $3 wp_pass, $4 root password # prerequisites: an existing mysql db, and a root password # care! .htaccess is not generated, needs to be done manually, by clicking on "Update Permalinks" in Options once everything is installed # todo: add themes, check plugin list, make wrapper script for multiple installs, prepare php patch template for options and common stuff, see if the script can edit the vhost conf files for mass installs, prepare alternate version for French, add bilingual plugin and maybe cache. Add an extra user to the WP install. Also an alternate version for upgrading the school blogs. # set database name to user name and other stuff (config) d="wp" # database name pass=$4 # your mysql root password rkuser="rkuser" # user with privs on ref karma tables rkpass="rkpass" # password for above user url="http://test.swissblogs.com" # this will change a lot depending what you are using the script for, basically it's the url the blog will have title="Mon weblog de test" # your title here u=$2 # the mysql user p=$3 # the mysql user's password adminmail="edublogs@gmail.com" # administrator e-mail for the weblog directory="wordpress" # name of the directory the wordpress install will live in # files to wget wpress="http://wordpress.org/latest.tar.gz" # testing -- comment this out if you're starting on a clean system sudo rm -rf wordpress # do dirty mysql stuff first echo GRANT ALL PRIVILEGES ON $d.* to \'$u\'@\'%\' IDENTIFIED BY \'$p\' WITH GRANT OPTION\; | mysql -u root -p$pass # clean previously installed stuff -- comment this out if you're starting on a clean system cat < wp-config.php # get plugin manager in there chmod -R 777 wp-content cd wp-content wget http://wp-plugins.net/wp-plugin-mgr.zip unzip wp-plugin-mgr.zip mv wp-plugin-mgr-plugin/put_into_wp-root/wp-plugin-mgr.php ../ mv wp-plugin-mgr-plugin/wp-plugin-mgr-plugin.php plugins rm -rf wp-plugin-mgr* # get ref karma wget http://wp-plugins.net/downloads/ref-karma.zip unzip ref-karma.zip mv ref-karma/* ./ rm -rf ref-karma rm -rf __MACOSX rm ref-karma.zip cat rk_settings_sample.php | sed -e "s/_NAME.*$/_NAME\', \'$d\'\);/" | \ sed -e "s/_USER.*$/_USER\', \'$rkuser\'\);/" | \ sed -e "s/_PASSWORD.*$/_PASSWORD\', \'$rkpass\'\);/" | \ sed -e "s/_configure.*$/_configure = false;/" | \ sed -e "s/_config_pwd.*$/_config_pwd = \"spamaway\";/" | \ sed -e "s/_blacklist\ =.*$/_blacklist = true;/" | \ sed -e "s/rumplestiltskin/whatever/" > rk_settings.php # we want backup mkdir backup chmod o+w backup touch backup/index.html cd plugins wget http://boren.nu/downloads/wp_backup.tar.gz tar -xzvf wp_backup.tar.gz mv wp_backup/backuprestore* ./ rm -rf wp_backup* # install wordpress (a few wgets) wget -q $url/wp-admin/install.php?step=1 wget -q $url/wp-admin/install.php?step=2 # spam karma, quick! wget -O spam-karma2.zip http://wp-plugins.net/downloads/sk2_pre_alpha.zip unzip spam-karma2.zip rm spam-karma2.zip # more dirty sql (set options, fix privs so that the current user can only do stuff on his tables -- allows different people to live side-by-side in the same db, sharing RK) cat < wp-plugin-mgr.php.tmp mv wp-plugin-mgr.php.tmp wp-plugin-mgr.php wget -q $url/wp-plugin-mgr.php # 1-click install some plugins wget -q $url/wp-plugin-mgr.php?oneclick_id=120 # theme manager wget -q $url/wp-plugin-mgr.php?oneclick_id=98 # bunny's technorati tags # put security back in place cat wp-plugin-mgr.php | sed -e "s/get_currentuserinfo(); \$user_level=8;/get_currentuserinfo();/" > wp-plugin-mgr.php.tmp mv wp-plugin-mgr.php.tmp wp-plugin-mgr.php # plugin options page bug cd wp-admin wget -O bugfix.zip http://ericanderson.us/wp-content/ea.us/files/wordpress-1-5-menu-header-fix.zip unzip -o bugfix.zip rm bugfix.zip