Hack and / - Your Own Personal Server: Blog
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.
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.
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.
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 systems architect; and the author of DevOps Troubleshooting, The Official Ubuntu Server Book, Knoppix Hacks, Knoppix Pocket Reference, Linux Multimedia Hacks, and Ubuntu Hacks.
- Readers' Choice Awards 2013
- The Geek's Guide to the Coolest 2013 Holiday Gifts
- A Plexible Pi
- Sublime Text: One Editor to Rule Them All?
- Swap Your Laptop for an iPad + Linode
- RSS Feeds
- Raspberry Pi: the Perfect Home Server
- Linux Kernel News - November 2013
- Mars Needs Women
- Advanced Hard Drive Caching Techniques
- "RasPlex Linux-based OS
1 hour 45 min ago
- Clarification; RasPlex is not
8 hours 34 min ago
- Clarification; RasPlex is not
8 hours 36 min ago
- Starting the conversation is the first step.
9 hours 35 min ago
11 hours 22 min ago
11 hours 22 min ago
- Nice but....
11 hours 45 min ago
- great specs
18 hours 14 min ago
- Reply to comment | Linux Journal
19 hours 20 min ago
- rilakkuma onesie
21 hours 56 min ago