30 August 2009

KISS: Complete Ubuntu Server Configuration


The Simplest way to install and configure our Ubuntu Server Edition. With this step-by-step manual instalation, we can configure Network, Internet, APT instalation source, XAMPP for Linux, Apache Web server, ProFtpd Ftp Server, PHP, MySql Database Server, Samba file sharing, Squid proxy server.


A. Network And Internet Configuration

1. Intall Ubuntu Server Edition, I prefer using 8.04 LTS, a stable build with long time support, even better than the newer ones, in my opinion. Login as root or use this command to become root for user in sudoers list.
# sudo su

2. Now, Change the hostname
# pico /etc/hosts
127.0.0.1 localhost //Don't change this

192.168.1.12 hercules //Change with your ip address and hostname

::1 ip6-localhost ip6-loopback

fe00::0 ip6-localnet

ff00::0 ip6-mcastprefix

ff02::1 ip6-allnodes

ff02::2 ip6-allrouters

ff02::3 ip6-allhosts


3. Make configuration for network interfaces
# pico /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.1.12

netmask 255.255.255.0

network 192.168.1.0

broadcast 192.168.1.255

gateway 192.168.1.1 //This is our modem ip address


4. Set our dns. This is come from isp dns server. For example this is IP Address of Telkom Speedy DNS Server.
# pico /etc/resolve.conf
nameserver 202.134.1.10


5. That's it. Now our server connected to internet. Try to ping google to test internet configuration.
# ping google.com


6. Install console web browser :)
# apt-get install lynx
# apt-get install links
# links google.com



B. APT Instalation Source

7. Change apt source based on your nearest location. For example, if you're in Surabaya, use buaya mirror, a linux source that maintenance by KLAS, Komunitas Linux Arek Surabaya. If you want to use indonesian mirror, see the full list in http://wiki.ubuntu-id.org/SourcesListLokal, or create your own source in http://arsip.ubuntu-id.org/a/sources.list/. With the nearest location, we can install new application or updates newest patch faster, instead of using ubuntu server original location or using full 6 DVDs.

This is an example apt source,
# pico /etc/apt/source.list
deb http://buaya.klas.or.id/ubuntu/ hardy main restricted universe multiverse
deb http://buaya.klas.or.id/ubuntu/ hardy-updates main restricted universe multiverse
deb http://buaya.klas.or.id/ubuntu/ hardy-security main restricted universe multiverse

8. Try to test our new configuration to update linux packages.
# apt-get update
# apt-get upgrade



C. XAMPP For Linux intalation

9. We will install web, mysql, and ftp server. But for easier maintenance, we will not using default server from ubuntu instalation, but using xampp for linux instead. So, remove the other service to make sure there's no conflict configuration.
# apt-get autoremove apache2
# apt-get autoremove mysql
# apt-get autoremove proftpd

10. Now Download and install XAMPP for Linux from http://www.apachefriends.org/en/xampp-linux.html
# wget http://downloads.sourceforge.net/project/xampp/XAMPP%20Linux/1.7.2/xampp-linux-1.7.2.tar.gz?use_mirror=biznetnetworks
# tar xvfz xampp-linux-1.7.2.tar.gz -C /opt

11. Try to start xampp for the first time
# /opt/lampp/lampp start


12. To make it service that start at linux startup, add this at first line of /etc/init.d/rc.local
# pico /etc/init.d/rc.local
/opt/lampp/lampp start

13. Apache configuration file is in /opt/lampp/etc/httpd.conf. There's nothing to change.

14. MySql configuration file is in /opt/lampp/etc/my.cnf. There's nothing to change either.

15. PHP configuration file is in /opt/lampp/etc/php.ini. Change the error reporting setting here to be like this:
# pico /opt/lampp/etc/php.ini
error_reporting = E_ALL & ~E_DEPRECATED & ~E_NOTICE

16. Now, try to start with new configuration
/opt/lampp/lampp restart

17. From the computer client, try to access this server, ftp://hercules, with default username is nobody and lampp as password.





D. SAMBA for Network Sharing



18. Install Samba
# apt-get install samba

19. Change Samba configuration
# pico /etc/samba/smb.conf

#======================= Global Settings =======================
[global]
workgroup = OLIMPIC
server string = %h server (Samba, Ubuntu)
dns proxy = no
#### Networking ####
; interfaces = 127.0.0.0/8 eth0

; bind interfaces only = true

#### Debugging/Accounting ####
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d


####### Authentication #######
encrypt passwords = true
passdb backend = tdbsam
obey pam restrictions = yes
; guest account = nobody

; invalid users = root

guest account = root

unix password sync = yes
passwd program = /usr/bin/passwd %u

passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .

pam password change = yes
map to guest = bad user
########## Domains ###########
########## Printing ##########
############ Misc ############
socket options = TCP_NODELAY
usershare allow guests = yes
#======================= Share Definitions =======================
[browse]

comment = Server

writable = yes

path = /opt

guest ok = yes

browseable = yes

create mask = 0777

directory mask = 0777

[data]

comment = Data

writable = yes

path = /home/actaeon/data

guest ok = yes

browseable = yes

create mask = 0777

directory mask = 0777

[htdocs]

comment = Server Apache

writable = yes

path = /opt/lampp/htdocs

guest ok = yes

browseable = yes

create mask = 0777

directory mask = 0777

[mysql]

comment = Server Mysql

writable = yes

path = /opt/lampp/var/mysql

guest ok = yes

browseable = yes

create mask = 0777

directory mask = 0777

[printers]

comment = All Printers

browseable = no

path = /var/spool/samba

printable = yes

guest ok = no

read only = yes

create mask = 0700

# Windows clients look for this share name as a source of downloadable

# printer drivers

[print$]

comment = Printer Drivers

path = /var/lib/samba/printers

browseable = yes

read only = yes

guest ok = no




E. Squid fo Proxy Server


20. For installing squid, we need two ethernet card. One for internet connection (eth0) and the other (eth1) to connect with the client. Make configuration for network interfaces
# pico /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.1.12

netmask 255.255.255.0

network 192.168.1.0

broadcast 192.168.1.255

gateway 192.168.1.1


auto eth1

iface eth1 inet static

address 192.168.0.12

netmask 255.255.255.0

network 192.168.0.0

broadcast 192.168.0.255

gateway 192.168.1.12 //the 1st eth, as internet source


21. Install squid for proxy server
# apt-get install squid

22. Change squid configuration
# pico /etc/squid/squid.conf
http_port 8888 transparent

cache_mem 32 MB

cache_dir ufs /var/spool/squid 1600 4 256

negative_ttl 2 minutes

maximum_object_size 1024 KB

minimum_object_size 4 KB

visible_hostname hercules_actaeon

cache_swap_low 80

cache_swap_high 100


acl all src 0.0.0.0/0.0.0.0

acl local src 192.168.1.0/24

acl neightbour src 192.168.0.0/24

http_access allow local

http_access allow neightbour

delay_pools 2
delay_class 1 1

delay_parameters 1 64000/64000

delay_access 1 allow local

delay_access 1 deny all

delay_class 2 1

delay_parameters 2 8000/8000

delay_access 2 allow neightbour

delay_access 2 deny all

http_access deny all

23. Try to start squid server
# /etc/init.d/squid restart

24. Change computer client browser setting, for example in internet options, coonnection, LAN Setting, Use proxy server with 192.168.0.12 port 8888


25. Finish. Restart Your server to activate all new configuration.
# init 6


Keep-It-Simple-Stupid

0 °C:

Post a Comment