Showing posts with label YUM configuration and XEN virtulization in RedHat 5.. Show all posts
Showing posts with label YUM configuration and XEN virtulization in RedHat 5.. Show all posts

Friday, February 2, 2018

Setting up DNS (Domain Name server) on CentOS 7 / RHEL 7

Hello friends,

I will show you how to configure DNS in CentOS 7 Linux. Let see How to configure BIND DNS Master server on CentOS 7.
DNS is used for name resolution.
DNS configuration is very useful to recognize your server with FQDN in LAN and WAN. You can ping your server with server name with in LAN (from any workstation) and WAN.
Following steps are useful to configure DNS.
Change HostName (give proper hostname with fully qualified domain name)
Set hostname first (here my hostname is anand.linuxserver.com)
# vi /etc/hosts
127.0.0.1     localhost localhost.localdomain localhost4 localhost4.localdomain4
::1                 localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.1.105     anand.linuxserver.com anand


# vi /etc/hostname
Here you type correct hostname (FQDN) Fully Qualified Domain Name.
Or
# nmtui    à command for change hostname (easy way)
   nmtui -Select Set HostName   
Check you IP Address is correct or not and confirm.

# ifconfig

Here in this example my IP Address is 192.168.0.105 and Host Name is anand.linuxserver.com

# ls –al /etc/sysconfig/network-scripts/

In this directory you will find ifcfg-eth0 or eno(some numbers) linux nic card details that you can view using ifconfig command.
Now bind packages installed.
What is BIND in DNS ?
BIND (Berkely Internet Name Domain) is a popular software for translating domain names into IP addresses and usually found on Linux servers.
BIND's configuration consists of multiple files,
yum install bind bind-utils
Confirm the prompt by entering  y

bind-9.9.4-51.el7_4.2.x86_64

bind-utils-9.9.4-51.el7_4.2.x86_64

bind-license-9.9.4-51.el7_4.2.noarch

bind-chroot-9.9.4-51.el7_4.2.x86_64

rpcbind-0.2.0-42.el7.x86_64

bind-libs-lite-9.9.4-51.el7_4.2.x86_64

bind-libs-9.9.4-51.el7_4.2.x86_64


Above packages are important and this will install by YUM.
YUM will resolved dependency error.
After installation of bind packages edit /etc/named.conf file.
Make few changes in the file as shown in below.
Here My IP ADDRESS is 192.168.0.105 and Hostname is anand.linuxserver.com
# Vi /etc/named.conf

        listen-on port 53 { 127.0.0.1; 192.168.0.105; };

       #listen-on-v6 port 53 { ::1; };

 

        allow-query     { localhost; 192.168.0.0/24; };

        # allow-transfer{ localhost; 192.168.0.0/24; };

 

zone "linuxserver.com" IN {

type master ;

file "anand.zone" ;

allow-update { none;};

};

 

zone "0.168.192.in-addr.arpa" IN {

type master ;

file "anand.local" ;

allow-update { none; };

};


Save the file and exit, check the permission of file .
Permission should be 775 and owner, group should be root and named.
Command is “chmod 775 /etc/named.conf “  ; chown root:named /etc/named.conf
Now nest step is very important be care full while typing.
Change the directory /var/named
# cd /var/named
List the files using command “ls –al” you will list the files and directories.
Few files already present with DNS configuration contents .
Example :- named.ca, named.empty, named.localhost, named.loopback
Easiest method for to configure DNS with your own DNS name .
Copy named.localhost to yourDNSname.zone
In my example I have given anand.zone name is /etc/named.conf file.
Make sure you are in /var/named directory
Here I am creating zone file, this would be a my forward zone file.
Command is à # cp named.localhost  anand.zone
Content of my file is as follows.

$TTL 1D

@    IN SOA    anand.linuxserver.com. root.anand.linuxserver.com. (

                    0    ; serial

                    1D    ; refresh

                    1H    ; retry

                    1W    ; expire

                    3H )    ; minimum

 

@                     IN  NS anand.linuxserver.com.

anand     IN  A   192.168.0.105


Save file and exit.

Now I creating reverse zone file
Copy file from same directory, command is à cp named.loopback anand.local
Open into editor and change with following contents .

$TTL 1D

@    IN SOA anand.linuxserver.com.  root.anand.linuxserver.com. (

                    0    ; serial

                    1D    ; refresh

                    1H    ; retry

                    1W    ; expire

                    3H )    ; minimum

 

@ IN  NS    anand.linuxserver.com.


save and exit from this file.
Change the permission of the files.
# chmod 775 anand.zone anand.local
# chown named:named  anand.zone anand.local
Edit the file /etc/resolve.conf
# vi /etc/resolve.com  à make few changes as mentioned below.

search linuxserver.com

nameserver 192.168.0.105


# named-checkzone anand.zone /var/named/anand.zone
# named-checkzone anand.local /var/named/anand.local
If the configuration is correct then you will get OK prompt

Now start the service of named
# systemctl enable named.service
# systemctl restart named.service
# firewall-cmd –permanent –add-port=53/tcp
# firewall-cmd –permanent –add-port=53/udp
# firewall-cmd --reload
Last command to check DNS is properly configured .
# dig anand.linuxserver.com

; <<>> DiG 9.9.4-RedHat-9.9.4-51.el7_4.2 <<>> anand.linuxserver.com

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- 28031="" id:="" noerror="" o:p="" opcode:="" query="" status:="">

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

 

;; OPT PSEUDOSECTION:

; EDNS: version: 0, flags:; udp: 4096

;; QUESTION SECTION:

;anand.linuxserver.com.         IN      A

 

;; ANSWER SECTION:

anand.linuxserver.com.  86400   IN      A       192.168.0.105

 

;; AUTHORITY SECTION:

linuxserver.com.        86400   IN      NS      anand.linuxserver.com.

 

;; Query time: 0 msec

;; SERVER: 192.168.0.105#53(192.168.0.105)

;; WHEN: Thu Feb 01 21:29:46 IST 2018

;; MSG SIZE  rcvd: 80


You will get similar output on screen.
Please remember in above output check the ANSWER section.
I hope this will help you to configure DNS.
Leave your comments or question if any I am appreciate your feedback.

Cheers and good luck.

Tuesday, February 16, 2010

YUM configuration and XEN virtulization in RedHat 5.

Hi friends,

Please see the step by step yum configuration and XEN virtulization configuration. I wish this will help you more.
Your comments are welcome.



1.Yum configuration in Red Hat 5.x and XEN Virtualization

Here is a step by step Yum configuration.

Either you can make a separate partition or make a separate folder in / directory
Here in my case I am making /data/redhat directory
I am coping all 5 CDs of Red Hat 5.2 OS to /data/redhat folder using following command.
1.mount CD 1 and give this command
# cd /media/RHEL-5.3\ i386\ Disc\ 1/
2.# cp -av * /data/redhat/
3.Repeat step 1 and step 2 for rest of all CDs (CD2, CD3, CD4, CD5).
4.# createrepo -v /data/redhat for to create a local Yum Repository.
5.Configure ftp server with following steps.
6.Open /etc/vsftpd/vsftpd.conf file and make necessary changes.
anonymous_enable=YES
local_enable=YES
anon_root=/data/redhat/Server
7.Open /etc/yum.repos.d/base.repo
[Server--RHEL5]

name = RHEL 5.3

baseurl=file:///data/redhat/
#ftp service not require.
Or
baseurl=ftp://SERVER-IP/ # ftp service require to install client side.
enabled=1

gpgcheck=0

8.service vsftpd restart
9.service yum-updatesd restart
10.If you are trying to install and configure yum on same server ftp server will not require even if you configure ftp service on same server this will work, it is optional .
11.Now you can install rpms and dependency using yum.
12.yum clean all
13.yum update
14.yum install
15.Here I am doing xen virtulization .
16.yum install xen virt-manager kernel-xen
17.restart your server
18.make sure your system in booting form kernel /xen.gz-2.6.18-128.el5
19.To check your system boot in new kernel use command uname -a
20.use command to '#virt-manager & ' for Create new domains.
21.On command prompt type following command.
22.# virt-install --paravirt --name OSNAME --ram 512 --file /data/vm/OS.img --file-size 9 --network network:default --vnc --cdrom /dev/cdrom-sr0
23.In my system I used following example..
]# virt-install

What is the name of your virtual machine? RedHat5.3

How much RAM should be allocated (in megabytes)? 512

What would you like to use as the disk (file path)? /data/vm/rhel.img

How large would you like the disk (/data/vm/rhel.img) to be (in gigabytes)? 9

Would you like to enable graphics support? (yes or no) yes

What is the install location? /dev/cdrom-sr0

24.You view all system using xm list command.


Good Luck

Anand.