====== Installing Drupal on Simple Hosting ====== ===== Decide on your install location ===== ==== Subdomain ==== If you want to install Drupal on a subdomain (i.e. ''%%drupal.example.com%%'') you'll need to [[:en:simple:shs-dns_config|create a virtual host]] for it to live in. ==== Subdirectory ==== If you would rather access Drupal from a subdirectory (i.e. ''%%example.com/drupal/%%'') you'll need to [[:en:simple:shs-dns_config|create a virtual host]] corresponding to the root domain which will contain the directory. **In other words:** ^ To access Drupal from here... ^ ... create this vhost: ^ And place Drupal files in this directory via sFTP: | | ''%%www.example.com/drupal/%%'' | ''%%www.example.com%%'' | ''%%vhosts/www.example.com/htdocs/drupal/%%'' | | ''%%example.com/drupal/%%'' | ''%%example.com%%'' | ''%%vhosts/www.example.com/htdocs/%%'' | | ''%%www.example.com/%%'' | ''%%example.com%%'' | ''vhosts/example.com/htdocs/'' | | ''%%drupal.example.com/%%'' | ''%%drupal.example.com%%'' | ''vhosts/drupal.example.com/htdocs/'' | If you want to have more than one vhost use a single Drupal installation, you can [[en:simple:symlink|create a symlink]]. ===== Download Drupal ===== ==== Download using SFTP ==== Begin by downloading the latest version of [[https://drupal.org/start|Drupal]] (7.37 as of this writing) to your computer and decompressing it. You now have a folder containing all of the Drupal files. Let's rename it ''drupal'' to keep things consistent. Launch your favorite FTP client (we recommend FileZilla), and connect to your instance. Then, open the folder corresponding to the VirtualHost you had initially defined. ==== Download using SSH ==== 1. [[en:contacts:login#logging_into_gandinet|Log into]] your Gandi handle that owns the Simple Hosting instance. 2. [[en:simple:console|Activate and access]] your Simple Hosting instance's SSH console. 3. Navigate to the vhost: $ cd web/vhosts/www.example.com 4. Go to the downloads page on [[https://drupal.org/start|Drupal's website]] and copy the location of the archive. (For 7.37, this is http://ftp.drupal.org/files/projects/drupal-7.37.zip ) 5. Download the archive: $ wget http://ftp.drupal.org/files/projects/drupal-X.X.zip 6. Uncompress the archive: $ unzip drupal-X.X.zip 7. Rename the folder that was created from this decompression: $ mv drupal-X.X drupal ===== Preparing the Drupal files ===== ==== Prepare files with SFTP ==== If you're installing Drupal to ''%%www.example.com/%%'', upload the **contents** of the decompressed folder containing the Drupal installation files directly into the ''htdocs/'' directory: /lamp0/web/vhosts/www.example.com/htdocs/ If you're installing Drupal to ''%%drupal.example.com/%%'', upload the **contents** of the decompressed folder containing the Drupal installation files directly into the ''htdocs/'' directory: /lamp0/web/vhosts/drupal.example.com/htdocs/ If you're installing Drupal to ''%%www.example.com/drupal/%%'', upload the **contents** of the decompressed folder containing the Drupal installation files into the ''drupal/'' directory: /lamp0/web/vhosts/www.example.com/htdocs/drupal/ For Drupal to configure properly, certain folders and files will need specific rights. In most cases, to change these rights with your FTP client, all you need to do is right-click on the file and choose the right term in the menu (could be Rights, CHMOD, Properties…). Supposing you were using FileZilla, this is how the client would operate: Right-click the concerned file and select "File Attributes...". The window that has just opened gives you two different methods to change the file rights: boxes to tick and numeric values. The point of the tutorial not being to teach the numeric values of rights in UNIX, let's just say you can simply replace the numeric value of the ''/sites/default/settings.php'' file with ''777''. ==== Prepare files with SSH ==== If you're installing Drupal to ''%%www.example.com/%%'', replace the htdocs folder inside the vhost with the drupal folder: $ rm -rf /lamp0/web/vhosts/www.example.com/htdocs && mv /lamp0/web/vhosts/www.example.com/drupal /lamp0/web/vhosts/www.example.com/htdocs /lamp0/web/vhosts/www.example.com/htdocs/ If you're installing Drupal to ''%%www.example.com/drupal%%'', remove index.html from the htdocs folder, and move the drupal folder so that it is inside the htdocs folder: $ rm /lamp0/web/vhosts/www.example.com/htdocs/index.html && mv /lamp0/web/vhosts/www.example.com/drupal /lamp0/web/vhosts/www.example.com/htdocs /lamp0/web/vhosts/www.example.com/htdocs/drupal/ ===== Configure the database ===== ==== MySQL ==== [[en:simple:mysql#create_a_mysql_database|Create the MySQL database]] using phpMyAdmin from your [[en:simple:administration_of_your_instance|administration interface]]. ==== PostgreSQL ==== Create the database using [[en:simple:phppgadmin|phpPgAdmin]] from the [[en:simple:administration_of_your_instance|instance administration page]]. ==== SQLite ==== You can use SQLite for the installation of your Drupal website, but the default location for the Drupal website isn't recommended for a Simple Hosting instance because this isn't secure. Instead of using the default location of ''%%sites/default/files/.ht.sqlite%%'' , you should use a location like this: ''%%/lamp0/web/vhosts/www.example.com/drupal_db/sites/default/files/.ht.sqlite%%'' . This way, the databases will be privately saved in ''%%/lamp0/web/vhosts/www.example.com/drupal_db/%%'', and not saved in the publicly facing directory ''%%/lamp0/web/vhosts/www.example.com/htdocs%%'' ===== Configure Drupal ===== Access your new drupal installation at the web location you installed it in, and follow the directions that follow. Note that for MySQL, you will use these settings: * **User:** root * **Password:** (empty/blank) * **Database:** The name that you gave the database that you created in the above step. For PostgreSQL, you will use these settings: * **User:** hosting-db * **Password:** (empty/blank) * **Database:** The name that you gave the database that you created in the above step. ===== Recommended modules ===== If you're using Drupal 7, then it is recommended to install the 'forcejs' module to enable caching of pages for anonymous users in [[::en::simple::cache | Varnish]] : * https://www.drupal.org/project/forcejs Note: This module is not needed for Drupal 8.