Membangun Website Linux Ubuntu bag. 3


3.  Membuat Suddomain

Perintah menambah user linux ubuntu :

$tkjsmk3@tkjsmk3-Kota-Tegal:~$ sudo adduser lan
[sudo] password for tkjsmk3:
Adding user `lan’ …
Adding new group `lan’ (1001) …
Adding new user `lan’ (1001) with group `lan’ …
Creating home directory `/home/lan’ …
Copying files from `/etc/skel’ …
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for lan
Enter the new value, or press ENTER for the default
Full Name []: Lokal Area Network
Room Number []: 0
Work Phone []: 12345
Home Phone []: 67890
Other []:
Is the information correct? [Y/n] y
tkjsmk3@tkjsmk3-Kota-Tegal:~$ ls /home
lan  root  tkjsmk3
tkjsmk3@tkjsmk3-Kota-Tegal:~$

Dengan cara yang sama buat user baru dengan nama user wan perintahnya :

$tkjsmk3@tkjsmk3-Kota-Tegal:~$ sudo adduser wan

Maka isi dari direktory home, untuk menampilkan isi direktory home ( ls /home) :

  • lan
  • root
  • tkjsmk3
  • wan

Isi dari direktory lan :

  • Desktop
  • Downloads
  • Documents
  • Music
  • Pictures
  • Public
  • Templates
  • Videos
  • examples.desktop

Menyiapkan direktory untuk lokasi website pada setiap user, misalkan website akan ditempatkan pada direktory Public.

$ sudo mkdir /home/lan/Public/html
$ sudo mkdir /home/lan/Public/html/cgi-bin
$ sudo mkdir /home/lan/Public/html/logs

Membuat file index.html pada direktory /home/lan/Public/html

$ sudo gedit /home/lan/Public/html/index.html

<HTML>
<TITLE>WEB LAN.TKJSMK3</TITLE>
<BODY>
Website ini
Lokasi : /home/lan/Public/html/
</Body>
</HTML>

Mengganti hak akses :

$ sudo chmod -R 755 /home/lan/Public/html/
$ sudo chown -R www-data:www-data /home/lan/Public/html/

Ulangi lagi  hal yang sama untuk user wan dan tkjsmk3.

Menyalin file default pada direktory /etc/apache2/sites-available/  ke file dengan nama sesuai subdomain misalkan lan.tkjsmk3.net :

$ sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/lan.tkjsmk3.net

Buat Virtual file lan.tkjsmk3.net :

$ sudo gedit /etc/apache2/sites-available/lan.tkjsmk3.net

<VirtualHost *:80>
DocumentRoot “/home/lan/Public/html/”
ServerName lan.tkjsmk3.net
ServerAdmin tkjsnk3@tkjsmk3.net
ErrorLog /home/lan/Public/html/logs/error.log

<Directory /home/lan/Public/html/>
Options Indexes FollowSymLinks MultiViews +Includes
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>

Link dengan perintah a2ensite :

$ sudo a2ensite lan.tkjsmk3.net

Buat Virtual file wan.tkjsmk3.net :

$ sudo gedit /etc/apache2/sites-available/wan.tkjsmk3.net

<VirtualHost *:80>
DocumentRoot “/home/wan/Public/html/”
ServerName wan.tkjsmk3.net
ServerAdmin tkjsnk3@tkjsmk3.net
ErrorLog /home/wan/Public/html/logs/error.log

<Directory /home/wan/Public/html/>
Options Indexes FollowSymLinks MultiViews +Includes
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>

Link dengan perintah a2ensite :

$ sudo a2ensite wan.tkjsmk3.net

Buat Virtual file tkjsmk3.net :

$ sudo gedit /etc/apache2/sites-available/tkjsmk3.net

<VirtualHost *:80>
DocumentRoot “/home/tkjsmk3/Public/html/”
ServerName  tkjsmk3.net
ServerAdmin tkjsnk3@tkjsmk3.net
ErrorLog /home/tkjsmk3/Public/html/logs/error.log

<Directory /home/tkjsmk3/Public/html/>
Options Indexes FollowSymLinks MultiViews +Includes
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>

Link dengan perintah a2ensite :

$ sudo a2ensite tkjsmk3.net

Restart apache2

$ sudo /etc/init.d/apache2 restart

Konfiguarasi DNS:

Pada terminal, masukkan perintah berikut untuk menginstal dns (Jika belum di Install):

$ sudo apt-get install bind9

Edit /etc/bind/ named.conf.options : (tambahkan DNS IP ISP Anda)

$ sudo gedit /etc/bind/named.conf.options

directory “/var/cache/bind”;
// If there is a firewall between you and nameservers you want
// to talk to, you may need to fix the firewall to allow multiple
// ports to talk. See http://www.kb.cert.org/vuls/id/800113
// If your ISP provided one or more IP addresses for stable
// nameservers, you probably want to use them as forwarders.
// Uncomment the following block, and insert the addresses replacing
// the all-0′s placeholder.
// forwarders {
// 0.0.0.0;
// };
// Menambah IP DNS ISP Anda

forwarders {
192.168.1.9;
203.130.193.74;
202.134.0.155;
202.155.0.10;
202.155.0.15;     };

auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
};

Primary Master untuk domain tkjsmk3.net. Edit /etc/bind/named.conf.local:

$ sudo gedit /etc/bind/named.conf.local

//
// Do any local configuration here
//

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include “/etc/bind/zones.rfc1918”;

zone “tkjsmk3.net” {
type master;
file “/etc/bind/db.tkjsmk3.net”;
};

zone “9.168.192.in-addr.arpa” {
type master;
notify no;
file “/etc/bind/db.192″;
};

Membuat file /etc /bind/db.tkjsmk3.net :

$ sudo cp /etc/bind/db.local /etc/bind/db.tkjsmk3.net

Edit file /etc/bind/db.tkjsmk3.net

$ sudo gedit /etc/bind/db.tkjsmk3.net

;
; BIND data file for local loopback interface
;
$TTL    604800
@    IN    SOA    ns.tkjsmk3.net. root.tkjsmk3.net. (
2        ; Serial
604800        ; Refresh
86400        ; Retry
2419200        ; Expire
604800 )    ; Negative Cache TTL
;
@    IN    NS    ns.tkjsmk3.net.
@    IN    A    192.168.1.9
@    IN    AAAA    ::1
@    IN    MX    10    mail.tkjsmk3.net.

ns    IN    A    192.168.1.9
www    IN    A    192.168.1.9
mail    IN    A    192.168.1.9
ftp    IN    A    192.168.1.9
lan    IN    A    192.168.1.9
wan    IN    A    192.168.1.9

Sekarang buat file /etc/bind/db.192 :

$ sudo cp /etc/bind/db.127 /etc/bind/db.192

Edit /etc/bind/db.192 :

$ sudo gedit /etc/bind/db.192

;
; BIND reverse data file for local loopback interface
;
$TTL    604800
@    IN    SOA    ns.tkjsmk3.net. root.tkjsmk3.net. (
1        ; Serial
604800        ; Refresh
86400        ; Retry
2419200        ; Expire
604800 )    ; Negative Cache TTL
;
@    IN    NS    ns.
9    IN    PTR    ns.tkjsmk3.net.
9    IN    PTR    www.tkjsmk3.net.
9    IN    PTR    mail.tkjsmk3.net.
9    IN    PTR    ftp.tkjsmk3.net.
9    IN    PTR    lan.tkjsmk3.net.
9    IN    PTR    wan.tkjsmk3.net.

edit /etc/resolv.conf :

$ sudo gedit /etc/resolv.conf

nameserver 192.168.1.9
nameserver 202.134.0.155
nameserver 202.155.0.15

Restart BIND9

$ sudo /etc/init.d/bind9 restart

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s