Академический Документы
Профессиональный Документы
Культура Документы
Fundamental Class
Yaniko Dimas Yogo Prasetyo - @okinay
What Will You Get?
DHCP Proxy
Mail Server
Server Server
Objective
At the end of this course, the student will:
Be familiar with Linux Debian OS and basic command of
Linux
Be able to configure, manage, do basic troubleshooting
of Linux Debian OS
Be able to build basic server services, such as DNS
Server, Web Server, DHCP Server, Mail Server and Proxy
Server
MODUL 1
Linux Basic
Why Debian?
Unparalleled support
Easy installation
Incredible amounts of software
Easy upgrades
Stability
Fast and easy on memory
Drivers for most hardware is written by GNU/Linux /
GNU/kFreeBSD users, not the manufacturer.
Good system security
Many more
Preparation
DVD Source / ISO Debian 6
Server Computer (or virtual box)
Intel x86 : i386 / Intel 64 or AMD 65 : AMD64
RAM > 2GB
HDD > 40 GB
Internet connection > 512 mbps
A cup of coffee or tea
Install Virtual Box
Configure Virtual Box
Open Oracle VM VirtualBox
Then click New icon to create new virtual machine
2
1
Configure Virtual Box
Then click Start icon and now you can start to Install
you Debian
Install Debian 6
When you already start your virtual machine, you can
find the option of installing debian
Install Debian 6
When you already start your virtual machine, you can find
the option of installing debian
192.168.50.100/24
192.168.50.254/24
Intern
et
192.168.50.x/25 (dhcp)
Basic Setup (Configure Network)
Run this script to setup your new IP Address:
# nano /etc/network/interfaces
Then it will show you a configuration file to configure
network
Basic Setup (Configure Network)
At the section of # The primary network interface
change the configuration script like below
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.50.100
netmask 255.255.255.0
gateway 192.168.50.254
New IP Configuration
Basic Setup (Configure Network)
Run this script to setup DNS:
# nano /etc/resolv.conf
Then write the script with the following format
nameserver <DNS Server IP Address>
And you can add more than one DNS Server IP Address
Basic Setup (Configure Network)
Now you can test your configuration by doing ping test
# ping google.com
Basic Setup (Configure APT Package
Source)
Run this script to setup APT Package Source:
# nano /etc/apt/sources.list
Then write the script with the following format
Then save the configuration, and run the script below to upgrade your
package source
# apt-get update
Basic Setup (Configure SSh Server)
Install SSh Server with the following script below
# apt-get install openssh-server
then you wait the installing process
Now you can test the SSh Server
with Remote SSh Program,
such as Putty
Basic Setup (Testing SSh Server)
Enter the Server IP Address in Host Name (or IP
Address) section and choose SSH for connection type
DNS Server
Installing DNS Server
Bind9 (Berkeley Internet Name Domain Ver. 9)
One of the most popular DNS Server Application in
Linux, and most of Linux Distro use it for DNS Server
and its pretty easy to be configured and understood
You can install bind9 by following this script below
# apt-get install bind9
And follow the wizard
Configuring DNS Server
There are 4 important files that we will be configured
a. /etc/bind/named.conf
b. file forward
c. file reverse
d. /etc/resolv.conf
Edit and add some configuration script for Forward
and Reverse in named.conf file
Configuring DNS Server
Run this script below:
# nano /etc/bind/named.conf.local
Then Add this following script to it
zone "debiancourse.com" { //Your domain zone
type master;
file "db.debian"; //FORWARD file location, by default located in /var/cache/bind/
};
nameserver 192.168.50.254
nameserver 202.134.0.155
nameserver 202.134.1.10
From Windows
First, set your primary DNS to your server IP Address
Then run ping command to debiancourse.com on Command Prompt
MODUL 3
Web Server
Installing Web Server
Apache 2
One of the most popular Web Server Application in
Linux, and most of Linux Distro use it for Web Server
and its pretty easy to be configured and understood
also have a lot of feature inside
You can install Apache2 by following this script below
# apt-get install apt-get install apache2 php5
libapache2-mod-php5
And follow the wizard
Testing Web Server
After you have finished for installing Apache, you can test your
Web Server by accessing your server IP Address or Domain
#a2ensite my.debiancourse.com
Configuring Virtual Host
Now, we will make a directory for subdomain
my.debiancourse.com
# mkdir /var/www/my.debiancourse.com
Make index page for my.debiancourse.com
# nano /var/www/my.debiancourse.com/index.php
Then
<?phpAdd this following script to first line
phpinfo();
?>
DHCP Server
What is DHCP?
Dynamic Host Configuration Protocol (DHCP) is a network protocol
that enables aserverto automatically assign an IP address to a
computer from a defined range of numbers (i.e., a scope)
configured for a given network.DHCPassigns an IP address when
a system is started
Installing DHCP Server
DHCP3-Server
This is the default program of DHCP server for Linux.
This program is compatible for all kinds of linux distro
You can install DHCP Server by following this script
below
# apt-get install dhcp3-server
And follow the wizard
Configuring DHCP Server
Now, run this script:
# nano /etc/dhcp3/dhcp.conf
Then Add this following script to last line
# A slightly different configuration for an internal subnet.
subnet 192.168.50.0 netmask 255.255.255.0 {
range 192.168.50.10 192.168.50.50;
option domain-name-servers debiancourse.com;
option domain-name debiancourse.com";
option routers 192.168.50.254;
option broadcast-address 192.168.50.255;
default-lease-time 600;
max-lease-time 7200;
}
Email Server
What is Email Server?
Amail server(also known as amailtransfer agent or MTA,
amailtransport agent, amailrouter or an Internet mailer) is an
application that receives incoming e-mailfrom local users
(people within the same domain) and remote senders and
forwards outgoing e-mailfor delivery.
Installing Email Server
iRedMail
This program is more advance from default Email Server in Linux. It has
simply control panel and very easy to deploy
Download the latest stable release
# wget https://bitbucket.org/zhb/iredmail/downloads/iRedMail-0.8.5.tar.bz2
Install package bzip2
# apt-get install bzip2
Extract iRedMail Package
# tar xjf iRedMail-0.8.5.tar.bz2
Change directory to iRedMail package directory
# cd /root/iRedMail-0.8.5/
And now start iRedMail Installer
# bash iRedMail.sh
Installing Email Server
After you start iRedMail Installer
process, your screen will be like
this
Then choose Yes to continue
the wizard installer
In another kind of browser, open IRedMail Webmail. Then login to second user
that you have created. And you can find a message that you have sent from
first user account
MODUL 6
Proxy Server
What is Proxy Server?
In computer networks, aproxy serveris a server(a computer
system or an application) that acts as an intermediary for requests
from clients seeking resources from otherservers.
Installing Proxy Server
Squid
A proxyserverand web cache daemon. It has a wide
variety of uses, from speeding up a webserverby
caching repeated requests; to caching web, DNS and other
computer network lookups for a group of people sharing
network resources; to aiding security by filtering traffic.
aclurl
For access
dstdomain list, add script
/etc/squid/url #blockedbelow to
domains ACL section
acl key url_regex i /etc/squid/key #blocked words
http_access deny url
http_access deny key
acl lan src 192.168.50.0/24 #local IP Address
http_access allow lan
http_access allow all
Configuring Proxy Server
Make a blocked site list
# nano /etc/squid/url
And enter the site that you will be blocked and save it
detik.com
kaskus.co.id
Make a blocked words list
# nano /etc/squid/key
And enter the site that you will be blocked and save it
sex
porn
And start
# squid -z
Testing Proxy Server
Point your browser proxy setting to your proxy IP Address
Testing Proxy Server
Point your browser proxy setting to your proxy IP Address
Testing Proxy Server
And now open site url that you have blocked before
Additional
If you use your Proxy Server, you make as a Gateway Server other
than as Proxy Server. You can make a Transparent Proxy with it.
Transparent proxy will force every single package to pass through
the proxy before it go to Internet
How?
Just add this IPTABLES to your server
# iptables t nat A PREROUTING s 192.168.50.0/24 p tcp --dport 80 j
REDIRECT --to-port 3128
# iptables-save > /etc/iptables