• You are here:
  • Home »
  • No category »

New install DirectAdmin on Debian 6.0 x64 OpenVZ, Spam Assassin, CSF and other – my notes

After another install DirectAdmin on VPS and loosing time to search in many place information how to do this or that I wrote this few notes to keep steps in one place. Maybe it will be useful for you. My system was Debian 6.0 x64, VPS on OpenVZ.1. Update system and install modules

apt-get update
apt-get upgrade
apt-get install build-essential mc htop gcc g++ make flex bison openssl libssl-dev perl perl-base perl-modules libperl-dev libaio1 libaio-dev zlib1g zlib1g-dev libcap-dev bzip2 automake autoconf libtool cmake pkg-config python libreadline-dev libdb4.8-dev libsasl2-dev

if you need change language or timezone data:

dpkg-reconfigure locales
dpkg-reconfigure tzdata

2. Install DirectAdmin

wget http://www.directadmin.com/setup.sh
chmod 755 setup.sh
./setup.sh

and follow instructions.

3. Install firewall – CSF

wget http://www.configserver.com/free/csf.tgz
tar -xzf csf.tgz
cd csf
sh install.sh

4. For security reason it’s good to change default port from 22 to other else
Change SSH port:

/etc/ssh/sshd_config

change port in line bellow

Port 22

to other and restart service:

/etc/init.d/sshd restart

Remember to change CSF firewall settings – disable port 22 and enable your new port.

5. Enable login based on public keys.

Create on server (if not exist):

mkdir ~/.ssh
 chmod 700 ~/.ssh

and write to authorized_keys2 file public key and set permissions:

chmod 600 ~/.ssh/authorized_keys2

Under windows you can create ssh key in Puttygen software.

6. Add to alias to /etc/aliases to get notifications

root: my@mail.com

to recive system notification on your email.

7. To install SpamAssassin:

apt-get install libdigest-sha1-perl libhtml-parser-perl libnet-dns-perl libnetaddr-ip-perl libwww-perl librazor2-perl libnet-ident-perl libio-socket-ssl-perl libmail-dkim-perl libdbi-perl libencode-detect-perl  libmail-spf-perl
cd /usr/local/directadmin/scripts
 ./spam.sh

After install you should modify exim.conf, uncommen # Spam Assassin (only leave one in Spam Assassin line, like below):

# Spam Assassin
 spamcheck_director:
   driver = accept
   condition = "${if and {  \
       {!def:h_X-Spam-Flag:}  \
       {!eq {$received_protocol}{spam-scanned}}  \
       {!eq {$received_protocol}{local}}  \
       {exists{/home/${lookup{$domain}lsearch{/etc/virtual/domainowners}{$value}}/.spamassassin/user_prefs}}  \
       {<{$message_size}{100k}} \
     } {1}{0}}"
   retry_use_local_part
   transport = spamcheck
   no_verify

and after restart exim:

/etc/init.d/exim restart

8. If you have problem with Roundcube, phpMyAdmin just try:

cd /usr/local/directadmin/custombuild
./build rewrite_confs

Leave a Comment: