Automating SMF forum installation


I decided to look at SMF instead of phpBB as the forum of choice because SMF has OpenID support built in already.

Just like I did previously for Mediawiki, I also plan to create a puppet recipe to install SMF. The first step is to automate the installation from the commandline. Just like MediaWiki, SMF expects you to surf to your freshly unpacked software and fill in some required fields. It will then create a configfile and database and such.

This is the process I used to do everything from commandline:


cd /tmp/
wget http://www.simplemachines.org/download/index.php/smf_2-0-beta3-1p_install.tar.bz2
mkdir /var/www/planet/planet.blabla.be/html/smf
cd /var/www/planet/planet.blabla.be/html/smf
tar -xjf /tmp/smf_2-0-beta3-1p_install.tar.bz2
chmod a+rw * ### This is obviously bad, but I'm too lazy to pick the files that I need to chmod at the moment


Create a file bla1.php:

<?
$_GET["step"] = 1;
$_SERVER["HTTP_HOST"] = "planet.blabla.be";
$_SERVER["PHP_SELF"] = "/smf/install.php";
$_SERVER["HTTP_USER_AGENT"] = "installer";
$_POST["mbname"] = "My Community";
$_POST["boardurl"] = "http://planet.blabla.be/smf";
$_POST["compress"] = "on";
$_POST["dbsession"] = "on";
$_POST["db_type"] = "mysql";
$_POST["db_server"] = "localhost";
$_POST["db_user"] = "root";
$_POST["db_passwd"] = "";
$_POST["db_name"] = "smf";
$_POST["db_filename"] = "smf_12e728c1c8";
$_POST["db_prefix"] = "smf_";

include "install.php"; ?>


create a file bla2.php:

<?
$_GET["step"] = 2;
$_SERVER["HTTP_HOST"] = "planet.blabla.be";
$_SERVER["PHP_SELF"] = "/smf/install.php";
$_SERVER["HTTP_USER_AGENT"] = "installer";
$_POST["username"] = "xxx";
$_POST["password1"] = "xxxx";
$_POST["password2"] = "xxxx";
$_POST["email"] = "[email protected]";
$_POST["password3"] = "";

include "install.php"; ?>


Execute the scripts:

php bla1.php
php bla2.php


Enable OpenID:

echo "INSERT INTO smf_settings VALUES ('enableOpenID','1');" | mysql smf


Finish installation by removing some files:

rm -f install.php bla1.php bla2.php