Install Drupal 8 Locally

Ready for review -- AWAITING PEER REVIEW
Description: 
This is a lesson about installing Drupal 8 locally and running it using XAMPP/LAMP/MAMP
Overview: 

Downloading and installing Drupal 8 on your local machine is not so hard and provides a safe method to experiment with code without affecting a live site or exposing confidential site data to others. All you need to have is a web server and a database server.

Prerequisites: 

Resources

  • Guide on installing XAMPP on Windows.
  • Guide on installing LAMP on Linux.
  • Video on installing MAMP on Mac OS.
  • Guide on installing phpmyadmin on LAMP stack.
Steps: 
  1. Download and install XAMPP/LAMP/MAMP depending on the operating system you use.
  2. Start Apache and MySQL servers.
  3. Start your terminal and navigate to your web server's directory. Enter one of the following commands:
    cd c:/xampp/htdocs on Windows.
    $ cd /var/www on Linux.
    $cd /Applications/MAMP/htdocs on Mac.
  4. Run the following command in the command line window:
    git clone --branch 8.0.x http://git.drupal.org/project/drupal.git drupal8
    This will clone Drupal 8 in the 'drupal8' folder.
  5. You might need admin permissions to perform the above step.
  6. Provide Read and Write Permissions to 'sites/default' and all its subfolders.
  7. Run the following command in the command line window:
    cd drupal8 to move to drupal8 folder.
    composer update to install all dependencies required by Drupal.
  8. Copy the 'default.settings.php', rename it 'settings.php' and paste it in the same folder.
  9. Open localhost/phpmyadmin from your favourite browser. Click 'Database' on the top left and enter the name of the new database as 'drupal8' (without quotes). Select UTF Unicode from the drop-down box and click Create.
  10. Set your password for MySQL for the “root” user by going to the 'User Accounts' tab in phpmyadmin.
  11. Now we are all set to install Drupal on our local server.
    Navigate to localhost/drupal8 .
  12. Select your preferred language and the default installation profile.
  13. Add information about the database server (mysql), site database (drupal8), database user (root) and database password (the password you set) .
  14. After all core modules are installed, complete the form regarding the site configuration.
  15. (Optional) If you want to install a contrib module, choose a module, download it into the 'drupal8/modules' directory. Visit http://localhost/drupal8/admin/modules, select it from the list of available modules and click on 'Save Configuration' to enable it.
  16. Enjoy Drupal 8. If you face any issues, report them @ https://www.drupal.org/project/issues/search/drupal.
  17. You should always update your Drupal 8 clone to the lastest code before you start new work. You can pull down all of the latest changes from Drupal.org, by moving into your Drupal 8 directory, make sure you are in the "8.0.x" branch with git checkout 8.0.x and then doing a git pull command.

Important: The above steps are only to be used for set-up of a development environment of Drupal 8 on your local computer. Don't follow these steps for setting-up your live website as it may contain security loopholes.

So you have successfully installed Drupal. Follow the ladder to learn more about Drupal.

Have a good day!