Tutorial CentOS

24
Instalasi CentOS Bagi teman-teman yang senang ngutak-ngatik server, atau yang senang dengan OS yg berbasiskan linux. Saya punya pengalaman tersendiri dalam menyiapkan sebuah server, dalam waktu yang tidak sampai satu rokok jie sam su habis, server ini sudah kelar digunakan. Tentu saja supaya server ini berguna hingga bisa mengudara, anda harus punya jaringan internet sekaligus dengan IP Public (Static) yang disediakan oleh ISP anda. Paling tidak anda harus sudah menyediakan dua IP address. IP local dan IP Public. IP local untuk memudahkan anda masuk melalui jaringan local dan lebih cepat, hampir tanpa kendala. Sedang kalau menggunakan IP Public pun sebetulnya juga tidak masalah. Kelebihannya, kalau dengan IP Public anda bisa mengaksess server anda dari manasaja dan di manasaja anda berada. Kekurangannya, IP Public itu bukan milik kita murni. Jadi jika pada kondisi tertentu (katakanlah diblokir oleh ISP anda karena satu dan lain hal), maka anda tidak bisa masuk lagi melalui IP ini. Kita mulai saja: Pertama, anda harus menyediakan software CentOS Server ini dengan cara download. TIdak terlalu besar sih ukurannya, sekitar 600 Mb, tepatnya 580Mb. Yah… 1 CD saja: Anda bisa memilih cara download dan jenis filenya; ada dua: 1. Jika anda menggunakan OS windows anda bisa langsung download ke alamat ini :

Transcript of Tutorial CentOS

Page 1: Tutorial CentOS

Instalasi CentOS

Bagi teman-teman yang senang ngutak-ngatik server, atau yang senang dengan OS yg berbasiskan linux. Saya punya pengalaman tersendiri dalam menyiapkan sebuah server, dalam waktu yang tidak sampai satu rokok jie sam su habis, server ini sudah kelar digunakan.

Tentu saja supaya server ini berguna hingga bisa mengudara, anda harus punya jaringan internet sekaligus dengan IP Public (Static) yang disediakan oleh ISP anda. Paling tidak anda harus sudah menyediakan dua IP address. IP local dan IP Public.

IP local untuk memudahkan anda masuk melalui jaringan local dan lebih cepat, hampir tanpa kendala. Sedang kalau menggunakan IP Public pun sebetulnya juga tidak masalah. Kelebihannya, kalau dengan IP Public anda bisa mengaksess server anda dari manasaja dan di manasaja anda berada. Kekurangannya, IP Public itu bukan milik kita murni. Jadi jika pada kondisi tertentu (katakanlah diblokir oleh ISP anda karena satu dan lain hal), maka anda tidak bisa masuk lagi melalui IP ini.

Kita mulai saja:

Pertama, anda harus menyediakan software CentOS Server ini dengan cara download. TIdak terlalu besar sih ukurannya, sekitar 600 Mb, tepatnya 580Mb. Yah… 1 CD saja:

Anda bisa memilih cara download dan jenis filenya; ada dua:

1. Jika anda menggunakan OS windows anda bisa langsung download ke alamat ini :

http://vault.centos.org/4.4/isos/i386/CentOS-4.4.ServerCD-i386.iso

2. Jika sudah selesai downloadnya, anda tinggal memburning pake nero atau ashampo atau software burning lainnya kesukaan anda. Sediakan satu blank cd untuk diburning di media ini.

3. Jika sudah selesai, maka anda telah memiliki satu master cd CentOS Server versi 4.

Kedua, sediakan satu mesin computer yang akan dijadikan server oleh anda. Semakin besar spesifikasinya semakin baik. Kalaupun pakai Pentium III pun sebetulnya sudah bisa dengan kapasitas Hardisk 30 G dan RAM minimal 512 kb atau 1024 kb. Ini adalah ukuran minimalis untuk server web yang tidak terlalu besar muatannya. Tapi jika anda mempunyai spesifikasi server yang handal (seperti XEON dari HP mutakhir, misalnya) itu sangat dianjurkan.

Page 2: Tutorial CentOS

Jangan lupa untuk menyiapkan dua LAN Card. Kalau CPU anda menyediakan LAN onboard. Berarti anda cukup menyediakan satu LAN Card saja. Kita asusmsikan masing-masin LAN Card ini, dengan nama: eth0 untuk IP local. Misalkan 192.168.50.7. Sedangkan LAN Card lainnya kita namakan: eth1 misalkan 222.156.134.170. Gambarnya sbb:

1. LAN Card OnBoard, dengan nama : eth0 IP: 192.168.50.7

2. LAN Card External, dengan nama : eth1 IP:222.156.134.170

Kita mulai install. Pertama masukkan CD CentOS Server anda ke Driver. Kemudian anda restart computer anda. Ketika tampilan pertama muncul. Ada dua pilihan untk memulai menginstall ini: Pertama berbasiskan GUI, artinya anda menginstall dengan full tampilan yang familiar, tinggal klik saja. Kedua berbasiskan text. Dari model kedua ini anda hampir sepenuhnya menggunakan text, tapi masih juga dibantu dengan grafis-grafis ringan untuk interaksi dengan anda.

Saya sarankan, untuk install pertama, sebaiknya jangan menggunakan Firewall bawaan dari CentOS. Lebh baik Firewall jangan diaktifkan. Firewall bisa kita sediakan sendiri setelah installasi selesai. Dan akan kita bahas pada artikel sendiri.

Pada saat option muncul sebelum installasi. Ada beberapa hal prinsip yang harus anda perhatikan:

Ketika option untuk mengatur partisi, anda tinggal pilih remove all partition. Dan biarkan linux untuk auto configurasi. Sebab dengan sendirinya linux akan secara otomatis mengatur partisinya dengan baik. Perlu diketahui, partisi di linux dengan di windows sangat berbeda. Anda tidak perlu pusing-pusing mikirkan ini. Tinggal ok dan next. Terkecuali ketika ada option tentang firewall, untuk sementara klik pakai spasi di checklist DISABLE-nya ( option ini hampir sama, antara yg berbasis text dengan GUI). Anda tinggal perhatikan secara seksama. Ketika ada option untuk costumasi server, pilih ini. Jangan lupa untuk mencheklist, antara lain:

DNS server, jika anda akan membuat server dns sekalian pada server ini. Karena didalamnya disiapkan software Bind (named) untuk manajemen domain. Jika tidak. Maka tidak perlu dichecklist. Untuk menyaipkan manajemen domain, akan dibuat artikel tersendiri. MYSQL Server, anda harus pilih ini jika anda hendak menggunakan MYSQL sebagai basis data di server anda. Atau pilih juga POSTGRESQL jika anda termasuk pecinta POSTGRE. Kalau saya masih setia pada MySQL. Jadi PostgreSql tidak saya checklist. Web Server, harus dipilih sebab didalamnya terdapat httpd dari apache yang akan menggerakkan server anda untuk bisa menampilkan halaman web.> Anda pun bisa menchecklist Mail Server, jika anda hendak mengembangkan server anda untuk mail server juga. ( Ini disarankan bagi yang servernya cukup handal dan belum

Page 3: Tutorial CentOS

ada mesin server lain untuk dijadikan mail server). Untuk bab membuat mail server, akan ada artikel tersendiri. Ketika masuk pada opsi manajemen IP. Jangan dichecklist DHCP-nya. Sebagaimana yg kita tentukan sebelumnya, untuk Card yang inisialnya eth0 anda isi dengan no IP 192.168.50.7 netmask 255.255.255.240 atau disesuaikan dengan netmask dari ISP anda. Demikian juga eth1 dengan no IP 222.156.134.170 netmask 255.255.255.240 atau disesuaikan dengan netmask dari ISP anda. Kemudian isi nama server anda dengan nama favorit anda sendiri. Defaultya localhost.localdomain anda bisa mengganti dengan sidukun.domain.com atau apa saja kesukaan anda. Berikutnya, jangan lupa untuk mengisi Gateway. Masukkan no Gateway, Primary Server, Secondary Server yang diberikan oleh ISP anda. Misalnya:

Gateway: 222.245.250.200Primary Server : 202.13.2.5Secondary Server : 202.134.0.155

Perhatikan baik-baik, apa-apa yang perlu untuk di server anda nanti. Atau langsung saja pada langkah instalasi. Anda tidak perlu khawatir urusan dengan software yang tidak terinstall. Hal ini akan bisa dilakukan ketika server telah selesai diinstall, dengan menggunakan perintah YUM INSTALL. GO! Install. Anda tinggal minum kopi sambil mengisap ji sam su ( bagi yg suka rokok) menunggu sampai selesai install. Linux akan dengan pintarnya mengolah file-filenya di server anda.

Pada tahap ini, jika tidak ada aral melintang, berarti anda sukses installasi server anda. Horeeee.....!Jika masih penasaran, anda bisa kontak saya unt sharing.

Setup a DNS Server on CentOS 5This is a pretty geeky thing to do but running your own DNS Server on your intranet does make some sense from a performance and conveience perspective.

BackgroundThe sole purpose of a DNS Server is to provide a look-up service for mapping hostnames e.g. www.google.com to IP addresses 100.101.20.2. By far the most popular DNS Server software out there is a package called bind.

There are essentially 2 reasons to running your own DNS Server.

1. Improving the speed of hostname lookups2. Managing your own intranet hostnames & IP addresses in a central location

Page 4: Tutorial CentOS

The first reason is what is commonly called a Caching Name Server. In essence by having one machine provide all hostname look-ups in your intranet, you’re cutting down on every machine in your intranet having to independently look-up names. Additionally once a name is looked up your DNS Server will cache the results for a set period of time so that subsequent queries can come out of your DNS Server’s cache and not have to go and do the look-up on your ISPs DNS Server.

The second reason is actually the cooler one. Since you control the DNS Server you can create your own local domain (called zones in bind lingo) and name all the systems within your intranet. In so doing this it’s much easier to connect to systems using names rather than IP addresses. Plus it’s fun to name all the systems!

Taking this a step further you can create generic hostnames such as imap, mail, smtp, ntp, pop, etc. and manage these in one stop rather than having to manage them throughout your intranet.

Getting started

First things first, install the necessary bind software.

1 yum install bind bind-utils bind-libs

Generating a rndc key

NOTE: All the config files we’re going to work on are located in /var/named/chroot

Next you’ll need to create/modify a rndc.conf and/or rndc.key file. This file contains a key which is required in order to manage the bind service once it’s up and running. With this key you can theoretically manage bind either on the host where it’s running or you can manage it on any system that is allowed to do so and knows this key!

12

# command to generate a new 512 byte keyrndc-confgen -b 512

This command will return the following output which you’ll want to either redirect to a file or copy and paste into a file. The file should be rndc.conf but I like to use this name instead, /var/named/chroot/etc/rndc.key. It just makes more sense to me.

123456789101112

# Start of rndc.confkey "rndckey" { algorithm hmac-md5; secret "nHFS3WOpdap75IvsYSXVNYWusnAQPT6z5XC8V5YPWXnZ8RN8tdfSFuClZ8nNouWyGhvHB8mETJgwsrvhiYhIhA==";}; options { default-key "rndckey"; default-server 127.0.0.1; default-port 953;};# End of rndc.conf

Page 5: Tutorial CentOS

The rndc-confgen command also returns some additional output below. This goes into the file /var/named/chroot/etc/named.conf. Make sure to remove the comments at the beginning of each line to turn them on.

1234567891011

# Use with the following in named.conf, adjusting the allow list as needed:key "rndckey" { algorithm hmac-md5; secret "nHFS3WOpdap75IvsYSXVNYWusnAQPT6z5XC8V5YPWXnZ8RN8tdfSFuClZ8nNouWyGhvHB8mETJgwsrvhiYhIhA==";};# controls { inet 127.0.0.1 port 953 allow { 127.0.0.1; } keys { "rndckey"; };};# End of named.conf

named.conf file

Now let’s flesh out that named.conf file a little bit more.

123456789101112131415161718192021222324252627282930313233343536

acl lan { 192.168.1.0/24; 127.0.0.1;}; controls { inet 127.0.0.1 port 953 allow { lan; } keys { "rndckey"; };}; logging { category default { default_syslog; }; category lame-servers { null; };}; options { pid-file "/var/run/named/named.pid"; directory "/var/named"; dump-file "named_dump.db"; forward only; forwarders { # the following IP addresses are my ISPs DNS Servers. These will be used for looking up # hostnames that I don't locally manage, i.e. the REST OF THE INTERNET! 24.92.226.40; # my ISPs DNS Server #1 24.92.226.41; # my ISPs DNS Server #2 }; /* * If there is a firewall between you and nameservers you want * to talk to, you might need to uncomment the query-source * directive below. Previous versions of BIND always asked * questions using port 53, but BIND 8.1 uses an unprivileged * port by default. */ query-source address * port 53;

Page 6: Tutorial CentOS

37383940414243444546474849505152535455

allow-query { lan; }; allow-recursion { lan; }; allow-transfer { lan; };}; zone "bubba.net"{ type master; file "data/db.bubba.net";};zone "0.0.127.in-addr.arpa"{ type master; file "data/db.127.0.0";};zone "1.168.192.in-addr.arpa"{ type master; file "data/db.192.168.1";};zone "." { type hint; file "root.hints";};

Here is a quick rundown of what’s going on here. The acl lan creates an access control list that includes 192.168.1.0/24 and 127.0.0.1 so that only hosts within these IP address ranges can remotely manage and use this bind instance. 192.168.1.0/24 means IP addresses in the range 192.168.1.1 – 192.168.1.255.

The zones, “bubba.net”, “0.0.127.in-addr.arpa”, “1.168.192.in-addr.arpa”, and “.” are all essentially files containing either hostname → IP address mappings or IP address → hostname mappings that this bind server will be responsible for.

Bulding zone files

The first zone: “bubba.net” includes all the hostnames and the IP addresses they point to. So these would be my systems:

scully.bubba.net mulder.bubba.net doggett.bubba.net

The second and third zones: “0.0.127.in-addr.arpa” and “1.168.192.in-addr.arpa” are special zones that provide “reverse” name look-ups. These are when you look up a IP address and want to know what name(s) are associated with it. For example:

192.168.1.100 192.168.1.101

The fourth zone: “.” is a special zone that makes this bind server act as a caching name server, for any hostnames and IP addresses that fall outside of the first 3 zones. These hostname and IP address look-ups will be forwarded to my ISPs DNS Server, and the results cached here for subsequent quereies.

Here is what the zone “bubba.net” looks like.

Page 7: Tutorial CentOS

123456789101112131415161718192021222324252627282930313233343536373839

$TTL 604800;; Zone file for bubba.net;; Mandatory minimum for a working domain;@ IN SOA ns.bubba.net. hostmaster.bubba.net. ( 2000072802 ; serial 28800 ; refresh 7200 ; retry 3600000 ; expire 86400 ; default_ttl )@ IN NS ns.bubba.net.@ IN MX 10 mail.bubba.net.@ IN MX 20 mail.bubba.net.;; Provide familiar names to services but; acutally all are coming from XXXXX; These need to be bound to the address directly, no CNAME's.; -----------------------------------------------------------bubba.net. IN A 192.168.1.1;hostmaster.bubba.net. IN A 192.168.1.101ns.bubba.net. IN A 192.168.1.101......; Subnet 192.168.1 machines; -------------------------mulder.bubba.net. IN A 192.168.1.1mulder.bubba.net. IN HINFO "AMD Athlon(tm) Dual Core Processor 4850e 2.2GHz" "LINUX"mulder.bubba.net. IN MX 10 mail.bubba.net.mulder.bubba.net. IN TXT ""scully.bubba.net. IN A 192.168.1.2scully.bubba.net. IN HINFO "Celeron 450" "Windows 2000"scully.bubba.net. IN MX 10 mail.bubba.net.scully.bubba.net. IN TXT ""......

The first 16 lines are pretty standard. These setup a TTL or Time To Live which means how long any of this data should be cache. Line 14 denotes which machine is the SOA, Start of Authority, ns.bubba.net is the master of this domain is what it’s saying 8-). Lines 15 & 16 state which machine is the mail exchange for this domain. I only have one mail exchange so I just list it twice.

The most important section in this file starts with the declaration of hostnames. Each hostname gets 4 lines. A “IN A” line which tells you the IP address for this hostname. The “IN HINFO“ which is just a description of the host itself. The “IN MX” states who the mail exchange is for this host. And finally the “IN TXT“ line which I’m not going to get into today but it is important later on when you’re setting up you mail server.

Here is what the zone “db.192.168.1″ looks like.

12

$TTL 604800@ IN SOA ns.bubba.net. hostmaster.bubba.net. (

Page 8: Tutorial CentOS

3456789101112131415

2000072801 ; serial 28800 ; refresh 7200 ; retry 604800 ; expire 86400 ; default-ttl )@ IN NS ns.bubba.net.;101 IN PTR mulder.bubba.net.102 IN PTR scully.bubba.net.103 IN PTR doggett.bubba.net.......

The first 9 lines are essentially stating how long any Caching DNS Name Server should cache this data before getting a fresh copy. The SOA ns.bubba.net is saying which machine is the authority for this domain. The hostmaster.bubba.net is actually an email address that is responsible for this domain, [email protected].

Finally the zone “db.127.0.0″ which really serves no purpose other than as a backup in case a host didn’t configure itself correctly with the loopback address. Here is what my zone file looks like:

1234567891011

$TTL 604800@ IN SOA ns.bubba.net. hostmaster.bubba.net. ( 2000031801 ; serial 28800 ; refresh 7200 ; retry 604800 ; expire 86400 ; default_ttl )@ IN NS ns.bubba.net.;1 IN PTR localhost.bubba.net.

The zone “.” uses a file called root.hints. Here is an example of what this file looks like.

123456789101112131415161718192021

; <<>> DiG 9.3.4-P1 <<>> @e.root-servers.net . ns; (1 server found);; global options: printcmd;; Got answer:;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 21247;; flags: qr aa rd; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 14 ;; QUESTION SECTION:;. IN NS ;; ANSWER SECTION:. 518400 IN NS D.ROOT-SERVERS.NET.. 518400 IN NS C.ROOT-SERVERS.NET.. 518400 IN NS G.ROOT-SERVERS.NET.. 518400 IN NS L.ROOT-SERVERS.NET.. 518400 IN NS F.ROOT-SERVERS.NET.. 518400 IN NS I.ROOT-SERVERS.NET.. 518400 IN NS B.ROOT-SERVERS.NET.. 518400 IN NS J.ROOT-SERVERS.NET.. 518400 IN NS M.ROOT-SERVERS.NET.. 518400 IN NS K.ROOT-SERVERS.NET.

Page 9: Tutorial CentOS

222324252627282930313233343536373839404142434445

. 518400 IN NS H.ROOT-SERVERS.NET.

. 518400 IN NS A.ROOT-SERVERS.NET.

. 518400 IN NS E.ROOT-SERVERS.NET. ;; ADDITIONAL SECTION:A.ROOT-SERVERS.NET. 3600000 IN A 198.41.0.4A.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:503:ba3e::2:30B.ROOT-SERVERS.NET. 3600000 IN A 192.228.79.201C.ROOT-SERVERS.NET. 3600000 IN A 192.33.4.12D.ROOT-SERVERS.NET. 3600000 IN A 128.8.10.90E.ROOT-SERVERS.NET. 3600000 IN A 192.203.230.10F.ROOT-SERVERS.NET. 3600000 IN A 192.5.5.241F.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:500:2f::fG.ROOT-SERVERS.NET. 3600000 IN A 192.112.36.4H.ROOT-SERVERS.NET. 3600000 IN A 128.63.2.53H.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:500:1::803f:235I.ROOT-SERVERS.NET. 3600000 IN A 192.36.148.17J.ROOT-SERVERS.NET. 3600000 IN A 192.58.128.30J.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:503:c27::2:30 ;; Query time: 109 msec;; SERVER: 192.203.230.10#53(192.203.230.10);; WHEN: Fri Feb 20 03:49:01 2009;; MSG SIZE rcvd: 500

Starting bind up

Once you have all this in place you can start up bind with this command.

1 /etc/init.d/named start

Configuring a host to use your DNS serverOne final step is to configure your host to use your newly setup DNS Server as it’s name server. You can accomplish this by changing 2 files. /etc/resolv.conf and /etc/nsswitch.conf.

The /etc/resolv.conf should look like this:

12

search bubba.netnameserver 192.168.1.101

The /etc/nsswitch.conf should have an entry like this in it:

12345

...

...hosts: files dns......

Taking it out for a test driveYou can see if it’s working by poking the name server using host, dig, or nslookup. Here are a couple of example quereies.

12

# host example% host -l bubba.net

Page 10: Tutorial CentOS

345678910111213141516171819202122232425262728293031323334353637

bubba.net name server ns.bubba.net.bubba.net has address 192.168.1.1...... # dig example% dig ns.bubba.net ; <<>> DiG 9.3.4-P1 <<>> ns.bubba.net;; global options: printcmd;; Got answer:;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 54856;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0 ;; QUESTION SECTION:;ns.bubba.net. IN A ;; ANSWER SECTION:ns.bubba.net. 604800 IN A 192.168.1.101 ;; AUTHORITY SECTION:bubba.net. 604800 IN NS ns.bubba.net. ;; Query time: 1 msec;; SERVER: 192.168.1.101#53(192.168.1.101);; WHEN: Sat Feb 28 20:54:46 2009;; MSG SIZE rcvd: 60 # nslookup example% nslookup ns.bubba.netServer: 192.168.1.101Address: 192.168.1.101#53 Name: ns.bubba.netAddress: 192.168.1.101

Enable user directory (public_html) edit /etc/httpd/conf/httpd.conf

remove this lineUserDir disable

and uncomment this lineUserDir public_html

(or can just change the first line)

Then restart the server/usr/sbin/apachectl restart

If SELinux is enabled (I did), you must also need to run these

Page 11: Tutorial CentOS

/usr/sbin/setsebool -P httpd_enable_homedirs truechcon -R -t httpd_sys_content_t /home/user-abc/public_html

(do not forget to change the path on the second line)

Cara Install CPanel di CentOSSubmitted by admin on Mon, 04/26/2010 - 01:12

Tips & Tricks cpanel

Cara install CPanel di CentOS sangat mudah, karena CentOS adalah salah satu OS yang direkomendasikan oleh CPanel. Caranya sbb:

1. cd /home — Opens the directory /home. 2. wget -N http:/

/layer1.cpanel.net/latest — Fetches the latest installation file from the cPanel servers.

3. sh latest — Opens and runs the installation files. 4.

/usr/local/cpanel/cpkeyclt — Activates your license after installation.

Maka otomatis CPanel akan terinstall di CentOS!

Konfigurasi Virtual Host di CentOS

Apa itu Virtual Host?

Virtual host berguna untuk pengaturan website atau URL dalam satu mesin atau satu IP, contoh kita punya dua domain yaitu domainsatu.com dan domaindua.com tetapi kita hanya punya satu mesin dengan IP 192.200.200.1 kemudian kita ingin semua domain tadi mempunyai website yg berbeda-beda. Dengan konfigurasi pada virtual host kita dapat menyelesaikan masalah ini.

1. check package apache

[root@rhesanu ~]# rpm -qa http*httpd-2.0.52-41.ent.centos4httpd-suexec-2.0.52-41.ent.centos4httpd-manual-2.0.52-41.ent.centos4httpd-devel-2.0.52-41.ent.centos4

Page 12: Tutorial CentOS

2. Buat direktori untuk pengaturan domain[root@localhost html]# mkdir -p /var/www/html/domainsatu.com/public_html/[root@localhost html]# mkdir -p /var/www/html/domaindua.com/public_html/pastikan direktori tersebut berada di document root.

3. Edit file /etc/httpd/conf/httpd.conf

[root@localhost html]# /etc/httpd/conf/httpd.confedit baris iniNameVirtualHost 192.200.200.1:80

kemudian tambahkan baris ini<VirtualHost 192.200.200.1:80>ServerAdmin [email protected] /var/www/html/domainsatu.com/public_htmlServerName domainsatu.comErrorLog /var/log/httpd/domainsatu.com-error_logCustomLog /var/log/httpd/domainsatu.com-access_log common</VirtualHost>

<VirtualHost 192.200.200.1:80>ServerAdmin [email protected] /var/www/html/domaindua.com/public_htmlServerName domaindua.comErrorLog /var/log/httpd/domaindua.com-error_logCustomLog /var/log/httpd/domaindua.com-access_log common</VirtualHost>

4. Untuk melihat hasilnya kita dapat menambahkan file php pada domainsatu dan domaindua[root@localhost ~]# nano /var/www/html/domainsatu.com/public_html/index.php<?phpecho “this is domainsatu.com”;?>

[root@localhost ~]# nano /var/www/html/domaindua.com/public_html/index.php<?phpecho “this is domaindua.com”;?>

5. Kemudian restart apache[root@localhost ~]# service httpd restartStopping httpd:                                            [  OK  ]Starting httpd:                                            [  OK  ]

Page 13: Tutorial CentOS

setelah itu coba browsing domainsatu.com dan domaindua.com, seperti gambar di bawah ini

tetapi pada saat kita menambahkan url dengan www.domainsatu.com dan www.domaindua.com ada masalah, www.domaindua.com berisi domainsatu.com.lihat gambar dibawah ini:

Page 14: Tutorial CentOS

Perhatikan pada alamat url dan isi url ada kesalahan pada www.domain satu.com berisi this is domainsatu.com pada domain ini benar tetapi perhatikan pada www.domaindua.com kenapa berisi isi dari domainsatu.com???

6. untuk masalah diatas tambahkan server alias pada file /etc/httpd/conf/httpd.conf.[root@localhost ~]# /etc/httpd/conf/httpd.conftambahkan baris di bawah iniServerAlias www.domaindua.com

lihat gambar dibawah ini:

setelah itu lihat hasilnya:

Page 15: Tutorial CentOS

How to install cPanel/WHM on CentOSHello Folks,

Today we will be starting with the basics, how to install cPanel/WHM on CentOS. I will be using CentOS 5.5 64-bit as my base OS; this will be the same for RedHat and for 32-bit also.

First we need to start with a fresh install of CentOS, you don’t need to install anything like Apache, MySQL, etc as the cPanel installer will take care of it all for us.

When reading this tutorial, I am going to assuming you know the basics of a shell (aka using SSH as some would say, if your running Windows I recommend PuTTy).

Ok, the first step is to make sure you are logged into your shell, the screen should look something similar to below.

Once we are both there, the next command will be to make the ‘cpinstall’ folder in your /home directory, you can do that by running the code below.

# mkdir /home/cpinstall

This will make the necessary folder on the file system for us to start with, next we will want to move, or as some will know it as ‘cd’ into that folder. You can do that by running the below command.

# cd /home/cpinstall

Page 16: Tutorial CentOS

Now that we are there, we will need to download the appropriate file to start the cPanel install. This file is always updated, so by running the below command you’ll always get the newest version of cPanel installed on your server/VPS.

# wget http://layer1.cpanel.net/latest

If everything goes well with that, your shell window will look something like this.

Now that we are upto this point, we can start the install process. Depending on how fast the system is, and how fast your network connection is, this can take anywhere from 30 minutes to 4 hours. Usually for me, I can say it takes about 2 hours. You can invoke the installer by running the command below.

# sh latest

After running that code, you should see a cPanel logo come on the screen and the install will start. There will be no need for any user intervention unless there is a problem. Once the

Page 17: Tutorial CentOS

screen looks like below you are safe to walk away.

Once the install is complete your SSH screen will look something like this:

Page 18: Tutorial CentOS

In my case, it was telling me I need to restart my server. Once restarted, you can access the WHM by going to http://IPHERE:2086.

Once this is done, you’ll get a screen like this:

Your default login username is ‘root’, and your password is your root password