Drupal Zombie

Dezombifying Drupal developers since 2011

    Braaains!
Eat braaains!
News feed

Drushing a new Drupal

Submitted by Kieran on

You can use Drush to install a new Drupal installation from scratch. This procedure is adapted from http://www.leveltendesign.com/blog/tom/installing-drupal-7-using-ssh-drush.

The steps are:

  1. Create a new database and user.
  2. Download Drupal core.
  3. Run the Drupal install script.
  4. Add modules and themes.

I assume you have Drush installed, and a directory ready for the Drupal installation.

Create a new database and user

I find it easier to do this step through a Web interface from my host, or with phpMyAdmin. However, you can also do it through the command line:

mysqladmin –u [db_user] –p create [db_name]

E.g.:

mysqladmin –u jimbo –p create doooom

Sometimes your host requires you to name your databases in a specific way. For example, a shared host might require that your databases start with your user name. This separates your DBs from those of other accounts on the same server. If your username was erica, you might type:

mysqladmin –u jimbo –p create erica_doooom

You might have to make it:

mysqladmin –u erica_jimbo –p create erica_doooom

As I said, I tend to use the host's Web interface to make databases. It takes care of this issue for me.

Download Drupal core

cd to the directory where you want to put the installation. Then:

drush dl drupal

This will get the latest version, create a directory, and put all the Drupal files in it.

You can also install a distribution this way. For example:

drush dl cis

This downloads the cis distribution.

If you ls, you'll see that the files are in a directory like drupal-7.20. Ack! You need to move all the files out of there into your current directory:

mv drupal-7.20/* .

One problem. Drupal comes with two hidden files: .htaccess and .gitignore. The command above might or might not move those files. So:

ls -al

Does .htaccess show up? If so, you're OK. If not, you have to move the hidden files as well:

mv drupal-7.20/.* .

I get an error message from this, but it works. I don't get errors when I move the files one at a time:

mv drupal-7.20/.htaccess .
mv drupal-7.20/.gitignore .

Now you can remove the directory Drush created:

rm -r drupal-7.20

Your might need to use rmdir instead of rm -r.

Run the Drupal install script

Like this:

drush site-install standard --account-name=admin --account-pass=[useruser_pass] --db-url=mysql://[db_user]:[db_pass]@localhost/[db_name]

This uses the standard install profile. You can change that. Here's an example:

drush site-install cis --account-name=admin --account-pass=driBBl3r --db-url=mysql://jimbo:jimbopasssword@localhost/doooom

This installs the cis distribution.

Install modules and themes

You can download modules like this:

drush dl admin_menu module_filter

You can enable them through the Drupal modules page, or:

drush en admin_menu module_filter

That's it!

Add a comment

Basic WYSIWYG

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <blockquote> <br> <cite> <code> <dd> <div> <dl> <dt> <em> <h2> <h3> <h4> <h5> <img> <li> <ol> <p> <pre> <span> <strong> <ul>
    Allowed Style properties: border, border-style, border-width, float, height, margin, margin-left, position, text-align, width

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Images
Images for your comment.
Files must be less than 1 MB.
Allowed file types: png gif jpg jpeg.
CAPTCHA
Prove that your are sentient. Code has letters only.
Image CAPTCHA
Enter the characters shown in the image.