Article

Quick Tip: Up and Running with Drupal 8 in Under Five Minutes

By Bruno Skvorc

In this quick tip, we’ll be installing a local instance of Drupal 8, beta 1. By the end, you’ll have a copy of Drupal that’s not only ready to be extended with Symfony bundles and other packages, but also ready to accept content and display it to end users.

Step 1: Prepare Environment

In order for everyone to have the same starting point, we’ll be using our trusty old Homestead Improved vagrant box. It’s important to note that even if this tip will be installing Drupal 8 into the Vagrant box, the procedure is absolutely identical for any Ubuntu based environment.

So, somewhat optional, please clone a new Homestead Improved instance as per instructions in this tip. Then, add a new site and make sure you add the entry to your host machine’s hosts file. In my case, it’s test.app and Homestead.yaml looks like this:

---
ip: "192.168.10.10"
memory: 2048
cpus: 1

folders:
    - map: .
      to: /home/vagrant/Code

sites:
    - map: homestead.app
      to: /home/vagrant/Code/Laravel/public
    - map: test.app
      to: /home/vagrant/Code/drupal

variables:
    - key: APP_ENV
      value: local

Step 2: Download and extract Drupal 8 b1

If you’re using a VM, log into it and enter the folder where you keep your projects. In the case of the Homestead Improved installation above, that’ll be /home/vagrant/Code. If you’re using your own LAMP stack or whatever, just go into your projects folder.

wget http://ftp.drupal.org/files/projects/drupal-8.0.0-beta1.tar.gz

When downloading finishes, extract the archive and rename the resulting folder to drupal.

tar -xvzf drupal-8.0.0-beta1.tar.gz
mv drupal-8.0.0-beta1 drupal

Step 3: Create the DB

In this case we’ll be using MySQL. We’ll also be using Homestead-specific user/pass defaults. If you’ve got your own environment, adapt as needed. For PostgreSQL see here.

mysqladmin -u homestead -psecret create drupaltest
mysql -u homestead -psecret

Once in the MySQL console, execute the following:

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES ON drupaltest.* TO 'homestead'@'localhost' IDENTIFIED BY 'secret';

exit

Step 4: Settings

In this step, we create a settings and services file from the provided templates, and let the Drupal installer edit them by altering permissions.

cd drupal
cp sites/default/default.settings.php sites/default/settings.php
cp sites/default/default.services.yml sites/default/services.yml
chmod a+w sites/default/settings.php
chmod a+w sites/default/services.yml
chmod a+w sites/default

Step 5: Install

In your host’s browser, enter the URL test.app:8000/install.php and follow the instructions of the wizard.

Choose a standard installation profile for the quickest setup. You can find out more about these profiles here, if interested.

Optional Cleanup and Tweaks

Optional but recommended:

  1. Remove the original downloaded archive to free up disk space
  2. Activate the cron
  3. Change the permissions back:

    chmod 644 sites/default/settings.php
    chmod 644 sites/default/services.yml
    chmod 755 sites/default

Conclusion

As you can see, adding a new Drupal installation onto your server can be done in minutes from total zero to fully functional CMS. For more information on other aspects and edge cases of Drupal installation, see their installation guide.

  • Alex Pott

    Instead of using beta 1 it’s best to use beta 2. Beta 1 has a critical security hole. Beta 2 is available at http://ftp.drupal.org/files/projects/drupal-8.0.0-beta2.tar.gz

  • Rolando Payán Mosqueda

    Drupal 8 creates the database automatically ;-)

  • http://jmolivas.com Jesus Manuel Olivas

    you can use drush instead and save steps 2 to 5

    $ drush dl drupal-8.0.0-beta2
    $ mv drupal-8.0.0-beta2 drupal8.dev
    $ cd drupal8.dev

    $ drush si standard –db-url=mysql://USER:PASS@HOST/DATABASE –site-name=drupal8.dev –account-name=ADMIN_USER –account-pass=ADMIN_PASS –account-mail=YOUR_EMAIL -y

Recommended
Sponsors
Because We Like You
Free Ebooks!

Grab SitePoint's top 10 web dev and design ebooks, completely free!

Get the latest in Front-end, once a week, for free.