Archive for the ‘Server Administration’ Category

KVM with Bridged Networking on Ubuntu (10.04 LTS) (With UFW, Netfilter, Bridge-Utils, Virt-Manager)

One of the big reasons I moved to the new Ubuntu LTS for my main server was to get the new packages for KVM. To my disappointment, the versions that ship with 10.04 are slightly antiquated, especially with the amount of changes that are happening in the KVM development society. I found this PPA maintained by Daniel Baumann had everything that I needed. He keep is quite up to date and resolves build problems quickly. I don’t recommend you to use this PPA for production systems, I use it for my personal system and try to give any support to Daniel that I can because it really helps me out that he is packaging/maintaining this for the bleeding edge KVM packages.

KVM is a really great piece of virtualization software that is up and coming in the linux world, in the last several months the graphical (newbie) tools have become very simple to use. These tools still lag behind other solutions for virtualization such as VirtualBox or Vmware products, however KVMs performance and developmental activity make it a likely candidate for people setting up virtualization servers for personal and enterprise use.

Before we begin let me explain my set-up. I have a server that will be running the qemu-kvm software with libvirt that I will administer from my laptop running virt-manager. You can use KVM and Virt-Manager all while on the same machine without issue, but this guide is written for my particular configuration. I assume before beginning that you are running a pretty vanilla machine and will not have any strange configurations that would conflict with a standard Ubuntu 10.04 install. (more…)

Ubuntu, Webmin and Samba for Windows and linux clients

Samba can be one of those things that causes a ton of headaches. It always feels like a huge slowdown when I get to the Samba portion of my media server install. This time I decided to check out using Webmin for my samba configuration and I was pleasantly surprised with how easy it made some of the configurations.

I will hit on the major things to be noted here, firstly the idea of separate samba and system users. You can set up synchronization between these so that when a user is created it gets added to the smbpasswd file also. I created my system users earlier and converted them to samba users, so the synchronization didn’t do me any good for my original user set. New users will be created in the smbpasswd file correctly. In any case, the current users I had did not have the password hash information in the smbpasswd file. An example looks like this: (more…)

Power Monitoring with APCUPSD, Email using SSMTP and Google Apps

Recently I performed a large upgrade to my raid file-server, the information being stored is much more critical at this point in time and I have chosen to step up the game in four ways:

  1. Move from on-board Intel controller to dual LSI L8i 8channel hba controllers
  2. Move from raid5 to raid6
  3. Install an APC UPS and monitor it with apcupsd
  4. System monitoring with email alerts via mdadm and Google SMTP

(Sorry for re-iteration if you are following the feed, trying to establish context)

The apcupsd tool lets you connect to your UPS and control when the machine shuts itself down during a scenario where you loose power. Another really nice thing this will do is allow you to send yourself an email through whatever MTA you set up.

The difficult part of getting email setup is configuring a MTA (Mail Transfer Agent). I searched for quite a while on how to get this setup. My initial impression was that I would have to host my own via postfix or some other alternative. I was happy to find that I could use a much more lightweight solution with ssmtp and an email I created from my google apps account.

Install ssmtp

sudo apt-get install ssmtp

Configure ssmtp via its config file /etc/ssmtp/ssmtp.conf

# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=serveremailaddress@yourgoogleappsdomain.tld

# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtp.gmail.com:587

# Where will the mail seem to come from?
#rewriteDomain=

# The full hostname
hostname=servername.yourgoogleappsdomain.tld

# Are users allowed to set their own From: address?
# YES – Allow the user to specify their own From: address
# NO – Use the system generated From: address
#FromLineOverride=YES

UseSTARTTLS=YES
UseTLS=YES
AuthUser=serveremailaddress@yourgoogleappsdomain.tld
AuthPass=password

Now for a test of ssmtp, create a test file with some text in it. My test file was called ‘test’:

ssmtp youremail@yourgoogleappsdomain.tld < test

For apcupsd we need to modify two files to set our email address up for alerts. They are both located in the /etc/apcupsd directory and are called ‘onbattery’ and ‘offbattery’. I would suggest to leave these as they are because if you set up ssmtp like I have, when an email comes in for root it will be sent on to the ssmtp root address.

Now unplug your UPS and wait for the emails to come!

RAID Monitoring with MDADM, Email using SSMTP and Google Apps

Recently I performed a large upgrade to my raid file-server, the information being stored is much more critical at this point in time and I have chosen to step up the game in four ways:

  1. Move from on-board Intel controller to dual LSI L8i 8channel hba controllers
  2. Move from raid5 to raid6
  3. Install an APC UPS and monitor it with apcupsd
  4. System monitoring with email alerts via mdadm and Google SMTP

Software raid tool mdadm has monitoring functionality that is easily configured through the /etc/mdadm/mdadm.conf file. You simply need to specify an email address under the MAILADDR property. I would suggest to leave this as root, because with ssmtp you are going to set the email address for everything routed to root.

The difficult part of getting email setup is configuring a MTA (Mail Transfer Agent). I searched for quite a while on how to get this setup. My initial impression was that I would have to host my own via postfix or some other alternative. I was happy to find that I could use a much more lightweight solution with ssmtp and an email I created from my google apps account.

Install ssmtp

sudo apt-get install ssmtp

Configure ssmtp via its config file /etc/ssmtp/ssmtp.conf

# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=serveremailaddress@yourgoogleappsdomain.tld

# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtp.gmail.com:587

# Where will the mail seem to come from?
#rewriteDomain=

# The full hostname
hostname=servername.yourgoogleappsdomain.tld

# Are users allowed to set their own From: address?
# YES – Allow the user to specify their own From: address
# NO – Use the system generated From: address
#FromLineOverride=YES

UseSTARTTLS=YES
UseTLS=YES
AuthUser=serveremailaddress@yourgoogleappsdomain.tld
AuthPass=password

Now for a test of ssmtp, create a test file with some text in it. My test file was called ‘test’:

ssmtp youremail@yourgoogleappsdomain.tld < test

Test mdadm

sudo mdadm –monitor –scan –test

Everything should be set to go now, hopefully you wont ever need to be notified of a failure.

Known Issue

Using ssmtp with Google’s smtp is great, however if you use special characters in your email password ssmtp will not be able to authenticate. I ran into this and saw the following error:

ssmtp: Authorization failed (454 4.7.0 Cannot authenticate due to temporary system problem. Try again later. 14sm88672bwz.5)

This was promptly resolved by my choosing a password without special characters.

VirtualHosts on Apache2 (Multihost & Sub-domains)

Several times now I have seen questions in IRC or from friends on how to configure apache2 for multiple hosts and sub-domains. This is a fairly simple task, do not get tempted into using tools such as webmin to handle this kind of configuration for you. It is easy to cripple yourself by using such tools as primary configurators instead of understanding how the systems work. (more…)

Install (Set Up) WordPress from Subversion

This is a quick and simle guide, installing from subversion is fantastic because you pull down the most recent version from the beginning and doing updates is as simple as running another subversion command in the webroot. Make sure you have subversion installed by running this command:

sudo apt-get install subversion

Get WordPress Files

So to install wordpress from subversion go ahead and make a directory someplace in the webroot and run this command to pull down wordpress:

svn co http://svn.automattic.com/wordpress/trunk .

Now remember that trailing period, that will specify to copy to the directory that you are in.

So when you want to do an update all you have to do is go back to that directory in which you pulled down wordpress and type:

svn up

Prepare the Database

The very basics, you need to create a new schema and user, give that user permissions to the schema from a local connection. I would supply some pretty pictures for this right now but for some reason I cannot connect to my own database at the moment…. Grrr. I will solve that later

Setup a configuration file

You should still have your terminal in the directory the blog was in, now we have to setup a configuration file to finish the install. Run this command to move the sample configuration file to the configuration file that wordpress is looking for:

mv wp-config-sample.php wp-config.php

Now you need t o edit that config file to have the proper variables for your database.  Here is an example, most of the settings are strait forward however you may want to change your table prefix for security/database reasons:

define(‘DB_NAME’, ‘putyourdbnamehere’);

define(‘DB_USER’, ‘usernamehere’);

define(‘DB_PASSWORD’, ‘yourpasswordhere’);

define(‘DB_HOST’, ‘localhost’);

$table_prefix  = ‘wp_’;

I typically install all blogs to a single schema in the database, so changing the table prefix is something that is very important so they can all co-exist.

Install (Set up) Webmin (With Apt) on Ubuntu

I am not as masochistic as some of my buddies who insist on configuring every aspect of their system by hand, now this is a trade off because there is some things that I dont know how to do on my own without a program or two and the obvious security issues of running more programs than needed on a server. However my google-fu is strong and I would rather configure Apache through webmin. That being said here is the install procedure:

(more…)

Install (Set up) Linode with Ubuntu

Recently purchased hosting through Linode which i am extremely happy with. They offer strictly Linux dedicated virtual private server hosting, their packages are competitively priced and the guys in IRC are fantastic for answering the little questions that someone new to Linux hosting might have.

This is a list of the things I had to immediately overcome regarding setting up ubuntu with their XEN system. They have a pre-packaged deploy-able Ubuntu 8.10 server that is stripped down to the bare minimum to conserve disk space… which is really important if you buy one of their smaller accounts.

(more…)