Thursday, January 8, 2009

OpenSolaris 2008.11 - Notes for Qmail and Vpopmail

I was very excited to try out OpenSolaris 2008.11. You see, I had a need for active-active replication on the cheap. I also have a new found love of ZFS. ZFS works wonderfully on FreeBSD 7.0, but I'm having bi-monthly issues with that system, and I'm attributing it to ZFS's beta state. Yes, it's 64bit, and has 8GB of RAM. I have also had to tweak some settings, but I just have to have something more stable.

Enter OpenSolaris. A Free OS with the stability of Solaris, along with mature ZFS code, PLUS the recently released Availability Suite into the Open Source community, and I have an excellent solution that fits my problem. At least, on paper. The plan is to have 2 servers, both with a single OS hardware RAID mirrored drive, and 6 JBOD 500GB SATA drives. Using AVS, I will mirror every other drive to the opposite system as shown here:

Back to my exctement about OpenSolaris 2008.11. Why was I excited? Because 2008.5 didn't support the Areca OR LSI RAID cards I purchased. That really sucked. These things aren't cheap, and I'm trying to do this on the cheap. Fortunately just as I was about to ditch the whole idea, 2008.11 came out with support for Areca.

Installation. As opposed to Solaris (which I also tried, and didn't support my RAID cards either), OpenSolaris' installation program is quite nice. It's very straightforward and simple. I booted off the CD into the GUI system, and clicked 'Install'. I was able to install the OS on my hardware mirrored drives fairly rapidly.

Configuration. Here's where the trouble started - at least, after the driver debacle. I tried to change the IP Address. Sounds simple, doesn't it? Hell no. I'm ssh'd into these machines, and supposedly, you can just change a couple files in /etc. Doesn't work. I also tried the 'sys-unconfig' command to start over from scratch. This cleared the system, but I discovered a new issue: The re-configuration doesn't come up in GUI mode. You MUST select TEXT mode from Grub when booting. Amusingly, this is the only time 'TEXT' mode actually works. If you select to boot into TEXT mode when the system is fully operational, it will happily boot into the GUI after giving you something like 5 lines of output. Nice.

GUI posed a huge problem, I only have a single PS2 port on these servers, and no USB mouse. The GUI environment (GNOME) ABSOLUTELY SUCKS without a mouse. You cannot move around at all. I had to resort to banging on the keyboard to find a combination that would get me out of certain menus. It's awful. Eventually, I found a USB mouse and was able to quickly configure the network on the 2nd machine via the GUI. After a reboot, it's finally active, it's not a 'live' change.

Oh yeah, and edit /etc/nsswitch.conf
Make sure:
hosts: files dns mdns
ipnodes: files dns mdns

This doesn't change automatically for some reason.

I'd also like to note I can't log into the GUI as root, but oddly enough, as 'rick' I can change the network settings and install packages. This is not good.

Now I needed to install my software. At that point, I didn't have a USB mouse, so I was installing via SSH. Bad idea. pkg -r search 'name' is a good way to get a whole list of packages, but the names are all funky. MySQL is SUNWmysql5. Why can't it be just 'mysql5' ? And it's not enabled, so we need:

svcadm enable mysql5
pfexec svccfg import /var/svc/manifest/application/database/mysql.xml
svcs -xv mysql

Now I realize I need packages that the SUN Site (ha!) doesn't have, so we need to add a couple of authorities:

pkg set-authority -O blastwave
pkg set-authority -O sunfreeware

Then add the packages:

pkg refresh

pkg install SUNWgcc
pkg install SUNWcurl
pkg install IPSpkgconfig
pkg install IPSgawk
pkg install IPSFWlynx

pkg install perl-dbi

Ok, so after a lot of searching I have some base applications installed, but I need more. I need Perl packages. Ohh, but you can't just compile Perl packages without a hack - that would be silly!

vi /usr/perl5/5.8.4/lib/i86pc-solaris-64int/

Find these variables, and set them as follows:

Oh, and change the compiler
ln -s /usr/bin/cc /usr/bin/gcc

Now you can use cpan to install Perl modules.

Note: When using useradd, you MUST SUPPLY A VALID SHELL! !#@#!@!
So that means after you add all your daemon users, modify the shell in /etc/passwd.
Maybe there's a better way, I dunno.

Installing Qmail:
groupadd nofiles
useradd -g nofiles -d /var/qmail -s /bin/bash qmaild
useradd -g nofiles -d /var/qmail -s /bin/bash alias
useradd -g nofiles -d /var/qmail -s /bin/bash qmaill
useradd -g nofiles -d /var/qmail -s /bin/bash qmailp
groupadd qmail
useradd -g qmail -d /var/qmail -s /bin/bash qmailq
useradd -g qmail -d /var/qmail -s /bin/bash qmailr
useradd -g qmail -d /var/qmail -s /bin/bash qmails
mkdir /var/qmail
make setup check

Installing vpopmail:
groupadd -g 89 vchkpw
useradd -u 89 -g vchkpw -d /usr/local/vpopmail -s /bin/bash vpopmail

I had quota issues on my system. Anything over 2GB was wrong. The fix is to change off_t to int64_t in maildirquota.c Why there were no problems on other 64bit kernels, and even 32bit, is beyond me. Other than it being an OpenSolaris issue :/
Configure can be run as you wish, but I had to point to the libdir, and then link the MySQL library into a path where vpopmail could find it.

./configure --enable-auth-module=mysql --enable-rebuild-tcpserver-file=n --enable-ip-alias-domains=y --enable-valias=y --enable-qmail-ext=y --enable-mysql-replication=y --enable-incdir=/usr/mysql/include/mysql --enable-libdir=/usr/mysql/lib/mysql/

ln -s /usr/mysql/lib/mysql/ /usr/lib/


YAY! No issues on a single running system. I've hosed up my second system while trying to learn AVS, so after I fight though the IP change again and figure out AVS, I'll follow up with another post.

No comments: