The Perfect Server - Gentoo 2007.0 - Page 7
18 ISPConfig
18.1 Install ISPConfig software dependencies
ISPConfig will install its own copy of spamassassin inside itself, but it won't automatically get its dependencies. You can install those by doing this:
emerge --ask --verbose HTML-Parser perl-DB_File Net-DNS
Alternatively you could just do,
emerge --ask --verbose --onlydeps spamassassin
This will install the packages that Gentoo's spamassassin depends on, but not spamassassin itself. Interestingly it will install an awful lot more than the three things we're installing for ISPConfig's spamassassin.
Also, ISPConfig wants iptables and smrsh:
emerge --ask --verbose iptables smrsh
As noted earlier, ISPConfig requires that the default character set in MySQL is latin1, not utf-8, so if you didn't do that when you installed MySQL earlier,
echo "dev-db/mysql latin1" >> /etc/portage/package.use
emerge --ask --verbose mysql
18.2 Initialise root's crontab
Then we just want to make sure that there is a crontab file for root already in existence, so ISPConfig's installer doesn't complain.
echo "# m h dom mon dow command" | crontab -
18.3 Configure Postfix
Earlier we set up Postfix for normal Maildir operation. Now we want to set it to the state that ISPConfig wants in order to take that function over with its procmail recipies.
postconf -e 'home_mailbox ='
postconf -e 'mailbox_command = procmail -a "$EXTENSION"'
/etc/init.d/postfix restart
18.4 Patch ISPConfig to make it Gentoo-aware
ISPConfig doesn't install out of the box on Gentoo. When you unpack the ISPConfig tarball you must first patch it. This has been implemented as a script rather than a diff in the hope that, as it's just a couple of sections dropped into the ISPConfig files, and not editing or removing anything already there, we can make it a little version-independent. That said, it has only been tested on ISPConfig-2.2.16.tar.gz.
Distro version numbers don't mean very much in Gentoo, so the "version" number we use in ISPConfig to recognise the system is actually based on the major.minor version number of the baselayout as written into /etc/gentoo-release. We disregard the revision number. Therefore, if that file contains,
Gentoo Base System release 1.12.9
Then we use a "version" number of "112" in our patch to ISPConfig.
This script will download (if necessary), unpack and patch ISPConfig with a little code to recognise Gentoo. If ISPConfig has been unpacked in /root already, it will attempt to patch that. It is embedded here in its entirety in homage to the tradition that indispensable scripts linked to from HowTos always, in the end, go astray:
#!/bin/bash # GentooISPConfig.sh 1.0 echo "Setting up ISPConfig..." cd ~ if [ -d install_ispconfig ] ; then ISPCV=$(grep "version" install_ispconfig/config.inc.php.tmp | cut -f2 -d= | cut -f2 -d'"') echo "Unpacked ISPConfig ${ISPCV} installer found. I will attempt to patch this now." else ISPCV="2.2.17" echo "Downloading ISPConfig ${ISPCV}" wget -Nc http://prdownloads.sourceforge.net/ispconfig/ISPConfig-${ISPCV}.tar.gz?download echo "Unpacking ISPConfig ${ISPV}" tar xvfz ISPConfig-${ISPCV}.tar.gz fi cd install_ispconfig if grep gentoo112 dist.txt > /dev/null ; then echo "This ISPConfig installer has been patched already" exit 1 fi echo "Patching dist.txt" cat >> dist.txt <<-"END" dist_init_scripts=/etc/init.d ## # gentoo112 dist_runlevel= ## # gentoo112 dist_smrsh=/usr/sbin/smrsh ## # gentoo112 dist_shells=/etc/shells ## # gentoo112 dist_http_user=apache ## # gentoo112 dist_http_group=apache ## # gentoo112 dist_bind_init_script=named ## # gentoo112 dist_bind_user=named ## # gentoo112 dist_bind_group=named ## # gentoo112 dist_bind_conf=/etc/bind/named.conf ## # gentoo112 dist_bind_dir=/etc/bind ## # gentoo112 dist_bind_pidfile=/var/run/named/named.pid ## # gentoo112 dist_bind_hintfile=named.ca ## # gentoo112 dist_bind_localfile=localhost.zone ## # gentoo112 dist_passwd=/etc/passwd ## # gentoo112 dist_shadow=/etc/shadow ## # gentoo112 dist_group=/etc/group ## # gentoo112 dist_cron_daemon=cron ## # gentoo112 dist_cron_tab=/var/spool/cron/crontabs/root ## # gentoo112 dist_mysql_group=mysql ## # gentoo112 dist_httpd_daemon=apache2 ## # gentoo112 END echo "Patching mod/mail/postfix" cat >> mod/mail/postfix <<-"END" dist_mail_log:/var/log/messages:Log-File:read::gentoo112 dist_mail_virtusertable:/etc/postfix/virtusertable:Virtusertable-File:read::gentoo112 dist_mail_local_host_names:/etc/postfix/local-host-names:Local-Host-Names-File:read::gentoo112 END echo "Patching mod/ftp/proftpd" cat >> mod/ftp/proftpd <<-"END" dist_ftp_conf:/etc/proftpd/proftpd.conf:Config-File:read::gentoo112 dist_ftp_version:standalone:Server-Version:exit::gentoo112 dist_ftp_log:/var/log/messages:Log-File:read::gentoo112 END echo "Patching mod/httpd/httpd" cat >> mod/httpd/httpd <<-"END" dist_path_httpd_root:/var/www:Web-Root:read::gentoo112 END echo "Patching setup1" ed - -s setup1 > /dev/null <<-"END" /\"$distvers\" \]; i if [ -f /etc/gentoo-release ] && [ ! -h /etc/gentoo-release ]; then version=`cat /etc/gentoo-release | cut -f5 -d' ' | cut -f1,2 -d'.'` distversion="Gentoo Baselayout $version" echo $distversion distvers=gentoo${version//./} echo dist=$distvers '##' > dist.info.tmp grep -i $distvers dist.txt >> dist.info.tmp cp -f dist.info.tmp dist.info VAR1=`cat dist.info.tmp | cut -f1 -d=` for var1 in $VAR1 do echo export $var1 >> dist.info.ende done cat dist.info.ende >> dist.info.tmp rm -f dist.info.ende fi . wq END echo "Finished patching ISPConfig. Run setup now."
18.5 Install ISPConfig
cd install_ispconfig
./setup
The configuration of the server is now finished, and is ready for you to install ISPConfig on it. Please check out the ISPConfig installation manual: http://www.ispconfig.org/manual_installation.htm
19 Post-install ISPConfig
19.1 Startup
To make the ISPConfig web interface start at boot, just enter,
rc-update add ispconfig_server default
19.2 Spamassassin
You may prefer to run Spamassassin in daemon mode rather than the ISPConfig default, which is to run its own copy of Spamassassin directly for each email (which can be slow). To do this, just:
emerge --ask --verbose spamassassin
/etc/init.d/spamd start
rc-update add spamd default
Now edit /root/ispconfig/isp/conf/spamassassin.rc.master and replace this line:
| /home/admispconfig/ispconfig/tools/spamassassin/usr/bin/spamassassin --prefs-file={PREFS_FILE}
with just,
| /usr/bin/spamc
(This version, and presumably later versions, of ISPConfig put symlinks into new users' home directories to allow spamc to pick up the user preferences.)