Design Workflow Part 3 – Install A Local Copy of Drupal or Wordpress
Installing a CMS hosting package on your live server is very easy- most web hosts provide a “one-click-install”. This is normally offered from that site’s control panel, and takes a couple of minutes to complete. If you are just starting out this is probably your best choice- just do the one click install and work off of your live site. If you are set on doing your development local and want to know how to install Drupal or Wordpress locally, keep on reading.
The first thing you should get your head wrapped around is that your CMS is just a collection of files.
Each CMS has a different directory structure, but for the most part you can do anything with these files you want. They contain all of the modules, themes, code, CSS, and HTML. What they don’t contain is the content- no blog posts, articles, nodes, blocks, posts, menu’s etc. Theoretically you could take a copy of your sites directory and move it around to many computers and set up multiple websites using the same file structure. This information is useful because it is a great way to make a backup- just take a copy of all of the files and zip it up.
Each CMS stores its content in a database, I typically use MySQL. Most web hosts offer several flavors, and I have not found one yet that did not offer MySQL. Each CMS has one file that controls this database connection. Drupal has a file in /Root/Sites/Default/Settings.php. Wordpress has one in the web root directory named WP-Config.php.
You can edit these files to change, add, or create database connections. These files are important when moving or installing your site, and I normally manually edit my files to point at manually created databases. I do this even when I am uploading my websites to go live, because I like control over the database name, user, and permissions.
On to the install!
The basic steps are the same for Drupal and Wordpress.
Alright, now time to setup your database, which will store your website content. We will use a tool called phpMyAdmin, which gets installed locally when you install XAMPP and MySQL. Most web hosts will offer a link in your control panel that launches the tool. With the local install, there will be either no root credentials to log in, or you will have set this up previously. The current version looks like this:
First thing we will do is create a user and a database- I find it is easiest to create a user first, and let the system create a database automatically. Up on the top navigation bar, select Users, then select Add User mid page.
Fill out the fields, and pick a username and password. Select Local from the dropdown in the host field. Check Create database with same name and grant all privileges and then select Check All to select all Global Privledges. We can customize security here but that isn’t normally needed for local development if you don’t share your PC.
Once this is all filled out click Go down in the lower right- and that’s it for the database creation.
This process is the same for both Wordpress and Drupal, though connecting to the database is different for each.
Note: each CMS uses a different or no table prefix, and you can set up your own if you like. I tend to leave things at default, which is no prefix for Drupal and wp_ for Wordpress.
The last step is easy, and wizard driven.
Above I outlined simple procedures to install Wordpress or Drupal for local development. You can get really complex with local deployments, and use tools like Git or SVN. But as a single developer developing sites this simple local install works great. To see the other articles in this workflow, go check it out!