Archive for the 'CentOS' Category

Pukwudgie roars into life

Last night I finally finished cutting all my server services to their new residence on Pukwudgie (my spectacular CentOS 5.3 based server VM). I turned off my old Thinkpad server, which has been doing the job reliably for over 2 years, rebooted pukwudgie just to make sure everything starts up correctly unattended and that was that. My first impressions are that everything seems to run faster. I really expected that, though, because there are a lot more resources available to Pukwudgie than there were to the old server. I am loving it so far and it sure is nice to have an up-to-date server. The old server was running Ubuntu 6.10, which was so old I couldn’t even get security patches for it anymore and this new CentOS server is completely current.

Hopefully this is a move for the better, and I can probably offer the old lappy/server on FreeLinuxBox.org too!

On Server Migrations

new-servers
Lately, I have been slowly migrating my server services from my ancient Thinkpad server to a VM on some real server hardware. This has been an arduous process, mostly because this is my own personal server, which means I am #1 strapped for time, #2 deprived of ambition when home and #3 insanely paranoid about screwing up any of my data.

I mentioned recently about how to set up a fakie mail server, which is what I have used for a long time. Well, oddly enough, the *new* portion of the server setup is quick, easy and works great. The hard part of that, which I didn’t mention on the previous post was data migration. You see, on the old server I used UW-IMAP and on the new one am using Dovecot IMAP. They both are set to use Maildir, so I just copied the folders from one machine to the other. Somewhere in there there is something funny in how each uses the folder structure. I noticed the problem immediately when using Alpine to get email from the server that it couldn’t find the previously configured folders. It turns out that I had to rename them to INBOX.foldername on the new system instead of just foldername and then things would mostly jive. I still had to make a few mail client tweaks, which were irritating, but hey, I got mail!

Once mail was running, I set out to get my webdav share working. That’s a pretty easy process and you can find a good instructable at http://www.cyberciti.biz/faq/rhel-fedora-linux-apache-enable-webdav/. I have used webdav fileshares for quite some time now and really dig them despite the fact that it’s a crap shoot if such-and-such version of nautilus will work with them (/me grates teeth at nautilus). It still makes for good document portability.

I set up subversion (dav) as well. This is a must have for any coder of any kind and a great tutorial for this is at http://wiki.centos.org/HowTos/Subversion. Once again, I pretty much copied my repo files from one machine to the other, and I even renamed the base repo on the way. Everything just worked and retained my logs and revision history, etc. Good stuff!

I installed LAMP on the server and moved over my intranet php code and databases and set up ntpd (a time server).

Lastly I installed bind on the new server so I can keep my dns going. That was a little bit more of a pain as the installs are *way* different between Ubuntu (old server) and CentOS (new one). CentOS uses a jailed instance, a different directory structure and a slightly different config setup as well. The tutorial at http://www.sanhom.com/?p=83 was invaluable at getting things going.

Whew, we are almost there! The only things I have left to do is setup my music server (GnuMP3d) and dhcp server, bothl of which are pretty much a piece of cake. After that I am ready for the momentous unplugging of the old machine :-)

I wonder how Dann managed all this in just one night?! :-)

Personal IMAP mail server

What is a personal IMAP mail server and why would you want one? Well, such a server is, like it sounds, your very own mail server that you can access via IMAP. You might want such a thing because, like me, you have a lot of different email accounts in different places and you want to collect them all into one central and easy to manage location. I also like having more direct control over my access to my email. For example, if your email account at somewhere.com stops working because their server is down and you need to reference an email stored there, you are out of luck, unless you store your somewhere.com email on your own email server where you can still access it even though their server is inaccessible.

Since I am doing some personal server upgrades and migration, I thought it would be great to share just how to get this kind of server up and running with the most minimal hassle.

For starters, my new mail server is going to be a 32 bit server install of CentOS 5.3. This OS is not at all difficult to install at all and it’s enterprise ready, so it’s plenty reliable.

When you have a machine ready with CentOS running on it, you will need to install Dovecot to handle your IMAP mail access. This is just an yum install away:

yum -y install dovecot

You will need to configure Dovecot after the install. Edit the /etc/dovecot.conf file and make sure the following is set and uncommented:

protocols = imap imaps
mail_location = maildir:~/Maildir

CentOS uses a sendmail/procmail mail combo by default, so in order to make sure your server and IMAP are both using Maildir (so your email gets delivered to you locally) you’ll need to create a file called /etc/procmailrc and in it put:

DEFAULT=$HOME/Maildir/

And then restart your mail service (just to make sure):

service sendmail restart

Once that is set, you will need to turn on Dovecot!

chkconfig dovecot on
service dovecot start

At this point, you should be able to (firewall issues not withstanding) connect to your new mail server via IMAP and see that you have no mail. I am assuming that you have set up mail clients before, the only difference now is you will point to “YourNewMailServerName” and set it up for IMAP mail and use your account name and password from “YourNewMailServerName”.

For example, I created a new server called “Pukwudgie.linc.lan” and created an account on it called linc and made a supersecret password. When I set up my mail client to test the mailserver setup, I set it up to point to Pukwudgie.linc.lan using my username of linc and my password of supersecret via the IMAP protocol. I was able to log directly into my new mail account, which was completely empty.

At some point, you will want to SEND some mail from this account. Since this personal IMAP server is just a place to HOLD your emails, you will need to configure your email client to use your ISP’s smtp address to send through. Follow their instructions for doing this. Most ISP’s do not allow you to use any smtp server other than their own these days.

Now for the fun part. You wan to collect your mail from other places and store it here. This is accomplished through the use of fetchmail. You will need to place a “~/.fetchmailrc” file in your home directory. Please refer to the fetchmailrc man page for full details, but in essence mine looks a lot like this:

poll lincisgreat.org user "linc" there with password "itsasecret"

And you can have as many of those lines in that file as you have email accounts. After creating the rc file, you can run fetchmail to get your mail and have it delivered locally on your new server, where you can access it via IMAP. There are several methods of running fetchmail. You can run it by itself and watch the output as it goes each time, you can run it in daemon mode by starting it with the -d command line switch and specifying a time interval:

fetchmail -d 60

Will check for and grab your email every 60 seconds. Or you could put fetchmail in your crontab and have cron manage getting your mail like so:

*/5 * * * * /usr/bin/fetchmail &> /dev/null

Which would check your email every 5 minutes.

Sys_Basher

Late last ‘week I noticed that my new nagios server was not responding anymore. Well, I checked it and it was down. Not only that, it was a vm on my test server and the entire server was down as well. Arrrgh.

Usually I use this as a foray to tell you all to remember to do your backups. Well, in this case I didn’t do them either. Hey, it’s a test vm server right? Yeah, well I am kicking myself about that anyhow. I just got nagios working really well the way I wanted. Oh well, I guess I get to practice some more right :-)

Well, as it turns out, my server had a catastrophic drive failure. I did EVERYTHING to try and resuscitate this thing. To start with, it had no partition table at all. Luckily I bought 2 of these servers and they were identically configured, so I checked out the partition table of the one and used fdisk to apply it to the broken one. After that I was able to fsck one partition, but as it would happen, that partition was only boot. Feh. The other partition had lost all it’s superblock info. I couldn’t even use a backup superblock. Nada. I noticed that mkfs had a command line switch of -S, which writes the superblock info on a artition without formatting or touching the inodes. I tried that and it appeared to be successful. At leat I could run fsck on the partition now and it was fixing the inodes. YAY! except that after a few hours of fixing, I still got nothing but a few system files in a pile under the lost-n-found directory. Shortly thereafter the drive lost it’s partition info again anyway. That’s life I guess.

So, it was off to Microcenter to get a new hdd. I brought that home and did a fresh CentOS 5.3 32 bit install and played with it a bit and thought to myself, hey, maybe I should run some kind of burn-in test on this server before I go investing a lot of time into it again.

That is where Sys_Basher comes in. Sys_Basher is a multithreaded memory and disk exerciser. That’s what the website says. It makes a pretty good burn in program by continually testing your memory and disk (which pushes on your cpu as well) for any length of time you specify. I kinda like it actually, and that is a good thing because there are woefully few burn-in or stress test type programs available to the Linux community. In fact, if you are a programmer and looking for a great project, you could generate a lot of traffic and interest by making one. Not that I don’t like Sys_Basher, mind you, but variety is the spice of life and certainly the way of open source!

Anyway, I ran Sys_Basher overnight on my new machine which passed with flying colors. Then, this morning, I decided that maybe I should run 64bit Linux on this box. Some days I am so fickle, but I decided it would be in my best interest to change up the OS before building a bunch of new test vms on there :-)

Maybe this time I’ll even back the darn thing up too! Wish me luck and, btw, do your backups!