Drush si
Naar navigatie springen
Naar zoeken springen
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
drush si
oftewel drush site-install
verzorgt de installatieprocedure van een Drupal-site.
Voorbeeld Drupal 8 met bestaand MySQL-account
- Je moet eerst Drupal downloaden
- Standaard maakt
drush sl
een database aan, of leegt deze, als-ie al bestaat - Let op: In dit geval betreffen
$database_gebruiker
en$database_wachtwoord
een al bestaand MySQL-account. Vaak is die situatie anders
#################################################################### # Download Drupal #################################################################### # if [ "$download_drupal" = true ]; then drush dl drupal-8 --destination=$root --drupal-project-rename mv $root/drupal/* $root mv $root/drupal/.* $root rmdir $root/drupal fi #################################################################### # Installeer Drupal #################################################################### # if [ "$installeer_drupal" = true ]; then cd $root drush si --db-url=mysql://$database_gebruiker:$database_wachtwoord@localhost/$database_naam fi
Output:
You are about to create a /var/www/dc8/sites/default/settings.php file and CREATE the 'dc8' database. Do you want to continue? (y/n): y Starting Drupal installation. This takes a while. Consider using the --notify global option. [ok] Installation complete. User name: admin User password: uKYpsdsjAxM7H [ok] Congratulations, you installed Drupal!
Als ik het script nog een keer uitvoert, wordt de database overschreven:
You are about to DROP all tables in your 'dc8' database. Do you want to continue? (y/n): y Starting Drupal installation. This takes a while. Consider using the --notify global option. [ok] Installation complete. User name: admin User password: TqjonatzpK [ok] Congratulations, you installed Drupal!
Voorbeeld Drupal 7: Installatiebug omzeilen
Een specifieke toepassing van drush si
is om de 'installatiebug' in Drupal 7 te omzeilen. Dit script is zo simpel mogelijk: De bestanden staan al op de juiste plek, en er is ook al een database aangemaakt. Er hoeft geen beheerder-account aangemaakt te worden:
#!/bin/sh ############################ # Variabelen initialiseren ############################ # domeinnaam="example.com" locatie="/home/blub/public/example.com/public" sitename="Example-site" # MySQL # databasenaam="examplebase" databasegebruiker="examplebase" databasewachtwoord="examplewachtwoord" ############################ # Deploy ############################ # # Change working directory # cd $locatie # Deploy # drush si --db-url=mysql://$databasegebruiker:$databasewachtwoord@localhost/$databasenaam
Shell:
./deploybasissite.sh You are about to DROP all tables in your 'examplebase' database. Do you want to continue? (y/n): y No tables to drop. Starting Drupal installation. This takes a few seconds ... [ok] Installation complete. User name: admin User password: rDZJg8jSk3
Bronnen
Appendix: help-bestand drush si (Drupal 7 & 8)
drush si -h
Install Drupal along with modules/themes/configuration using the specified install profile. Examples: drush site-install expert --locale=uk (Re)install using the expert install profile. Set default language to Ukranian. drush site-install Install using the specified DB params. --db-url=mysql://root:pass@localhost:por t/dbname drush site-install Install using SQLite (D7+ only). --db-url=sqlite://sites/example.com/file s/.ht.sqlite drush site-install --account-name=joe Re-install with specified uid1 credentials. --account-pass=mom drush site-install standard Pass additional arguments to the profile (D7 example shown here - install_configure_form.site_default_coun for D6, omit the form id). try=FR my_profile_form.my_settings.key=value drush site-install Disable email notification during install and later. If your server install_configure_form.update_status_mod has no smtp, this gets rid of an error during install. ule='array(FALSE,FALSE)' Arguments: profile the install profile you wish to run. defaults to 'default' in D6, 'standard' in D7+ key=value... any additional settings you wish to pass to the profile. Fully supported on D7+, partially supported on D6 (single step configure forms only). The key is in the form [form name].[parameter name] on D7 or just [parameter name] on D6. Options: --account-mail uid1 email. Defaults to admin@example.com --account-name uid1 name. Defaults to admin --account-pass uid1 pass. Defaults to a randomly generated password. If desired, set a fixed password in drushrc.php. --clean-url Defaults to 1 --db-prefix An optional table prefix to use for initial install. Can be a key-value array of tables/prefixes in a drushrc file (not the command line). --db-su=<root> Account to use when creating a new database. Must have Grant permission (mysql only). Optional. --db-su-pw=<pass> Password for the "db-su" account. Optional. --db-url=<mysql://root:pass@127.0.0.1/db A Drupal 6 style database URL. Only required for initial install - > not re-install. --locale=<en-GB> A short language code. Sets the default site language. Language files must already be present. You may use download command to get them. --site-mail From: for system mailings. Defaults to admin@example.com --site-name Defaults to Site-Install --sites-subdir=<directory_name> Name of directory under 'sites' which should be created. Only needed when the subdirectory does not already exist. Defaults to 'default' Aliases: si