Installing Drupal 7 on the XO
I've seen a few other Drupal/XO installation tutorials around -- here's my documented effort to get Drupal 7 running on the XO...
Here are the steps I followed to get a Drupal 7 installation up and running:
- Open the 'Terminal' activity:
Because of the memory limit issues, it's best to not open any other activities during installation. When I ran into memory issues anyways, I had the best luck when doing a reboot, then reopening Terminal and trying again. - Install the necessary software:
Fortunately, yum is already installed, and all the necessary packages are available. Runningsudo yum install php php-gd php-mbstring php-pdo php-xml httpd cvs lynxwill install all of the necessary dependencies.One issue that cropped up for me here was the following yum error:
error: Couldn't fork %post: Cannot allocate memory. I fixed this by runningsudo yum reinstall [packagename]for any of the packages that threw the error. - Download Drupal 7:
At the time of this writing, there is no official Drupal 7 branch, so I used the latest CVS code:
cd /var/www/html
sudo cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal checkout drupal - Create settings.php and make it writeable to the webserver:
sudo cp /var/www/html/drupal/sites/default/default.settings.php /var/www/html/drupal/sites/default/settings.php
sudo chmod 666 /var/www/html/drupal/sites/default/settings.php - Edit the webserver configuration:
Open the configuration file withsudo vi /etc/httpd/conf/httpd.conf
Edit the following:- In the <Directory "/var/www/html"> section, change "AllowOverride None" to "AllowOverride All"
- In the <IfModule prefork.c> section, change the following settings to have a value of 2: StartServers, MinSpareServers, MaxSpareServers (I found this helped a lot with reducing the memory footprint of Apache -- the XO really isn't built to be serving 100's of pages per second, anyways!)
- Edit the PHP configuration:
Open the configuration file withsudo vi /etc/php.ini
Set the following parameters to the indicated values:- memory_limit = 64M
- max_execution_time = 120
- max_input_time = 240
The last two settings adjustments helped overcome script timeout issues during the install.
- Create permanent a log file directory:
The default logging directory for the webserver is /etc/httpd/log, which is symlinked to /var/log/httpd. For some reason, the XO kept deleting /var/log/httpd, so I decided to just move the logging to /etc/httpd/log for real:
sudo rm /etc/httpd/log
sudo mkdir /etc/httpd/log - Start the webserver:
sudo service httpd start
If all goes well you should see a nice green 'OK' appear. - Start the installer via the lynx web browser:
lynx http://localhost/drupal
I chose to use lynx because the 'Browse' activity really sucked up a lot of memory, resulting in repeated failures in the installer. lynx is a nice light text browser, and did the job just fine. - Select the minimal Drupal install profile, and the language:
The minimal profile was the safest path to get Drupal up an running, as it's the least work that the installer has to do. - Select SQLite as the database:
I initially tried to get MySQL working, but to no avail. The software installed ok, and installed the base tables, but would fail for some unknown reason when I tried starting it. SQLite is installed by default on the XO, and is a great lightweight solution. - Select the database file:
Make sure you specify a full path to the database file (ex. /var/db/drupal.db), and make sure that the user who is running the webserver (apache by default) has write permissions on the directory that contains the database file.It's not necessary to actually create the database file now -- the Drupal installer will create it for you.
Leave Username and Password blank, as these are not necessary with SQLite.
- Save the settings, and refresh the installer until it completes:
Another tricky thing is that the Drupal installer, when it doesn't have JavaScript available, sets an auto-refresh on the page to run the multistage installer. However, lynx doesn't do auto-refresh -- you have to manually refresh the the installer progress page until it completes. This is accomplished by simply hitting the Enter button each time the previous page request completes. You'll see the installer slowly moving through the progress bar -- just keep manually refreshing until you get to the installation complete page. - You're done!
Follow the instructions on the installation complete page to finish up the initial install, then enable any other core modules you wish.
Here are some lingering questions I have -- hopefully somebody more familiar with the XO can help out answering these:
- Is it possible to shut down the GUI and just use CLI during the installation? I think this could alleviate all the nailbiting surrounding memory issues during the install process.
- How would it work to make Drupal into an activity? This would be the smoothest way to do an install. It seems best to have some of the software dependencies become their own activity (the webserver and CVS, for example), and Drupal could depend on these activities.

