1
Manual For BIND DNS Server on CentOS
1. Install BIND DNS server.
root@test [~]# yum update –y
root@test [~]# yum install bind –y
2. We'll open the BIND (named) configuration file and make several modifications.
root@test [~]# vi /etc/[Link]
3. Add the private IP address of ns1 to listen to port 53. (Local Machine IP [Link])
listen-on port 53 { [Link]; };
4. Add the following lines under the options tab in “[Link]” file. (Local/Caching DNS)
recursion yes;
allow-transfer { localhost; };
allow-query { any; };
5. Under the [ view "localhost_resolver" ] add following lines (For Authoritative DNS)
match-clients { any; };
match-destinations { any; };
recursion no;
zone "." IN {
type hint;
file "/var/named/[Link]";
Provide the Path , where the Zone file is present.
"vi /var/[Link]"; or
“vi /etc/[Link]";
Prepared By : Syed Zeeshan Ali
2
6. Now make the [Link] file and add the following lines.
root@test [~]# vi /etc/named/[Link]
zone "[Link]" {
type master;
file “[Link]” ;
};
7. Now make the directory for zone files.
Let's create the directory where our zone files will reside. According to our [Link] configuration,
that location should be /etc/named/zones:
root@test [~]# chmod 755 /var/named
root@test [~]# cd /var/named
[root@test named] # mkdir [Link]
Afterwards go to vi /etc/[Link]
Add name server : [Link]
8. Create the Zone file as follows.
;
; Zone file for [Link]
;
$TTL 3D
@ IN SOA [Link]. [Link]. (
2017052501 ; serial
6H ; refresh, seconds
2H ; retry, seconds
4W ; expire, seconds
1D ) ; minimum, seconds
;
NS [Link].
NS [Link].
;
MX 0 [Link].
MX 5 [Link].
;
A [Link]
Prepared By : Syed Zeeshan Ali
3
www A [Link]
9. Now restart the DNS BIND.
root@test [8~]# service named restart
Stopping named: . [ OK ]
Starting named: [ OK ]
10. Now check the zone file by following command.
root@test [~]# dig [Link] @[Link] (For Local/Caching DNS)
For Authoritative DNS :
Prepared By : Syed Zeeshan Ali
4
Similarly
12. The last step. Check it by nslookup.
Prepared By : Syed Zeeshan Ali
5
Manual For Apache Server on CentOS (How to Virtually Host a
Website)
1) Install APACHE
yum install httpd
2) Create a Directory
The first step in creating a virtual host is to create a directory where we will keep the new website’s
information.
[root @test html] mkdir -p /var/www/html/abc
3) Create/Edit the Page
We need to create a new file called [Link] within our configurations directory.
[root @test abc] vim /[Link]
We can add some text to the file so we will have something to look at when the IP redirects to the
virtual host.
“This is my First Website “
4) Turn on Virtual Hosts
[root @test abc] Vim /etc/httpd/conf/[Link]
#Listen [Link]:80
Prepared By : Syed Zeeshan Ali
6
Listen 80
Scroll down to the very bottom of the document to the section called Virtual Hosts.
NameVirtualHost *:80
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
<VirtualHost *:80>
ServerAdmin webmaster@[Link]
DocumentRoot /var/www/html/[Link]
ServerName [Link]
Prepared By : Syed Zeeshan Ali
7
ServerAlias [Link]
#ErrorLog /var/www/[Link]/[Link]
#CustomLog /var/www/[Link]/[Link]
</VirtualHost>
Prepared By : Syed Zeeshan Ali
8
5) Setting Up the Local Hosts
If want to try out your new virtual hosts without having to connect to an actual domain name (our case)
Vim /etc/hosts
6) Restart Apache
We’ve made a lot of the changes to the configuration. However, they will not take effect until Apache is
restarted.
Service httpd restart
7) Results
Prepared By : Syed Zeeshan Ali
9
Prepared By : Syed Zeeshan Ali