Hack and / - Your Own Personal Server: Blog

If your blog isn't on your own server, is it truly yours? Learn how to set up your own.

This column is the third in a series about how to manage your own services on your own server. In the first column, I discussed how to make sure your home network is ready to host your own services. In the second, I covered DNS, and in this column, I talk about one of the services people commonly put in the cloud but is simple to host yourself: a blog.

At first, I planned to focus this series strictly on how to set up your own Web server, but I realized that these days, most people don't simply set up Apache and upload some static HTML. Instead, most modern sites are built so that their content is generated dynamically, often with data stored on a database. Instead of just a basic static page, today if you want to set up your own Web server at home, you probably want to host a forum, post some information about yourself, share some pictures or, quite likely, manage your own blog.

What Flavor Is the Best?

Many different types of blogs exist—from sites that attempt to replicate the function of a physical magazine on the Web to sites that act as a person's public diary to sites that just link to other interesting content. And, just as many different types of blogging software are available under Linux. Each type of blogging software has its advantages and disadvantages, but for the purposes of this article, I had to pick one. I chose WordPress because it's relatively simple to set up and has a large user base, which means it should be easier for you to get support from the community.

I not only had to choose what blogging software to cover, I also had to decide on a base distribution. When it comes to Apache and WordPress, although the software itself is basically the same across major Linux distributions, the organization of that software can be quite different. Because I'm aiming this column at someone who has never set up a Web server before, I'm going to use Ubuntu Server here (specifically 10.04 LTS), as I think the way it has organized Apache configuration and WordPress is the most friendly for the new system administrator.

Install the Software

The first step in the process is to install WordPress, Apache and all of the dependencies this software needs. On a modern Linux distribution, this is relatively simple. In the case of Ubuntu, simply type the following into a terminal:

$ sudo apt-get install apache2 mysql-server wordpress

Those packages will pull down the Web server software, the MySQL server that WordPress will access on this same machine and WordPress itself, along with all of its dependencies. During the install, you will be prompted to choose a password for the MySQL root user. Although you optionally can leave this blank, I advise you to choose a password and document it somewhere. If you decide to leave it blank, you always can add a password to the root user later, but it's much simpler to set it here.

Ubuntu Apache2 Site Organization

Apache2 under Ubuntu (and Debian-based distributions in general) has a somewhat unique way to organize Apache configuration. If you ever have managed multiple Web sites on a single Apache instance (often referred to as virtual hosts), you know how challenging it sometimes can be to organize each site's configuration along with all the modules you need Apache to load. Under Ubuntu, all of the currently available virtual hosts and modules store their files under /etc/apache2/sites-available and /etc/apache2/mods-available, respectively. Any virtual hosts or modules that are enabled are set up as symbolic links under /etc/apache2/sites-enabled and /etc/apache2/mods-enabled. Along with this new organization, the apache2 package includes a set of new tools to enable and disable sites and modules. For instance, if you added a new virtual host configuration at /etc/apache2/sites-available/foo and wanted to enable it, you would type:

$ sudo a2ensite foo

That command creates the necessary symlinks for you in /etc/apache2/sites-enabled. Likewise, if you wanted to load a module named cgi that you see under /etc/apache2/mods-available, you would type:

$ sudo a2enmod cgi

To undo the above two commands, you would type:

$ sudo a2dissite foo
$ sudo a2dismod foo

Although it's true that you could set up these symlinks manually, the included commands certainly make it more clear and easier to script.

______________________

Kyle Rankin is a director of engineering operations in the San Francisco Bay Area, the author of a number of books including DevOps Troubleshooting and The Official Ubuntu Server Book, and is a columnist for Linux Journal.

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState