Download Ubuntu Server 9.04

Ubuntu server 9.04 available for free from here :

http://www.ubuntu.com/getubuntu/download-server

Or you can request free CD that get delievered to your home, for personal or commercial use.

Make sure to choose right version, for real server you might need 64 bit version but when you don’t have you can use 32 bit version for siumulation before implement in production server.

64bit

Configure DNS

For the sake of example I use minimal configuration and a fake domain name ‘digitalfusi.com’

Lets start :

# apt-get install bind9

# nano /etc/bind/named.conf.local

add these lines :

zone “digitalfusi.com” {
type master;
file “/etc/bind/zones/digitalfusi.com.db”;
};

zone “12.168.192.in-addr.arpa” {
type master;
file “/etc/bind/zones/rev.12.168.192.in-addr.arpa”;
};

save.

Creating zone :

# mkdir /etc/bind/zones

# nano /etc/bind/zones/digitalfusi.com.db

Put these lines :

$TTL 3D
@ IN      SOA     ns.digitalfusi.com admin.digitalfusi.com. (
2006081401
28800
3600
604800
38400
);
digitalfusi.com.      IN      NS              ns.digitalfusi.com.
digitalfusi.com.      IN      MX     10       mail.digitalfusi.com.
www                 IN      A              192.168.12.103
mail               IN      A               192.168.12.103

postfixadmin       IN      A               192.168.12.103
mailguard          IN      A               192.168.12.103
ns                 IN      A               192.168.12.103

save.

# nano /etc/bind/zones/rev.12.168.192.in-addr.arpa

Pu these lines :

$TTL 3D
@ IN SOA ns.digitalfusi.com. admin.digitalfusi.com. (
2006081401;
28800;
604800;
604800;
86400
)

IN    NS     ns.digitalfusi.com.
254                  IN    PTR    digitalfusi.com

Forward dns request :

nano /etc/bind/named.conf.options

put these lines :

options {
directory “/var/cache/bind”;

forwarders {
# dns server of my isp
192.168.12.1;
};
auth-nxdomain no;    # conform to RFC1035
listen-on-v6 { any; };
};

Add dns entry :

nameserver 192.168.12.103

in /etc/resolv.conf

Restart dns server :

# /etc/init.d/bind9 restart

Testing :

# dig www.digitalfusi.com

; <<>> DiG 9.5.0-P2 <<>> www.digitalfusi.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 42841
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:
;www.digitalfusi.com.           IN      A

;; ANSWER SECTION:
www.digitalfusi.com.    259200  IN      A       192.168.12.103

;; AUTHORITY SECTION:
digitalfusi.com.        259200  IN      NS      ns.digitalfusi.com.

;; ADDITIONAL SECTION:
ns.digitalfusi.com.     259200  IN      A       192.168.12.103

;; Query time: 1 msec
;; SERVER: 192.168.12.103#53(192.168.12.103)
;; WHEN: Sun Apr 12 00:41:20 2009
;; MSG SIZE  rcvd: 86

# dig mx digitalfusi.com

; <<>> DiG 9.5.0-P2 <<>> mx digitalfusi.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 3077
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 2

;; QUESTION SECTION:
;digitalfusi.com.               IN      MX

;; ANSWER SECTION:
digitalfusi.com.        259200  IN      MX      10 mail.digitalfusi.com.

;; AUTHORITY SECTION:
digitalfusi.com.        259200  IN      NS      ns.digitalfusi.com.

;; ADDITIONAL SECTION:
mail.digitalfusi.com.   259200  IN      A       192.168.12.103
ns.digitalfusi.com.     259200  IN      A       192.168.12.103

;; Query time: 1 msec
;; SERVER: 192.168.12.103#53(192.168.12.103)
;; WHEN: Sun Apr 12 00:42:23 2009
;; MSG SIZE  rcvd: 103

Incoming search terms for the article:

Install maia mailguard

under construction

Incoming search terms for the article:

Install pear

# apt-get install php-pear

Incoming search terms for the article:

Install ClamAntiVirus

# apt-get install clamav

Add user and group :

# adduser clamav amavis

Adding user `clamav’ to group `amavis’ …
Adding user clamav to group amavis
Done.

# adduser amavis clamav

Adding user `amavis’ to group `clamav’ …
Adding user amavis to group clamav
Done.

Install FuzzyOCR

# apt-get install fuzzyocr

Incoming search terms for the article:

Install spamassassin

Installation
Install SpamAssassin

# apt-get install spamassassin

Install AmavisNew

# apt-get install amavisd-new

Install pyzor and razor

# apt-get install pyzor razor

Install compress and uncompress utility

# apt-get install arj bzip2 cabextract cpio file gzip lha nomarch pax rar unrar unzip unzoo zip zoo

Configuration :

Activate spamassassin

edit /etc/default/spamassassin :

change  ENABLED=0 into :
ENABLED=1
Start :

# /etc/init.d/spamassassin start

Starting SpamAssassin Mail Filter Daemon: spamd.

Amavis

# nano /etc/amavis/conf.d/15-content_filter_mode

make into these lines :

use strict;

# You can modify this file to re-enable SPAM checking through spamassassin
# and to re-enable antivirus checking.

#
# Default antivirus checking mode
# Uncomment the two lines below to enable it back
#

@bypass_virus_checks_maps = (
\%bypass_virus_checks, \@bypass_virus_checks_acl, \$bypass_virus_checks_re);

#
# Default SPAM checking mode
# Uncomment the two lines below to enable it back
#

@bypass_spam_checks_maps = (
\%bypass_spam_checks, \@bypass_spam_checks_acl, \$bypass_spam_checks_re);

1;  # ensure a defined return

Discard bouncing spam by editing /etc/amavis/conf.d/20-debian_defaults :

$final_virus_destiny      = D_DISCARD;  # (data not lost, see virus quarantine)
$final_banned_destiny     = D_BOUNCE;   # D_REJECT when front-end MTA
$final_spam_destiny       = D_DISCARD;
$final_bad_header_destiny = D_PASS;     # False-positive prone (for spam)

Start  :

# /etc/init.d/amavis restart

Stopping amavisd: (not running).
Starting amavisd: head: cannot open `/etc/mailname’ for reading: No such file or directory
The value of variable $myhostname is “smsgw”, but should have been
a fully qualified domain name; perhaps uname(3) did not provide such.
You must explicitly assign a FQDN of this host to variable $myhostname
in /etc/amavis/conf.d/05-node_id, or fix what uname(3) provides as a host’s
network name!
(failed).

Solution :

Edit /etc/hostname :

change from smsgw into mail.digitalfusi.com

Or by typing this command :

# hostname mail.digitalfusi.com

Restart amavis

# /etc/init.d/amavis restart

Stopping amavisd: (not running).
Starting amavisd: head: cannot open `/etc/mailname’ for reading: No such file or directory
amavisd-new.

Ok, I make the file and put ‘mail.digitalfusi.com’ inside /etc/mailname and restart amavis

# /etc/init.d/amavis restart

Stopping amavisd: amavisd-new.
Starting amavisd: amavisd-new.

Seem good :-)

Checking all equipment ::

# tail -f /var/log/mail.log

Apr 25 12:38:30 smsgw amavis[4654]: No decoder for       .zoo  tried: zoo
Apr 25 12:38:30 smsgw amavis[4654]: No decoder for       .lha
Apr 25 12:38:30 smsgw amavis[4654]: No decoder for       .doc  tried: ripole
Apr 25 12:38:30 smsgw amavis[4654]: No decoder for       .cab  tried: cabextract
Apr 25 12:38:30 smsgw amavis[4654]: No decoder for       .tnef
Apr 25 12:38:30 smsgw amavis[4654]: Internal decoder for .tnef
Apr 25 12:38:30 smsgw amavis[4654]: No decoder for       .exe  tried: unrar-free; arj, unarj
Apr 25 12:38:30 smsgw amavis[4654]: Using primary internal av scanner code for ClamAV-clamd
Apr 25 12:38:30 smsgw amavis[4654]: Found secondary av scanner ClamAV-clamscan at /usr/bin/clamscan
Apr 25 12:38:30 smsgw amavis[4654]: Creating db in /var/lib/amavis/db/; BerkeleyDB 0.34, libdb 4.6

Install missing package :

# apt-get install lha zoo cabextract

Try again to verify :

# tail -f /var/log/mail.log

Apr 25 12:42:34 smsgw amavis[4878]: Found decoder for    .zoo  at /usr/bin/zoo
Apr 25 12:42:34 smsgw amavis[4878]: No decoder for       .lha
Apr 25 12:42:34 smsgw amavis[4878]: No decoder for       .doc  tried: ripole
Apr 25 12:42:34 smsgw amavis[4878]: Found decoder for    .cab  at /usr/bin/cabextract
Apr 25 12:42:34 smsgw amavis[4878]: No decoder for       .tnef
Apr 25 12:42:34 smsgw amavis[4878]: Internal decoder for .tnef
Apr 25 12:42:34 smsgw amavis[4878]: No decoder for       .exe  tried: unrar-free; arj, unarj
Apr 25 12:42:34 smsgw amavis[4878]: Using primary internal av scanner code for ClamAV-clamd
Apr 25 12:42:34 smsgw amavis[4878]: Found secondary av scanner ClamAV-clamscan at /usr/bin/clamscan
Apr 25 12:42:34 smsgw amavis[4878]: Creating db in /var/lib/amavis/db/; BerkeleyDB 0.34, libdb 4.6

Install other  decoder:

# apt-get install unrar-free arj  ripole tnef

Postfix Integration

Edit /etc/postfix/main.cf :

Add this line :

content_filter = smtp-amavis:[127.0.0.1]:10024

Edit /etc/postfix/master.cf :

Add these lines :

smtp-amavis     unix    -       -       -       -       2       smtp
-o smtp_data_done_timeout=1200
-o smtp_send_xforward_command=yes
-o disable_dns_lookups=yes
-o max_use=20

127.0.0.1:10025 inet    n       -       -       -       -       smtpd
-o content_filter=
-o local_recipient_maps=
-o relay_recipient_maps=
-o smtpd_restriction_classes=
-o smtpd_delay_reject=no
-o smtpd_client_restrictions=permit_mynetworks,reject
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o smtpd_data_restrictions=reject_unauth_pipelining
-o smtpd_end_of_data_restrictions=
-o mynetworks=127.0.0.0/8
-o smtpd_error_sleep_time=0
-o smtpd_soft_error_limit=1001
-o smtpd_hard_error_limit=1000
-o smtpd_client_connection_count_limit=0
-o smtpd_client_connection_rate_limit=0
-o receive_override_options=no_header_body_checks,no_unknown_recipient_checks

Save.

Test

# telnet localhost 10024

Trying ::1…
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
220 [127.0.0.1] ESMTP amavisd-new service ready

Incoming search terms for the article:

Install Postfixadmin

Find uid and guid of user postfix :

# id postfix

uid=109(postfix) gid=117(postfix) groups=117(postfix)

Edit dovecot-sql.conf :

# nano /etc/dovecot/dovecot-sql.conf

change it from :

125 AS uid, 125 AS gid

into :

109 AS uid, 117 AS gid

and save the file.

Edit main.cf

# nano /etc/postfix/main.cf

Change these section :

virtual_alias_maps = proxy:mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_gid_maps = static:117
virtual_mailbox_base = /usr/local/virtual
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_limit = 51200000
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_minimum_uid = 109
virtual_transport = virtual
virtual_uid_maps = static:109

Create database for postfix :

# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 35
Server version: 5.1.31-1ubuntu2 (Ubuntu)

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql> create database postfix;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on postfix.* to postfix@localhost identified by ‘postfix2008′ with grant option;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql>exit

Install postfixadmin :

# wget http://transact.dl.sourceforge.net/sourceforge/postfixadmin/postfixadmin-2.2.1.1.tar.gz

# tar -xvzf postfixadmin-2.2.1.1.tar.gz

# mv postfixadmin-2.2.1.1 /var/www/nginx-default/postfixadmin

# cd /var/www/nginx-default/postfixadmin/

Edit config.inc.php :

$CONF['configured'] = true;
$CONF['postfix_admin_url'] = ‘http://postfixadmin.digitalfusi.com/‘;
$CONF['database_type'] = ‘mysqli‘;
$CONF['database_host'] = ‘localhost‘;
$CONF['database_user'] = ‘postfix‘;
$CONF['database_password'] = ‘postfixjaunty’;
$CONF['database_name'] = ‘postfix‘;
$CONF['database_prefix'] = ”;
$CONF['admin_email'] = ‘postmaster@digitalfusi.com‘;
$CONF['default_aliases'] = array (
‘abuse’ => ‘abuse@digitalfusi.com‘,
‘hostmaster’ => ‘hostmaster@digitalfusi.com‘,
‘postmaster’ => ‘postmaster@digitalfusi.com‘,
‘webmaster’ => ‘webmaster@digitalfusi.com
);
$CONF['generate_password'] = ‘NO‘;
$CONF['page_size'] = ‘20‘;
$CONF['domain_path'] = ‘YES‘;
$CONF['domain_in_mailbox'] = ‘NO‘;
$CONF['encrypt'] = ‘md5‘;
$CONF['aliases'] = ‘50‘;
$CONF['mailboxes'] = ‘50‘;
$CONF['maxquota'] = ‘1024‘;
$CONF['quota'] = ‘YES‘;
$CONF['quota_multiplier'] = ‘1048576‘;
$CONF['transport'] = ‘NO‘;
$CONF['vacation'] = ‘YES‘;
$CONF['vacation_domain'] = ‘autoreply.digitalfusi.com‘;
$CONF['alias_control_admin'] = ‘YES‘;
$CONF['special_alias_control'] = ‘YES‘;
$CONF['show_header_text'] = ‘YES‘;
$CONF['header_text'] = ‘:: Postfix Admin ::‘;
$CONF['show_footer_text'] = ‘YES‘;
$CONF['footer_text'] = ‘Return to postfixadmin‘;
$CONF['user_footer_link'] = ‘http://postfixadmin.digitalfusi.com/‘;
$CONF['welcome_text'] = <<<EOM
Hello,

Welcome to your new email account!

For questions or comments regarding your mail account,
please feel free to send an email to support@digitalfusi.com.
Likewise, any other inqueries regarding digitalfusi or their
affiliates can be sent to the same address.

Also, don’t forget to check your mail settings via Maia-
Mailguard located at http://mailguard.digitalfusi.com/.
Simply log into your account using your email address
and password. That’s it! From Maia-Mailguard, you can
adjust your spam, virus, malware, whitelists, blacklists,
etc… This will put you in full control of your email so
you never miss anything important.

Enjoy your new email
account!

Regards,
Alamsyah Rasyid
support@
digitalfusi.com
EOM;
?>

Setting postfixadmin by accessing :

http://postfixadmin.digitalfusi.com/setup.php

Edit /etc/nginx/sites-available/default  and add these lines :

# postfixadmin

server {
listen          80;
server_name     postfixadmin.digitalfusi.com;

location / {
index index.php index.html;
root  /var/www/nginx-default/postfixadmin;
}
location ~ \.php$ {
fastcgi_pass    127.0.0.1:9000;
fastcgi_index   index.php;
fastcgi_param     SCRIPT_FILENAME     /var/www/nginx-default/postfixadmin$fastcgi_script_name;
include      fastcgi_params;
}

}

Restart nginx.

Delete setup.php first before continue to this step and make sure to see these message :

Postfix Admin Setup Checker

Running software:

  • PHP version 5.2.6-3ubuntu4

Checking for dependencies:

  • Warning: Magic Quotes: ON (internal workaround used)
  • Depends on: presence config.inc.php – OK
  • Checking $CONF['configured'] – OK
  • Depends on: MySQL 3.23, 4.0 – OK
  • Depends on: MySQL 4.1 – OK (change the database_type to ‘mysqli’ in config.inc.php!!)
  • Testing database connection – OK – mysql://postfix:xxxxx@localhost/postfix
  • Depends on: session – OK
  • Depends on: pcre – OK
  • Depends on: multibyte string – OK
  • Depends on: IMAP functions – OK

Everything seems fine… attempting to create/update database structure

Database is up to date

Admin has been added!
(alamster@gmail.com)

You can now log in to Postfix Admin.

Make sure you delete this setup.php file!
Also check the config.inc.php file for any settings that you might need to change!

Access from browser :

http://postfixadmin.digitalfusi.com

Incoming search terms for the article:

Install php

Install :

apt-get install php5-cgi php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

Incoming search terms for the article:

Install Nginx

Install nginx :

# apt-get install nginx

Enable php in nginx.conf :

# nano /etc/nginx/sites-available/default

add these lines :

location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass  127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param  SCRIPT_FILENAME  /var/www/nginx-default$fastcgi_script_name;
}

Install spawn-fcgi :

# wget http://www.lighttpd.net/download/spawn-fcgi-1.6.1.tar.gz

# tar xvzf spawn-fcgi-1.6.1.tar.gz

# cd spawn-fcgi-1.6.1

# ./configure

# make

# make install

# ln -s /usr/local/bin/spawn-fcgi /usr/bin/spawn-fcgi

Configure nginx to recognize php using spawn-fcgi :

# touch /usr/bin/php-fastcgi

# nano /usr/bin/php-fastcgi

Type this :

#!/bin/sh
/usr/local/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -f /usr/bin/php5-cgi

save.

# touch /etc/init.d/init-fastcgi

# nano /etc/init.d/init-fastcgi

Type this :

#!/bin/bash
PHP_SCRIPT=/usr/bin/php-fastcgi
RETVAL=0
case “$1″ in
start)
$PHP_SCRIPT
RETVAL=$?
;;
stop)
killall -9 php
RETVAL=$?
;;
restart)
killall -9 php
$PHP_SCRIPT
RETVAL=$?
;;
*)
echo “Usage: php-fastcgi {start|stop|restart}”
exit 1
;;
esac
exit $RETVAL

Make it work :

# chmod 755 /usr/bin/php-fastcgi

# chmod 755 /etc/init.d/init-fastcgi

Make test file :

# nano /var/www/nginx-default/info.php

Type this :

<?php
phpinfo();
?>

Make it run at start up :

# update-rc.d init-fastcgi defaults

Start nginx and fastcgi :

# /etc/init.d/nginx start

# /etc/init.d/init-fastcgi start

Open from browser :

http://192.168.12.103/info.php

If it work, you’ll see page like this :

nginx-ubuntu

Incoming search terms for the article:

  • Pages

  • Download Ubuntu

  • Download Fedora

  • Tags

    atmail open on ubuntu server change ip address check connection clamav continue install dns dovecot fuzzyocr install jaunty maia mailguard mysql New Virtual Disk Wizard nginx pear php postfix postfixadmin preparation roundcube mail Setting Virtual Machine spamassassin squirrelmail
  • Categories

    • Translate to: