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 VP of engineering operations at Final, Inc., the author of a number of books including DevOps Troubleshooting and The Official Ubuntu Server Book, and is a columnist for Linux Journal. Follow him @kylerankin.
Fast/Flexible Linux OS Recovery
On Demand Now
In this live one-hour webinar, learn how to enhance your existing backup strategies for complete disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible full-system recovery solution for UNIX and Linux systems.
Join Linux Journal's Shawn Powers and David Huffman, President/CEO, Storix, Inc.
Free to Linux Journal readers.Register Now!
In modern computer systems, privacy and security are mandatory. However, connections from the outside over public networks automatically imply risks. One easily available solution to avoid eavesdroppers’ attempts is SSH. But, its wide adoption during the past 21 years has made it a target for attackers, so hardening your system properly is a must.
Additionally, in highly regulated markets, you must comply with specific operational requirements, proving that you conform to standards and even that you have included new mandatory authentication methods, such as two-factor authentication. In this ebook, I discuss SSH and how to configure and manage it to guarantee that your network is safe, your data is secure and that you comply with relevant regulations.Get the Guide