Drush can be said to be Drupal's Swiss ***. it is inconvenient for you to use drush for a while without it. However, if you install drush using the method I mentioned in the previous blog post, drupal8 is not supported, so this blog post will show you how to install the drush tool that supports drupal8.
On the GitHub homepage of drush, we can easily see that drush7.x supports drupal8, so let's install drupal7.x:
1. Install composer
First, install composer globally and run the following command:
curl -sS https://getcomposer.org/installer | php sudo mv composer.phar /usr/local/bin/composer
In this way, Composer can be used anywhere on the machine to replace PHP composer. phar to run the composer command! The test method is simple. Enter composer in the command line to check whether the help of composer is output.
Ii. Set the compser Environment
To ensure that the command in the global bin directory of composer can be called anywhere, we recommend that you include the command in the path directory of the system and enter the following command in ~ /Add the corresponding directory to the bashrc file:
sed -i ‘1i export PATH="$HOME/.composer/vendor/bin:$PATH"‘ $HOME/.bashrc
To view the effect immediately, run the following command:
source $HOME/.bashrcenv
Then view the output:
PATH=/home/firehare/.composer/vendor/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
If the preceding result is displayed, the added settings take effect.
3. Install drush
If the above settings are complete, it will be very easy to install drush. You only need one command:
composer global require drush/drush:dev-master
However, in tianchao, sometimes the download of the above commands is slow or interrupted, and there is no doubt that the Great Wall is doing a strange job. You may wish to use goagent as a proxy for download, here we will not talk about the specific method.
Note: The above command requires git support. If you are prompted to install git during the installation process, you only need to enter the following statements in the command line:
sudo apt-get install git
4. Set drush
After drush is installed, you also need to set drush. For example, some bash aliases can be found in ~ Add the following command to the end of the/. bashrc file:
# enable drush.bashrcif [ -f $HOME/.composer/vendor/drush/drush/examples/example.bashrc ]; then source $HOME/.composer/vendor/drush/drush/examples/example.bashrcfi
Then, restart the machine or directly enter:
source ./bashrc
In this way, basically drush is installed. We can perform a small test. Enter the following command in any directory and obtain similar results, which indicates that drush installation and setting have basically taken effect:
[email protected]:~$ dr --version Drush Version : 7.0-dev
This article is from the "Rabbit's nest" blog, please be sure to keep this source http://firehare.blog.51cto.com/809276/1532030