How do we keep this site running? This post may contain affiliate links — the cost is the same to you, but we get a referral fee. Compensation does not affect rankings. Thanks!
The purpose of this guide is to provide an easy to use, no hassle Drupal installation guide, regardless of the version you’re installing. Remember that Drupal is one of the more powerful CMS (Content Management Systems), and may not be as easy to use or install out of the box as say, the more popular WordPress blogging platform. But once you have Drupal installed and are comfortable using it, you’ll see that you have greater flexibility and power at your fingertips.
Drupal Install Walkthrough with mySQL, cPanel, and phpMyAdmin
This sample install guide uses mySQL 4.0, cPanel, and phpMyAdmin as its default install tools. You may need to adjust your steps accordingly for different software or versions.
The first thing you’ll need to do is head on over to Drupal.org and download the latest stable Drupal release (in a compressed format – for example .zip). Browser to where you downloaded the file and extract it to where you would like your Drupal installation to be. Note: for CVS testing please read the (link) CVS section below first to set up a version control environment.
Preparing your Server
Setting Email Addresses
Once you have registered your domain and gotten access to cPanel, log in, and make sure you have a default email address set, a catch-all address, and any forwarding addresses if necessary.
Setting up your Database and User
Next, click on “MySql Databases,” and under Databases: type in a database name after the Db: prompt and click on “Add Db.” So far so good? Next, type in a username and password in the Users: section and click on “Add User.” Finally, you are going to click on “Add User to DB” in the Databases: section, making sure that “Privileges: All” is checked (no other check marks necessary). You will then see the screen display connection strings – no need to write them down, but it is a good idea to write down your full username and database name (the names you chose are usually prepended by your hosting account username).
Running Drupal SQL commands in phpMyAdmin
The database and user privileges have now been created. In order to add the Drupal database structure we are going to access phpMyAdmin by clicking on “phpMyAdmin” on the bottom of the page. Once in the phpMyAdmin environment, click on your database name, and then in the navigation tabs on top click on “SQL.” Here we are going to browse for Drupal’s SQL file which contains a series of SQL statements that the server will run to produce Drupal’s database tables. Browser for the “location of the text file” to the directory where you extracted Drupal, and select the database file in the /database directory corresponding to your SQL version (often database.4.0.mysql). You can leave compression on “Autodetect;” click ‘Go’ and the tables will be created.
Prepare Settings File
You need to make some changes to the <root>/sites/default/settings.php file to let Drupal know where your database is and how to access it. Open the file and edit the following lines:
- $db_url = ‘mysql://username:password@localhost/databasename’; -> make sure you are using the line corresponding to your SQL version (mySQL is the default). Replace username and password with the username and password you wrote down when you setup the database. Remember that these are usually prepended by your hosting account username, for example: hostingname_username:password@localhost/hostingname_databasename. Make sure that the line is surrounded by single quotes and ends in a semicolon, or you will end up with the Drupal Unexpected T_CONSTANT_ENCAPSED_STRING error.
- # $base_url = ‘//www.example.com’; // NO trailing slash! -> this line is commented out in Drupal 4.7.0 and higher because it is no longer necessary – if the line is uncommented, or you can’t get your installation to work, fill in your domain name here.
Upload Your Drupal Files
You can use a version control system to see which files change in each version of Drupal. That way, you do not have to replace everything every time there’s a minor upgrade. If you are installing Drupal for the first time, simply upload the entire contents of the Drupal directory you extracted. Using the FTP access information given to you by your hosting provider, upload the files to your public_html (or www) folder on your domain’s server.
Install the First Account
Once your database is setup, settings file edited, and files are uploaded, browse to your new domain name. You will be shown a screen asking you to setup your first Drupal account. If you don’t see this screen, search the site using the search box on the left or browse directly to my listing of Drupal Error Messages to see if your error is listed. If not, search Google for “Drupal [insert your error message here]”. Once your first account is setup you are ready to setup your Drupal installation for general use.
Setting up Drupal for the First Time
I am going to walk you through a series of steps to get Drupal running with commonly used features and modules.
- In the left-hand column, browse to administer -> settings -> General settings and change “Drupal” to the name of your website. Next add a contact email address for your website.
- I recommend checking “Clean URL’s” for SEF (Search Engine Friendliness) purposes. In newer Drupal versions you will need to click on the “clean URL test” to see if your server configuration supports clean URL’s, before the clean URL button is enabled.
- Under Error Handling change Error reporting to “Write errors to the log” (you don’t want them written to the screen as everyone will see them – this is fine, on the other hand, in a local testing environment.
- Under Date Settings adjust to your local timezone.
- Under Site Maintenance you may want to check “Offline” until you are finished making changes. When the site is offline only user 1 (you, as administrator) has access to the site. If for some reason you log yourself out while the site is offline you can get back online by browsing to <root>/user and entering your username and password (the ones you signed up with as administrator – other users will not be able to sign in). Next edit the Site off-line message and change “Drupal” to your site’s name.
One of the great things about Drupal are its customizable themes. You can modify Drupal themes with simple knowledge of stylesheets. By browsing to administer -> themes you will see a list of the default themes installed. Feel free to select some of the alternate themes (bluemarine is the default – it is recommended to switch your site back to the default bluemarine theme during upgrades in case an upgrade creates an incompatibility with an alternate theme).
Click on configure next to the theme you’ve decided to use. This will give you access to theme-related settings, most of which are self-explanatory. You can set global settings that take effect when specific theme settings do not override them.
Installing Drupal Modules
Commonly Recommended Drupal Core Modules
Click on administer -> modules and select the following modules if they are not already selected:
- aggregator – for feed (RSS, Atom, etc.) support.
- comment – allows users to post comments.
- forum – enables users to post in threaded forum discussions.
- menu – enables users to customize the site navigation menu.
- page – enables the creation of pages that can be added to the navigation system.
- path – allows users to rename URLs. Combined with the pathauto module this is important to creating SEF (Search Engine Friendly) URL’s. You will be able to create a path alias so your page will look like directory/page-title instead of directory/node/2.
- search – enables sitewide key searching. For those having trouble configuring, or have never heard of, cron, we will be installing poormans cron (below) to work with this.
- statistics – logs access statistics for your site.
- story – allows users to submit stories, articles or similar content.
- taxonomy – enables the categorization of content.
- tracker – enables tracking of recent posts for users.
- upload – allows users to upload and attach files to content.
How to Obtain and Install Contributed (Addon) Modules
In order to get the most out of your Drupal installation, I recommend installing the following addon modules. First, I’ll show you the basics on how addon modules (contributed modules) are installed.
Obtaining Addon Modules
Browse to Drupal Modules and select the modules you are interested in (some basic recommended ones will be discussed below). Download the version corresponding with your version of Drupal and extract and upload the module directory into your <root>/modules/ folder.
Installing Addon Modules
Some modules install without database support. For those that do not, access phpMyAdmin (as described above), click on SQL again, and this time browse to your module’s (ie. module.mysql) file (in <root>/modules/) and click on “Go.” This will add your module’s table and SQL data to your Drupal database. Next:
- Browse to administer -> modules and enable the module you just added. If you copied the module directory correctly into your /modules folder you should see the module name in the list.
- For Drupal 4.7 and higher: Drupal has automated module support that will let you install and upgrade modules by simply uploading them into your /modules folder and then browsing to example.com/update.php (you must be logged in as administrator for the update to work). This is the same update script used for updating the Drupal core.
- Module Settings: Browse to administer -> settings -> [module name] to configure your module. Voila!
Commonly Recommended Drupal Addon Modules
- poormanscron – runs the Drupal cron operations without needing the cron application.
- feedback – very similar to Drupal’s core contact module, for differences between the two see this thread.
- filemanager – adds support for a managed file repository for other modules.
- nodewords – allows users to add meta tags, eg keywords or description – I recommend disabling “universal” mega tags and writing specific keywords and descriptions for each node.
- pathauto – provides a mechanism for modules to automatically generate aliases for the content they manage. This is especially useful for active forums and when many pages are being produced on a site – by giving each page a name they are automatically becomming more SEF (Search Engine Friendly).
Dozens of Additional Useful Modules
The above modules still merely represent a core installation. For most purposes there are many more modules that will prove useful and that I almost added to the above list. The include instant messaging modules such as privatmsg, the Google sitemap module gsitemap, modules supporting feed (RSS) functionality and syndication, and more. Check out my List of Popular Drupal Modules for an extended list.
Setting up Access Control
We’re almost done! After installing your modules (you can always add more later), browse to administer -> access control, where you may define access control for user types and add user roles. Typically some useful access roles are turned off by default. By turning these on for anonymous users you let non-members access content, view forums, read news feeds, etc. which you probably want them to be able to do so you can better promote your site. Some typical recommendations for anonymous access include:
- aggregator module – access news feeds
- comment module – access comments & post comments
- feedback module – can send feedback
- node module – access content (without this they won’t see your site at all)
- poll module – vote on polls
- search module – search content
Again, you can customize these according to specific user roles, so if you have content managers with different access privileges you can differentiate their authorization levels here.