Contact Sales Sitemap Customer Login

Ubuntu 6.06 Web PHP Mysql Mail Dns

Contents

[edit]

Intro

Back to HOWTO Section.
Guide by Sam Stevens (forum name sam159)


This guide will help you setup a ubuntu server with the following

You will need a link-3 for this! i started with a link-2, just not enough ram :(
With this, my ram usage is (using : Memory Utilization Script)

total: 239 mb   used: 165 mb   free: 74 mb

This guide is going off memory, so it may not be accurate, if theres something ive missed out, please email me @ sam[at]xnet.tk, post in the forums or just edit this :)

[edit]

Starting off

If your using windows i recommend using putty to ssh to the server http://www.chiark.greenend.org.uk/~sgtatham/putty/

To set the correct locale and sources refer to HOWTO:_Install_LAMP_on_Ubuntu_6.06

I believe apt-get is pre-installed...
Firstly, install apps that will be useful:

apt-get install man-db nano cron wget ftp

the manual pages and cron daemon are not installed as standard (should be really), nano is a very nice text editor for those who dont like vi (like me). Wget is a internet download utility. And for some reason theres no ftp client.

[edit]

Webmin

Webmin is a great web-based control panel, ive had it installed on all my *nix servers, works great!
There is cpserver (or something like that) but ive never used it

Webmin may be web-based, but it runs its own webserver so we dont need to install apache first, as isnt available directly through ubuntu youll have to get it directly:

Goto http://prdownloads.sourceforge.net/webadmin/webmin_1.330_all.deb in a web browser and select a mirror, copy the download location

wget [webmin download location]

perl and openssl needs to be installed

apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libio-pty-perl \ 
libmd5-perl

and to install

dpkg --install webmin_1.330_all.deb

Webmin is now running through port 10000 ie. http://yourdomain-or-ip:10000/
Its best to see if theres a better webmin available so logon to webmin using root and navigate to Webmin->Webmin Configuration->Upgrade Webmin.

NOTE: Try not to install anything major through webmin, since sometimes whatever you are installing trys to ask you to configure it, webmin will just use the defaults

[edit]

Apache 2

Apache is (i believe) the most widly used web server for linux. but is can eat memory precious memory.
lighttpd is an alternative, with a smaller memory footprint, but ive never used it.

Install with

apt-get install apache2 apache2-mpm-prefork apache2-utils

That should have apache up and running :)

Now for some editing, to reduce the memory : nano /etc/apache2/apache2.conf
And apply the following

...
<IfModule prefork.c>
StartServers 2
MinSpareServers 2
MaxSpareServers 5
MaxClients          10
MaxRequestsPerChild 0
</IfModule>
...
and to apply the changes apache run
/etc/init.d/apache2 restart

This vastly reduces the amount of memory apache uses :)

The default directory for webpages is /var/www. you can put your website there

[edit]

PHP 5

PHP 5 is also very widly used, in this case for writing dynamic web pages. and is part of LAMP.

To install :

apt-get install php5 php5-mysql php5-mysqli phpmyadmin

This will install everything that you should need, it will also configure apache for php.

To test create a file in /var/www called phpinfo.php, ie nano /var/www/phpinfo.php
With the contents of

<?php
phpinfo(); //Displays info about the php installation
?>

And go to http://yourdomain-or-ip/phpinfo.php to confirm that its installed properly.
If it doesnt work, you may need to restart apache (/etc/init.d/apache2 restart).

NOW DELETE PHPINFO.PHP, leaving there is a big security risk

[edit]

MYSQL 5

MySql 5 is also part of LAMP, and is my fravorite database server.

To Install:

apt-get install mysql-server mysql-admin mysql-client-5.0

Now that probably wont start after it installs, since innodb is enabled by default (uses alot of memory).
to remove innodb, edit the file /etc/mysql/my.cnf and add the following after the [mysqld] section. You can also turn off networking to save memory

skip-innodb
skip-networking

you should change the root password for mysql

mysqladmin -u root password (newpassword)
#and restart
/etc/init.d/mysql restart
[edit]

Proftpd

I dont think there is anything much to change with the config for this so just install

apt-get install proftpd

devplanner: Yes, there are some changes required, such as setup ftp users. I found the following link very useful: ubuntuforums.org

[edit]

Bind 9

Bind 9, is the dns server to which all others are compared to :P but does use ~40MB of memory
an alternative is tinydns, which as the name would suggest, uses less memory.

To Install:

apt-get install bind9
#Stop bind while we reconfigure it
/etc/init.d/bind9 stop
[edit]

Configure Bind

Add/Alter the following in /etc/bind/named.conf

key "rndc-key" {
	algorithm hmac-md5;
	secret "<alter later>";
	};
controls {
	inet 127.0.0.1 port 953 allow { 127.0.0.1; } keys { "rndc-key"; };
	};
logging {

  channel default_file { file "/var/log/named/default.log" 
    versions 3 size 5m; severity dynamic; print-time yes; };
  channel general_file { file "/var/log/named/general.log" 
    versions 3 size 5m; severity dynamic; print-time yes; };
  channel database_file { file "/var/log/named/database.log" 
    versions 3 size 5m; severity dynamic; print-time yes; };
  channel security_file { file "/var/log/named/security.log" 
    versions 3 size 5m; severity dynamic; print-time yes; };
  channel config_file { file "/var/log/named/config.log"  
    versions 3 size 5m; severity dynamic; print-time yes; };
  channel resolver_file { file "/var/log/named/resolver.log"  
    versions 3 size 5m; severity dynamic; print-time yes; };
  channel xfer-in_file { file "/var/log/named/xfer-in.log"  
    versions 3 size 5m; severity dynamic; print-time yes; };
  channel xfer-out_file { file "/var/log/named/xfer-out.log"  
    versions 3 size 5m; severity dynamic; print-time yes; };
  channel notify_file { file "/var/log/named/notify.log"  
    versions 3 size 5m; severity dynamic; print-time yes; };
  channel client_file { file "/var/log/named/client.log"  
    versions 3 size 5m; severity dynamic; print-time yes; };
  channel unmatched_file { file "/var/log/named/unmatched.log"  
    versions 3 size 5m; severity dynamic; print-time yes; };
  channel queries_file { file "/var/log/named/queries.log" 
    versions 3 size 5m; severity dynamic; print-time yes; };
  channel network_file { file "/var/log/named/network.log"  
    versions 3 size 5m; severity dynamic; print-time yes; };
  channel update_file { file "/var/log/named/update.log"  
    versions 3 size 5m; severity dynamic; print-time yes; };
  channel dispatch_file { file "/var/log/named/dispatch.log"  
    versions 3 size 5m; severity dynamic; print-time yes; };
  channel dnssec_file { file "/var/log/named/dnssec.log"  
    versions 3 size 5m; severity dynamic; print-time yes; };
  channel lame-servers_file { file "/var/log/named/lame-servers.log"  
    versions 3 size 5m; severity dynamic; print-time yes; };

  //remove any of the following to stop logging of that type
  category default { default_file; default_syslog; default_debug; };
  category general { general_file; };
  category database { database_file; };
  category security { security_file; };
  category config { config_file; };
  category resolver { resolver_file; };
  category xfer-in { xfer-in_file; };
  category xfer-out { xfer-out_file; };
  category notify { notify_file; };
  category client { client_file; };
  category unmatched { unmatched_file; };
  category queries { queries_file; };
  category network { network_file; };
  category update { update_file; };
  category dispatch { dispatch_file; };
  category dnssec { dnssec_file; };
  category lame-servers { lame-servers_file; };
}

Now we have to create the log files (well i did, because bind9 wasnt starting and wasnt creating log files, does now :)

cd /var/log
mkdir named
chown bind named
cd named
touch default.log general.log database.log security.log config.log resolver.log 
touch xfer-in.log xfer-out.log notify.log client.log unmatched.log queries.log 
touch network.log update.log dispatch.log dnssec.log lame-servers.log
chown bind * 
[edit]

Configure RNDC

RNDC is the control app for bind, it allows you to reload bind's host files without restarting the service.

to create a default config file run

rndc-confgen

That should of wrote to /etc/rndc.conf open that file and copy the key ie. ljU07qafM1si+cw9RsmaGQ== (not mine btw :P)

open /etc/bind/named.conf and alter the following, replace <alter later> with the one you just copied

key "rndc-key" {
	algorithm hmac-md5;
	secret "<alter later>";
	};

Not Done yet! open the file /etc/bind/rndc.key (may or may not exist) and put this in

key "rndc-key" {
        algorithm hmac-md5;
        secret "<YOUR KEY>";
};

Now start bind and test if rndc works

/etc/init.d/bind9 start
rndc reload

If it worked you should get "server reload successful"

[edit]

Dovecot

Dovecot is a nice IMAP/POP server. You could also use Qmail, i hear it uses less memory, but is older.

Install Dovecot with (install dovecot-pop3d if you need pop)

apt-get install dovecot-common dovecot-imapd dovecot-pop3d

In webmin there is a few things to change.. (Servers->Dovecot IMAP/POP Server)
Under Networking and Protocols select the protocols that you will be using (use ctrl)

Under User and Login Options, select plain-text as the authentication method.

That should be it, click Apply Changes

LINUX RULES!!!

[edit]

Postfix

Postfix is a good SMTP server, and is usually preferred to sendmail...

The best postfix installation guide i have found is here --> http://www.howtoforge.com/perfect_setup_ubuntu_6.06_p5

Follow that to the letter, and postfix will work flawlesly!

[edit]

SpamAssassin

Say No to spam, Install SpamAssassin
/ad_mode off

SpamAssassin is great, catches nearly ALL spam mail.

To install:

apt-get install spamassassin

And then in Webmin (Servers->SpamAssassin Mail Filter).

Under Message Modification, Change "Prepend text to Subject: header" to something like "*** SPAM ***", all suspected spam mail will now have that in the subject.

And under Procmail Spam Delivery, I think you just get a button to configure procmail, if so click it, after that change the Procmail setings to just deliver all mail normally, instead of into a file.

[edit]

ClamAV

TODO: Write stuff about clamav & clamsmtp

Retrieved from "http://wiki.vpslink.com/Ubuntu_6.06_Web_PHP_Mysql_Mail_Dns"
Recent Changes | RSS RSS Feed