Tag Archives: install

Installing Using Drupal book source on Dreamhost

USE THIS INFORMATION AT YOUR OWN RISK. Any information found on this website is offered only as informational and includes no warranty, guarantees or support. The author claims no authority on any subject whatsoever.

Using Drupal, 1st Edition by OReilly

Using Drupal, 1st Edition by O'Reilly

I just started reading the recently published book Using Drupal, 1st Edition, published by trusty ol’ O’Reilly and written by a bunch of Lullabots.

So far the book is great, but the instructions on setting up a dev environment aren’t exactly crystal clear for those completely new to Drupal. I thought I’d help out the next geek that bothers to GTS to find pitfalls before starting.

First review the preface section 2.7 ‘Downloading Drupal’. If you’ve never installed Drupal before, or any web application on a web server before, it’s a good idea to check out Lullabot Addison Berry’s very easy to follow video, Installing Drupal 6.

These instructions are specific to the context of a shared hosting account on Dreamhost, but may work for your environment as well. Be sure to review the book’s errata – the ‘confirmed errata’ will let you know about any code mistakes or problems with source discovered since the book was published. For troubleshooting help related to the books exercises and installation issues, review the Using Drupal book forum.

THESE INSTRUCTIONS MAY CAUSE YOUR DATAZ TO BE LOST. In addition to setting up things quickly, these steps include how to quickly delete all the stuff in your database, without bothersome ‘back up your data first’ steps. The idea is you are just creating a sandbox and nuking your install is no big deal.

Enough blab, let’s do this:

  • Create a subdomain for your dev environment like drupal.yourdomain.com
    • Dreamhost panel > Domains > Mandage Domains > Add New Domain / Sub-Domain
  • Create a new database (on a new or existing subdomain)
    • Goodies > Manage MySQL, scroll to the bottom where it says ‘Create a new MySQL database:’
    • Enter something in all the fields:database name must be unique system wide so get creative, create a new hostname like mysql.drupal.yourdomain.com, you can use your own username but I created a special username and password that I’ll also be using for the admin user in the Drupal install (note: dev enviro, not recc’d for production), you might want to put something to remind you what this is later in the comment field like “Sandbox for Using Drupal Book”.
    • Write down all that DB stuff so you can use it later.
    • Wait a while for new database host name and/or new subdomain to propagate.
  • Download the latest source from the book site.
    • Extract the zip somewhere you can find it, like your desktop.
  • Change the database connection string in using_drupal_source\drupal\sites\default\default.settings.php
    • Open default.settings.php with your favorite text editor
    • change connection string stored in $db_url (line 92 at TOW) from mysql://username:password@localhost/databasename to something like mysql://name:psswd@mysql.drupal.yourdomain.com/dbname
  • Copy default.settings.php in the same folder and call it settings.php
    • There should now be 2 files in the default folder
  • Save a backup copy of your default folder somewhere
    • I just copied the default folder and renamed it ‘_default’, or save somewhere on your hard drive, thumb drive, whatever…the point is, settings.php and default.settings.php that will soon live on your web server are going to change and you’re going to want these files again someday.
  • Upload the contents of using_drupal_source\drupal to the root of your new subdomain
  • chmod /sites/default to 777
    • On you web server (via your FTP client) navigate to /drupal/sites/default
    • If you’re using FileZilla, right click (ctrl+click for macs) the default folder and select file permissions, this will allow you to enter the numeric value 777 or just check read/write/execute for all roles
  • Open http://drupal.yourdomain.com

Installation profile options on successful install

Installation profile options on successful install

You’ll be prompted to select an ‘Installation Profile’. The book source code includes scripts to automatically install a site with assets and modules used in their examples for you. If you are just starting Chapter 2. where they send you off to the Appendix for installation instruction, chose the last option – the generic/basic Drupal install.

Here’s how to “start over” so you can use a different installation profile. These steps will cause you to lose any data you entered in Drupal – you will end up with a brand new install and a chance to chose a diferent installation profile:

  • Nuke all your database tables

    • Note I said ‘tables’, not the database.
    • Go to http://mysql.drupal.yourdomain.com (phpMyAdmin screen) and login
    • Select you Drupal database from the databases list at left (e.g. NOT information_schema)
    • Scroll to the bottom of tables listing page and select ‘Check All’, change the ‘With selected:’ drop down to ‘Drop’.
    • You will see a screen asking if you really want to execute this command. Click ‘Yes’.
  • CHMOD /sites/default to 777 again
    • On your web server, go to /sites/default
    • CHMOD default to 777 (again, because the previous install process modified the permissions) and be sure to check ‘recursive’ (or use -R on commandline) because there’s new files in there and we need to blow everything in the default folder away.
  • Delete everything in /sites/default
  • Put a clean copy of default.settings.php and settings.php in /sites/default
    • Remember that saved copy of default.settings.php and settings.php?
  • Go to http://drupal.yourdomain.com/install.php and start all over again :)

Bold moves in phpMyAdmin. Select all  drop.

Bold moves in phpMyAdmin. Select all > drop.

I hope that was helpful for someone. I remember all to well not even knowing what chmod was and trying to write perl scripts, ouch! As you might guess, with as much time as I spend documenting when I should be doing book exercises I don’t really have time to offer support, but please let me know if anything I’ve written here needs to be corrected or elaborated on. Have fun in Drupal land!

Installing Netbeans PHP IDE on Ubuntu

Lizard Steals Green Bean

Nothing amazing going on, just a few tips that might save you some time:

  • You need java runtime installed and working, prolly apt-cache search to make
    sure you’re putting in the most recent version (6 as of this writing)

    • sudo apt-get update
    • sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-font
  • The netbeans in the repo is for the Java IDE, so don’t bother with apt-get
  • Download the install file here: http://www.netbeans.org/downloads/index.html
    • Be sure to pick the PHP bundle
  • If clicking on the netbeans-x.x-ml-php-linux.sh file gives you an error or tries to open in gedit or something, right-click > properties > permissions and check ‘allow executing file as a program’
  • Select Run (not ‘Run in Terminal’), running in terminal will throw some GTK errors

Next you might want to head over to the Netbeans website and watch the intro vid and orient yourself to the plethora of PHP-centric features.

As fair newb to programming in PHP I can’t say I’m qualified to suggest an IDE. So why Netbeans? It’s free. It porvides syntactic and semantic code highlighting for PHP and debugging through Xdebug. Folks in my Seattle PHP meetup group who know a lot more about programming than I do seem to really like it, every time I go to install Eclipse I am daunted by the website, instructions and innumerable options. Finally, it was recommended in the recent Smashing Magazine article The Big PHP IDE Test: Why Use One And Which To Choose (2009.02.11) so I stopped resisting.

Do you like it, recommend others over it?

Drupal 5.x on Ubuntu LAMP

The quick and dirty dev install of Drupal on Ubuntu

USE THIS INFORMATION AT YOUR OWN RISK. Any information found on this website is offered only as informational and includes no warranty, guarantees or support. The author claims no authority on any subject whatsoever.

Why Drupal, Why Ubuntu?

For me it's all about community. I've always enjoyed apache web development in part because of the active and helpful user groups, forums, irc channels, etc. I use Ubuntu as the operating system for my LAMP because it's really popular right now - it has a very active forum and pretty good documentation. Drupal is an open-source content management system, or you could look at it as a framework since it was built to make it easy for coders to override almost anything it does without hacking the core. This means you could make it do anything you want if you happen to be good enough at PHP and still take advantage of core development and security updates no matter how much you modify the product.

Why write installation instructions?

Good question? Well, the installation instructions at Drupal.org are good but they cover all sorts of environments (who wants to slog through all that?) and those in the Ubuntu Community Docs are great and pretty specific but cover Drupal 4.6.7 and 5.1. I probably should update the docs at Ubuntu, perhaps I will after I hash it out here and after a few people let me know they worked or what to change. Also, I like to search for instructions specific to my situation whenever I approach a new installation. It's good to see what other people in similar circumstances have encountered, I call it due diligence. I would suggest any user doing this install review the documentation mentioned above thoroughly. Also see related links at the end of this article.


These instructions don't cover the setup of your server environment. Mine happens to be:
  • Ubuntu 6.06 LTS server
  • Apache
  • PHP 5.1.2
  • MySQL 5.0.22

Get Drupal

wget http://ftp.drupal.org/files/projects/drupal-5.7.tar.gz
tar -zxvf drupal-5.7.tar.gz

I'm a big fan of apt-get but there were a lot of issues in the forum started by people having problems with Drupal in the repositories. Community Docs recommend getting the latest package from Drupal.org, right now that happens to be Drupal 5.7. (Drupal 6 is out now as well, and is very cool, but CCK/Views aren't ready for prime-time and I'm installing for the purposes of following tutorials written for 5.x.)

Move Drupal

sudo mkdir /var/www/drupaltest
sudo mv drupal-5.3/* drupal-5.3/.htaccess /var/www/drupaltest
sudo mkdir /var/www/drupaltest/files

My apache install is pretty much setup to default config. /var/www is my web root, yours may vary. Because I'm just using this particular install as a test which I plan on destroying later I'm going to put it in the boring old subdirectory 'drupaltest', actually I named mine d57_test_01 but thought drupaltest would be more comprehendable in the example.

In the mv command we explicitly move .htaccess because it's a hidden file.

Database Setup

mysqladmin -u root -p create db_drupaltest
mysql -u root -p

Create the database for Drupal to use - you can replace 'db_drupaltest' with whatever you'd like to call the database. You'll need to enter your mySQL root password. If you get an access denied error make sure you're using the mySQL root password and not your login or Ubuntu root password. The second command puts you in mySQL monitor, the command line interface for managing your MySQL server. The commands in the next code section are SQL. You could also run this in phpMyAdmin if you'd rather have a GUI.


Change the datebase name, the username 'drupal_usr' and 'secretpassword' to whatever you like. Just don't forget to write it down somewhere safe because you'll need to know it later.

Edit Settings.php

sudo vi /var/www/drupaltest/sites/default/settings.php

Using vi (or whatevs) change the $db_url line. Note: If you use a fancy charcters or dashes in your user, password or database names replace them URI hex encodings, this is detailed in database settings comments section in the settings.php file.


Up Your PHP Memory Allocation

If you have a new LAMP install the default memory setting for scripts is 8M. This is redonkulous and Drupal will suck. Look for the 'Resource Limits' section and change memory_limit to 32M and then restart apache.

sudo vi /etc/php5/apache2/php.ini sudo /etc/init.d/apache2 restart

Final Steps

Go to http://localhost/drupaltest/install.php (or your servername instead of localhost if DNS is setup). You should see this:

Screenshot of Drupal Installation Message

One last thing, if you click Administer you will probably get a 'one or more problems were detected' error message. Two things: your files directory isn't writable and you cron job hasn't run. The first one is easy - just make the files area writable by all:

sudo chmod 777 /var/www/drupaltest/files

As for cron, you can just click 'run cron manually' on the Status report page - but you'll need to do this anytime you want to update the index. For a quick dev install you're likely to trash soon it may not be necessary but for a production or long-term dev install you'll want to set up a cron job to hit http://localhost/drupaltest/admin/logs/status/run-cron every few minutes depending upon your site's traffic and requirements. See Configuring cron jobs in Drupal's Getting Started guide for more.

That's it. Good luck folks, now enjoy surfing the Drupal learning curve...heheh.

Related Links