The Perfect Server - Debian Lenny (Debian 5.0) With MyDNS & Courier [ISPConfig 3] - Page 4

Want to support HowtoForge? Become a subscriber!
 
Submitted by falko (Contact Author) (Forums) on Tue, 2009-02-24 18:43. ::

10 Install Amavisd-new, SpamAssassin, And Clamav

To install amavisd-new, SpamAssassin, and ClamAV, we run

apt-get install amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 arj nomarch lzop cabextract apt-listchanges libnet-ldap-perl libauthen-sasl-perl clamav-docs daemon libio-string-perl libio-socket-ssl-perl libnet-ident-perl zip libnet-dns-perl

 

11 Install Apache2, PHP5, phpMyAdmin, FCGI, suExec, Pear, And mcrypt

Apache2, PHP5, phpMyAdmin, FCGI, suExec, Pear, and mcrypt can be installed as follows:

apt-get install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-php5 php5 php5-common php5-gd php5-mysql php5-imap phpmyadmin php5-cli php5-cgi libapache2-mod-fcgid apache2-suexec php-pear php-auth php5-mcrypt mcrypt php5-imagick imagemagick libapache2-mod-suphp libapache2-mod-ruby

You will see the following question:

Web server to reconfigure automatically: <-- apache2

Then run the following command to enable the Apache modules suexec, rewrite, ssl, actions, and include (plus dav, dav_fs, and auth_digest if you want to use WebDAV):

a2enmod suexec rewrite ssl actions include

a2enmod dav_fs dav auth_digest

Restart Apache afterwards:

/etc/init.d/apache2 restart

 

12 Install PureFTPd And Quota

PureFTPd and quota can be installed with the following command:

apt-get install pure-ftpd-common pure-ftpd-mysql quota quotatool

Edit the file /etc/default/pure-ftpd-common...

vi /etc/default/pure-ftpd-common

... and change the start mode from inetd to standalone and set VIRTUALCHROOT=true:

[...]
STANDALONE_OR_INETD=standalone
[...]
VIRTUALCHROOT=true
[...]

Edit the file /etc/inetd.conf to prevent inetd from trying to start ftp:

vi /etc/inetd.conf

Comment out the line beginning with ftp stream tcp:

[...]
#:STANDARD: These are standard services.
#ftp    stream  tcp     nowait  root    /usr/sbin/tcpd /usr/sbin/pure-ftpd-wrapper
[...]

Restart inetd afterwards:

/etc/init.d/openbsd-inetd restart

Then start PureFTPd:

/etc/init.d/pure-ftpd-mysql start

Edit /etc/fstab. Mine looks like this (I added ,usrquota,grpquota to the partition with the mount point /):

vi /etc/fstab

# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
/dev/sda1       /               ext3    errors=remount-ro,usrquota,grpquota 0       1
/dev/sda5       none            swap    sw              0       0
/dev/hda        /media/cdrom0   udf,iso9660 user,noauto     0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto  0       0

To enable quota, run these commands:

touch /quota.user /quota.group
chmod 600 /quota.*
mount -o remount /

quotacheck -avugm
quotaon -avug

 

13 Install MyDNS

Before we install MyDNS, we need to install a few prerequisites:

apt-get install g++ libc6 gcc gawk make texinfo libmysqlclient15-dev

MyDNS is not available in the Debian Lenny repositories, therefore we have to build it ourselves as follows:

cd /tmp
wget http://heanet.dl.sourceforge.net/sourceforge/mydns-ng/mydns-1.2.8.25.tar.gz
tar xvfz mydns-1.2.8.25.tar.gz
cd mydns-1.2.8
./configure
make
make install

Next we create the start/stop script for MyDNS:

vi /etc/init.d/mydns

#! /bin/sh
#
# mydns         Start the MyDNS server
#
# Author:       Philipp Kern <phil@philkern.de>.
#               Based upon skeleton 1.9.4 by Miquel van Smoorenburg
#               <miquels@cistron.nl> and Ian Murdock <imurdock@gnu.ai.mit.edu>.
#
set -e
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/sbin/mydns
NAME=mydns
DESC="DNS server"
SCRIPTNAME=/etc/init.d/$NAME
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
case "$1" in
  start)
        echo -n "Starting $DESC: $NAME"
        start-stop-daemon --start --quiet \
                --exec $DAEMON -- -b
        echo "."
        ;;
  stop)
        echo -n "Stopping $DESC: $NAME"
        start-stop-daemon --stop --oknodo --quiet \
                --exec $DAEMON
        echo "."
        ;;
  reload|force-reload)
        echo -n "Reloading $DESC configuration..."
        start-stop-daemon --stop --signal HUP --quiet \
                --exec $DAEMON
        echo "done."
        ;;
  restart)
        echo -n "Restarting $DESC: $NAME"
        start-stop-daemon --stop --quiet --oknodo \
                --exec $DAEMON
        sleep 1
        start-stop-daemon --start --quiet \
                --exec $DAEMON -- -b
        echo "."
        ;;
  *)
        echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
        exit 1
        ;;
esac
exit 0

Then we make the script executable and create the system startup links for it:

chmod +x /etc/init.d/mydns
update-rc.d mydns defaults

 

14 Install Vlogger, Webalizer, And AWstats

Vlogger, webalizer, and AWstats can be installed as follows:

apt-get install vlogger webalizer awstats

mkdir -p /usr/share/awstats/tools/
cp -prf /usr/share/doc/awstats/examples/awstats_buildstaticpages.pl /usr/share/awstats/tools/awstats_buildstaticpages.pl

 

15 Install Jailkit

Jailkit is needed only if you want to chroot SSH users. It can be installed as follows (important: Jailkit must be installed before ISPConfig - it cannot be installed afterwards!):

apt-get install build-essential autoconf automake1.9 libtool flex bison

cd /tmp
wget http://olivier.sessink.nl/jailkit/jailkit-2.5.tar.gz
tar xvfz jailkit-2.5.tar.gz
cd jailkit-2.5
./configure
make
make install
cd ..
rm -rf jailkit-2.5*

 

16 Install fail2ban

This is optional but recommended, because the ISPConfig monitor tries to show the log:

apt-get install fail2ban


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by scuzzu (registered user) on Tue, 2010-10-19 18:21.

Hello,

I really need jailkit to restrict folder access to shell users, but I have Debian Leny + ISPConfig 3.0.3 and Jailkit seems not installed (no /etc/jailkit/ folder).

Do you think if I install jailkit then make an update of ISPConfig then jailkit will work ?

Thank you,

Fred 

Submitted by SamTzu (registered user) on Sun, 2010-10-17 16:31.

I realized that 5 saslauthd processes were running, each consuming about 10% of the available memory. All together 1,5Gb mem.

You can tune this down to about 0.5Gb and 1 thread!

edit /etc/default/saslauthd

Change this line:
OPTIONS=”-m /var/spool/postfix/var/run/saslauthd -r”

to

OPTIONS=”-n0 -m /var/spool/postfix/var/run/saslauthd -r”

 

Submitted by Enzo24 (not registered) on Sat, 2010-08-28 21:50.

Nice tutorial.

There's just one important detail that was forgotten at step 13 - install MyDNS

Debian Lenny's base installation is delivered with bind9 pre-installed & active.

Before installing mydns, do this :

apt-get purge bind9
update-rc.d bind9 remove

 If you don't do it, then you'll wind up having mydns & bind both running & dns will not work because bind is already running on port 53...I spent a day on this one...( with thanks to "The Worm" and his tuto (in french))

http://forum.cabane-libre.org/topic-821-1.html

Thanks again for a nice tutorial, very well written & VERY useful too.

Submitted by Gummel (not registered) on Sun, 2010-06-27 10:54.

Hi,

thank you for this tutorial.

Make it sense to add a alternative caching system  for a perfect server ? 

To install e.g. eAccelerator have I only add "apt-get php-eaccelerator" in step 11 ?

Have someone testet a alternative cache ?

Thank you  a lot   

Submitted by suzeFan (not registered) on Mon, 2010-03-01 23:54.

Tip for all people lazy as me: create mydns by copy and paste into any editor on the host/Web-Browser-Computer and save it on an arbitrary local webserver.

Then get it by wget:

cd /etc/init.d
wget http://192.168.0.99/mydns

Could save some writing/typos that way

 

 

Submitted by suzeFan (not registered) on Mon, 2010-03-01 23:16.

Because after edit out ftp as last service from default inetd configuration, the inetd gives an errormsg on restart and, off course, do not start again.

Maybe telnetd should be added to the tutorial ...

 

Submitted by Jan Schulz-Hofen (not registered) on Tue, 2009-12-29 15:33.

see http://www.dikant.de/2009/01/22/setting-up-pureftpd-on-a-virtual-server/

Essentially, it's:

apt-get source pure-ftpd

add --without-capabilities to optflags in debian/rules

apt-get build-dep pure-ftpd

dpkg-buildpackage -uc -b

dpkg -i ../pure-ftpd-common_1.0.1-8_i386.deb

dpkg -i ../pure-ftpd-mysql_1.0.1-8_i386.deb

Submitted by diamen (not registered) on Fri, 2009-12-25 12:16.

1. Edit or create /etc/pure-ftpd/conf/CallUploadScript

2. Write on this file YES 

3 Edit or create /etc/pure-ftpd/clamav_chek.sh

4. Write on this file 

#!/bin/sh
/usr/bin/clamdscan --remove --quiet --no-summary "$1"

5. Edit /etc/default/pure-ftpd-common

UPLOADSCRIPT=/etc/pure-ftpd/clamav_chek.sh

6. Restart pure-ftpd 

/etc/init.d/pure-ftpd-mysql restart

Submitted by Robert (not registered) on Thu, 2009-12-10 20:16.

9 Install Postfix, Courier, Saslauthd, MySQL, phpMyAdmin, rkhunter, binutils

We can install Postfix, Courier, Saslauthd, MySQL, phpMyAdmin, rkhunter, and binutils with a single command:

apt-get install postfix postfix-mysql postfix-doc mysql-client mysql-server courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl libsasl2-2 libsasl2-modules libsasl2-modules-sql sasl2-bin libpam-mysql openssl courier-maildrop getmail4 rkhunter binutils

At step 9 you are saying that your are installing phpMyAdmin. But you are not.

Instead you are installing phpMyaAdmin at step 11. Which one is the better, at step 9 together with MySQL, or at step 11 where it is installed now ?

Submitted by alogoc (not registered) on Tue, 2009-09-01 13:24.

It's a very nice a useful tutorial...though how i make my squirremail point to whole domain?It's not very handy to have to put the /webmail in the end.

 If anyone could help...thanks!

Submitted by Anonymous (not registered) on Fri, 2009-06-26 14:54.

If you are on a low-spec server, do not install ClamAV. I installed it on a server with 540M ram and I realized that it was taking a third of my memory, forcing it to hit the swap (which kills performance).

Submitted by Aprasmac (not registered) on Tue, 2009-06-23 06:11.
There's no /etc/init.d/openbsd-inetd in my case. Did i miss something? How to restart the service then?
Submitted by Anonymous (not registered) on Fri, 2009-12-04 19:49.
did you solve this? the file is missing here too
Submitted by pallermo (not registered) on Fri, 2010-02-26 01:22.
Also missing...
Submitted by Anonymous (not registered) on Wed, 2010-03-10 08:59.
I also crashed at this point:(
Submitted by Paolo (not registered) on Sat, 2010-03-13 00:21.

Restart inetd afterwards:
/etc/init.d/openbsd-inetd restart
become
/etc/inetd restart

Submitted by Anonymous (not registered) on Fri, 2010-03-12 22:16.
apt-get install openbsd-inetd and go on
Submitted by Julien (not registered) on Mon, 2009-06-15 14:13.
Hi, this tutorial comes in very handy, thanks. But there seem to be a problem with your phpmyadmin security fix. By doing this, you remove setup.php protection and leave it available to anyone. (I don't understand how this is a security fix in the first place) Since debian lenny runs phpmyadmin 2.11.8.1 it becomes subject to code injection! See phpmyadmin security annonce : http://www.phpmyadmin.net/home_page/security/PMASA-2009-3.php Thanks again for your great site
Submitted by Croydon (registered user) on Tue, 2009-06-02 10:30.
I would recommend adding the volatile repository to apt (see http://www.debian.org/volatile/ ) when using clamav.
Submitted by clebedamasio (registered user) on Tue, 2009-05-05 07:16.
sorry my english ... I used google

The mydns not resolve external domain ...

so the place ...
Submitted by mbunal (registered user) on Fri, 2009-10-16 07:30.

look for /etc/resolv.conf

nameserver 127.0.0.1
nameserver YOUR.NS1.IP
nameserver YOUR.NS2.IP

Submitted by Anonymous (not registered) on Sun, 2009-05-03 23:08.

I would suggest to use jailkit with hardlinks:

 vi /etc/jailkit/jk_update.ini

 

 hardlinks = 1

 

Regards,

Andreas

Submitted by scuzzu (registered user) on Thu, 2010-10-21 05:41.

Hello,

Jailkit is not installed on my system (no etc/jailkit folder). How can I install it without deleting ISPConfig ?

Thank you,

Fred

Submitted by Vagelis Koutsomitros (not registered) on Sat, 2009-03-07 02:01.

I tried to initialize quota in lenny with the commands used here, but I got various errors.

So instead I used some info found here http://learnlinux.tsf.org.za/courses/build/sys-admin/ch05s02.html and i think that the best way to initialize quota, is the following

quotacheck -cvugm /home

 This will create the files aquota.user and aquota.group  ( -c flag ) on partition /home (or use the -a flag for all partitions and do not specify /home as 2nd parameter)

Then 

quotaon -avug

as the tutorial says

Also quota.user and quota.group is for version 1 while aquota.user and aquota.group is for version 2 (man quotacheck)

So in short, I suggest that 

touch /quota.user /quota.group
chmod 600 /quota.*
mount -o remount /
quotacheck -avugm

 is replaced by

quotacheck -acvugm

A big thank you, for your tutorials! Very useful!

Submitted by conket (not registered) on Tue, 2009-11-10 18:54.

I followed the part of Install MyDNS, and here is what I got. Could someone help me of  what to do next? Thank you,


test1:/tmp# wget http://heanet.dl.sourceforge.net/sourceforge/mydns-ng/mydns-1.2.8.25.tar.gz                      --2009-11-10 12:49:49--  http://heanet.dl.sourceforge.net/sourceforge/mydns-ng/mydns-1.2.8.25.tar.gz
Resolving heanet.dl.sourceforge.net... 193.1.193.66, 2001:770:18:aa40::c101:c142
Connecting to heanet.dl.sourceforge.net|193.1.193.66|:80... failed: Connection refused.
Connecting to heanet.dl.sourceforge.net|2001:770:18:aa40::c101:c142|:80... failed: Network is unreachable.
test1:/tmp#

Submitted by quannv (not registered) on Tue, 2009-04-28 12:20.

I did follow the perfect sever guide but I have different partition scheme, when I  install ISP config, it doesn't require enter the main directory for www data.

How to change like that?