Check your version

This video covers a topic in Drupal 7 which may or may not be the version you're using. We're keeping this tutorial online as a courtesy to users of Drupal 7, but we consider it archived.

Before You Begin Installing Drupal

Video loading...

  • 0:00
    [This series based on: Using Drupal - 2nd Edition, by Angela Byron and Addison Berry, with Bruno De Bondt]
  • 0:03
    [http://oreil.ly/19WDWOg]
  • 0:06
    [Drupalize.Me]
  • 0:11
    [Using Drupal - Installing and Upgrading Drupal - Before You Begin Installing Drupal]
  • 0:13
    [with Addison Berry]
  • 0:16
    [♪ music ♪]
  • 0:21
    In this short series, we're going to take a look
  • 0:23
    at the fundamentals of working with Drupal, which is to get it installed
  • 0:27
    and then keeping it up to date.
  • 0:29
    We'll actually walk through the installation process, and then we'll look at
  • 0:33
    how you can know if your site needs to be kept up to date
  • 0:36
    and then how to do that, both for core and contrib.
  • 0:39
    In this lesson, to get things started, we're going to get ourselves ready
  • 0:44
    for installation, by going through a few steps to prepare for that.
  • 0:49
    The first and most important one is gathering our requirements,
  • 0:53
    making sure that we actually have all the requirements in place
  • 0:56
    in order for us to do the installation.
  • 0:58
    This is mostly checking things on our web server to make sure that
  • 1:02
    we have the right software on the server.
  • 1:04
    After that, we'll actually need to download Drupal.
  • 1:09
    We need to get that source code, and then once we have the source code,
  • 1:12
    we're going to take a quick tour of the file and directory structure,
  • 1:15
    just so you understand what it is that you're installing.
  • 1:18
    So let's go ahead and get started by gathering the information and files that we need.
  • 1:26
    So before we actually install Drupal,
  • 1:29
    we want to make sure that we have our requirements in place.
  • 1:32
    So let's start off by going to drupal.org and looking at the requirements page for Drupal.
  • 1:39
    You can go to drupal.org/requirements as the URL,
  • 1:44
    or if you just go to drupal.org, you can navigate there
  • 1:47
    by going to Documentation and then looking at the Installation Guide.
  • 1:54
    The very first section of the Installation Guide is System Requirements.
  • 2:00
    And what we'll see here is the basic stuff we need.
  • 2:04
    So you need to have a web server somewhere where your site is going to live.
  • 2:09
    You do need a minimum amount of disk space.
  • 2:12
    This should be covered by most any server.
  • 2:14
    It doesn't require a whole lot of actual physical disk space.
  • 2:17
    The important pieces, though, here are these three: the web server,
  • 2:22
    the database, and PHP.
  • 2:25
    So for web server, you have to have some sort of web-server software.
  • 2:30
    Apache is the most popular, and it's the one most widely used in the community.
  • 2:35
    For database, you need to have—for Drupal 7, you're going to want MySQL 5 or higher,
  • 2:44
    with PDO, which most of the time you will have that.
  • 2:47
    And you can also use Postgres or SQLite.
  • 2:53
    Those are not as widely supported, though.
  • 2:56
    Most people in the community use MySQL or an equivalent of MySQL.
  • 3:01
    And then the last thing is PHP.
  • 3:04
    That's the code that is used to run Drupal.
  • 3:07
    And so, again, for Drupal 7 specifically, we want to have PHP 5.25 or higher.
  • 3:14
    Generally, people recommend using 5.3.
  • 3:17
    5.2 has actually been deprecated at this point, so most of your servers
  • 3:21
    should be upgrading to a minimum of 5.3 anyway.
  • 3:25
    But these are the three basic components you have to have
  • 3:28
    on that web server that you're going to run Drupal on.
  • 3:33
    Once you have a web server with those pieces in place,
  • 3:37
    if you're using some—like a web host that is providing this for you—
  • 3:41
    not uncommon—you need to make sure that you have your
  • 3:44
    FTP or SSH information, because you're going to need to put the Drupal files
  • 3:49
    onto the actual web server.
  • 3:52
    So whatever you need to connect for that, you should have that information.
  • 3:55
    Or if you're using a local host, you just need to know where
  • 3:59
    on your local computer you would be putting those files for your web root.
  • 4:04
    The other thing you need is database server credentials.
  • 4:09
    So you need the username, password, and a database name
  • 4:12
    so that Drupal can actually connect to the database.
  • 4:15
    You're going to have to create a database for Drupal to use.
  • 4:20
    So either someone will have created that for you already, and they
  • 4:23
    can give you that username, password, and database connection information.
  • 4:27
    Or you would need to create it yourself and then make sure
  • 4:31
    you write down and remember that information.
  • 4:33
    Drupal's installation process will not create a brand new database for you.
  • 4:38
    You need to create an empty database, and then the Drupal installation
  • 4:42
    process will fill the database for you as you proceed.
  • 4:45
    And if you do want to have your own local—so you can install
  • 4:50
    the web server on your local computer that's not necessarily run by a web host,
  • 4:55
    so that you can play around and experiment with things.
  • 4:58
    There are a couple of different options out there.
  • 5:01
    So there's XAMP, which is cross-platform,
  • 5:04
    so you can get that for Linux, Windows, and Mac.
  • 5:07
    For Mac-specific, there is also MAMP, which is at mamp.info.
  • 5:13
    And then there's also WampServer, which is for Windows,
  • 5:17
    Apache, MySQL, PHP.
  • 5:19
    The community as a whole uses the AMP stack,
  • 5:23
    Apache, MySQL, and PHP, and that's the assumption that
  • 5:27
    you'll be running with as you work through these lessons.
  • 5:31
    For actually installing Drupal, we're going to grab that from drupal.org as well.
  • 5:35
    Now you should—if you're working through the Using Drupal series of lessons,
  • 5:39
    you should be using the source code that we provide,
  • 5:42
    and there's already a lesson on that in the Preface series,
  • 5:46
    or the About the Using Drupal series, that shows you how to use
  • 5:50
    the source code that we provide with the book.
  • 5:53
    In this lesson, I'm going to walk through how you install
  • 5:57
    brand new Drupal that's downloaded from drupal.org,
  • 6:00
    instead of the installation profile stuff that we've provided.
  • 6:04
    So when you go to drupal.org, there's a big Get Started with Drupal button.
  • 6:09
    You can click on that, or you can also go to Download and Extend.
  • 6:13
    But we'll just do the Get Started with Drupal.
  • 6:15
    And you can see Download Drupal, and it will have the latest version,
  • 6:18
    which right now, at the time of this lesson, is 7.22. I'll click that.
  • 6:23
    And instead of actually starting a download, this takes me to the Drupal core project page
  • 6:28
    on drupal.org, and if I scroll down, you'll see, these are the downloads
  • 6:33
    that are available to me, and I can read the release notes on it, etcetera.
  • 6:38
    I can look at issues. But these are the download links right here.
  • 6:42
    So there's a tarball, a tar.gz file, and a Zip file.
  • 6:46
    Download whichever one you like or prefer or need for your operating system.
  • 6:50
    But you want to download a copy of this, and then once you get that,
  • 6:55
    you're going to need to put it into your web server,
  • 6:58
    wherever your website is supposed to live.
  • 7:01
    So if you are doing it on your local computer,
  • 7:04
    then you need to put it into the right directory on your computer.
  • 7:07
    And if you're using a web host, you need to make sure you SFTP
  • 7:11
    or SSH, and put those files into the right place for the website to function.
  • 7:17
    I'm going to go ahead and download this onto my local computer,
  • 7:21
    because I have a local development environment here.
  • 7:23
    And then we'll take a look at what we've downloaded.
  • 7:26
    So now I'm going to switch over to where I've downloaded this file.
  • 7:30
    And it's here, drupal-7.22.zip. I got the Zip file.
  • 7:35
    I'm going to go ahead and open that up,
  • 7:37
    unzip it, whatever software you need to use in your operating system.
  • 7:41
    And it creates this folder, Drupal-7.22.
  • 7:44
    I can change the name of this folder. It's not going to hurt anything.
  • 7:48
    So if I wanted to just change it to Drupal or D7 or Drupal7,
  • 7:52
    whatever you want to name this folder is fine.
  • 7:54
    If you are just using these files on a web root,
  • 7:58
    you probably won't want this folder at all. You just want the contents of it.
  • 8:01
    This is actually Drupal, all of these files here.
  • 8:05
    The important pieces to be looking at here
  • 8:08
    are the files that we need for installation and update,
  • 8:12
    as well as the sites directory, which is a very important folder in your Drupal installation.
  • 8:18
    So the install.php and update.php files are the two scripts
  • 8:23
    that actually do the work of installing and updating, respectively.
  • 8:27
    Because they're located in this top-level folder,
  • 8:31
    this is called the Drupal root.
  • 8:34
    So you can see we have install and update.
  • 8:37
    This is your Drupal root folder, and that's how people will refer to it.
  • 8:42
    You can access either of those directly in your browser
  • 8:46
    by going to whatever the web address for your Drupal site is,
  • 8:50
    slash, for instance, install.php or update.php.
  • 8:55
    You can type it directly into the URL, and you'll go to that file
  • 8:59
    and run the scripts there.
  • 9:02
    In addition to those actual scripts that end with .php,
  • 9:06
    there are two text files, one for each, install.txt and upgrade.txt,
  • 9:11
    that have instructions and more information on what those scripts are used for.
  • 9:16
    Now most first-time Drupal administrators are going to take a look
  • 9:21
    at these directories and put contributed and custom modules and themes
  • 9:27
    into the modules and themes directories. That makes sense.
  • 9:30
    There's modules, there's themes, if I get a new one.
  • 9:32
    You would think that would be where you would place them.
  • 9:35
    They will actually work there, but it's really not a best practice.
  • 9:40
    It's going to create a lot of problems, because if you
  • 9:45
    overwrite those directories, when you do an update of Drupal,
  • 9:49
    you could lose all of the stuff that you put in there.
  • 9:52
    The best practice is to keep all of your site's specific contributed and custom code
  • 9:58
    in the sites directory.
  • 10:01
    So this directory here, sites.
  • 10:03
    And unless you're using something called a multisite installation,
  • 10:09
    which we'll look at in a couple of minutes,
  • 10:11
    you should put all of your modules and themes inside directories inside sites.
  • 10:18
    So I would go into my sites, all, and I have modules and themes here.
  • 10:25
    And that's where I would actually put all of my contributed and custom modules and themes
  • 10:29
    for my Drupal site, in that location.
  • 10:33
    So this way it's easy; you can isolate the sites folder whenever you do an upgrade
  • 10:37
    and not change anything else, and let Drupal core update everything
  • 10:41
    it needs to without a risk of overwriting the files that you want to keep in there
  • 10:46
    that are specific to your site.
  • 10:48
    Now a minute ago, I referred to something called a multisite installation.
  • 10:53
    And Drupal has the capacity to run multiple sites from one Drupal code base.
  • 11:00
    So you can have one set of code, this code that we're looking at now.
  • 11:04
    But you can actually run multiple websites with different domain names
  • 11:08
    from just that one bit of source code.
  • 11:10
    And in the Drupal world, we call that multisite.
  • 11:13
    So actually the example websites that we have for usingdrupal.com
  • 11:18
    are using this multisite feature to run,
  • 11:20
    so that we have a domain name like jumpstart.usingdrupal.com.
  • 11:26
    They all are running from that same code base.
  • 11:29
    We only have one set of code, and then each site has its own individual database.
  • 11:34
    So the way that you would set that up—
  • 11:36
    I'm not going to go into great detail, but I just want to give you some
  • 11:39
    of the basics so that you understand what might be involved
  • 11:42
    if you're interested in doing something like that.
  • 11:45
    Because this is going to involve a little bit of web server configuration,
  • 11:50
    in terms of you need to set things up for Apache to understand
  • 11:53
    what it should be doing.
  • 11:55
    So what you need to do is first let Apache or your web server
  • 12:00
    know that whatever different domain names you want
  • 12:05
    to use should point to this particular directory.
  • 12:09
    So even if I have five different sites with five different domain names,
  • 12:11
    they all need to point to just this one folder of Drupal.
  • 12:16
    And I'll just show you a real quick example of what that looks like.
  • 12:19
    Here is what we call the vhost file for usingdrupal.com.
  • 12:23
    You'll notice in the ServerAlias—
  • 12:25
    so the server name itself is using drupal.com.
  • 12:28
    But under ServerAlias, we have this usingdrupal.com with an asterisk in the front.
  • 12:33
    So that means that anything that is a subdomain there of usingdrupal—
  • 12:37
    I could list out each individual one that we're using.
  • 12:41
    Since we have multiple, I just put an asterisk as a wildcard,
  • 12:45
    say anything with a subdomain should also point to this same directory
  • 12:49
    that the main usingdrupal.com domain name is pointing at.
  • 12:53
    And that directory is this document root.
  • 12:56
    And so this is where it's living on my server.
  • 12:59
    So you need to set up your virtual host to make sure that the web server points
  • 13:03
    to the directory that you need, and then all you need to do
  • 13:06
    in your Drupal installation is have—each of those sites gets
  • 13:11
    its own little directory inside of your sites folder.
  • 13:14
    So let's take a look at what that looks like.
  • 13:18
    So here is my Drupal root on the usingdrupal.com site.
  • 13:26
    And you can see, so we have the all, which has modules and themes
  • 13:32
    like we were looking at, and if you just have a single site,
  • 13:34
    that's all you really need to use, and the default is where your settings.php file is.
  • 13:40
    But then you can see I have—for each of our subdomains,
  • 13:44
    there's a different folder, and each of these can have
  • 13:48
    its own files settings, and it can have its own modules and themes folders,
  • 13:53
    if I want to limit what it can choose from only there.
  • 13:56
    So there's a lot more information about multisite on drupal.org,
  • 14:02
    and so you can investigate that more if you want to.
  • 14:04
    It is a capability that Drupal has.
  • 14:07
    Honestly, there aren't a whole lot of use cases where it makes a lot of sense
  • 14:11
    to use it, but you should know that it's there, because if you
  • 14:14
    do need it, it's a really, really handy thing to be able to implement.
  • 14:17
    Also, in Drupal 7, there's now an Advanced feature that allows you
  • 14:21
    to create aliases for multisite installation directories.
  • 14:25
    So this would let you map one or more arbitrary site names that would be used
  • 14:29
    in a URL to a specific configuration folder.
  • 14:33
    So hopefully you have a sense of the requirements that you
  • 14:36
    need, and make sure that you get your basic web server requirements set up.
  • 14:41
    We've downloaded Drupal and looked at the important files and
  • 14:45
    folders that we'll mostly be working with when we're working with Drupal.
  • 14:49
    And then we had a quick review of a pretty nifty feature called
  • 14:52
    multisite, which most of the time you won't need,
  • 14:55
    but if you do need it, it's a very handy thing to know about.
  • 14:58
    So now that we have everything in place,
  • 15:01
    we're ready to actually begin installation of Drupal.
  • 15:05
    [Drupalize.Me]
  • 15:07
    [Based on the book Using Drupal, 2nd Edition, by Angela Byron, Addison Berry, and Bruno de Bondt]
  • 15:10
    [Excerpts from the book used with permission of O'Reilly Media, Inc., which owns or controls all rights to publish and sell the same]
  • 15:13
    [O'Reilly®]

Before You Begin Installing Drupal

Loading...

Prior to installing Drupal, it’s important to make sure that you can actually do so, and understand a bit about how Drupal is structured. The first lesson provides a checklist of Drupal’s requirements, and also highlights important things in the Drupal file structure that are worth knowing before diving into the installation process. We also explain and take a quick look at how you can use Drupal to run multiple sites from the code base, known in Drupal as a multisite installation.