The Perfect Server - Ubuntu 13.04 (Apache2, BIND, Dovecot, ISPConfig 3) - Page 3

4 Get root Privileges

After the reboot you can login with your previously created username (e.g. administrator). Because we must run all the steps from this tutorial with root privileges, we can either prepend all commands in this tutorial with the string sudo, or we become root right now by typing

sudo su

(You can as well enable the root login by running

sudo passwd root

and giving root a password. You can then directly log in as root, but this is frowned upon by the Ubuntu developers and community for various reasons. See http://ubuntuforums.org/showthread.php?t=765414.)

 

5 Install The SSH Server (Optional)

If you did not install the OpenSSH server during the system installation, you can do it now:

apt-get install ssh openssh-server

From now on you can use an SSH client such as PuTTY and connect from your workstation to your Ubuntu 13.04 server and follow the remaining steps from this tutorial.

 

6 Install vim-nox (Optional)

I'll use vi as my text editor in this tutorial. The default vi program has some strange behaviour on Ubuntu and Debian; to fix this, we install vim-nox:

apt-get install vim-nox

(You don't have to do this if you use a different text editor such as joe or nano.)

 

7 Configure The Network

Because the Ubuntu installer has configured our system to get its network settings via DHCP, we have to change that now because a server should have a static IP address. Edit /etc/network/interfaces and adjust it to your needs (in this example setup I will use the IP address 192.168.0.100 and the DNS servers 8.8.8.8 and 8.8.4.4 - starting with Ubuntu 12.04, you cannot edit /etc/resolv.conf directly anymore, but have to specify your nameservers in your network configuration - see

man resolvconf

for more details):

vi /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
        address 192.168.0.100
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
        dns-nameservers 8.8.8.8 8.8.4.4

Then restart your network:

/etc/init.d/networking restart

Then edit /etc/hosts. Make it look like this:

vi /etc/hosts

127.0.0.1       localhost.localdomain   localhost
192.168.0.100   server1.example.com     server1

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Now run

echo server1.example.com > /etc/hostname
/etc/init.d/hostname restart

Afterwards, run

hostname
hostname -f

Both should show server1.example.com now.

 

8 Edit /etc/apt/sources.list And Update Your Linux Installation

Edit /etc/apt/sources.list. Comment out or remove the installation CD from the file and make sure that the universe and multiverse repositories are enabled. It should look like this:

vi /etc/apt/sources.list

#

# deb cdrom:[Ubuntu-Server 13.04 _Raring Ringtail_ - Release amd64 (20130423.1)]/ raring main restricted

#deb cdrom:[Ubuntu-Server 13.04 _Raring Ringtail_ - Release amd64 (20130423.1)]/ raring main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://de.archive.ubuntu.com/ubuntu/ raring main restricted
deb-src http://de.archive.ubuntu.com/ubuntu/ raring main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://de.archive.ubuntu.com/ubuntu/ raring-updates main restricted
deb-src http://de.archive.ubuntu.com/ubuntu/ raring-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://de.archive.ubuntu.com/ubuntu/ raring universe
deb-src http://de.archive.ubuntu.com/ubuntu/ raring universe
deb http://de.archive.ubuntu.com/ubuntu/ raring-updates universe
deb-src http://de.archive.ubuntu.com/ubuntu/ raring-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://de.archive.ubuntu.com/ubuntu/ raring multiverse
deb-src http://de.archive.ubuntu.com/ubuntu/ raring multiverse
deb http://de.archive.ubuntu.com/ubuntu/ raring-updates multiverse
deb-src http://de.archive.ubuntu.com/ubuntu/ raring-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://de.archive.ubuntu.com/ubuntu/ raring-backports main restricted universe multiverse
deb-src http://de.archive.ubuntu.com/ubuntu/ raring-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu raring-security main restricted
deb-src http://security.ubuntu.com/ubuntu raring-security main restricted
deb http://security.ubuntu.com/ubuntu raring-security universe
deb-src http://security.ubuntu.com/ubuntu raring-security universe
deb http://security.ubuntu.com/ubuntu raring-security multiverse
deb-src http://security.ubuntu.com/ubuntu raring-security multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu raring partner
# deb-src http://archive.canonical.com/ubuntu raring partner

## Uncomment the following two lines to add software from Ubuntu's
## 'extras' repository.
## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
# deb http://extras.ubuntu.com/ubuntu raring main
# deb-src http://extras.ubuntu.com/ubuntu raring main

Then run

apt-get update

to update the apt package database and

apt-get upgrade

to install the latest updates (if there are any). If you see that a new kernel gets installed as part of the updates, you should reboot the system afterwards:

reboot

 

9 Change The Default Shell

/bin/sh is a symlink to /bin/dash, however we need /bin/bash, not /bin/dash. Therefore we do this:

dpkg-reconfigure dash

Use dash as the default system shell (/bin/sh)? <-- No

If you don't do this, the ISPConfig installation will fail.

 

10 Disable AppArmor

AppArmor is a security extension (similar to SELinux) that should provide extended security. In my opinion you don't need it to configure a secure system, and it usually causes more problems than advantages (think of it after you have done a week of trouble-shooting because some service wasn't working as expected, and then you find out that everything was ok, only AppArmor was causing the problem). Therefore I disable it (this is a must if you want to install ISPConfig later on).

We can disable it like this:

/etc/init.d/apparmor stop
update-rc.d -f apparmor remove
apt-get remove apparmor apparmor-utils

 

11 Synchronize the System Clock

It is a good idea to synchronize the system clock with an NTP (network time protocol) server over the Internet. Simply run

apt-get install ntp ntpdate

and your system time will always be in sync.

Share this page:

11 Comment(s)

Add comment

Comments

From: Ajith at: 2013-11-12 08:28:03

Dear sir,

Thanks for the post it was very usefully, I have setup a mail server in Ubuntu 13.04 server as per your post. I have a setup the server as a local only. my domain is @example.co.in and users are able to send mails from ajith@example.co.in to ajth1@example.co.in, my question is can we change the mail server

1. to receive mails form outside

2.create two user group and allow one group to send mails to @gmail.com only

From: sant3001 at: 2013-05-03 19:04:09

Thanks for this wonderful tutorial. I believe the only thing missing here is cURL for PHP. When you open ISPConfig and go to ASP Installer it tells you that you don't have the PHP cURL extension.

I fixed it using this command:

sudo apt-get install curl libcurl3 libcurl3-dev php5-curl

And then I just restarted apache:

service apache2 restart

From: SkiOne at: 2013-05-10 16:56:17

The FCGI wrapper being installed is not supported by default in ubuntu 13.04 and the syntax used by the conf file doesn't match. If you get a client denied by server configuration install this:

 apt-get install libapache2-mod-fcgid

And the restart apache

From: Anonymous at: 2013-05-11 19:30:37

Yes,  as mentioned prior, thanks for this very detailed and very complete tutorial (actually a tour-de-force) on installing the ISPConfig software.

Along the way, many questions were answered as to 'what was what'....

I ordered/downloaded the manual. 

I probably will not do anything that makes the server become a 'public' site (it's really a VM).

The most I might to is have the server join a Win2003 domain or create what appear to be virtual sites in the Apache server (almost sound like IIS' virtual sites).

Again, Many Thanks for doing this.  A real help!!

 

 

From: Anonymous at: 2013-06-30 05:10:28

I followed this guide to the letter, twice, as I've followed several of these guides for older versions of Ubuntu and also using Nginx. They never fully work out for me.

This time whenever I went to my site, either through my domain name or through its LAN IP, all that would ever come up was SquirrelMail, which wouldn't even let me log in this time. ISPConfig3 would never come up, either, and I was at least able to get that up and running through past versions of this guide, both with Apache and Nginx. PHPMyAdmin worked.

I always enjoy the learning experience, though, despite the disappointment.

From: Anonymous at: 2013-07-23 23:21:10

I got the same issue, by removing this part below on page 6, I was able to get ISPConfig working on https not http, but I'm not able to log in to SquirrelMail !!!

[...]
<VirtualHost 1.2.3.4:80>
  DocumentRoot /usr/share/squirrelmail
  ServerName webmail.example.com
</VirtualHost>

From: Kenny at: 2013-09-22 20:16:02

Here is the output I got:
 

 ubuntu@ip-10-0-0-226:/tmp/ispconfig3_install/install$ sudo quotacheck -avugm

sudo: unable to resolve host ip-10-0-0-226

quotacheck: Scanning /dev/disk/by-label/cloudimg-rootfs [/] done

quotacheck: Checked 11946 directories and 151360 files

ubuntu@ip-10-0-0-226:/tmp/ispconfig3_install/install$ sudo quotaon -avug

sudo: unable to resolve host ip-10-0-0-226

quotaon: using //quota.group on /dev/disk/by-label/cloudimg-rootfs [/]: No such process

quotaon: Quota format not supported in kernel.

quotaon: using //quota.user on /dev/disk/by-label/cloudimg-rootfs [/]: No such process

quotaon: Quota format not supported in kernel.

ubuntu@ip-10-0-0-226:/tmp/ispconfig3_install/install$

 
Using Ubuntu 13.04 in Amazon EC2.  Worked fine in Debian Wheezy in EC2.  Do I need to do something with my fstab?  Debian takes up less space and uses less memory anyway, so I think I'm just going to use Debian.  I just wanted to try both.

From: at: 2014-01-07 04:28:48
From: Tweexter at: 2013-10-13 23:16:11

I seem to be stuck at in the SquirrelMail section regarding the additions to the squirrelmail.conf file.  

 Whenever i try to start apache2 I get an error "AddType requires at least two arguments, a mime type followed by one or more file extensions".  

To make sure I got it right I straight up copy and pasted the code from the guide to my Putty window and compared it visually.  

 

From: Tweexter at: 2013-10-14 17:35:32

Disregard, it was my own stupid mistake.  Somehow had the same AddType line at the top of the file, with no space before .php.  The entire line wasn't even supposed to be there, and I'm not even sure how it got there either.  Thanks for the great write up.  Can't wait to play with this a bit.  

From: at: 2013-10-22 14:37:19

There seems to be a typo in /etc/postfix/main.cf.  If you edit this file you'll see the following on about line 60:

proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps

There is an extra word "limit" in "$virtual_mailbox_limit_maps".  Change this to "$virtual_mailbox_maps":

proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_maps

Then restart Postfix:

/etc/init.d/postfix restart