Installing Oracle Database 11g XE on Oracle Enterprise Linux (64-bit)

Before we begin installing Oracle Database XE in Linux, we need to prepare
the environment by installing the required packages, setting kernel parameters,
and so on.
———–Installing and Uninstalling Oracle Database XE————-

To begin, make sure that the following Linux packages are installed. To verify that the
following Linux packages are installed use the rpm –qa <package name> command:
• kernel-headers-2.6.18-194.el5.x86_64.rpm
• glibc-2.5-49.x86_64.rpm
• make-3.81-3.el5.x86_64.rpm
• binutils-2.17.50.0.6-14.el5.x86_64.rpm
• glibc-devel-2.5-49.x86_64.rpm
• glibc-headers-2.5-49.x86_64.rpm
• libgomp-4.4.0-6.el5.x86_64.rpm
• gcc-4.1.2-48.el5.x86_64.rpm
• libaio-0.3.106-5.x86_64.rpm
The parameters that need to be included in the sysctl.conf file under /etc are as
follows. These changes are to be made by logging in as the root user:
kernel.semmsl=250
kernel.semmns=32000
kernel.semopm=100
kernel.semmni=128
kernel.shmmax=4294967295
kernel.shmmni=4096
kernel.shmall=2097152
kernel.sem= 250 32000 100 128
fs.file-max= 6815744
net.ipv4.ip_local_port_range=9000 65500
We are now ready to start the Oracle Database XE installation. However, it is
recommended to complete the following steps for creating a Linux user oracle:
1. Create new groups and the oracle user as shown in the following code
snippet, by logging in as the root user:
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba,oper,asmadmin oracle
passwd oracle
2. Log in as the oracle user and add the following lines at the end of the
.bash_profile file:
# Oracle instance name
ORACLE_SID=XE; export ORACLE_SID;
# Oracle home directory
ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe; export ORACLE_HOME;
# Search path for executable

PATH=$ORACLE_HOME/bin:$PATH; export PATH;
# Search path for shared libraries
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH; export LD_
LIBRARY_PATH
3. Copy the downloaded software to a temporary folder, say /u01/software,
and run the following command as the root user to install Oracle Database
XE, as shown in the following screenshot:
4. Run /etc/init.d/oracle-xe configure as the root user to configure
the database. You will be prompted to select the HTTP port for Oracle
Application Express, database listener port, SYS and SYSTEM user
password, and the boot option. It is recommended to accept the default
values and continue with the configuration of the database as shown in the
following screenshot:
Installing and Uninstalling Oracle Database XE

To access the database’s home page go to Applications menu | Oracle Database 11g
Express Edition | Get Started.
Starting and stopping Oracle Database XE in
Linux
After you have installed Oracle Database XE, the database is up and running and
you can begin using it right away.

Alternatively, we can start the database manually by running the following
command as the root user:
# /etc/init.d/oracle-xe start
To manually stop the database, run the following command as the root user:
# /etc/init.d/oracle-xe stop
——Uninstalling Oracle Database 11g XE on Oracle Enterprise Linux (64-bit)——
When you uninstall Oracle Database XE, all components, including datafiles, control
files, redo logfiles, and software are removed.
Log on with the root privilege and run the command shown in the following

root@xe1 software]# rpm -e oracle-xe

ADDING EXTERNAL HDD AND FORMATTING IT

– Part 3

In PART 1 of this series, we successfully installed CentOS 5.8 on a VMware Workstation environment.. and in PART 2, I showed you how to install VMware Tools in CentOS manually..

In this continuation series (PART 3), I am going to show you how to add a additional virtual Hard Drive to the CentOS VM, that too without rebooting it..

There are two ways to configure a new disk drive into a CentOS system:

    • One very simple method is to create one or more Linux partitions on the new drive, create Linux file systems on those partitions and then mount them at specific mount points so that they can be accessed. This is the approach that will be covered in this tutorial.
  • Another approach is to add the new space to an existing volume group or create a new volume group.

When CentOS is installed using the default disk configuration layout, a volume group is created and called VolGroup00. Within this volume group are two logical volumes named LogVol00 and LogVol01 that are used to store the / file system and swap partition respectively. By configuring the new disk as part of a volume group we are able to increase the disk space available to the existing logical volumes. Using this approach we are able, therefore, to increase the size of the / file system by allocating some or all of the space on the new disk to LogVol00. This topic will be discussed in detail in Adding a New Disk to a CentOS Volume Group and Logical Volume.

First, we will add the Hard Disk to the VM…

Select your virtual machine, as you can see from the above PIC selected the virtual machine. Next press the “Settings‘ to open the Virtual Machine Settings dialog.

From the “Virtual Machine Settings” dialog select the “Add…” button at the bottom of the screen. From this dialog you can also modify how much memory you dedicate to the machine when it boots.

Next we will walk through the “Add Hardware Wizard” the process makes it very simple to add additional hardware to a predefined virtual machine. From this screen we can see the many types of hardware we can add to a virtual machine. You can emulate just about any piece of hardware that one can expect in a modern operating system. It definitely makes testing with different configurations and devices much easier. For our example we want to select “Hard Disk” and then select the “Next >” button.

In the next screen we see the three options for adding a new disk. We can “Create a new virtual disk“, this will create a brand new disk on the guest operating system.

The second option, “Use an existing virtual disk“, allows you to mount a disk from another virtual machine.

The last option is to “Use a physical disk“, this allows you to mount a local physical disk to the operating system. This option is akin to NFS mounting a drive to a virtual machine. To add a new disk we select the “Create a new virtual disk” option and select the “Next >” button.

Next we want to select the type of disk. So in this step we want to select “SCSI (Recommended)” and the “Next >” button.

Now we want to set the size of the disk we are creating.

One of the nice features of VMware is that you don’t have to allocate all of the disk when you create it. So if you create a 40 GB disk it doesn’t have to take it all right away, the disk will grow as your virtual machine needs it. I will say this is a big performance hit you take when the disk has to extend, but for most applications its OK.

Also, I will warn that if the virtual disk grows and there is no physical disk left on the host operating system you will see a catastrophic failure and in most cases both the host and guest operating systems lock up and become unusable. (Don’t say I didn’t warn you !)

Lastly, you can split the files into 2GB sizes, while this isn’t necessary, it just makes all the disks much easier to manage and move around. For this step we want to set our disk size (12 GB in this case), I chose to allocate the disk space right now.. 10 GB in size and Split disk into 2 GB files.

This is actually pretty simple in that you decide what you want to physically call the disk and where to put it. .vmdk is the extension for VMware virtual disks. After we name the disk we can select the “Finish” button which adds the disk to the virtual machine.

So now we can see that the new disk has been added to the “Virtual Machine Settings” within the selected virtual machine. From here the disk acts just like it would if you added a new disk to a standalone server. So we select the “OK” button to continue.

After we’ve logged in and accessed a terminal window as root (or another user with root/sudo priveledges) we first want to run fdisk -l to display list of partitions.

In Linux the first SCSI drive is sda, the second sdb, the third sdc, etc. since this was the second SCSI drive we added to the system, the device is known as /dev/sdb

As shown above, the new hard drive has been assigned to the device file/dev/sdb. At this point the drive has no partitions shown (because we have yet to create any).

The next step is to create one or more Linux partitions on the new disk drive. This is achieved using the fdisk utility which takes as a command-line argument the device to be partitioned:

The basic fdisk commands you need are:

    • m – print help
    • p – print the partition table
    • n – create a new partition
    • d – delete a partition
    • q – quit without saving changes
  • w – write the new partition table and exit

In order to view the current partitions on the disk enter the p command:

As we can see from the above fdisk output the disk currently has no partitions because it is a previously unused disk.

The next step is to create a new partition on the disk, a task which is performed by entering n (for new partition) and p (for primary partition):

In this example we only plan to create one partition which will be partition 1.

Next we need to specify where the partition will begin and end. Since this is the first partition we need it to start at cylinder 1 and since we want to use the entire disk we specify the last cylinder as the end.

Note that if you wish to create multiple partitions you can specify the size of each partition by cylinders, bytes, kilobytes or megabytes.

The next option is t. t is used to replace the type of the current partition.

You can list the different types of Partitions by pressing L as shown below.. this will list down all the available partition types..

for our example, we need a Linux Partition, i.e. number 83.. similarly, if you want to create a SWAP out of this new HDD, then the number would be 82 (Linux/ Swap). Type 83 and press Enter key to continue

Now that we have specified the partition we need to write it to the disk using the w command:

If you do a fdisk -l again, you will see the newly created Disk with the Partition table allocated as shown below.

The next step is to create a file system on our new partition.

We now have a new disk installed, it is visible to CentOS and we have configured a Linux partition on the disk.

The next step is to create a Linux Filesystem system on the partition so that the operating system can use it to store files and data. The easiest way to create a file system on a partition is to use the mkfs.ext3 utility which takes as arguments the label and the partition device:

In order to do this we need to create a mount point. A mount point is simply a directory or folder into which the file system will be mounted. For the purposes of this example we will create a /extra in root (/) directory to match our file system label (although it is not necessary that these values match): mkdir /extra

The file system may then be manually mounted using the mount command: mount /dev/sdb1 /extra

In order to set up the system so that the new file system is automatically mounted at boot time an entry needs to be added to the /etc/fstab file.

The following example shows an fstab file configured to automount our /extra partition:

With the appropriate configuration line added to the fstab file, the file system will automatically mount on the next system restart.

Install and Configure phpMyAdmin on CentOS

phpMyAdmin

phpMyAdmin is a tool written in PHP intended to handle the administration of MySQL over the Web. Visit the phpMyAdmin website for more information.

Version

  1. CentOS 5.x
  2. phpMyAdmin 3.1.x

Requirements:

  • Install and Configure the Remi Repository

Install phpMyAdmin 3.1.x

Run the following yum install command

yum install phpmyadmin


Restart the Apache Server

service httpd stop
service httpd start


Test

Visit http://localhost/phpmyadmin in your local web browser. You should be prompted for authentication

Enter the system root username and password and click OK

You should now be presented with the phpMyAdmin home page

INSTALLING VMware TOOLS

– Part 2

in PART 1, we saw how to effectively install CentOS 5.8 on VMware Workstation…

in this PART, we will install VMware Tools in the VM..

NOTE: If you had selected Easy Install during the install process from Workstation, then this step can be avoided as Easy Install installs VMware-Tools automatically.. still if you ever want, you can install VMware-Tools anytime you want…

Benefits of VMware Tools

The followings are benefits of VMware Tools on your Guest OS:

  1. A set of VMware device drivers:

These drivers include:

    • Graphics Performance: VMware Tools installs a SVGA driver that increases vide0 refresh.
    • Efficient Memory Allocation: A memory control driver that is installed with  VMware Tools provides increased efficiency in memory allocation.
    • Accelerated Mouse Driver: For increased mouse responsiveness.
  • Optimized SCSI Driver: A Bus Logic SCSI driver provides faster I/O performance for some guest OS.

VMware Tools control panel:

The Tools control panel lets you modify settings.

    • Run Scripts: Scripts can be defined to run after particular events such as the VM starting up or shutting down.
  • Shrink the Virtual Disk: By reducing the amount of disk space a VM’s virtual disk takes up by removing empty unused space will lead to more usable storage on your hosts volume.

Connect External Devices:

  • You can connect external media devices such as a floppy (who uses those anymore)  or CD/DVD drive. These appear as a virtual device when presented within the guest

To summarize,Installing VMware Tools eliminates or improves the following issues:

    • Low video resolution
    • Inadequate color depth
    • Incorrect display of network speed
    • Restricted movement of the mouse
    • Inability to copy and paste and drag-and-drop files
  • Missing sound

Installing VMware Tools within X

Select VM > Install VMware Tools in your Workstation menu as shown:

When you choose VM > Install VMware Tools from the VMware Workstation menu, VMware Workstation temporarily connects the virtual machine’s first virtual CD-ROM drive to the ISO image file that contains the VMware Tools installer for your guest operating system and you are ready to begin the installation process.

Double-click the VMware Tools CD icon on the desktop.

Note: In some Linux distributions, the VMware Tools CD icon may fail to appear when you install VMware Tools within an X windows session on a guest.

Extract the VMwareTools.tar to the Desktop as shown below:

In an X terminal, logged in as root (su -), configure VMware Tools by navigating to the path where we extracted the VMwareTools.tar contents.. in this case, its /root/Desktop/vmware-tools-distrib/

Once there, simply execute the vmware-install.pl file as shown below:

Respond to the questions the installer displays on the screen. Press Enter to accept the default value.

Note: Be sure to respond yes when the installer offers to run the configuration program.

Note: Some guest operating systems require a reboot for full functionality.

Installing VMware Tools from the Command Line with the Tar Installer

The first steps are performed on the host, within Workstation menus:

1. Power on the virtual machine.

2. After the guest operating system has started, prepare your virtual machine to install VMware Tools.

  • Choose VM > Install VMware Tools.

The remaining steps take place inside the virtual machine.

3. As root (su -), mount the VMware Tools virtual CD-ROM image, change to a working directory (for example, /tmp), uncompress the installer, then unmount the CD-ROM image.

Note: Some Linux distributions automatically mount CD-ROMs. If your distribution uses automounting, do not use the mount and umount commands below. You still must untar the VMware Tools installer to /tmp.

Some Linux distributions use different device names or organize the /dev directory differently. If your CD-ROM drive is not /dev/cdrom or if the mount point for a CD-ROM is not /mnt/cdrom, you must modify the following commands to reflect the conventions used by your distribution.

    • mount /dev/cdrom /mnt/cdrom
  • cd /tmp

Note: If you have a previous installation, delete the previous vmware-distrib directory before installing. The default location of this directory is
/tmp/vmware-tools-distrib.

4. Untar the VMware Tools tar file:

    • tar zxf /mnt/cdrom/VMwareTools-5.0.0-<xxxx>.tar.gz
  • umount /dev/cdrom

Where <xxxx> is the build/revision number of the VMware Workstation release.

Note: If you attempt to install a tar installation over an rpm installation — or the reverse — the installer detects the previous installation and must convert the installer database format before continuing.

5. Run the .tar VMware Tools installer:

    • cd vmware-tools-distrib
  • ./vmware-install.pl

Respond to the configuration questions on the screen. Press Enter to accept the default value.

6. Log off of the root account.

  • exit

7. Start X and your graphical environment

8. In an X terminal, launch the VMware Tools background application.

  • vmware-toolbox &

Note: You may run VMware Tools as root or as a normal user. To shrink virtual disks, you must run VMware Tools as root (su -).

Uninstalling VMware Tools

To remove VMware Tools from your Linux guest operating system, log on as root (su -) and enter the following command:

From a tar install
  • vmware-uninstall-tools.pl
From an RPM install
  • rpm -e VMwareTools

Monitoring MySQL using Nagios

This tutorial will discuss the various ways using which you can effectively monitor your MySQL Database using Nagios.
Before we begin, do note that the steps shown here are actually a continuation from my earlier series of tutorials based on Nagios:

Prerequisites:

  • Nagios Monitoring System: Installed and configured (Refer steps HERE)
  • MySQL Database: Installed, configured and located on a remote system on the same network as that of the Nagios Server. Here, I am using a LAMP server (192.168.50.152) on a CentOS 6.5 OS as my client.
 

NOTE: We are going to monitor our MySQL Database using two methods:
1) Using in-built Plugins
These are the standard set of Plugins that are shipped with Nagios distributions, such as check_tcp, check_mysql.
2) Third-Party Plugin
In this case, we will be installing a 3rd party plugin called check_mysql_health. You can read more about it HERE

So without further adieu, lets get busy!!

1) Using in-built Plugins

Firstly, we need to locate where the Nagios Plugins are stored on our Nagios Server. If you have installed Nagios using binaries or from yum, then they would generally be placed at /usr/lib64/plugins/nagios if your host runs on CentOS or even at /usr/lib/plugins/nagios in case of a Ubuntu-based host.
As you can see from the below screenshot, there are quite a few plugins provided already by Nagios. For our tutorial, we will be using two of them: check_tcp and check_mysql

But first things first, we need to do few modifications to our Database so that it can allow Nagios to monitor it.

Login to the MySQL database using root as a user.

Execute the following commands one at a time:

# The following command will create a user named “nagios” with a password “password” and grant him access on the local MySQL DB.
CREATE USER ‘nagios’@’localhost’ IDENTIFIED BY ‘password’; 

# The following command issues full permissions to the nagios user.
GRANT ALL PRIVILEGES ON *.* TO ‘nagios’@’localhost’;

# The following command will create a user named “nagios” with a password “password” and allow him to access the DB from any (%) location.
CREATE USER ‘nagios’@’%’ IDENTIFIED BY ‘password’;

# The following command issues full permissions to the nagios user from any location.
GRANT ALL PRIVILEGES ON *.* TO ‘nagios’@’%’;

flush privileges;

NOTE: Make sure MySQL can also listen on all interfaces, besides the default loopback address (127.0.0.1). You can change this setting by editing the my.cfg file and commenting out the bind-address field as shown:
# bind-address          =   127.0.0.1

Next, we configure the plugin on our Nagios Server.

a) check_tcp
This plugin basically tests TCP connections (here, port 3306) with a particular host.

First, add the “command definition” in the objects/commands.cfg file as shown

define command {
    command_name        check_tcp
    command_line           $USER1$/check_tcp -H $HOSTNAME$ -p $ARG1$
    }

define its corresponding “service” as well in the servers/clients.cfg file as shown:

define service {
    use generic-service lamp
    service_description Check MYSQL via TCP port 
    check_command check_tcp!3306 
}

Restart the nagios service:

# service nagios restart

Check your MySQL Host’s “Services” Tab from the Nagios UI. You should see the plugin status as shown:


b) check_mysql

This plugin is used to test connections to a local or remote MySQL Server.
You can test the Plugin by executing it directly as shown below. Note that I am executing this plugin from /usr/lib64/nagios/plugins directory.

Syntax
./check_mysql -H <Hostname> -u <MySQL_User> -p <MySQL_Password> -d <Database_Name>

For Example, the following command will return details about a specific MySQL Database such as uptime, threads, open tables etc
# ./check_mysql -H 192.168.50.152 -u nagios -p password -d mysql

Next, we add the “command definition” for check_mysql in the objects/commands.cfg file as shown below:

define command {
    command_name        check_mysql
    command_line           $USER1$/check_mysql -H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$ -d $ARG3$
    }

Save the file and quit the editor

Add the corresponding “service definition in the /servers/clients.cfg file as well

define service {
    use generic-service lamp
    service_description Check MySQL Database 
    check_command check_mysql!nagios!password!mysql
}

Save the file and exit the editor.

Restart the nagios service:

# service nagios restart

Check your MySQL Host’s “Services” Tab from the Nagios UI. You should see the plugin status as shown:


2) Third-Party Plugin

Nagios provides a lot of third party plugins over at Nagios Exchange which you can use according to your needs and requirements. In this case, we will be installing a 3rd party plugin called check_mysql_health. You can read more about it HERE
As per Nagios Exchangecheck_mysql_health is a plugin for Nagios that allows you to monitor a MySQL database. Among the list of metrics are time to login, index usage, bufferpool hit rate, query cache hit rate, slow queries, temp tables on disk, table cache hit rate, connected threads, and many more.
The first thing we need to do is download the Plugin and install it on our nagios Server. To do so, follow these simple steps:
# wget http://labs.consol.de/download/shinken-nagios-plugins/check_mysql_health-2.1.8.2.tar.gz
NOTE: It really doesn’t matter which folder you download this Plugin to. It will be moved never the less to its correct destination in the coming steps.
For the sake of simplicity, I move all my custom and third party plugin sources to the /opt directory. Once there, simply untar the contents of your Plugin as shown:

# mv /check_mysql_health-2.1.8.2.tar.gz /opt

# tar -xvzf check_mysql_health-2.1.8.2.tar.gz

Once the contents of your Plugin are uncompressed, simply follow the three commands listed below to compile the Plugin:

# ./configure

Make sure there were no errors during the execution of the previous command, If so, proceed to the nest step, i.e. make. If not, then do look into them before proceeding:

# make

The final command will install the plugin and make it ready for use:

# make install

Our Plugin is almost ready for use. if you run an ls command, you will see that a new folder named “plugin-scripts” has been created. A further look into that folder, and we find our Plugin s there.
NOTE: There are two plugins here. One; a perl file (*.pl) and the other is an executable file. You can use either of them for monitoring your MySQL Database. In my case, I have selected the executable file.

Copy either of the Plugins to the Plugins folder for Nagios, i.e. /usr/lib64/nagios/plugins

Once there, you can execute it and test if its working well.

Syntax

./check_mysql_health -H <Hostname> –user <MySQL_User> –password <MySQL_Password> –mode <MODE>

Where <MODE> can be either of:
  • connection-time (Time to connect to the server)
  • uptime (Time the server is running)
  • threads-connected (Number of currently open connections) etc

For example, the following command will return the uptime for the specific MySQL
# ./check_mysql_health -H 192.168.50.152 –user nagios –password password –mode uptime

You can configure the Plugin to work from the Nagios UI as well. Simply follow the same procedure as we did for the rest of our plugins.

First add the “Command Definition” in the /objects/commands.cfg file:

define command {
    command_name        check_mysql_health
    command_line           $USER1$/check_mysql_health -H $ARG1$ –port $ARG2$ –username $ARG3$ -password $ARG4$ -mode $ARG5$
    }

Save the file and quit the editor

next, define the “Service Definition” as well at the /servers/clients.cfg file:

define service {
    use generic-service lamp
    service_description Check MySQL status using PLUGIN 
    check_command check_mysql_health!192.168.50.152!3306!nagios!password!uptime
}

Save the file and exit the editor.

Don’t forget to restart the Nagios Service. If you see any errors here, its probably because of mis-configuration either at your commands.cfg file or the clients.cfg file.

# service nagios restart

Check your Nagios UI for the newly added Plugin under the “Services” Tab.

Monitoring with Nagios: Installation and Configuration

In this series of tutorials, I’ll be walking you through simple steps to setup and get started with Nagios, a really cool open source monitoring tool.

Why Nagios?

Nagios has a lot of features, making it a very powerful monitoring tool. Some of the major features are listed below:
  • Monitoring of network services (SMTP, POP3, HTTP, NNTP, PING, etc.)
  • Monitoring of host resources (processor load, disk and memory usage, running processes, log files, etc.)
  • Monitoring of environmental factors such as temperature
  • Simple plugin design that allows users to easily develop their own host and service checks.. and much more..
Post’s I’ll be covering:
1) Installing and configuring Nagios Core (THIS TUTORIAL)
2) Monitoring Basic Services with Nagios
So without further adieu, LETs GET STARTED!!

Nagios Server Setup:

OS: CentOS 6.5 Minimal Server
Name: nagios.cloud.com
IP: 192.168.50.150
NOTE: You will need to have root privileges for executing some of these commands

Install few pre-requisite packages first:

# yum install gd gd-devel gcc glibc glibc-common

Next, we install wget package as well.
# yum install wget

Once done, the next step is to install and setup the EPEL Repo. We will use this repo to download the required Nagios packages for our system.

# wget http://epel.mirror.net.in/epel/6/<YOURARCH>/epel-release-6-8.noarch.rpm

NOTE: Remember to change the <YOURARCH> depending on your system’s architecture, i.e. x86_64 or i386

Once the RPM is downloaded, simply install it using the following command:
# rpm -ivh epel-release-6-8.noarch.rpm

Run a quick repolist command to make sure the EPEL Repo can list its packages:
# yum repolist

All done, we can now install the Nagios packages using a simple command:
# yum install nagios*

Once the installation completes, feel free to walk through the Nagios folder (/etc/nagios) and have a quick look around. The important things to know here are:
nagios.cfg
This is the configuration file which defines the various directives that Nagios uses. These directives include the path to various folders where Nagios needs to check in for the required files, the object config files, the command files etc and various other parameters which decide how Nagios operates.
nrpe.cfg
‘nrpe’ is a commonly used client application or agent that runs on the hosts to be monitored to gather local data which cannot (or is less logical to) be retrieved directly from the Nagios host. The nrpe.cfg file contains several command definitions that you’ll likely use to monitor such hosts. READ MORE
objects Directory
This directory contains few configuration files described below:
contacts.cfg
This config file is used to send notifications of alerts and recoveries to particular users/ sysadmins.

Sample definition:

    define contact {
        contact_name bob
        alias Bob The builder-sysadmin
        use generic-contact
        email john@exmaple.com
    }

hosts.cfg
This config file defines various servers, routers, switches and other devices which Nagios has to monitor.

Sample definition:
    define host {
        use generic-host
        host_name testserver.cloud.com
        address 192.168.50.xxx
        max_check_attempts 10
    }

services.cfg
Nagios service objects call nagios commands (from the commands.cfg) which are a defined set of objects that run commands which return either of four flags: OK, WARNING, CRITICAL or UNKNOWN.
The following service simply checks the connectivity to the testserver by pinging it.

Sample definition:
    define service {
        use generic-service
        host_name testserver.cloud.com
        service_description PING TEST
        check_command check_icmp!500.0,80%!1000.0,100%
    }
commands.cfg
Here, the individual commands are defined. the following example describes the check_icmp command parameters.
Sample definition:    
define command {
command_name check_icmp
command_line $USER1$/check_icmp -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$

}

To do a quick start with Nagios, we will first add a EMAIL ADDRESS for our Nagios admin account. This can be done in the objects/contacts.cfg file as shown below:


# Add the following in objects/contacts.cfg file
email      admin@cloud.com   

Set the password for your nagiosadmin user:
# htpasswd /etc/nagios/passwd nagiosadmin

You are almost there! Simply start up the Nagios service:
# service nagios start
# chkconfig nagios on

Open up a browser and type in the following:
http://<NAGIOS_SERVER_IP>/nagios

The Web-based UI is fairly simple to understand and use. The menus o the left of the page help in quick navigation to view status of various hosts, their services, host groups and service groups.

If you click on the Hosts tab, it displays all the hosts that are being monitored by Nagios. Since we haven’t added any host explicitly yet, all you will see is the localhost, i.e. the Nagios Server itself. You can view its status and status information here. To know more details about the individual host, simply select the host as shown below:
As shown here, you can monitor the individual host for its performance, uptime, etc. You can also set various commands for your host such as disable active checks, schedule downtime for a host etc from the Host Commands section provided to the right of the page.
Configuring Nagios monitoring on Clients
Nagios can virtually monitor any infrastructure thats basically on a network. In this case, I’m going to show you a quick way to setup Nagios monitoring on a Client host.
Nagios Client Setup:

In this section of the tutorial, I’ll be using a CentOS 6.5 as my Client however, similar steps can be followed for a Ubuntu-based Client as well… just remember to change yum install.. to a sudo apt-get install..

OS: CentOS 6.5 Minimal Server
Name: lamp.cloud.com
IP: 192.168.50.152
NOTE: You will need to have root privileges for executing some of these commands

Next, we install the Nagios Plugins and NRPE in our Client system
# yum install nrpe nagios-plugins-all openssl

Once installed, we need to add the Nagios Server IP address (192.168.50.150) in our Client NRPE’s configuration file as shown below:
# vi /etc/nagios/nrpe.cfg

# Append the Nagios Server IP to the allowed_hosts parameter
allowed_hosts=127.0.0.1,192.168.50.150

Save the nrpe.cfg file.
Now moving over to the Nagios Server, edit the nagios.cfg and remove the comment on the following line:
cfg_dir=/etc/nagios/servers 

Next, create a new directory inside the nagios called as servers and create a new config file in it as shown:
We are going to use this newly created config file to add our Client for remote monitoring.

# mkdir servers
# cd servers/
# vi clients.cfg  

Add the following content in the clients.cfg file. Make sure to change the host_name and address parameters as per your client’s needs.
NOTE: Use of ‘#’ as in comments does not work in Nagios, instead, you need to use a semi-colon ‘;’ for it.
    define host {
        use                                 linux-server
        host_name                      lamp
        alias                                lampserver
        address                           192.168.50.152
        max_check_attempts       5
        check_period                   24×7
        notification_interval          30
        notification_period            24×7
    }

Restart the Nagios service for the changes to take effect.

NOTE: Nagios service will not startup if they are any errors in the config files

To view the Client in the Nagios UI, click on the Hosts tab. You should see the newly added Client (in this case, lamp) as shown below:

Clicking on the Client name shows you further details regarding its status, performance, uptime etc

You can add services to be monitored for your client by defining services as shown below:

define service {
        use                               generic-service
        host_name                    lamp
        service_description       SSH
        check_command          check_ssh
        notifications_enabled     0
    }

Restart Nagios service once again and check the newly added service in the Services Tab in the Nagios UI. You should see the newly added SSH service under your Client name (here, its lamp)!!

You can add additional services and monitor additional clients as required.

Quick Start: Setup CentOS 7 as a LAMP Server

In this tutorial, I’m going to show you simple steps using which you can setup your own LAMP (Linux-Apache-MySQL-PHP) on a CentOS 7 system.

Prerequisites
CentOS 7 Minimal ISO
Make sure your system has a static IP address assigned to it and a fully qualified domain name.

System Details:
Base OS:        CentOS 7 64 Bit (Minimal ISO)
HOSTNAME:  master.cloud.com
IPADDRESS: 192.168.0.15

Steps:

LINUX
Start by Installing a CentOS 7 system. You can refer THIS GUIDE for the same.

APACHE WEB SERVER
Once the base OS is ready, we now install the Apache web server package.

# yum install httpd

The httpd package downloads some additional dependencies as well. Hit “Y” and download all the required RPMs as shown.

Next, edit the “httpd conf” file

# vi /etc/httpd/conf/httpd.conf

In this file, you only need to edit at two places:

# Replace ServerAdmin root@localhost
ServerAdmin root@<YOUR_CENTOS_IP_ADDRESS>

# Replace ServerName localhost:80
ServerName <YOUR_CENTOS_IP_ADDRESS>:80

NOTE: ServerName attribute is commented out by default, so remember to uncomment it out first.

Save and exit the editor once the changes are made.

Start and enable the httpd service

# systemctl start httpd

# systemctl enable httpd

Enable the HTTP port (Port 80) on the firewall and reload the firewall.

# firewall-cmd –permanent –add-port=80/tcp

# firewall-cmd –reload

Test your Web Server by typing in the CentOS system’s IP address in a browser. You should see the following web page if your settings are done correctly.

http://<YOUR_CENTOS_IP_ADDRESS>

MySQL
Next up we install the MySQL Database. An important point to note here is that with CentOS 7, MariaDB is shipped as the default MySQL Engine unlike the earlier versions where MySQL was the de facto choice.

In this guide, I’ll show you how to install both MariaDB and MySQL Server.

First off, its MariaDB

# yum install mariadb mariadb-server

This will install the necessary DB packages for MariaDB, rest of the configuring steps remain the same for MySQL so I’ll now show you how to install MySQL Community Edition on a CentOS 7 system.

First off, we download some prerequisites:

# yum install wget

Next, download the MySQL Community Release RPM using the following command:

# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

Install the downloaded RPM

# rpm -ivh mysql-community-release-el7-5.noarch.rpm


The RPM installs two repos at /etc/yum.repos.d directory, both will be used to install the MySQL Community Server packages

Once prepped, you can now install the MySQL packages as required

# yum install mysql-server mysql

Start and enable the MySQL service

# systemctl start mysqld

# systemctl enable mysqld

Run the mysql_secure_installation script to set the root password and other necessary parameters

# mysql_secure_installation

Test your MySQL server by logging on the DB:
 
# mysql -u root -p

PHP
The final install is PHP. Run the following command to install the basic PHP packages:

# yum install php php-mysql

Hit “Y” to download and install the packages

Next, create a simple file to test whether PHP was successfully installed or not

# vi /var/www/html/info.php

<?php phpinfo(); ?>
Restart the httpd service before you proceed.

# systemctl restart httpd

Open up a browser and type in the following. You should see the PHP info page as shown below:

http://<CENTOS_SERVER_IP_ADDRESS>/info.php


Thats it for this post.. but stay tuned for much more coming your way soon..

Cheers.

Quick Start: LAMP on Ubuntu 14.04

Quick Start
LAMP on Ubuntu 14.04
Here’s a simple, easy to follow guide that will help you set up a fully functional “LAMP“: Linux (duuuuhhh), Apache, MySQL and PHP on your Ubuntu Desktop/ Server
For this tutorial, I am using a Ubuntu 14.04 Desktop, however, the steps remain more or less the same for a majority of other Ubuntu versions as well.
NOTE: The following steps require root (sudo) access to perform.
To get started, launch a terminal in your Ubuntu System, obtain root privileges by typing the sudo -i command.
The next thing to do is to provide a static IP address to your Ubuntu system. Although this can be left as optional, but I highly recommend that you always use static IPs for such Servers.
Make a note of your Ubuntu System’s IP address by executing the  ifconfig command. Note down the IP address.
# ifconfig
Edit the /etc/network/interfaces file and add the IP address info there. The final outcome of your interface file should look something as shown below:
 
# vi /etc/network/interfaces
 
# The Primary Network Interface
iface eth0 inet static
address 192.168.50.133
netmask 255.255.255.0
gateway 192.168.50.2
Once these preliminary activities are done, we are now ready to install our LAMP Server.
Install Apache
Installing Apache is a simple process. Simply type in the following command in your terminal and watch the magic happen:
# apt-get install apache2
The installation automatically attempts to start the Apache service. You can check the server’s status by executing the following command:
# service apache2 status
If the service status shows stopped, then start up the apache server by using:
# service apache2 start
Verify Apache was successfully installed by launching a browser window and simply putting your Ubuntu Server’s IP address in there. You should see Apache2 Default Page as shown below:
Install MySQL 
This involves installing and configuring MySQL Server and Client as well on your Ubuntu system. Type in the commands in your terminal to get started:
# apt-get install mysql-server mysql-client
Along the installation process, you will be prompted to provide the MySQL Server’s administrative (a.k.a root) password. Provide a strong password here.
TIP: I don’t know why, but I have faced issues with accessing MySQL from time to time especially if my password contained an ‘@’ in it. It seems MySQL treats this as some special character or something and does create problems at times. So avoid using the ‘@’ in your password, use whatever else that comes to your damn mind 🙂
Provide the same password again (Just to make sure that you are awake I guess.. 😛 )
Once the installation completes, check the status of your MySQL Server. It should be in the running state.
# service mysql status
You can then access your MySQL Server using the below syntax:
 
# mysql -u root -p


Install PHP
The next step in out LAMP is PHP.

# apt-get install php5 php5-mysql libapache2-mod-php5

To test your PHP installation, first we need to traverse to the following path and create a simple php file (Here, im gonna call it as info.php)
# cd /var/www/html
 
# vi php.info
 
# Add the following contents in your PHP.INFO file
<? php
phpinfo();
?>
The next thing to do is to restart the apache2 service. You may get a looooong warning message as shown in the image below, but not to worry. That’s there as we haven’t set the FQDN in the apache2 conf file. You can ignore this though for time being..
Open up a browser and type in the Ubuntu server’s IP address followed by the PHP.INFO file in the following format:
 
If you get a similar output as shown below, then voila.. you got yourself a working LAMP Server!!
Bonus Stuff!
Well, its not actually a bonus as such, but a pretty handy tool never the less. Its called as PHPMYADMIN. Ill not go in-depth on this, but just to keep things simple its a PHP based tool meant to administer MySQL databases using a web-based UI. You can read more about it HERE
To install it, type in the following in your terminal:
# apt-get install phpmyadmin
During the installation, it will prompt you to select the “Web Server” to run PHPMYADMIN. Select apache2 and continue
The next few screens, are just used for the configuration of PHPMYADMIN
Provide the administrative password of your MySQL DB to configure PHPMYADMIN
Provide a suitable password for PHPMYADMIN to register with the MySQL DB

Re-enter the password

Congrats! Your PHPMYADMIN is now ready for use.. simply login to the portal using root as the username and the password yhat you set in your earlier steps
You can use the tool to administer the MySQL DB as you want to.
There you have it! A simple LAMP tutorial to help you get started..
Stay tuned for more coming your way..

Best Practices- Installing CentOS VM on VMware Workstation- Part 1

– Part 1

INSTALLING CentOS AS A VIRTUAL MACHINE

In this series of blogs I am going to share my experiences and few best practices when it comes to installing and configuring a LINUX, in this case, a CentOS VM using VMware Workstation 8.

NOTE that these steps can well be used to install any LINUX VM on vSphere platforms as well… just the tuning with respect to the class of OS changes then.. like Debian, or Red-Hat..

Software used in this tutorial:

We are going to create a TYPICAL Virtual Machine

Now there are two ways of installing a VM using VMware Workstation.. first; there is something called as Easy Install which assumes certain criteria for installing the OS and provides a quick way to complete the OS installation.. but i am going to avoid that and install the OS manually. In this way, i can specify the Partitioning tables for my CentOS as I want it.

Select Linux from the Guest OS Menu and CentOS 64-Bit as the Version from the drop down list as shown

Provide a suitable name for your VM.. i usually go with Defaults…

Specify 5 GB as the Disk Capacity.. we don’t want to provide a lot of Disk unnecessarily.. 5 GB is enough for installing any LINUX OS.. We will show you how to attach a HDD to the VM in our PART 3 of the series..

Click Customize Hardware to mount the CentOS ISO File manually and do other bit of “cleaning up” !!

First of all, we do the “clean up“.. just remove unwanted devices like Floppy Drives and Printers (Unless you want to use them for your self !!)

Click on CD-ROM (IDE 1) item, select Use ISO image option and click Browse button to select your recently downloaded *.iso installation file of CentOS as shown below

Once done, the VM is ready to be Powered ON. Select the Power On this Virtual Machine as shown below

When your virtual pc starts, you’ll see welcome screen of installation CentOS. Press ENTER to begin the Installation Process…

If you’ll not be able to see this screen, then restart your virtual machine and click Esc button for Boot menu. And from this menu, select CD-ROM Drive

Click ENTER. The installation will tell you to begin testing of your installation CD or DVD. Select Skip button. It will skip testing your CD media and save your time..

Then you’ll get another welcome screen, you only have to click next button on this screen

Select your language of installation and click Next

Then, select your keyboard configuration to use it for the system you’re installing and click Next

Then, you’ll be warned to create new partitions by erasing ALL DATA on your newly created hard drive. As there’s no information in this drive, you’ll select Yes

We will Create a Custom Layout as in this case we will be able to specify the partitions and provide them sizes and all 🙂

We will first create a SWAP Partition. the size of the SWAP Partition depends on how much RAM is provided to the VM.. in this case, the VM is provided with 1 GB RAM.. hence we are providing SWAP 1000 MB..

Similarly, create a BOOT Partition of 100 MB

You can provide the remaining 4000MB (approximately) to the ROOT (/) Partition as shown.. The ROOT partition houses the installation of your CentOS System..

After you have created the Partitions, it should look something like this:

NOTE: Three Partitions are created; namely, sda1, sda2 and sda3

You may get a warning saying you have allocated less SWAP space than available. You can ignore this message as anyways, SWAP is only used when the system is almost at crashing point.. 🙂

You can create the GRUB BOOT Loader on the /dev/sda partitions. Leave this for default values and click NEXT

Then, you’ll see Network Configurations screen, don’t change anything and click next. You can change whatever you want after installation, for now, let it continue in this way and click Next

From this screen, select your region and click Next

Then, you’ll be prompted to enter password for root user, enter it and click Next

To install packages that you may want in your OS, you can select them Customizing your installation here. Select Customize now option and click Next

I am not a big fan of having all these extra services running on my VM.. so I simply remove what ever I don’t require.. in this case, Games and Entertainment, Graphics, Office Suite etc are removed from Installation process.

Now, you’re ready for installation. Click next on this screen, the installation will begin

You’ll see how all packages are installing. After a while, your OS will be ready for use

After the installation is completed, click Reboot button to reboot your OS

After reboot, you’ll face with another Welcome screen. There are some steps need to be completed

Click Forward button on the screen.

Here, just disable your Firewall. Do remember that this is only for test purpose, don’t disable your Firewall on a real system! And click forward button

For testing purpose, it would be good to disable SELinux too 🙂

If you need, make your Date and Time configuration and click Forward

If you want to create a new user, you can fill these blanks. You can pass this step too by clicking Forward button

Then Click Finish and the system will reboot

After reboot, CentOS will be opened and you’ll be prompted to enter username (root) and password (root’s password)

Your CentOS is ready to use! Congratulations !!

How to Setup DNS Server in Linux

Step by Step Guide for setting up a DNS Server in Red Hat / CentOS / Fedora

The following guide will help you setup your very own fully functional local DNS Server for your Linux Operating Systems.

In this guide, we are going to use CentOS as the base OS for setting up our DNS server, however the same steps should be applicable on most Linux OS platforms as well such as Red Hat, Fedora etc.
The diagram below depicts the layout of our test domain a.k.a “cloud.com“. We are going to set up a Primary / Master DNS along with a Client to test whether the DNS was successfully setup or not.
 
Machine Details:
Primary / Master DNS Server:
OS: CentOS 6.3 64 Bit
Host name: masterdns.cloud.com 
IP: 192.168.50.128
Subnet: 255.255.255.0
 
Secondary / Fail Safe DNS Server:
OS: CentOS 6.3 64 Bit
Host name: slavedns.cloud.com 
IP: 192.168.50.129
Subnet: 255.255.255.0
 
Test Client Server:
OS: CentOS 6.3 64 Bit
Host Name: client.cloud.com
IP: 192.168.50.130
Subnet: 255.255.255.0
 
Setting up the Master DNS Server:
First, we need to install the DNS software. In this case, we are using Bind. Bind is a popular Linux-based DNS server and is widely used all over the world.
Execute the following command in your Master DNS server:
NOTE: The following commands have been executed using root privileges.
# yum install bind*

Once installed, we configure the DNS Server. To do this, we need to edit a configuration file with some parameters:

# vi /etc/named.conf

Make ONLY the changes that are highlighted below:

NOTE: Replace the Master DNS Server IP address with your own Master Server’s IP address. If you plan to setup a Secondary DNS, then fill in the Slave DNS IP Address as shown below, else ignore the setting. Provide your Forward and Reverse Lookup zones as required.
//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
options {
listen-on port 53 { 127.0.0.1; 192.168.50.128;}; ### Provide your Master DNS IP ###
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query     { localhost; 192.168.50.0/24;}; ### IP Address Range ### 
allow-transfer{ localhost; 192.168.50.129;};   ### Slave DNS IP Address ###
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
};
logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};
zone "." IN {
type hint;
file "named.ca";
};
### Forward Lookup Zone ###
zone"cloud.com" IN {
type master;
file "forward.cloud";
allow-update { none; };
};
### Reverse Lookup Zone ###
zone"50.168.192.in-addr.arpa" IN {
type master;
file "reverse.cloud";
allow-update { none; };
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";

Once edited, we now need to create forward and reverse zone files which we mentioned in the ‘/etc/named.conf’ file.
Create forward.cloud file in the ‘/var/named’ directory.
NOTE: Make ONLY the changes that are highlighted below:
# vi /var/named/forward.cloud

$TTL 86400
@   IN  SOA     masterdns.cloud.com. root.cloud.com. (
        2011071001  ;Serial
        3600        ;Refresh
        1800        ;Retry
        604800      ;Expire
        86400       ;Minimum TTL
)
@       IN  NS          masterdns.cloud.com.
@       IN  NS          slavedns.cloud.com.
@       IN  A           192.168.50.128
@       IN  A           192.168.50.129
@       IN  A           192.168.50.130

masterdns       IN  A   192.168.50.128
slavedns    IN  A   192.168.50.129
client          IN  A   192.168.50.130
Similarly, create reverse.cloud file in the ‘/var/named’ directory.
NOTE: Make ONLY the changes that are highlighted below:
# vi /var/named/reverse.cloud

$TTL 86400
@   IN  SOA     masterdns.cloud.com. root.cloud.com. (
        2011071001  ;Serial
        3600        ;Refresh
        1800        ;Retry
        604800      ;Expire
        86400       ;Minimum TTL
)
@       IN  NS          masterdns.cloud.com.
@       IN  NS          slavedns.cloud.com.
@       IN  PTR         cloud.com.

masterdns       IN  A   192.168.50.128
slavedns    IN  A   192.168.50.129
client          IN  A   192.168.50.130

128     IN  PTR         masterdns.cloud.com.
129     IN  PTR         slavedns.cloud.com.
130     IN  PTR         client.cloud.com.

If all’s gone well, then we are now ready to start the DNS service:

# service named start
# chkconfig named on
You can test the DNS configuration and the Zone files for any errors by running the following commands:
# named-checkconf /etc/named.conf

# named-checkzone unixmen.local /var/named/forward.cloud

# named-checkzone unixmen.local /var/named/reverse.cloud 

You can test your DNS server by running the following command.
You should receive the output with a "NOERROR" status as shown:
# dig masterdns.cloud.com
You can alternatively run ‘nslookup‘ to verify your DNS settings
# nslookup cloud.com
# nslookup masterdns.cloud.com
Setting up the Slave DNS Server (OPTIONAL):

Once our Master DNS is set up, setting up a secondary or slave DNS Server is optional, but its always a good practice to have one in place. Installing a Slave DNS server is no different for that of the Master, just a few configurations differ.

To get started, first install bind on the slave DNS Server machine:

# yum install bind*
Once installed, we configure the DNS Server. To do this, we need to edit a configuration file with some parameters:
# vi /etc/named.conf

Make ONLY the changes that are highlighted below:

//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
options {
listen-on port 53 { 127.0.0.1; 192.168.50.129;}; ### Provide your Slave DNS IP ###
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query     { localhost; 192.168.50.0/24;}; ### IP Address Range ### 
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
};
logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};
zone "." IN {
type hint;
file "named.ca";
};
### Forward Lookup Zone ###
zone"cloud.com" IN {
type slave;
file "slaves/cloud.fwd";
masters { 192.168.1.100; };
masters {192.168.50.128;};
};
### Reverse Lookup Zone ###
zone"50.168.192.in-addr.arpa" IN {
type slave;
file "slaves/cloud.rev";
masters {192.168.50.128;};
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";

Once done, save the file and exit the editor.

If all’s gone well, then we are now ready to start the DNS service:
# service named start
# chkconfig named on

You can see that once the service is started, the Forward and Reverse lookup zone files are automatically copied form the Master DNS to /var/named/slaves folder in the Slave DNS Server.

You can test your DNS server by running the following command.
You should receive the output with a "NOERROR" status as shown:
# dig slavedns.cloud.com
# vi /etc/named.conf  // // named.conf // // Provided by Red Hat bind package to configure the ISC BIND named(8) DNS // server as a caching only nameserver (as a localhost DNS resolver only). // // See /usr/share/doc/bind*/sample/ for example named configuration files. // options { listen-on port 53 { 127.0.0.1; 192.168.1.101;}; listen-on-v6 port 53 { ::1; }; directory “/var/named”; dump-file “/var/named/data/cache_dump.db”;         statistics-file “/var/named/data/named_stats.txt”;         memstatistics-file “/var/named/data/named_mem_stats.txt”; allow-query     { localhost; 192.168.1.0/24;}; recursion yes; dnssec-enable yes; dnssec-validation yes; dnssec-lookaside auto; /* Path to ISC DLV key */ bindkeys-file “/etc/named.iscdlv.key”; managed-keys-directory “/var/named/dynamic”; }; logging {         channel default_debug {                 file “data/named.run”;                 severity dynamic;         }; }; zone “.” IN { type hint; file “named.ca”; }; zone”unixmen.local” IN { type slave; file “slaves/unixmen.fwd”; masters { 192.168.1.100; }; }; zone”1.168.192.in-addr.arpa” IN { type slave; file “slaves/unixmen.rev”; masters { 192.168.1.100; }; }; include “/etc/named.rfc1912.zones”; include “/etc/named.root.key”; – See more at: http://www.unixmen.com/dns-server-installation-step-by-step-using-centos-6-3/#sthash.y1dxQ5YU.dpuf
Setting up the Clients:

Once our Master DNS and Slave DNS is set up, we can now configure our Linux Clients against this Domain:

In all your ‘Client’ machines, simply add the following entries in the following file:

# vi /etc/resolv.conf
search cloud.com
### Master DNS ###
search 192.168.50.128
### Slave DNS ###

search 192.168.50.129

Save the file and exit the editor. You should now be able to see your ‘Client’ Machine’s FQDN as well as shown below:

NOTE: You will have to manually add each Client in your Master DNS forward and reverse files. This will help in providing a FQDN to your clients.

Thats all for now.. hope this tutorial guides you to set up your DNS successfully..