Create DNS server in Ubuntu version

1) Install bind9
#aptitude install update
#aptitude install bind9 dnsutils

2)Configure local Network
 #sudo nano /etc/hosts

as below

127.0.0.1       [yourhostname]   localhost.localdomain   localhost
192.168.1.x     [yourhostname].[yourdomain]              [yourhostname]
 

eg:-

 127.0.0.1       ns1 localhost.localdomain   localhost
192.168.1.2      ns1.geoffke.be              ns1


3)Configure your firewall
#sudo ufw allow 53
#sudo ufw allow bind9
 #sudo ufw app list 

4)create the zone file 


#cd /etc/bind
#sudo nano db.geoffke.be


Replace geoffke.be with your domain name to become your zone file name. Here's an example

;
; BIND zone definition file for geoffke.be
;
geoffke.be.      IN      SOA      ns1.geoffke.be. admin.geoffke.be. (
                        2011072601; Serial
                        28800
                        3600
                        604800
                        38400
)

; Nameserver and mailserver (replace with your own hostnames):
geoffke.be.        IN     NS           ns1.geoffke.be.
geoffke.be         IN     MX     10    mail.geoffke.be

; IP addresses of local hosts (replace the lines with your own hosts):
router             IN     A     192.168.1.1
ns1                IN     A     192.168.1.2
www                IN     A     192.168.1.3
mediacenter        IN     A     192.168.1.4
laptop1            IN     A     192.168.1.5
workstation1       IN     A     192.168.1.6




 5. Create the reverse zone file:

#sudo nano rev.1.168.192.in-addr.arpa

Use the following example file and replace the hosts and domain name with your own, matching the ones in the zone file above:

;
; BIND reverse zone file for geoffke.be
;
@ IN SOA ns1.geoffke.be. admin.geoffke.be. (
                        2011072601; Serial
                        28800;
                        604800;
                        604800;
                        86400
)

; IP addresses of local hosts (replace the lines with your own hosts):
        IN      NS      ns1.geoffke.be.
1       IN      PTR     router.geoffke.be
2       IN      PTR     geoffke.be
3       IN      PTR     www.geoffke.be
4       IN      PTR     mediacenter.geoffke.be
5       IN      PTR     laptop1.geoffke.be
6       IN      PTR     workstation1.geoffke.be


6. Edit the named.conf.local file:

and add the following:

zone geoffke.be {
        type master;
        file "/etc/bind/db.geoffke.be";
};

zone 1.168.192.in-addr.arpa {
        type master;
        file "/etc/bind/rev.1.168.192.in-addr.arpa";
}; 


7. Configure your clients:

domain <yourdomain.ext>
search <yourdomain.ext>
nameserver <ip_of_dns_server_1>
nameserver <ip_of_dns_server_2>
nameserver <ip_of_dns_server_3>


 If you have only one DNS server, you could use the following example:

domain geoffke.be
search geoffke.be
nameserver 192.168.1.2
nameserver 192.168.1.1


8. Test your DNS server:
Be sure that all of your hosts DNS settings on your clients point to your new DNS server before testing! Reload bind to accept the changes:

sudo service bind9 reload

Test your server with:
Source code 
dig example.com 

If your server doesn't respond correctly, you can check the logs to see what is causing the problem.
Source code
tail -f /var/log/syslog

CREATE A YUM REPOSITORY LOCALLY

Mount your CD/DVD or ISO images

DVD Disk or DVD ISO image

  • If you have DVD disk, please mount dvd-rom first, and then create yum repository:
  • # mkdir /mnt/dvd/
    # mount /dev/cdrom /mnt/dvd/
  • If you use DVD iso, please copy it to the system, and then create yum repository:
  • # mkdir /mnt/dvd/
    # mount -o loop /root/rhel5.1-dvd.iso /mnt/dvd

CD images

If you have multiple CD image files, you should mount all iso images and then create yum repository.
  • Mount all iso images:
  • # mkdir -p /mnt/{1,2,3,4,5}
    # mount -o loop rhel5.1-disc1.iso /mnt/1
    # mount -o loop rhel5.1-disc2.iso /mnt/2
    # mount -o loop rhel5.1-disc3.iso /mnt/3
    # mount -o loop rhel5.1-disc4.iso /mnt/4
    # mount -o loop rhel5.1-disc5.iso /mnt/5

Install necessary package

  • Find and install 'createrepo' package in /mnt directory:
  • # find /mnt -iname 'createrepo*'
    /mnt/dvd/Server/createrepo-0.4.11-3.el5.noarch.rpm
    # rpm -ivh /mnt/dvd/Server/createrepo-0.4.11-3.el5.noarch.rpm

Create yum repository

Create metadata

  • Create yum repository:
  • # cd /mnt/
    # createrepo .

Define yum repository

Create yum repository define file /etc/yum.repos.d/dvdiso.repo:
[ANYNAME]
name=ANYNAME
baseurl=file:///mnt/
enabled=1
gpgcheck=0

Test it

# yum clean all
# yum list

ಥಾಟ್ಸ್ ಇಟ್ ಡನ್

Start and Stop ssh-agent

Below is the bash script used to start and stop ss-agent #!/bin/bash ## in .bash_profile SSHAGENT=`which ssh-agent` SSHAGENTARGS="...