Selasa, 06 Desember 2011

Konfigurasi NTP Server pada Debian 5 Lenny Server




This will install all the required packages for NTP
Configuring NTP Server
By Default main configuration file located at /etc/ntp.conf
Default configuration file looks like below
#/etc/ntp.conf, configuration for ntpd
driftfile /var/lib/ntp/ntp.drift
statsdir /var/log/ntpstats/
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
# You do need to talk to an NTP server or two (or three).
#server ntp.your-provider.example
# pool.ntp.org maps to more than 300 low-stratum NTP servers.
# Your server will pick a different set every time it starts up.
# *** Please consider joining the pool! ***
# *** ***
server 0.debian.pool.ntp.org iburst
server 1.debian.pool.ntp.org iburst
server 2.debian.pool.ntp.org iburst
server 3.debian.pool.ntp.org iburst
# By default, exchange time with everybody, but don't allow configuration.
# See /usr/share/doc/ntp-doc/html/accopt.html for details.
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1
# Clients from this (example!) subnet have unlimited access,
# but only if cryptographically authenticated
#restrict 192.168.123.0 mask 255.255.255.0 notrust
# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)
#broadcast 192.168.123.255
# If you want to listen to time broadcasts on your local subnet,
# de-comment the next lines. Please do this only if you trust everybody
# on the network!
#disable auth
#broadcastclient
Example Configuration
You need to add a number of servers to the server list. The Debian default is pool.ntp.org which works but isn't always amazingly accurate because it makes no attempt to use time servers near you. If you want more accuracy use the time servers either on your continent (for instance europe.pool.ntp.org) or your country (for instance uk.pool.ntp.org) one of your local country servers.The optimal number of servers to listen to is three but two will also give a good accuracy. If your ISP runs a time server for you it is worth including it in your server list as it will often be more accurate than the pooled servers and will help keep the load down on the pool.
I am using the following two servers for my configuration
server ntp0.pipex.net
server ntp1.pipex.net
Restrict the type of access you allow these servers. In this example the servers are not allowed to modify the run-time configuration or query your Linux NTP server.
restrict otherntp.server.org mask 255.255.255.255 nomodify notrap noquery
restrict ntp.research.gov mask 255.255.255.255 nomodify notrap noquery
The mask 255.255.255.255 statement is really a subnet mask limiting access to the single IP address of the remote NTP servers.
If this server is also going to provide time for other computers, such as PCs, other Linux servers and networking devices, then you'll have to define the networks from which this server will accept NTP synchronization requests. You do so with a modified restrict statement removing the noquery keyword to allow the network to query your NTP server. The syntax is:
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
In this case the mask statement has been expanded to include all 255 possible IP addresses on the local network.
We also want to make sure that localhost (the universal IP address used to refer to a Linux server itself) has full access without any restricting keywords
restrict 127.0.0.1
Save the file and exit
Now you need to run the ntpdate command against your server
#ntpdate ntp0.pipex.net
restart NTP for these settings to take effect using the following command
#/etc/init.d/ntp restart
You can now configure other Linux hosts on your network to synchronize with this new master NTP server in a similar fashion.
Determining If NTP Is Synchronized Properly 
Use the ntpq command to see the servers with which you are synchronized. It provided you with a list of configured time servers and the delay, offset and jitter that your server is experiencing with them. For correct synchronization, the delay and offset values should be non-zero and the jitter value should be under 100.
#ntpq -p
Output looks like below

A star by any one of the names means that the system clock is synchronising with the NTP clock. If you don't have a star (as in the example above) it means that the clocks are unreachable, already synchronized to this server or has an outrageous synchronization distance. Try running ntpdate (you will need to stop the ntp server) with your first ntp server as an argument. This will set your system clock fairly accuratly and mean that the server will be able to choose a clock to synchronize with.
Firewall Configuration for NTP
NTP servers communicate with one another using UDP with a destination port of 123. Unlike most UDP protocols, the source port isn't a high port (above 1023), but 123 also. You'll have to allow UDP traffic on source/destination port 123 between your server and the Stratum 1/2 server with which you are synchronizing.
NTP Client Configuration
If you want to configure ntp client you need to install the following packages
#apt-get install ntp ntp-simple ntpdate
Configuring NTP client
You need to edit the /etc/ntp.conf file you need to point the following settings to NTP server ip address
Server configuration settings
server 192.168.1.1
Restrict the type of access you allow these servers. In this example the servers are not allowed to modify the run-time configuration or query your Linux NTP server.
restrict default notrust nomodify nopeer
Localhost configuration
restrict 192.168.1.1
In this case the mask statement has been expanded to include all 255 possible IP addresses on the local network.
We also want to make sure that localhost (the universal IP address used to refer to a Linux server itself) has full access without any restricting keywords
restrict 127.0.0.1
Now you need to save and exit the file
run ntpdate command against your server
ntpdate 192.168.1.1
Restart ntp service using the following command
/etc/init.d/ntp restart
If you use the date command to change time, it is worth setting also the hardware clock to the correct time. Otherwise, the time is wrong after the next reboot, since the hardware clock keeps the time when power is turned off. When the clock in the operating system shows the correct time, set the hardware clock like this
#hwclock --systohc
se the ntpq command to see the servers with which you are synchronized
#ntpq
#ntpdc -p

Membangun Web Server Berbasis Debian 5 (Lenny)

Web atau World Wide Web (WWW) merupakan salah satu layanan internet yang paling populer. Bisa dikatakan, web adalah “wajahnya internet”. Berbagai hal dapat ditampilkan di halaman web. Mulai dari text, gambar, video, music dan sebagainya. Protokol bernama HTTP (Hyper Text Transfer Protocol) bertanggung jawab menangani proses komunikasi antara client web dan server web.
Kita akan belajar membangun web server menggunakan Apache (http://apache.org). Apache memerlukan DNS server. Proses resolve (konversi) hostname menjadi IP Address dilakukan oleh DNS server. Untuk setting membuat DNS server di debian Lenny sendiri dapat dilihatDISINI. Sehingga saya anggap, DNS server sudah terinstall dengan baik dan akan saya hubungkan dengan Web Server ini dengan nama bloganakkomputer.com.
1. Instalasi
Pertama kali kita harus menginstall apache2 yang merupakan web server, php5 beserta lynx yang merupakan browser untuk mengujinya.
Perintahnya :
D4V1D:~# apt-get install apache2 php5 lynx
2. Konfigurasi Virtual Host
Jenis virtual host yang paling banyak digunakan adalah Name Based Virtual Host. Dengan fitur ini maka memungkinkan satu server memiliki lebih dari satu nama virtual. Fitur virtual host ini sering dimanfaatkan untuk jasa web hosting. Fitur virtual host ini harus ditambahkan di file /etc/apache2/sites-available/default.
>  Sebelum kita konfigurasi, kita backup dahulu dengan cara,
D4V1D:~# cp /etc/apache2/sites-available/default default2
>  Kemudian kita edit file default apache dan menyesuikan setting sesuai yang kita kehendaki, caranya
D4V1D:~# nano /etc/apache2/sites-available/default
Dan tambahkan baris sehingga menjadi berikut
ServerAdmin webmaster@localhost
ServerName www.bloganakkomputer.com
DocumentRoot /var/www/
Konfigurasi file “default” Apache2
>  Restart apache2 dengan perintah
D4V1D:~# /etc/init.d/apache2 restart
>  Kemudian edit file /var/www/index.html dengan perintah
D4V1D:~# nano /var/www/index.html
Menjadi
Selamat Datang di Blog Anak Komputer
3. Pengujian
a. Apache Server
Setiap kali anda melakukan proses editing terhadap file konfigurasi, pastikan anda selalu melakukan restart terhadap setiap service yang bersesuian. Sebagai catatan, sebaiknya lakukan konfigurasi sedikit-demi-sedikit kemudian lakukan proses restart. Hal tersebut dilakukan untuk menghindari kegagalan service akibat kesalahan konfigurasi.
1.      Pengujian dari computer server secara langsung
Untuk pengujian secara langsung dari tempat server dapat kita lakukan dengan cara,
D4V1D:~# lynx www.bloganakkomputer.com
Dan hasilnya seperti gambar di bawah ini.
Pengujian dari server dengan Lynx
2.      Pengujian dari client
Untuk pengujian dengan cara ini, pastikan IP client disetting dengna benar dan pastikan sudah terhubung ke server dengan baik dengan cara ping server.
Lalu dengan browser computer client (Mozilla Firefox, Opera, Internet Explorer, dll) masukkan www.bloganakkomputer.com di bagian address. Kemudian akan muncul seperti gambar di bawah.
Pengujian dari komputer client dengan browser
b. PHP5
Untuk uji coba apakah php sudah dapat berjalan dengan baik kita perlu beberapa setting dahulu.
·         Hapus file index.html dengan cara
D4V1D:~# rm /var/www/index.html
·         Buat file index.php
D4V1D:~# nano /var/www/index.php
·         Isi dengan
phpinfo();
?>
·         Simpan dan keluar.
·         Uji di computer server dengan
D4V1D:~# lynx www.bloganakkomputer.com
Pengujian PHP dari server
·         Dan pada computer client, dengan browser masukkan alamatwww.bloganakkomputer.com
Pengujian PHP dari client
Jika hasil uji kita sudah sesuai seperti di atas, maka dapat dipastikan web server kita sudah berjalan dengan baik (apache maupun php nya). Tinggal kita isi kontennya supaya web server dapat terisi halaman-halaman web yang cantik. Nah cara memberikan kontennya, kita desain dahulu dengan web maker seperti Microsoft Frontpage ataupun Macromedia Dreamwaver, lalu dapat kita upload dengan teknik FTP atau dengan teknik lain. Untuk cara upload nya, mungkin akan saya jelaskan di kesempatan yang lain.
Selamat mencoba.

Cara membuat web server dengan menggunakan Debian

web server dapat berupa perangkat keras ataupun perangkat lunak yang menyediakan layanan akses kepada user melalui protokol komunikasi HTTP atau HTTPS atas berkas-berkas yang terdapat pada suatu situs web dalam layanan ke pengguna dengan menggunakan aplikasi tertentu seperti browser. kali ini kita akan mencoba tuk membuat web server sendiri dengan menggunakan linux debian dan beberapa aplikasi tambahan.


okee langsung saja,,
sebelum kita membangun web server, kamu harus mempersiapkan beberapa hal :
  1. linux debian (kali ini saya menggunakan versi 5.0.2/lenny)
  2. koneksi internet (sy menggunakan speedy)

setelah itu login sebagai root. pastikan komputer kamu tehubung dngan internet dengan cara ping ke google.com. jika tes koneksi berhasil, maka ubah source apt kamu ke kambing.ui.ac.id atau ke kebo.vlsm.org via terminal.
#pico /etc/apt/sources.list
deb http://kebo.vlsm.org/debian lenny main contrib non-free
deb-src http://kebo.vlsm.org/debian lenny main contrib non-free
setelah itu save dengan menekan ctrl+x..
lalu update package list-nya dengan perintah:
#apt-get update
jika update-nya selesai, kemudian install apache2:
#apt-get install apache2
stelah itu, install juga php5:
#apt-get install php5
setelah apache2 dan php5 terinstall,,maka coba cek service-nya dengan perintah:
#dpkg -l | grep php5
#dpkg -l | grep apache2
jika service blum jalan, maka coba jalankan manual:
#/etc/init.d/php5 start
#/etc/init.d/apache2 start
setelah apache2 dan php5 berjalan dengan baik, coba cek service-nya yg terhubung dengan jaringan:
#netstat -tanp | grep php5
#netstat -tanp | grep apache2
Jika semuanya beres, coba edit dan save file html index web server kamu:
#pico /var/www/index.html

koneksi webserver berhasil!!!

Setelah itu restart apache kamu:
#/etc/init.d/apache2 restart
Well,,saatnya mencoba koneksi web server kamu.
Oke,,buka browser dan masukkan alamat ip kamu pada address bar browser:
127.0.0.1/index.html
Jika pada browser menampilkan “koneksi webserver berhasil!!!” artinya kamu brhasil mmbuat web servermu sendiri..
Sekian dan trima kasih,, :) 

Tidak ada komentar:

Posting Komentar