-3

It's been awhile since I worked on a Drupal 8 site. I have a freshly installed Ubuntu 20.04 server. Is there a simple one liner or script to install Drupal 8 now? Is drush still used or do people use the drupal cli instead that I read about? Trying to make this transition back to Drupal 8 as easy as possible.

  • 1
    Drush is still the most used way to install Drupal from the command line. But Drush is no longer included in the recommend composer package, so you need composer require drush/drush before you can use drush site:install. – 4k4 Sep 24 at 20:57
  • @4k4 I remember installing drush is problematic for whatever reason. I'm getting these missing file errors: prntscr.com/unbqld --- its a fresh install of lamp and composer too. not sure why drush seems so hard to install without missing something here or there. – Patoshi パトシ Sep 24 at 21:06
  • Could be a missing php extensions, try for example sudo apt install php-mbstring – 4k4 Sep 24 at 21:28
  • "It's 2020", so why is it more complicated than ever to install Drupal? Why isn't there a simple answer? It makes me sad ... – anonymous Sep 24 at 21:34
  • @4k4 nope failed again... prntscr.com/uncan9 -- yea i'm quite saddened everytime i try to install drush i run into these "dependency" issues even on a brand new fresh install of a OS. – Patoshi パトシ Sep 24 at 21:45
3

Currently the best way to install any modern php application is through composer.

So to install Drupal 8 you tell composer the following. composer create-project drupal/recommended-project:8.x-dev Drupal this would install Drupal 8 into the Drupal dir.

Or composer create-project drupal/recommended-project Drupal For the latest release (one of Drupal 9)

You can than install Drush into the vendor/bin directory with composer require drush/drush if you also install the drush launcher you can run drush from anywhere in the drupal root.

Composer checks for all requirements it knows about (like dependencies for php and other php libraries.) modules can not be installed by it so it will ask you to do so.

| improve this answer | |
  • If 8.x-dev doesn't work. Just add the version 8.9. I had an error as it needed php7.4-gd needed to be installed apt install php7.4-gd – Patoshi パトシ Sep 25 at 13:33
  • 1
    Drupal needs either get or imagemagic anyway. So I fail to do why it would be a problem. – LvB Sep 25 at 13:34
  • I just did composer require drush/drush but its not working. Do i need to manually add /.composer/vendor/bin in my $PATH or does it do it automatically? And where should I run require drush/drush? in my home directory or my drupal directory? Or do I have to install drush launcher? – Patoshi パトシ Sep 25 at 13:38
  • 1
    You install drush launcher to use drush from anywhere in your Drupal root. You require it as a dependency for your Drupal project (so from your Drupal project and without —global). If you install the drush launcher it will find the vendor bin path and launch drush from there. It’s all explained on drush.org/install . Also drush is now bound to your version of Drupal so it will always work (withou having to do fancy tricks with multiple versions of drush) – LvB Sep 25 at 13:44

Not the answer you're looking for? Browse other questions tagged or ask your own question.