How to Install Drupal using cPanel and MySQL

Heres a step by step tutorial on how to install Drupal 5.1 tailored for a standard LAMP (Linux, Apache, MySQL, PHP) setup. The servers I use for hosting have cPanel so these instructions are written to use it.

Download and Extract Drupal

  1. Open an ssh client and log into the machine you are installing Drupal on.
  2. Change Directory into the public_html folder.
    cyberswat@www [~]# cd ~/public_html
  3. Download Drupal.
    cyberswat@www [~]# wget http://ftp.osuosl.org/pub/drupal/files/projects/drupal-5.1.tar.gz
  4. Extract the downloaded file.
    cyberswat@www [~]# tar -xf drupal-5.1.tar.gz
  5. Move all files from the drupal-5.1 archives to your public_html folder
    cyberswat@www [~]# mv drupal-5.1/* ~/public_html/
    cyberswat@www [~]# mv drupal-5.1/.* ~/public_html/
  6. Remove files you've created for the installation
    cyberswat@www [~]# rm -rf drupal-5.1
    cyberswat@www [~]# rm drupal-5.1.tar.gz

Setup MySQL Database and User

  1. Login to your sites Cpanel
  2. Click the MySQL® Databases link.
  3. Under the heading Current Databases enter a new database name. Click the Create Database button.
  4. Click the Go Back link on the page confirming the database creation.
  5. Under the heading Current Users enter a new username and password. Click the Create User button.
  6. Under the heading Add Users To Your Databases click the Add Users To Your Databases button.
  7. Look for the following code that is now visible on the page. You will need the database name and the username recorded in the code. I chose cyberswat for my database name which cPanel named cyberswat_cyberswat and drupal as my database user which cPanel renamed cyberswat_drupal

    $dbh=mysql_connect ("localhost", "cyberswat_drupal", "") or die ('I cannot connect to the database because: ' . mysql_error());
    mysql_select_db ("cyberswat_cyberswat");

  8. Return to your ssh session and enter

    vi ~/public_html/sites/default/settings.php

  9. Move your cursor down to the following line. It is on line 93 and should be fairly easy to spot if your ssh client supports color syntax highlighting.

    $db_url = 'mysql://username:password@localhost/databasename';

  10. Press the letter a to enter the add mode of the vi editor. This allows you to make modifications to the code in the previous step. Enter your username and password in the appropriate spots. My finished version looks like this

    $db_url = 'mysql://cyberswat_drupal:somepasswd@localhost/cyberswat_cyberswat';

  11. Press the Esc key to escape from the add mode of the vi editor.
  12. Tell the vi editor to save and quit from the file by typing the following command and hitting the enter key.

    :wq

Create the files directory

  1. Make the files directory

    cyberswat@www [~]# mkdir ~/public_html/files

  2. Give the files the correct permissions

    cyberswat@www [~]# chmod 777 ~/public_html/files

Install Drupal

  1. Open a web browser and go to the /install.php file.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Off topic but...

Go check your email! :)

It worked! I didn't have ssh

It worked!

I didn't have ssh access so I left out step 7. no problem.

Thanks.

How o send Pm?

Hi, how I can send PM?