Drupal
From DreamHost
(DH Customers can request that Drupal be added to the one-click-installs panel by voting here) Go here for Drupal Troubleshooting.
Drupal is a full Content Management System (or CMS) that can be deployed with any number of purposes. It has been developed as an open-source project and released under the highly open GPL license. As such it is free both as in beer and as in speech. Drupal prides itself on being a system wherein the openness allows any developer to easily add what she needs using modules, effectively creating an infinite platform for expansion and growth. It is written in the PHP scripting language.
[edit] Drupal adoption advice
Drupal is a highly flexible and powerful tool and as such should be used by those with knowledge of HTML, web applications and at least a vague notion of how Databases (such as MySQL) function (as usual you don't have to actually know PHP and SQL to make it function but a working knowledge of PHPMyAdmin, the mysql GUI application is helpful if not mandatory for using Drupal.)
If your goal is simply to maintain a blog (or weblog, something Drupal is quite capable of) you might consider using a simpler and more targeted application like WordPress, which will be less confusing and more stable due to its simplicity (as well as being a "One-click install" from your Dreamhost panel).
[edit] Standard Drupal Features (as of 4.7.x)
Drupal is highly modular; most of Drupal's user-visible features are written separately from the codebase. This section lists the functionality provided by the modules included in the latest Drupal release by default. The features provided by your Drupal system can easily be expanded by adding or writing other modules.
- Users (scalable user structure)
- Forums
- Blogs (per user or collective)
- Articles
- Static pages
- Collective Book Writing.
- Taxonomy (categories)
- File-attachment on posts.
- International interface translations.
- Multi-language support.
[edit] Drupal 6 Installation
As of April 10, 2008 Drupal is in version 6.2. This is the easiest version of Drupal ever. It includes a screencast for installation. Directions for upgrading from version 5 to version 6 also include a detailed screencast. Detailed instructions for installing earlier versions specific to Dreamhost are below. You can either install version 6 directly, or install an earlier version and then upgrade to the latest version.
WARNING: You may get the following error during installation: "Failed to connect to your MySQL database server. MySQL reports the following message: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)." First, try the following: click the Advanced tab and change the server from it's default "LOCAL" to the actual mySQL user hostname, such as example.example.com. If that doesn't resolve your problem, chill out and come back to it a short time later. It may simply be that the server is overtaxed at the time and will function properly when the heavy use period has subsided.
[edit] Drupal 4.7.3 or 5.0 Installation with Dreamhost
[edit] Drupal 5.0 Update
Drupal now has an installation script which makes installation much easier. The installation instructions for Drupal 5 are not too bad and include some warnings for new users. However, the user base for Drupal is an intermediate to expert crowd and as such some of the documentation is not oriented to the n00b in all of us.
For Dreamhost installation of version 5, Complete steps 1, 2, and 4 below. Step 3 (modifying settings.php) should not be completed as with earlier versions of Drupal. Note: However, you do need to edit your settings.php and set the $base_url variable to your domain. Read more here: [1]
- Now, point your browser to your newly installed site (i.e. www.mynewsite.com). The page there contains a form for you to enter the database and first user settings for your site.
- Also on the first configuration page, ensure you cick the Advanced tab at the bottom of the page and enter your mysql hostname (mysql.mynewsite.com, or wherever the database is located).
- The script will then configure your settings.php file, essentially doing steps 3,5, and 6.
- You will shortly get a status page that will confirm the successful configuration of your site.
- Follow step 7 in the section below on configuring the .htaccess file, if desired
- Follow the instructions given in the Drupal Cron Jobs section to configure the required crontab settings.
- The new site is now ready for logon and configuration!
If you want to install version 4.7.3 instead, the instructions below should thoroughly cover every single action necessary to get it up and running. If anything is missing and you figure it out, add it for the next person!
[edit] Step 1: Set up the MySQL database using Control Panel
- Log into the Account Control Panel, select the Goodies tab, and click on the Manage MySQL link.
- At the top of the screen is a panel where you can input the information to create a new database.
(Remember: You will need all of this information later!)
- DB name
- Give your database a name. The name may contain only letters, decimal numbers, and the characters $ and _ and must be unique across our entire system. (consider maybe naming your db yourwebid_dbname, here yourwebid_drupal would work great)
- DB Hostname
- You will access your database via a subdomain. Give your mysql subdomain a unique name (Remember NOT to use a subdomain you plan to use for the site. Thus, drupaldb.yourdomain.com would be better than drupal.yourdomain.com)
- DB Username
- The unique username you will use to access your MySQL database
- DB Password
- The password you will use to login to MySQL
- Click Add New Database Now! Dreamhost claims the MySQL setup takes 5-10 minutes, follow step 2 while you wait!
[edit] Step 2: Download Drupal from their site.
There are other ways to do this but this one insures you have the newest version.
Go to the drupal project page within the drupal site at http://drupal.org/project/drupal, and download the most recent version (click on "download latest release") to your computer.
Unzip the files as necessary. (They are in a .tar.gz GZip file.)
- Under Linux or Mac, the extraction should be seamless (naturally).
- Linux command-line example:
$ tar zxvf drupal-5.3.tar.gz
- For Windows, use Winzip, Win-GZ, or visit the gunzip page.
[edit] Step 3: Edit SETTINGS.PHP
- Within the Drupal folder you just downloaded open the file called settings.php (it can be found in /sites/default/settings.php)
- Be careful to use a simple text editor like Notepad on Windows and TextEdit (be sure to set it to "plain text" using the format menu) on Mac OS. Any rich text or full word processor will add things into the document and corrupt it.
- Within the document you will have to edit two lines, $db_url and $base_url
- $db_url should look like this in the file:
$db_url = "mysql://username:password@localhost/database";
- you will have to replace the words there with the names you chose while setting up your MySql database with Dreamhost. Using the names from the DreamHost setup process (STEP 1) the $db_url line should be this:
$db_url = "mysql://DBUSERNAME:DBPASSWORD@DBHOSTNAME/DBNAME";
- so, in all likelihood, it should end up looking like this (though not necessarily, USE THE NAMES YOU GAVE YOUR DATABASE IN STEP 1):
$db_url = "mysql://yourname:password@drupaldb.yourdomain.com/yourwebID_drupal";
- $base_url is easier. It needs to be set to the url where your Drupal site will be found. Initially it looks like this:
$base_url = "http://www.example.com";
- Just change the url to reflect where your site will be found:
$base_url = "http://www.yoursite.com";
or
$base_url = "http://www.yoursite.com/drupal";
or whatever else it might be.
- Make sure to un-comment the $base_url line in the settings.php file. It is commented out by default
- Note that the $base_url should probably be the same as the directory on your site where the Drupal installation will be found (see next step)
- Warning! With the installation of PHP5+, the themes of pushbutton and bluemarine will not work without some work on your part. You will have to edit the $conf array at the bottom of settings.php. Just remove the '//' at the beginning of the five lines and change the theme_default to marvin.
- Also note that multiple sites on one installation are possible but complicated. See the official Drupal documentation for more details.
- Save the file in the same place where you found it.
[edit] Step 4: Upload the Drupal Files to your Server
It seems likely that most people know what FTP is and how to use it if they already have a website (even one hosted with DreamHost). If you are unsure or unconfident about the process and software involved see the FTP page on this wiki for more details.
- Upload all the contents of the drupal folder you dowloaded (along with the edited settings.php file) to the place on your server where you want drupal to sit. This can be the root of your domain (www.yoursite.com) or a folder (www.yoursite.com/drupal) or subdomain or whatever, as long as it is in the place/url indicated in the previous step.
- You should also create a folder within the Drupal main folder on the server called /files/ and chmod it to 777 (full write/read access). This folder will be used to store avatars and other files uploaded to Drupal by the users.
- Chmodding a file or folder should be pretty easy using any standard ftp interface. Note that the chmod of a file or folder is also called "permissions" and that there are often checkboxes as well as numbers (all boxes checked = 777).
(Note that, because DreamHost uses suEXEC, you should generally set your directory and file permissions to 755 even if applications' instructions say you should set them to 777. You *can* set the permissions to 777, via your ftp client program or via the command line in the shell, but this will create problems if you attempt to run any CGI programs from within that directory or if a CGI program file is set to 777.)
[edit] Step 5: Load the tables into your MySQL database
At this point, at least with version 5, you can just run the install.php script to finish up the rest of this process. Type http://www.yoursite.com/install.php (or wherever the root folder for drupal can be accessed at/install.php). Then create an admin user account and start administering. You will have to create a /files/ folder and set chmod to 777, as it says below.
I don't know why the Drupal guys never automated this process (WordPress has a great automated database install) but it's not that hard to do yourself.
The easiest method for loading the Drupal database is by using the instructions inside the compressed installation package. The filename should be similar to "INSTALL.mysql". You'll want to skip directly to step 2 because you should have already created and connected to your database through the DreamHost Control Panel. Using a SSH program like PuTTY navigate to your root Drupal directory and execute the following command:
mysql -u yourdatabaseusername -p -h yourdatabasehostname yourdatabasename < database/database.mysql
That's it! Your tables should now be loaded into the database.
You can also use the web-based control panel:
- Start by pointing your browser to the url of the "DB HOSTNAME" you set in Step 1. It will be a subdomain (like http://drupaldb.yoursite.com or whatever you called it). Note that it may take a few hours for the subdomain to be set up, so if you get a "server not found" error just try again a bit later.
- Log in to PHPMyAdmin using the username and password you set in Step 1.
- Select the "databases" link (between "storage engines" and "export")
- Select the drupal database you created from the list (there should only be the one).
- You should now see a blank page with several tabs on top. Click on the SQL tab.
NOTE: Loading a text file has now been moved to its own tab Import.
- Now we are going to load the tables into the database using the database.mysql file. It can be found in your Drupal directory in the /database/ folder.
- To do this click the "browse" button on the bottom part of the page and find the database.mysql file on your home computer in the Drupal folder you downloaded and open it.
- Click the Go button.
- Your tables should all be loaded into the database!
Now, having done all this, your database is ready for Drupal. You have all the files in the appropriate directory with the config.php file modified to suit your needs. You are ready to start the engines.
[edit] Step 6: Initialize Drupal and create Administrator Account
- Point your browser (preferably Firefox) at your drupal directory (the url of the site, not the database). Drupal should boot up with the default theme on and a page explaining that things are working smoothly and the first account has to be created.
- If any errors occur there should be some hints based on what you see when you try to load it up. I can't troubleshoot all eventualities here but remember that going through these instructions again will probably fix the problem.
- The first thing you will do here is "create the first account." The first account you create will be user #1, and by default will be an administrator with all privileges for this Drupal site. Be careful, this will be the main administrator account forever. You will probably want to go into your user profile quickly and change the password to something you will remember.
- Also, make a point of doing this asap after installation as anyone wandering in to the url could otherwise make themselves the administrator and give you a headache (as unlikely as that is).
[edit] Step 7: Edit Your .htaccess File
Drupal's initial settings can prevent access to your Dreamhost stats. As mentioned in the DH Knowledge Base, you can edit the .htaccess file and add these two extra rules in the main set to pass through the requests for /stats: (this bit of code must be at the top of your .htaccess file to work)
RewriteCond %{REQUEST_URI} ^/stats/(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/failed_auth.html$
RewriteRule ^.*$ - [L]
[edit] Step 8: Try and use the damn thing.
You should now have a fully functional copy of Drupal running on your Dreamhost account. Feel free to start experimenting with the different built-in themes and modules. There's hundreds of settings to flip on and off and hundreds more modules you can download from the Drupal site to have even more fun with.
[edit] Drupal Cron Jobs
This is something that many novice Drupal users (in fact many novice website designers/developers) have trouble with. Its a good idea to check out the Crontab page here on the wiki as a start, but here is some basic info you need to get the various Drupal Cron-Dependent stuff up and running (such as the search function).
- 1. Create a text file (name it crons.txt) with your cron job on the first line, it should read something like this:
0 2 * * * /usr/bin/wget http://www.yourdomain.com/cron.php
- Make sure that there is a line break at the end of your cron job, this lets it know that the job is over! Save the file as a text file.
- Specifically this tells the server to run "wget" every day at 2:00 am. The address at the end, tells it specifically to visit the cron.php file, which is where Drupal stores any cron job stuff (such as search indexing). You can read more about Crontab here on the wiki, especially if you would to change it to run weekly, rather then daily, or have run it at a different time.
- 2. Upload your text file to yourdomain.com/ via your FTP Program. It must be uploaded via ASCII mode, this should be automatic for most FTP Clients, but just double check to make sure!
- 3. Login to your account via SSH. Make sure that you have the permission to do so, via Dreamhost's Control Panel under the "Manage Users" section.
- 4. Type in:
crontab yourdomain.com/crons.txt
- Make sure your using the correct domain/folder for your site where crons.txt is located.
- 5. If all went well type in the following:
crontab -l
- If you see your cron job on its own line, then your done! Your Drupal Cron Job is now setup!
To "force" a cron job event for Drupal (such as on a brand new Drupal site), you can actually browse to the file manually via SSH using the following:
wget http://www.yourdomain.com/cron.php
If all goes well, then you won't see anything except for the file's name and some other information, but if you check your Drupal's Search Settings, it should show an increase in the amount of your site that has been indexed.
[edit] Removing Drupal from your Domain
To remove a Drupal installation from your domain, just delete all your Drupal related directories and files from your domain's space and, optionally, delete the database in the Control Panel. Dreamhost does not completely empty your directories even if your remove the hosting option. Should you later re-add the domain's hosting, any files yo had left in the directory could still be present.
A database created on DreamHost is never fully dropped using the Control Panel -> Goodies -> Manage MySQL screen. If you login to the host with the appropriate credentials, via phpMyAdmin or the shell command line, you'll still find your database. Dreamhost does not completely delete the database as the result of a Control Panel action. Be careful!
If you no longer want a database you have set up on DreamHost, and you have any sensitive data in the database that you want to obliterate, you might consider dropping all the tables from the database so that the data can not be viewed in this manner.
[edit] See also
- Drupal Troubleshooting
- Joomla!, another content management system (CMS) also used at DreamHost
[edit] External Links
- Drupal - Drupal's Main site.
- Download - Download page for Latest version of Drupal
- Handbook - Drupal's Official Handbook (not perfect)
- Forum - Drupal's forum, search before asking a question!
- Videos - Bittorrents for some videos of presentations at a Drupal Conference.
- Podcasts - Podcasts (video and audio) by Drupal developers Lullabot.
- Themes - Some preset themes that can easily be used in your Drupal installation.
- Building Online Communities With Drupal, phpBB, and Wordpress - Apress book showing users how to effectively configure and use all three applications
- Intro to Drupal - Intro to Drupal - An audio podcast by happy DreamHost client CreativeXpert. A great place to start.



