Drush не хочет устанавливаться

После установки Drupal и Drush через Composer, командная строка выдает ошибку на запись "drush st":

Command 'drush' not found, did you mean:
  command 'rush' from deb rush
Try: sudo apt install 

Интернет-друзья предложили следующее (здесь):

the guide examples all include some kind of version at the end of the global require statement

composer global require drush/drush:dev-master

then you add composer to your ~/.bashrc or ~/bash_profile file

export PATH="$HOME/.composer/vendor/bin:$PATH"

If the above does not work please review the drush installation guide.

Также статья отсюда https://drupal.stackexchange.com/questions/247227/drush-installation-problem

После запуска этих команд, поменялась директория:
Composer Drush


export PATH="$HOME/.composer/vendor/bin:$PATH"
source ~/.bashrc
composer global require drush/drush
drush --version

пока безрезультатно..

Статья, которая мне помогла: https://www.linode.com/docs/guides/how-to-install-drush-on-ubuntu-18-04/ Самое главное в моем процессе было вовремя включить composer update (под пользователем root). Возможно, я его вообще устанавливал глобально для всех пользователей. По крайней мере, сейчас я им могу пользоваться из любой папки без root доступа.

Drush is a command line tool for creating, administrating, and modifying Drupal websites. Command line tools, like Drush, add functionality through additional command packages. Once installed, Drush is as easy to use as any of the basic Linux commands. The name comes from combining the words Drupal and shell. Drush is designed only for Drupal and cannot be used with other content management systems.

Both new and experienced Drupal users can benefit from learning Drush. Users that have worked with a command line interface before have an advantage, but Drush is an excellent application for beginners, too.

Before You Begin

Before installing Drush, ensure that the following prerequisites have been met:

  1. Create a new Linode by following our Getting Started guide. Complete the steps for setting your Linode’s hostname and timezone.

  2. Follow our Securing Your Server guide to create a standard user accountharden SSH accessremove unnecessary network services and create firewall rules for your Linode.

  3. Install and configure a LAMP stack on Ubuntu 18.04

  4. Make sure that your system is up to date, using:

    sudo apt-get update && sudo apt-get upgrade

    This guide is written for a non-root user. Commands that require elevated privileges are prefixed with sudo. If you’re not familiar with the sudo command, you can check our Users and Groups guide.

Install Git & Composer

The developers of Drush recommend installing Drush using Composer, a PHP dependency manager. Since the Drush project is hosted on GitHub and controlled with Git, you will also need to install Git. In this section, you will install both dependencies.

  1. Install Git:

    sudo apt-get install git
  2. Install Composer:

    curl -sS https://getcomposer.org/installer | php
  3. Move the composer.phar file to /usr/local/bin/, so that it can be accessed from any directory:

    sudo mv composer.phar /usr/local/bin/composer
  4. Composer has a few PHP dependencies it needs in order to run. Install them on your Ubuntu system:

     sudo apt-get install php-xml, zip

Install Drush Globally

Composer is designed to install PHP dependencies on a per-project basis. The steps below will install a global Drush for all projects. If you want to install Drush for a specific system user, skip to the Install Drush for a Limited User Account section.

  1. Create a symbolic link between Composer’s local bin directory, /usr/local/bin/composer, and the system’s bin directory, /usr/bin/:

    sudo ln -s /usr/local/bin/composer /usr/bin/composer
  2. Use Git to download - or clone - the GitHub Drush project into a new directory, /usr/local/src/drush:

    sudo git clone https://github.com/drush-ops/drush.git /usr/local/src/drush
  3. Change the working directory to the new Drush directory:

    cd /usr/local/src/drush
  4. Use Git to checkout the version of Drush that you wish to use. View the GitHub project’s releases page to view all available versions.

For a different release, replace the version number, `10.2.2`, in the following command:

    sudo git checkout 10.2.2
  1. Create a symbolic link between the Drush directory in /usr/local/src to /usr/bin, so that the Drush command can be called from any directory:

    sudo ln -s /usr/local/src/drush/drush /usr/bin/drush
  2. Now, run the Composer install command:

    sudo composer install
  3. Drush has now been installed for all users on your Linode. To verify the installation, check Drush’s version number.

    drush --version

    You should see a similar output:

      Drush Commandline Tool 10.2.2

Install Drush for a Limited User Account

You may want to install Drush for only certain system users, for example, the site admin or the Apache webserver. This option may be optimal for a shared-hosting environment. Also, this allows individual users to install different versions of Drush and even install separate versions specific to a single project. Ensure you run the commands from the limited user account’s home directory. Before you complete this section, ensure you have completed the steps in the Install Git & Composer section of the guide.

  1. Install Drush using Composer:

    composer require drush/drush

    This will install Drush in your ~/vendor/bin/drush directory.

  2. Using the text editor of your choice, edit the user’s .bashrc file to add the vendor directory to your path:

    File: ~/.bashrc
    export PATH="$HOME/vendor/bin:$PATH"
  3. Run the source command on the .bashrc file to enable the changes:

    source ~/.bashrc
  4. Check to see that Drush was installed successfully:

     drush --version

    You can install the Drush Launcher, a utility to be able to call Drush globally. This program listens on your $PATH and hands control to a site-local Drush that is in the ~/vendor directory.

Using Drush

Drush has dozens of commands with hundreds of options. Drush can interface with MySQL, Drupal, Git, and more. Below are a few examples of some useful Drush commands to get you started. Refer to the Drush Commands documentation for more details.

  1. To get started with Drush, run it without any following commands to list the help manual:

  2. View more detailed documentation for a specific command by typing drush help and then the command, for example:

     drush help site-install
  3. List many of the specs for your server and website with:

     drush status


Ограниченный HTML

  • Допустимые HTML-теги: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Строки и абзацы переносятся автоматически.
  • Адреса веб-страниц и email-адреса преобразовываются в ссылки автоматически.