How to install and update Drupal 7 modules from the command line with Drush alvin February 10, 2019 - 6:43pm

As a note to self, I learned today that you can install Drupal 7 modules from the command line with this Drush command:

drush en module_name

such as:

drush en smtp

You can also update Drupal 7 modules with Drush. For instance, I just ran these commands on a Drupal 7 website:

drush up ctools
drush up context
drush up file_entity
drush up media
drush up rules

How to update a Drupal 7 website with Drush (notes)

As a brief “note to self,” this is how I just updated a Drupal 7 website using Drush. Please note that the output of some of the commands below refer to early versions of Drupal 8, but these commands also work with Drupal 7.

First, do these things:

A Drush 9 list of commands (for Drupal 8)

I’m sure there’s something I’m missing here, but ... as I’m just getting started using Drush 9 to manage a Drupal 8 website, I can’t find a list of Drush 9 commands on the drush.org website. Therefore, in an effort to make my life easier (and hopefully yours), here’s a list of Drush 9 commands.

Notes on how to update a Drupal 8 website with Drush and Composer

The process of updating a Drupal 8 website changed dramatically back in March-April, 2018, so I deleted the older content on this page and replaced it with the content below.

As of April, 2018 you now need to use Composer along with Drush to update your website. Here are my very brief notes on how to do this:

Drupal Console project

After being away from Drupal work for a long time, I just got back into it, and right away ran into a problem with Drupal 8 where, after migrating a Drupal 6 site to Drupal 8, I was unable to log into the new Drupal 8 website. I have no idea what the migration process set my user password to, but it wasn’t any of the ones I used on the old Drupal 6 website or on the new Drupal 8 website — probably because the migration process zapped my Drupal User 1 account.

Long story short, instead of using drush, I decided to use the Drupal Console project to reset the password, and it worked as advertised. After installing the Console project, just type drupal list | grep password to see the command to reset the password, and then use it. At the time of this writing the command is drupal user:password:reset. I have no idea if that will change in the future, but for now you can type that command and then respond to the prompts. You’ll need the User ID for the account that you want to modify, and you can get that by looking at the Drupal 8 users and users_field_data tables.