Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Throughout this course I will be building a Drupal site piece by piece. In this segment I will start by downloading the Drupal core, gathering information about site status then performing a site installation. Throughout this process I'll describe how each command works, and how it relates to everyday operations. Before you begin identify the location of your Web server root that you want to build your site and determine the following about the database, the username and password, database name, and the port that you wish to use for connection settings.
I'll start by opening a command line, connecting to my sandbox, and navigating to the Web server root where I will start the base installation, cd /media/sf_sandbox. I'll list the content to the directory to ensure that there are no files on it, ls - la. If you type drush help, you will see a comprehensive list of all commands that drush is aware of. To get help on any command type 'drush help' then the name of the command.
The first command I will demonstrate is pm-download, which stands for Project Manager download. Project Manager is a group of commands within Drush that allows you to download, manipulate, and analyze the Drupal extensions both modules and themes. While I can type the entire command there is a shorthand alias, dl; that I will use to save time. Drush will display high-level information about the command, followed by examples, arguments, options, and finally any aliases.
The first of the examples is the commands that I will be using, downloading the latest recommended release of Drupal core. The only argument that the Project Manager Download command takes is a comma separated list of projects to download, which in this case is the Drupal core itself, drush dl and then the project name drupal. As there is no site installed Drush will just default to downloading Drupal and extracting the contents into a directory named Drupal 7.17 which is as of this writing the current version. Once Drupal core is downloaded Drush will be aware of the context, and will not append to the project version to any downloaded modules or themes.
I see a success message describing what happened, followed by a summary of everything that was in the downloaded project. In this case 3 profiles, 4 themes, and 47 modules. I can also manually specify a particular release by version using drush dl Drupal 7.x, which will download the latest version of Drupal 7 now 7.15; we'll expressively download Drupal 7.15. Perform a directory listing to see what changes were made.
There is one directory Drupal 7.17 as described in the status message. Drush keeps all the temporary files and results of its operations out of the site root, which helps keep the workplace clean. Change directory to Drupal 7.17 then list the directory contents. All of the contents that Drupal project have been extracted which is exactly what I wanted. Let's get some introspection into Drupal, the command core status aliased as just status, so 'drush help status' provides a bird's eye view of the current Drupal installation.
I'll show the help on the core status command. There not nearly as many options for this Command, but it doesn't mean that it is not helpful. For now I just want to get the status report, drush status. The Drupal version Default and Administrative theme, PHP configuration, Drush version and configuration, and Drupal root are displayed. This is incredibly helpful for giving context when asked to help out with another site. When a Drupal site is installed this site will give connection information as well.
The next command I will demonstrate is site-install aliased as si, drush help si. Site Install is a powerful tool allowing an administrator to complete the install a site using a given installation profile with a single command, rather than slogging through pages of configurations. It also creates the first user UID1 and randomly generates a password for the user displaying the result. There are also a large number of options for the site-install command.
In its simplest form site-install will use the database configuration that was specified in settings.php, but as this is as freshly downloaded installation that information is missing. So if I just do drush si, Drush rightfully complaints that there is no database connection so I will need to specify it using drush si --db-url=. This is only required for the initial install not reinstalls. The DB URL is specified using the Drupal 6 database URL for conciseness and will generate the regular array structure automatically.
I'm using a MySQL database connection with a username and password root. I'm going to put it on the localhost at 127.0.0.1, on port 3306. That's the default port using the database Drush. Your connection settings may be slightly different than the ones I'm using, please adjust them to reflect your working environment. Before I perform the command I'm going to specify one more option the password of the admin user, so I don't have to keep track of the randomly generated password.
This is fine for a development environment but avoid doing this in a production context. --account-pass=admin, press Enter and Drush will install the site, but first it will prompt to you about what it's about to do. Create the database tables which include dumping any existing database tables. So it wants to be sure that this is what should be performed. I am sure so I'll just say y for yes. A few moments later an installation is complete and the admin password is displayed for my records.
I'll switch to my browser and navigate to where my site is installed which in my case is http://sandbox.dev:8080/ drupal-7.17, Welcome to Site-Install. This site has been installed using the standard Drupal installation profile. Login using the username and password, admin, admin, to verify everything is working properly. Switch back to the terminal.
Now that the site is installed drush status is going to be a lot more helpful. In addition to the status information shown before the site URL database connection information, ability for Drupal to bootstrap, site and file paths are displayed. Now that the site has been installed and I have some perspective into the site I'm going to start managing the modules including listing, searching, enabling, and disabling modules.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 100819 Viewers
61 Video lessons · 87663 Viewers
71 Video lessons · 71528 Viewers
56 Video lessons · 103460 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.