Install Drush on WAMP slowly but successfully

I am presently building a website based on Drupal using my WAMP server on my laptop as a development site.

In these notes, I record the rather frustrating task of installing DRUSH. Drush is a facility for automating repetitive tasks involving in clicking together a Drupal site.   In particular, I wanted to simplify the tedious process of downloading and implementing all the modules needed to create a website.

Where I start from

These notes begin when two important stages have been completed.

Completed: Install a Wamp Server on your laptop.

Completed: Use a 5 minute install to create a Drupal site.

I am also assuming email has been set up for your development site and that you have looked around sufficiently to find the Modules tab at the top of the page.

It might be useful to install and activate one Module by hand so you appreciate the timesavings involved in using Drush.

Getting oriented: check your file structure

It is also helpful to look at your file structure before you begin.  I have WAMP stored under c:wamp and I store useful tools that I have downloaded from the internet at c:tools.

Each of my websites is stored in c:wampwwwwebsite1, c:wampwwwwebsite2, etc.  If the website is based on Drupal, then Drupal is placed in the website folder.  This means I may have more than  one copy of Drupal on my laptop. That strikes me as inefficient, but that is my set up at present.

Find Drush and gnuwin32 online

To get Drush, working, locate the Drush site through Google and download version 5 (not 4 – it doesn’t work  on Windows) to a folder called Drush under c:tools.

Now find gnuwin32 using Google and download the following using whatever setup.exe there are.  Gnuwin32 will give you Unix commands.  Download the following into your Program Files (x86).

  • Libarchive
  • Gzip
  • Wget
  • Gtar
  • Bsdtar

An extra step

I found advice to copy bsdtar.exe onto tar.exe.  No feedback occurs at all so it might be idea to run through the whole setup and if you have trouble, come back to do this step.

Adjust your path statement

Now adjust your Path statement (very carefully).  Adjusting the path statement allows you to call Drush from c:tools and for Drush to call PHP and SQL from WAMP and to use the Gnuwin32 commands.

Practically, open Word or a text editor, and then open Windows Explorer.  Go to c:toolsdrush and confirm that you can see the drush.bat file.  If so, copy the path, e.g., c:toolsdrush from the browser at the top of the screen to the text editor and add a semi-colon (;).

Now do the same for the other critical components.

  • C:Program Files (x86)Gnuwin32
  • C:Program Files (x86)Gnuwin32bin [where gzip hangs out]
  • C:wampbinphpphpn.n.n [whatever numbers you have]
  • C:wampbinmysqlmysql.1.36bin

You should have a long line of paths separated by semi-colons(;).

Now find your path statement. Go to Computer/Properties/Advanced/Environment Variables and be very careful. Messing this up can mess up the entire system.  It is also hard to see what you are doing.

Make sure the current Path Statement ends with a semicolon (;).  Copy the extra paths from your text editor and save.

Test the installation of Drush

Get your Command Line (got to Accessories) and check whether all is well by typing “drush status”.

If all looks sensible, then you are ready to download another module.  First, go to Windows Explorer and add a subdirectory to your website as follows.

c:wampwwwmywebsitenamesitesallmodulescontrib

Then use the Windows Command Line to work within this new directory.

  • Cd c:wampwwwmywebsitenamesitesallmodulescontrib

Then

  • Drush dl module
  • Drush en –y module

Conclusion

When you log in to your website the module should be installed and activated, saving you a lot of effort.

Just remember to use the CLI to work within the subdirectory so that Drush downloads here and not elsewhere.

Check out Similar Posts

Similar Posts:

One Comment

Leave A Comment

Your email address will not be published. Required fields are marked *