Burn a searchable site to CD using Server2Go

Server2Go is a Webserver that runs out of the box without any installation and on write protected media. This means that you can use Server2Go to develop your Drupal site locally (or copy over a Drupal site you have already made) and then burn it to a CD. The CD version will be fully searchable and will run all Drupal’s php magic!
The clever part is that Server2Go copies all the databases to a temp folder once the CD is launched. This means your Drupal site will behave as if it is live so it can be searched etc. However, although you can also add content to the site when it is launched from the CD this will obviously not be recorded to the CD as the CD is read only! The next time you launch the CD you’ll be back with your original burnt site.
This tutorial is quite long, but the result is worth it in the end.
  1. Download server2go mini package (NOTE: this tutorial has only been confirmed to work with the mini package [Apache 2.0.61], the package with the latest version of Apache did not work)
  2. Unzip where you want it. The folder will be called ‘server2go_a2_psm_mini’. In this tutorial we will rename the folder ‘Drupal_S2G’ to make file addresses easier to write out.
    Check Server2Go is working by double clicking the Server2Go.exe file. You should get the splash screen saying “congratulations….” opening up in Internet Explorer.
  3. OPTIONAL STEP. You can skip this step if you can assume that anyone launching your site on CD will be happy using Internet Explorer. However, you can have Portable Firefox as the browser included on the CD. To do this:
    1. Download the latest version of Portable Firefox (tested working with Firefox 2 and 3).
    2. Install Portable Firefox in the ‘Drupal_S2G’ folder (click on ‘Browse’ to locate the folder on your computer).
    3. Launch Portable Firefox by clicking on FirefoxPortable.exe in (Drupal_S2G > FirefoxPortable). You can choose to disable session store. You can choose a blank page as the firefox home page in ‘Options’ and hide the Bookmarks Toolbar so you have a cleaner looking browser window when it launches. Close Portable Firefox. Opening and closing the application is important!
    4. Go to (Drupal_S2G > FirefoxPortable > App > firefox) and rename firefox.exe to ffp.exe IMPORTANT: Leave the FirefoxPortable.exe in (Drupal_S2G > FirefoxPortable) unchanged!
    5. Create a file FirefoxPortable.ini in (Drupal_S2G > FirefoxPortable). You can use a program like Notepad++ to do this.
    6. Paste the following in the file:
      [FirefoxPortable]
      FirefoxDirectory=Appfirefox
      ProfileDirectory=Dataprofile
      SettingsDirectory=Datasettings
      PluginsDirectory=Dataplugins
      FirefoxExecutable=ffp.EXE
      AdditionalParameters=
      LocalHomepage=
      WaitForFirefox=true
      DisableSplashScreen=true
      AllowMultipleInstances=true
      DisableIntelligentStart=false
      SkipChromeFix=false
      SkipCompregFix=false
      RunLocally=false
      NOTE: THESE SETTINGS ARE FOR SITE DEVELOPMENT. THEY WILL NEED TO BE CHANGED WHEN BURNING THE SITE TO CD (see instructions below).
    7. Open the pms_config.ini in (Drupal_S2G) and change the following:
      [line 52] BrowserType=PORTABLEFIREFOX
      [line 56] BrowserPath=FirefoxPortable/FirefoxPortable.EXE
    8. Check it works by launching the Server2Go.exe
  4. Change the following settings in the pms_config.ini file in (Drupal_S2G) the main folder (use a program like Notepad++ to change it):
    1. [line 21] StartLocal=1 (this is for using when you want to develop the website and have to write files. If you want to use server2go to run off a read-only CD at a later point, you will have to change it back to =0)
    2. [line 61] BrowserSize=MAXIMIZE NOTE: INTERNET EXPLORER ONLY. IGNORE IF USING PORTABLE FIREFOX
    3. [line 69] LocalMirror=0 this is so that the things you do to build your site are saved rather than carried out in a temporary folder
    4. Make a note of this value: ‘HostName=127.0.0.1’ [line 33] and this ‘MySQLPort=7188’ [line 80] as we need them later.
  5. Make the following changes in (Drupal_S2G > server > config_tpl > php.ini)to make sure Apache has the right settings to run Drupal, and can provide clean-urls:
    1. [line 201] max_execution_time = 60 (instead of 30)
    2. [line 202] memory_limit = 64M (instead of 8M)
  6. Change the following setting in (Drupal_S2G > server > config_tpl > httpd.conf)
    1. [line 164] Remove the ‘#’ so it reads LoadModule rewrite_module modules/mod_rewrite.so
  7. Download Drupal 6.X (latest version) and unzip it into the htdocs folder. You can unzip it so that it sits in a folder inside the htdocs folder. This means you’ll have a folder inside htdocs called ‘drupal.6.4’ or something similar.
    NOTE: YOU CAN IMPORT A SITE YOU HAVE ALREADY DEVELOPED. SEARCH THE DRUPAL HANDBOOK FOR ADVICE ON IMPORTING A DRUPAL SITE TO A LOCAL INSTALLATION.
    You can rename it to anything you want, but in this case we’ll call it ‘drupal’ so all Drupal’s files will sit in (Drupal_S2G > htdocs > drupal )
  8. Do the things the Drupal set up will tell you to do which are:
    1. Create a folder called ‘files’ in the main drupal folder i.e.(Drupal_S2G > htdocs > drupal > files)
    2. Create a ‘modules’ folder and a ‘themes’ folder in the default folder, this is where you will place your add-on modules and themes i.e. (Drupal_S2G > htdocs > drupal > sites > all
      > modules
      ) and (Drupal_S2G > htdocs > drupal > sites > all > themes)
    3. Copy the default settings file and rename it settings i.e. copy (Drupal_S2G > htdocs > drupal > sites > default > default.settings.php) and paste it in the same folder,
      re-naming it to settings.php
  9. Now we’re going to add the database that Drupal needs to run.
    1. Start server2go.exe in the ‘Drupal_S2G’ folder. It should open up the Server2Go start-page in a new browser (Internet Explorer if you didn’t do the Firefox Portable Apps change)
    2. Go to the phpmyadmin link under ‘Tools’ on the right-hand side.
    3. Click on priveleges
    4. Click on ‘Add user’
    5. Under username put ‘admin’ (or whatever you want to call your user); set ‘host’ as ‘local’ and set your own password (write it down!)
    6. Under database for user choose ‘none’
    7. Under ‘global priveleges’ click on ‘check all’
    8. Click on ‘Go’. You should get a message saying ‘You have added a new user’
    9. Click on the databases link and you’ll see a box at the bottom of the page that says ‘create database’. Put in the name of your database. Let’s call it ‘drupal’ and press ‘create’. You should get a message saying ‘Database drupal has been created.’
    10. Click on the picture of a house to go to the phpmyadmin home page. Then select ‘databases’ and click on ‘drupal’.
    11. Click on the ‘priveleges’ tab at the top of the page and check that ‘admin’ is one of the users listed as having access to the database. All done!
      NOTE: READ OTHER DRUPAL HANDBOOK INFORMATION ABOUT SECURITY AND CREATING DATABASES. THIS IS A QUICK METHOD AND NOT NECESSARILY VERY SECURE…
  10. Now we’re going to set up Drupal. Go to http://127.0.0.1:4001/drupal/ (or
    http://127.0.0.1:4001/whatever-you-called-the-folder-you-unzipped-drupal…) and you should see the Drupal set-up page.
    1. After you’ve selected which language you are installing Drupal in, you will be asked to fill in the database details. In our case the database name is ‘drupal’; the database username is ‘admin’; and the password is whatever password you chose.
    2. Click on the ‘Advanced options’. In ‘Database host’ put: 127.0.0.1 and in ‘Database port’ put 7188, the settings we noted earlier.
    3. Save and continue.
    4. Follow all the rest of the stuff as in the Drupal Handbook.
    5. As you’re installing on a local site, you’ll probably get this message:
      warning: mail() [function.mail]: Failed to connect to mailserver at “localhost” port 25, verify your “SMTP” and “smtp_port” setting in php.ini
  11. To check everything works, add some test content to your site and then close the browser. Restart Server2Go.exe once the server has shut down. If your content is there, bingo! It works!
Settings for burning site to a CD
If you want to run some tests without wasting loads of CDs you can create an ISO of your files (you should be burning all the files INSIDE ‘Drupal_S2G’ and not just copying the ‘Drupal_S2G’ folder itself onto CD, otherwise the autorun will not work) by using software such as PowerISO (the free version will create ISOs up to 300MB in size, which should be enough for testing).
There are lots of nice settings to change, including the splash screen (Drupal_S2G > splash.png) which you could replace with any graphic you like and you can even change the name of the server i.e. replace ‘Server2Go’ with ‘My Drupal Site on CD’. See the Server2Go website for more info. The following settings MUST be changed to make your site work on CD
  1. In the pms_config.ini file in the (Drupal_S2G) folder:
    1. [line 21] StartLocal=0
    2. [line 39] DefaultFile=drupal/ (or whatever the folder is called where you have your drupal files. Don’t forget the trailing slash)
    3. [line 69] LocalMirror=1
    If you are using Firefox portable, you will also have to change the following. Annoyingly, you can’t be running firefox already when you start the CD and closing the browser will not shut down the server, this has to be done from the tray icon instead.
  2. In the pms_config.ini file in the (Drupal_S2G) folder.
    1. [line 14] KeepRunningAfterBrowserClose=1
    2. [line 17] ShowTrayIcon=1 (you need this to be able to shut down the server once you’ve finished with the CD).
  3. In the FirefoxPortable.ini in (Drupal_S2G > FirefoxPortable ):
    1. AllowMultipleInstances=false
    2. RunLocally=true
Comments welcome on this as the method has only been tested briefly.