Building small server appliances: Drupal
By dougm on Sep 02, 2009
This is the start of a series of articles about building some small dedicated servers for home use.
This first article discusses Drupal, an OpenSource Content Management System (CMS). You might ask "why use a CMS for a web server?" A CMS will make life simpler, especially if you are providing a variety of services. Even for home use, a CMS can be quite useful. For one, it can split out sections of your site for different family members and provide reasonable levels of security while doing so. For a small office, it becomes even more useful since a lot of different services are usually already integrated into them and that makes it easier to get what you want.
Why Drupal? That's the system I know best. It has regularly been named one of the "Best OpenSource CMS" systems. There are others, Joomla comes to mind, but Drupal is the one I know. The source, documentation and other resources are available at Drupal.Org. Drupal may be overkill for what you need, so do read about it before plunging in.
What can Drupal provide?
Out of the box, so to speak, Drupal provides an AMP based CMS system with bare bones functionality. Drupal's strength comes in its many plugin extensions and the extensive set of "themes" that are available. Basic functionality includes:
Before installing Drupal, install the required software. Drupal needs the "AMP" stack (Apache, MySQL and PHP). This can be done with
pfexec pkg install amp
if you have install priviledges.
Installing Drupal is straightforward and well documented. Download the current release of Drupal 6 (this is the preferred version for new implementations). You can untar the package and then move the contents of the package into /var/apache2/2.2/htdocs/ to create the Drupal basic configuration.
Don't enable Apache yet.
Next, read the INSTALL.mysql file in htdocs. This tells you about setting up MySQL. The basic sequence is:
- running as mysql, "mysql_install_db" to get the basic configuration setup
- enable the mysql service (need root priviledge -- svcadm enable mysql)
- setup the root user of the mysql daemon following the instructions in INSTALL.mysql (running as mysql)
- mysqladmin -u root password 'your root mysql password'
- mysqladmin -u root -h <hostname> password 'your root mysql password'
- mysqladmin -u root -p create <database-for-your-site> (use the password defined above)
- mysql -u root -p
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER
TO 'drupaldatabaseuser'@'localhost' IDENTIFIED BY 'password';
(the drupaldatabaseuser and password are the identifiers you will use to let Drupal access mysql
- Now as a priviledged user, you can enable Apache2 (svcadm enable apache22)
- In /var/apache2/2.2/htdocs/sites/default, do the following:
- cp default.settings.php to settings.php
- chmod 755 settings.php
- mkdir files
- chmod 755 files
At this point,you are now ready to do the rest of the Drupal setup through the Drupal user interface via your favorite browser. You will follow the instructions and be guided through the process. Note that Drupal will tell you when to change the permissions on settings.php in order to make a secure implementation. All the files should be owned by the user that Apache runs as. The default is "webservd".
You are now ready to configure the functionality of your website. I'll cover this a bit in the next installment, but you should go and read some of the documentation on the Drupal.ORG website. The "Getting Started" guide, following the Drupal 6 paths will give a good overview of what you can do with your website. You will also want to give some thought to the look you might want.