The Perfect Server - Ubuntu 10.10 [ISPConfig 3] - Page 4

12 Install Postfix, Courier, Saslauthd, MySQL, rkhunter, binutils

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

aptitude 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 getmail4 rkhunter binutils maildrop

You will be asked the following questions:

New password for the MySQL "root" user: <-- yourrootsqlpassword
Repeat password for the MySQL "root" user: <-- yourrootsqlpassword
Create directories for web-based administration? <-- No
General type of mail configuration: <-- Internet Site
System mail name: <-- server1.example.com
SSL certificate required <-- Ok

We want MySQL to listen on all interfaces, not just localhost, therefore we edit /etc/mysql/my.cnf and comment out the line bind-address = 127.0.0.1:

vi /etc/mysql/my.cnf

[...]
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address           = 127.0.0.1
[...]

Then we restart MySQL:

/etc/init.d/mysql restart

Now check that networking is enabled. Run

netstat -tap | grep mysql

The output should look like this:

root@server1:~# netstat -tap | grep mysql
tcp        0      0 *:mysql                 *:*                     LISTEN      9815/mysqld
root@server1:~#

During the installation, the SSL certificates for IMAP-SSL and POP3-SSL are created with the hostname localhost. To change this to the correct hostname (server1.example.com in this tutorial), delete the certificates...

cd /etc/courier
rm -f /etc/courier/imapd.pem
rm -f /etc/courier/pop3d.pem

... and modify the following two files; replace CN=localhost with CN=server1.example.com (you can also modify the other values, if necessary):

vi /etc/courier/imapd.cnf

[...]
CN=server1.example.com
[...]

vi /etc/courier/pop3d.cnf

[...]
CN=server1.example.com
[...]

Then recreate the certificates...

mkimapdcert
mkpop3dcert

... and restart Courier-IMAP-SSL and Courier-POP3-SSL:

/etc/init.d/courier-imap-ssl restart
/etc/init.d/courier-pop-ssl restart

 

13 Install Amavisd-new, SpamAssassin, And Clamav

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

aptitude 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

 

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

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

aptitude 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 libopenssl-ruby libapache2-mod-ruby

You will see the following question:

Web server to reconfigure automatically: <-- apache2
Configure database for phpmyadmin with dbconfig-common? <-- No

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

 

15 Install PureFTPd And Quota

PureFTPd and quota can be installed with the following command:

aptitude install pure-ftpd-common pure-ftpd-mysql quota quotatool

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

vi /etc/default/pure-ftpd-common

... and make sure that the start mode is set to standalone and set VIRTUALCHROOT=true:

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

Now we configure PureFTPd to allow FTP and TLS sessions. FTP is a very insecure protocol because all passwords and all data are transferred in clear text. By using TLS, the whole communication can be encrypted, thus making FTP much more secure.

If you want to allow FTP and TLS sessions, run

echo 1 > /etc/pure-ftpd/conf/TLS

In order to use TLS, we must create an SSL certificate. I create it in /etc/ssl/private/, therefore I create that directory first:

mkdir -p /etc/ssl/private/

Afterwards, we can generate the SSL certificate as follows:

openssl req -x509 -nodes -days 7300 -newkey rsa:2048 -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem

Country Name (2 letter code) [AU]: <-- Enter your Country Name (e.g., "DE").
State or Province Name (full name) [Some-State]:
<-- Enter your State or Province Name.
Locality Name (eg, city) []:
<-- Enter your City.
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
<-- Enter your Organization Name (e.g., the name of your company).
Organizational Unit Name (eg, section) []:
<-- Enter your Organizational Unit Name (e.g. "IT Department").
Common Name (eg, YOUR name) []:
<-- Enter the Fully Qualified Domain Name of the system (e.g. "server1.example.com").
Email Address []:
<-- Enter your Email Address.

Change the permissions of the SSL certificate:

chmod 600 /etc/ssl/private/pure-ftpd.pem

Then restart PureFTPd:

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

Edit /etc/fstab. Mine looks like this (I added ,usrjquota=quota.user,grpjquota=quota.group,jqfmt=vfsv0 to the partition with the mount point /):

vi /etc/fstab

# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
/dev/mapper/server1-root /               ext4    errors=remount-ro,usrjquota=quota.user,grpjquota=quota.group,jqfmt=vfsv0 0       1
# /boot was on /dev/sda1 during installation
UUID=a8f37dcf-5836-485c-a451-3ae2f0f47720 /boot           ext2    defaults        0       2
/dev/mapper/server1-swap_1 none            swap    sw              0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0

To enable quota, run these commands:

mount -o remount /

quotacheck -avugm
quotaon -avug

 

16 Install BIND DNS Server

BIND can be installed as follows:

aptitude install bind9 dnsutils

 

17 Install Vlogger, Webalizer, And AWstats

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

aptitude install vlogger webalizer awstats geoip-database

 

18 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!):

aptitude install build-essential autoconf automake1.9 libtool flex bison debhelper

cd /tmp
wget http://olivier.sessink.nl/jailkit/jailkit-2.13.tar.gz
tar xvfz jailkit-2.13.tar.gz
cd jailkit-2.13
./debian/rules binary
cd ..
dpkg -i jailkit_2.13-1_*.deb
rm -rf jailkit-2.13*

 

19 Install fail2ban

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

aptitude install fail2ban

Share this page:

32 Comment(s)

Add comment

Comments

From: bibe at: 2010-10-13 10:30:36

Hi, and thanks for the well-detailed tutorial.

Just one (trivial?) question: is aptitude installed in an Ubuntu 10.10 server default install [I found that there was no aptitude on a 10.10-rc desktop default install]. If so, before the first aptitude command you should enter an

apt-get install aptitude

Thanks again, and keep up the good work!

From: Anonymous at: 2011-03-17 19:51:01

apt(APTitude)-get you can´t install a package with itself.

From: vinyll at: 2011-05-30 22:26:12

yes, you can install aptitude.

From: at: 2010-10-17 05:13:08

~(Oh gee... sure would have been nice to experience the professional web site "before" experiencing the "professional" tutorial...) 

From: Anonymous at: 2011-07-29 14:00:03

Google chrome and Safari use the same layout engine http://en.wikipedia.org/wiki/WebKit

From: Kevin at: 2010-10-22 14:50:34

When you are installing the sever from disc you can manual config the IP address and gateway plus add the nameservers.

If you are not sure how to do that just wait till it find the dhcp setting the yuse the tab button to go back.

Or just unplug the network cable and you will get the option screen come up

From: George at: 2010-10-27 07:47:25

Yeah! I have the exact same problem, and i cant figure it out??

From: Alex at: 2010-11-01 07:49:47

Hi, I had same problem at first so had a look around and realised that the gateway and network didn't match. I had to change mine to 192.168.80.1 and 192.168.80.0 respectively. Hope this helps

From: Anonymous at: 2011-01-07 09:00:30

Hi. first you should can delete the edit line data. after write new ..

 regards

Lj

From: Stefan J. at: 2011-02-09 01:40:46

I have the exact same problem, and i cant figure it out??I set static , I change DNS , ip address , mask , gateway , and I still don't have internet connection . Any sugestion ? 

From: Anonymous at: 2011-02-13 05:10:52

i have the same problem...any luck?

From: Carlos R. Moreira at: 2011-04-04 22:51:52

I had the same problem here...

What i did was returning the network config to dhcp, run aptitude update and made a safe-upgrade, reboot, uninstalled apparmor then reconfigured the network to static...

All working now, hope it helps...

From: clay at: 2010-10-16 23:34:55

after I rebooted I no longer have internet ???

From: Anonymous at: 2011-02-08 00:22:50

See http://ubuntuforums.org/showthread.php?t=765414 is no longer a valid link.

From: Lukeup at: 2011-04-29 22:32:12

Hi, I'm a noob.  I've been following this tutorial to get a ubuntu server up and running.  I got my eth0 setup for a static IP fine but I had problems with the - sudo aptitude update.  Since I was able to ssh into the server I knew the interface worked.  I was receiving a 'Temporary failure resolving 'us.archive.ubuntu.com'' error.

Just wanted to make a note that you should check your - resolv.conf to be sure your DNS nameserver is setup right.  The command is - sudo vi /etc/resolv.conf.  I set this to my gateway IP.  You can google to find more info as I know you can add several nameservers.

The only reason I started getting this error is because I had to switch networks.  Hope this helps someone.  Thanks, Luke.

From: Anonymous at: 2010-11-15 05:34:19

Use sudo.

From: Anonymous at: 2011-01-23 23:20:10

18 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!):

aptitude install build-essential autoconf automake1.9 libtool flex bison debhelper

cd /tmp
wget http://olivier.sessink.nl/jailkit/jailkit-2.12.tar.gz
tar xvfz jailkit-2.12.tar.gz
cd jailkit-2.12
./debian/rules binary
cd ..
dpkg -i jailkit_2.12-1_*.deb
rm -rf jailkit-2.12*

Can someone tell me what  './debian/rules binary' is suppose to do here? I type it in and it says, its not a directory.  I'm stuck here. :(

From: Anonymous at: 2011-02-28 01:23:56

same problem here. bash returns "No such file or directory"

From: Adam at: 2010-10-29 07:55:24

Entering:

echo 1 > /etc/pure-ftpd/conf/TLS

 returns:

 bash: /etc/pure-ftpd/conf/TLS: Permission denied

From: Gerry at: 2011-04-04 11:15:59

echo1 > /etc/pure-ftd/conf/TLS

the respose is then:

echo1: command not found...

 

Anyone...?

 

Greetzzzzzz

From: André at: 2010-12-20 22:29:33

Jailkit has released anew version 2.13 and with slightly changes to step 18 you can install latest version of Jailkit.

cd /tmp
wget http://olivier.sessink.nl/jailkit/jailkit-2.13.tar.gz
tar xvfz jailkit-2.13.tar.gz
cd jailkit-2.13
./debian/rules binary
cd ..
dpkg -i ../jailkit_2.13-1_*.deb
rm -rf jailkit-2.13*

 Just a little update and I hope this is of any help for whom want to follow this great tutorial!

Cheers All

From: at: 2011-01-03 05:04:45

Just a quick note:

dpkg -i ../jailkit_2.13-1_*.deb

 should be

dpkg -i jailkit_2.13-1_*.deb

From: vwpete at: 2011-01-19 19:29:55

phpmyadmin wont work as you need to ad system link

from

/var/www/[new alias] pointing to the directory /usr/share/phpmyadmin

cheers

Great work bytheway

 

From: Freiheit at: 2011-03-12 02:48:58

Hello,

Could someone tell me wich packages I don't install if I don't want an email server?

 Would it cause problems to ISPconfig?

 

 Thanks!

From: at: 2011-02-12 16:03:38

I have setup my server based on this tutorial but Jailkit is not working. When I add shell user to some site and then login via ssh as that user, the user can browse all system. Outputs are:

 tail -f /var/log/auth.log 

 Feb 12 16:58:43 www sshd[4370]: Accepted password for bojana from 10.13.1.56 port 2128 ssh2 Feb 12 16:58:43 www sshd[4370]: pam_unix(sshd:session): session opened for user bojana by (uid=0) Feb 12 16:58:44 www sshd[4370]: pam_unix(sshd:session): session closed for user bojana

 /etc/passwd

web3:x:5006:5005::/var/www/clients/client1/web3/./home/web3:/bin/false

bojana:x:5006:5005::/var/www/clients/client1/web3/./home/bojana:/bin/bash

 /etc/init.d/jailkit restart

 Stopping jailkit: jk_socketd/usr/sbin/jk_socketd: no process found

 done.

Starting jailkit: jk_socketdversion 2.13, no sockets specified in configfile /etc/jailkit/jk_socketd.ini or on commandline, nothing to do, exiting...

 done.

Please can you help me solve this.
 

 Zeljko

From: Anonymous at: 2011-04-07 17:50:54

Hi

Did anyone manage to fix this issue? Am having one hell of a time fixing it

From: at: 2011-06-24 19:17:56

I'm seeing the same thing (re: jailkit socket config file error on start). anyone? falko?

From: Carlos Paulino at: 2011-03-17 05:15:24

After following this guide I can not log into ISPCONFIG3.

I tried reinstalling, changing the password directly via phpmyadmin, but nothing seems to work.

FYI: The installation didn't give me any errors.

I get the following message.

ERROR

  1. Error

    Username or Password wrong.1
     

From: Tommy Nefcy at: 2011-03-28 20:27:18

cd /etc/apache2/conf.d/
ln -s ../../squirrelmail/apache.conf squirrelmail.conf
/etc/init.d/apache2 reload

I used the above instructions as detailed in 22.2 Squirrelmail above. When I attempt to access http://mydomain.net/squirrelmail the browser attempts to download a file called 'squirrelmail' to my local hd. The file is a copy of the /usr/share/squirrelmail/index.php file.

Any suggestions on how to correct this?

Tommy

From: MatrixDiaz at: 2012-03-10 15:34:17

I have the same problem, any sugestion to solve this???

 

From: Alberto at: 2011-04-01 21:20:38

Hello there!
I always post about problems but today I am happy to say that this manual worked perfect for me!
at once!

I am testing it in my server at home Ubuntu 10.10 ( btw I don't have a static IP and the installation worked perfect)

I am system administrator and at work I use CentOs and Ubuntu Server in few different servers.

I have to say that this is exactly what I was looking for.
Thank you!
 

From: Swiss420 at: 2011-04-05 05:56:13

When your Brain is experiencing a lack of activity howtoforge.com is here to jump start it.