Categories
Red Hat Enterprise Linux / CentOS

One liner command to insert IP and hostname in /etc/hosts

This a very useful One liner command to insert IP and hostname into /etc/hosts file and is particularly useful when it comes to kickstart scripts wherein you need to have /etc/hosts entry for the newly provisioned VM and get it enrolled to various applications that include Red Hat IDM/ FreeIPA and Puppet to start with.

Categories
Linux Red Hat Enterprise Linux / CentOS

Using awk in Alias Command – CentOS & Red Hat

Its possible to use awk in Alias command. I did that by simply just modifying some parenthesis and there you go, had a working awk command.

All that it required was closing awk in double quotes as opposed to single quotes and forward slash before the “$” variable. This alias command is for printing the default Gateway for an interface.

 alias eth0-gw='route -n | grep eth0 | awk "NR==1{ print \$2 }"'
Categories
Red Hat Enterprise Linux / CentOS

Run a script via Alias Command – CentOS & Red HAT

Its possible to run a script via Alias command. All you need is to modify the .bashrc and then source the script in the required user profile. Alias commands are very useful when it comes to running shortened versions of commands or a complex script to be run using just a single line of command. Currently I use this to run 2 of my custom scripts for waking up a ESXi server via WOL (Wake-ON-LAN).

Categories
Red Hat Enterprise Linux / CentOS

Create Self Signed SSL Certificate – CentOS and RHEL

This article will guide you on creating a custom Self-signed SSL Certificate in no time. For creating one you would need top have Root access to the host. SSL Certificate is used for securing the access to a website or any apache based WebUI you use and that includes Nagios and Cacti.

Categories
Red Hat Enterprise Linux / CentOS

Dual Instance of SSH – CentOS and RHEL

This guide is for configuring dual instances of ssh on a single server and bind them to seprate NIC’s/Interfaces/Ethernet ports. Usually this is required in DEV and Prod environments wherein you need additional security and separation of bandwidth and keep DEV and Prod users access limited.

Categories
Red Hat Enterprise Linux / CentOS

How to Telnet via BASH Script

This article will show you how to Telnet via BASH script and return the status as open or close. This has been tested on CentOS/RedHat and hopefully should work on all other Linux distributions as well.

Categories
Red Hat Enterprise Linux / CentOS

How to reduce LVM size & reuse free space on the fly

Reducing LVM disk size is possible using lvreduce on the fly without a reboot. Make sure that data is backed up for the disk to be resized so that FREE space can be reused. LVM (Logical Volume Management) is very efficient when it comes to mounting/partitioning disks in Linux. You need to be ROOT to carry out this process.

Categories
Red Hat Enterprise Linux / CentOS

Extend LVM partition to >2TB. No need for GPT, Parted or Kernel editing

Its now possible to extend LVM disk/partition to more than 2TB that too without using Parted, GPT or Kernel editing.After doing lots of Googling and not a single article explaining about extending LVM volume without GPT, I came up with this article which has been fully tested and working. It was tested on a 4TB disk with a single partition of 3.5TB. The LVM extension can be done without loosing any data although I would still recommend backing up the data as a precautionary measure.

NOTE: This has been tested in a DEV environment and assume no responsibility with regards to performance effect on the disk/volume in Production although the disk tested has been in a perfect condition and working for more than 2 years now.

Categories
Red Hat Enterprise Linux / CentOS

Setup DHCP Server in Linux

Its easy to setup DHCP server in Linux with full control over the IP’s and what IP’s are assigned to client hosts. We would be using DHCP package via YUM for this setup. DHCP is used for dynamic assinging of IP addresses for the clients in a network. First of all we would install the dhcp package.

Categories
Red Hat Enterprise Linux / CentOS

Setup and Configure DNS Server in Linux

This guide will help you in setting up a DNS server for resolving IP address to domain names and vice-versa. We will be using “named (bind)” as its the DNS version for Linux. First we need to install named Packages.