Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Setting up Drupal to Learn and Practice

Parent Feed: 

I decided to install Drupal for the first time on my Windows machine. As a beginner, I assumed that installing Drupal would be similar to installing other code editors and integrated development environment (IDE) tools, such as WebStorm, Atom, Visual Studio Code, and so on, but this was not the case. Unlike those, I had to first find software to create these "localhost" URLs I kept seeing in tutorials.

I learned that I needed software on my machine that can display PHP pages and allow those PHP pages to connect to a database on my Windows machine--not so easy at first! Once I set up a local web development environment that could run PHP/MySQL web sites, I could finally install the Drupal zip file I downloaded from drupal.org and get started with the hands-on tutorials in the Drupal User Guide.

Read on to learn about several local web development environment tools I would recommend to anyone starting out with learning Drupal and who wants to get Drupal up-and-running on their own machine. Or, jump to the short list of localhost software that enables you to run Drupal on your computer.

What is localhost and why do I need it?

I discovered that a so-called "localhost" is created by running web hosting software on your computer. But why would you want to do this? There's several reasons:

  1. You're learning web development and you want a private development sandbox to quickly see changes and experience errors without jeopardizing a live public site.
  2. You're learning Drupal and you want a private local sandbox to practice site building, theming, and module development exercises.
  3. You're attending a web technology workshop, the internet connection might not be reliable, and you want to be able to follow along with the exercises on your machine.
  4. You want to quickly develop and test out changes to your Drupal site (in configuration, themes, or modules) on your own machine, before committing to the changes and sharing them with others.

And, bonus, you want to set this up without becoming a server administrator or fully understanding Docker. You want an app that you can install, point to your Drupal directory, and go!

The most time-consuming part of this learning process was realizing what kind of software I needed, and that I didn't necessarily need to use Docker. (Many popular recommendations require Docker.) However, once that was accomplished, it took about 10 minutes to set up a local web hosting environment that could run Drupal sites.

Docker was too hard to set up on Windows

Before I dive into the recommendations, a quick note about Docker. (Docker is an open source containerization platform. It enables developers to package applications into containers.) You'll notice that a lot of the local web development environment tools recommended for Drupal developers these days require Docker. I'm on a Windows machine; while it is technically possible to install Docker on Windows (so I've read), as a newcomer to web development, the process for getting Docker installed on my Windows machine was complicated and I never got it working. I needed localhost software that was easy to install on Windows and didn't require Docker.

Later on, as I grow my skills and get more comfortable with Windows development environments and command line tools, I can sort that out. But for now, I want to learn how to build and theme Drupal sites--I don't want to worry about getting Docker installed on my Windows machine to do that.

So, I leapt out of the installing-Docker-on-Windows rabbit hole and set out to find other tried-and-true localhost software that was quick to set up. (But for those of you who don't mind using a Docker-based solution, I've included a recommendation that my co-workers on Macs prefer to use.)

What you need to install Drupal on your computer

Before installing Drupal, you should consider reviewing Drupal's system requirements. Drupal needs a web server stack that consists of a computer with a certain amount of memory and hard drive space, a web server, PHP 7, and a database like MySQL. This is a really common and popular stack which most web servers will support. Read more about Drupal's system requirements.

To create a Drupal-friendly dev environment on your computer that fulfills Drupal's system requirements, you need the same thing--an Apache web server running PHP version 7 or later and MySQL. The local web development environment applications I've listed below provide that. Your own computer fulfills the hard drive space and memory requirements.

Localhost apps for running Drupal locally

There are quite a few software applications that you can use to set up a local web server environment in which you can install Drupal on your machine. Here are a few recommendations we've tested and used:

  • XAMPP
    • Compatible with Linux, Windows, and Mac OS X.
    • It's a simple-to-install Apache distribution that includes MySQL, PHP, and Perl. XAMPP is extremely simple to install and use -- simply download, extract, and begin. I tested it out on my Windows machine and I found it easy to set up.
    • Download XAMPP: https://www.apachefriends.org/download.html
  • MAMP
    • Compatible with Windows and Mac OS X.
    • Like XAMPP, this is a tried-and-true application that has been a go-to for folks who want to quickly get a localhost running on their Mac so that they can install, run, and develop Drupal sites on their computer.
    • Download MAMP: https://www.mamp.info/en/downloads/
  • DDEV-Local
    • Compatible with Linux, Windows, and Mac OS X.
    • I tried installing this on my Windows machine, but got stuck on the Docker installation process. My co-workers on Macs (and who have a lot more experience with command line tools) prefer DDEV-Local because they can share configuration as a team and quickly install Drupal sites to test out tutorials and answer support questions. If you can install Docker on your machine and are comfortable with basic command line usage, this tool comes highly recommended.
    • Download DDEV-Local: https://ddev.readthedocs.io/en/stable/
  • You can read about other tools on our page of topical resources on Development Environments, especially the external resources at the bottom of the page.

Install Drupal on your computer

Once you have successfully set up a local web development environment using one of the tools listed above, the next step is to download and install Drupal on your local machine. You can find the zip file at https://www.drupal.org/download.

Configure your localhost app to point to an extracted Drupal directory on your computer and enter the localhost URL specified by your localhost application. (It might be something different than the word "localhost" or have a port number appended to it, like :8080.)

Your Drupal install welcome screen should display in your browser. You can now walk through the installation process. You'll need to refer to your localhost application to get the special local addresses for your web server and database that your localhost application provides.

For more details about the installation process, read the chapter on installing Drupal in the Drupal User Guide.

Once you've installed Drupal locally, you're ready to walk through Drupal tutorial exercises. Start with the Drupal User Guide to get an excellent overview and practice building and administrating a Drupal site.

Guide

Additional resources

Here's a few tutorials (written and video) that I found useful as I went through this learning process of getting a localhost running on my machine and Drupal installed.

For those who do not wish to go through the process of installing a localhost application, but still want to practice creating Drupal websites while working through the tasks on Drupalize.Me, here are a few options:

  1. You can sign up for a Pantheon account. Pantheon is a cloud-based website management platform that is free to use. After you've set up your account, go ahead and create a new site, then deploy Drupal as your CMS, and you're good to go. You will need to know how to use a File Transfer Protocol (FTP) program to connect to the server and download files to your computer for editing. Here is a link to get you started: https://pantheon.io/register
  2. Spin-up a cloud-based full development environment using DrupalPod. This is a relatively new tool that we've been playing with and are pretty excited about. Link: https://github.com/shaal/DrupalPod
  3. If you're not editing files and want to just use the administrative UI to test out a module or learn how to do a task in the admin UI, Simplytest.me might be the right choice, especially if you're short on time. You can also use it to install specific modules or patches in the issue queue. It's more geared toward evaluation and testing than development, but it can be a great tool to use when walking through site building, module configuration, or administrative tutorials. Link: https://simplytest.me/
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web