安装了Drupal7之后,如果直接使用的话,效果是很差的,它之所以能成为这么流行的开源CMS,大家为它所贡献的模块和主题功不可没,那么如何安装模块和主题呢,其实Drupal7已经提供了非常好的主题和模块安装方式,但这些如果同Drush比起来就相形见拙了。
Drush顾名思意就是 Drupal + Shell,这是一个十分强大的命令行命令。使用它一来可以利用Drush开发社区的力量,二来Drush的命令更为可靠,适用于更多的环境。
在Ubuntu 14.04 LTS中安装Drush很简单,一个命令即可:
sudo apt-get install drush
但如果是象我上篇文章所讲的那样是自己安装的Drupal,那就需要自行安装Drush了。不过这也不会太难,命令如下:
sudo apt-get install php5-pear sudo pear channel-discover pear.drush.org sudo pear install drush/drush
在安装了drush之后,您可以使用以下命令:
drush version
来查看drush是否正常安装?如果您得到了以下提示:
$ drush version Drush needs to download a library from [error] http://download.pear.php.net/package/Console_Table-1.1.3.tgz in order to function, and the attempt to download this file automatically failed because you do not have permission to write to the library directory /usr/share/php/drush/lib. To continue you will need to manually download the package from http://download.pear.php.net/package/Console_Table-1.1.3.tgz, extract it, and copy the directory into your /usr/share/php/drush/lib directory.
说明您没有安装Console_Table,可以使用以下命令安装:
sudo pear install Console_Table-1.2.0
安装完后,您再查询Drush的版本号将得到以下结果:
7$ drush version Drush Version : 6.2.0
安装好了Drush之后,再要安装Drupal模块或主题的话将十分的轻松。例如,我要安装我最常用的模块和主题的话,只需要输入下面的语句即可:
cd /var/www/drupal7 drush dl ctools views panels admin_menu module_filter l10n_update bootstrap