Acceder al contenido principal

Cómo instalar drush

Volver a Blog

Cómo instalar drush

09 Mar 011
Avatar Genérico

Drupal

drush es un shell de línea de comando y un script Unix para Drupal. Tiene que estar instalado a nivel de sistema, con lo que estará disponible automáticamente para su uso con todos los sitios Drupal instalados en la máquina. drush hace que muchos aspectos de la administración de Drupal se haga de forma rápida y fácil, incluyendo las copias de seguridad de la base de datos.

La página del proyecto http://drush.ws, contiene muchos recursos e información para los usuarios.

En este tutorial explicamos cómo instalar drush en un sistema linux para su uso con Drupal.

Lo primero será descargar drush desde la página http://drupal.org/project/drush. Para ello, escribimos en la terminal:

$ wget http://ftp.drupal.org/files/projects/drush-All-versions-4.2.tar.gz

Se descomprime el archivo:

$ tar xzf drush-All-versions-4.2.tar.gz

Comprobamos que se ha creado correctamente la carpeta drush

$ ls -la drwxr-xr-x 6 raulg raulg 4096 2011-02-01 05:42 drush -rw-r--r-- 1 raulg raulg 244432 2011-02-01 05:42 drush-All-versions-4.2.tar.gz

Si listamos la nueva carpeta creada:

$ ls -la drush drwxr-xr-x 6 raulg raulg 4096 2011-02-01 05:42 commands drwxr-xr-x 2 raulg raulg 4096 2011-02-01 05:42 docs -rwxr-xr-x 1 raulg raulg 3383 2010-11-10 14:57 drush -rw-r--r-- 1 raulg raulg 99 2009-12-31 23:02 drush.bat -rw-r--r-- 1 raulg raulg 170 2011-02-01 05:42 drush.info -rw-r--r-- 1 raulg raulg 23280 2010-02-05 20:25 drush_logo-black.png -rwxr-xr-x 1 raulg raulg 9285 2011-01-17 13:34 drush.php drwxr-xr-x 2 raulg raulg 4096 2011-02-01 05:42 examples drwxr-xr-x 2 raulg raulg 4096 2011-03-08 13:18 includes -rw-r--r-- 1 raulg raulg 14940 2006-04-23 11:54 LICENSE.txt -rw-r--r-- 1 raulg raulg 9740 2011-01-22 20:44 README.txt

se ve el ejecutable drush que es el que utilizaremos para lanzar las órdenes. Para que resulte más cómodo su uso, crearemos un enlace en la carpeta del usuario:

$ sudo ln -s drush/drush /usr/local/bin/

Esto, nos permitirá ejecutar el comando drush desde cualquier carpeta.

Para usarlo, únicamente tendremos que situarnos en la carpeta de un proyecto Drupal. Si ejecutamos drush solo (sin parámetros) nos aparecerá la ayuda con el listado completo de los comandos disponibles.

$ drush Global options (see `drush topic core-global-options` for the full list): -r , --root= Drupal root directory to use (default: current directory) -l http://example.com, URI of the drupal site to use (only needed in multisite environments) --uri=http://example.com -v, --verbose Display extra information about the command. -d, --debug Display even more information, including internal messages. -y, --yes Assume 'yes' as answer to all prompts -n, --no Assume 'no' as answer to all prompts -s, --simulate Simulate all relevant actions (don't actually change the system) -p, --pipe Emit a compact representation of the command for scripting. -h, --help This help system. --version Show drush version. --php The absolute path to your PHP intepreter, if not 'php' in the path. Core drush commands: (core) cache-clear (cc) Clear a specific cache, or all drupal caches. core-cli (cli) Enter a new shell optimized for drush use. core-cron (cron) Run all cron hooks in all active modules for specified site. core-rsync (rsync) Rsync the Drupal tree to/from another server using ssh. core-status (status, Provides a birds-eye view of the current Drupal installation, if any. st) core-topic (topic) Read detailed documentation on a given topic. drupal-directory Return path to a given module/theme directory. (dd) help Print this help message. See `drush help help` for more options. image-flush Flush all derived images for a given style. php-eval (eval, ev) Evaluate arbitrary php code after bootstrapping Drupal (if available). php-script (scr) Run php script(s). search-index Index the remaining search items without wiping the index. search-reindex Force the search index to be rebuilt. search-status Show how many items remain to be indexed out of the total. self-update Update drush to the latest version, if available. (selfupdate) site-alias (sa) Print site alias records for all known site aliases and local sites. site-install (si) Install Drupal along with modules/themes/configuration using the specified install profile. site-upgrade (sup) Run a major version upgrade for Drupal (e.g. Drupal 6 to Drupal 7). test-clean Clean temporary tables and files. test-run Run tests. Note that you must use the --uri option. updatedb (updb) Apply any database updates required (as with running update.php). variable-delete Delete a variable. (vdel) variable-get (vget) Get a list of some or all site variables and values. variable-set (vset) Set a variable. version Show drush version. watchdog-delete Delete watchdog messages. (wd-del, wd-delete) watchdog-list Show available message types and severity levels. A prompt will ask for a choice to show watchdog messages. (wd-list) watchdog-show Show watchdog messages. (wd-show, ws) Field commands: (field) field-clone Clone a field and all its instances. field-create Create fields and instances. Returns urls for field editing. field-delete Delete a field and its instances. field-info View information about fields, field_types, and widgets. field-update Return URL for field editing web page. Project manager commands: (pm) pm-disable (dis) Disable one or more extensions (modules or themes). pm-download (dl) Download projects from drupal.org or other sources. pm-enable (en) Enable one or more extensions (modules or themes). pm-info (pmi) Show detailed info for one or more extensions (modules or themes). pm-list (pml) Show a list of available extensions (modules and themes). pm-refresh (rf) Refresh update status information. pm-releasenotes Print release notes for given projects. (rln) pm-releases (rl) Print release information for given projects. pm-uninstall Uninstall one or more modules. pm-update (up) Update Drupal core and contrib projects and apply any pending database updates (Same as pm-updatecode + updatedb). pm-updatecode (upc) Update Drupal core and contrib projects to latest recommended releases. SQL commands: (sql) sql-cli (sqlc) Open a SQL command-line interface using Drupal's credentials. sql-connect A string for connecting to the DB. sql-drop Drop all tables in a given database. sql-dump Exports the Drupal DB as SQL using mysqldump or equivalent. sql-query (sqlq) Execute a query against the site database. sql-sync Copy and import source database to target database. Transfers via rsync. User commands: (user) user-add-role (urol) Add a role to the specified user accounts. user-block (ublk) Block the specified user(s). user-cancel (ucan) Cancel a user account with the specified name. user-create (ucrt) Create a user account with the specified name. user-information Print information about the specified user(s). (uinf) user-login (uli) Display a one time login link for the given user account (defaults to uid 1). user-password (upwd) (Re)Set the password for the user account with the specified name. user-remove-role Remove a role from the specified user accounts. (urrol) user-unblock (uublk) Unblock the specified user(s). Other commands: (drush_make,drush_make_d_o) convert-makefile Convert the specified makefile to a drupal.org friendly format, and verify the converted file. make Turns a makefile into a working drupal install. make-generate Attempts to generate a makefile from the current Drupal install, specifying project version numbers unless not known or otherwise specified. Unversioned projects will be interpreted later by drush make as "most (generate-makefile) recent stable release" make-test Run a drush make test. verify-makefile Verify the specified makefile is in a drupal.org-friendly format.

Comentarios

Añadir nuevo comentario