How to Create Additional LVM on RHEL 6/CentOS 6

Most of the linux administrator facing run out of disk space to store data and sometimes there is another request for them to create additional logical volume manager(LVM) for new system or to store data. It is possible to perform this task if that system administrator has the right skill on linux. Otherwise, they will put themselves and the organization in the disaster or risk as working with the system’s data is on of the most critical job that must be perform with the right steps and skills. In this post, i will show how to create additional LVM on Red Hat Enterprise Linux 6 (RHEL 6) system. This step may apply to CentOS 6.0. CentOS 6.1 and CentOS 6.2.

1. By typing the mount command with no arguments shows us all currently mounted filesystems

[root@rhel6 ~]# mount
/dev/mapper/VolGroup-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

2. Print the current partition table of the hard disk :

[root@rhel6 ~]# fdisk -l

Disk /dev/sda: 12.9 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0000690f

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        1567    12069888   8e  Linux LVM

Disk /dev/dm-0: 10.2 GB, 10242490368 bytes
255 heads, 63 sectors/track, 1245 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 2113 MB, 2113929216 bytes
255 heads, 63 sectors/track, 257 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/dm-1 doesn't contain a valid partition table

Disk /dev/sdb: 12.9 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sdb doesn't contain a valid partition table

3. Create new partition for /dev/sdb using below command :

[root@rhel6 ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x1adc0629.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1566, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1566, default 1566):
Using default value 1566

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

4. Convert this disk into a physical volume :

[root@rhel6 ~]# pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created

Display the physical volume :

[root@rhel6 ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               VolGroup
  PV Size               11.51 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              2946
  Free PE               0
  Allocated PE          2946
  PV UUID               tzxpC7-70n1-OuUQ-kMfT-H627-VHAA-kroHvm

  "/dev/sdb1" is a new physical volume of "12.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdb1
  VG Name
  PV Size               12.00 GiB
  Allocatable           NO
  PE Size               0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               SoWQ5U-CmmA-tjIY-KDh0-H3gU-qVpa-tx4n6n

5. With the physical volume created we now need to create new volume group for it. In this case i will give the volume group name VolGroup_rhel6 :

[root@rhel6 ~]# vgcreate VolGroup_rhel6 /dev/sdb1
  Volume group "VolGroup_rhel6" successfully created

Display the volume group

[root@rhel6 ~]# vgdisplay
  --- Volume group ---
  VG Name               VolGroup_rhel6
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               11.99 GiB
  PE Size               4.00 MiB
  Total PE              3070
  Alloc PE / Size       0 / 0
  Free  PE / Size       3070 / 11.99 GiB
  VG UUID               mg2I2s-8u5l-Mjm7-oKrQ-yYJ3-yzaO-mq2u9v

  --- Volume group ---
  VG Name               VolGroup
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               11.51 GiB
  PE Size               4.00 MiB
  Total PE              2946
  Alloc PE / Size       2946 / 11.51 GiB
  Free  PE / Size       0 / 0
  VG UUID               uROlLN-3aef-Cb7G-rJ8W-EyY0-aDaf-TyeE5T

6. Create logical volumes with the name of rhelvol into VolGroup_rhel6 volume group :

[root@rhel6 ~]# lvcreate --name rhelvol -l 100%FREE VolGroup_rhel6
  Logical volume "rhelvol" created

Display logical volume :

[root@rhel6 ~]# lvdisplay
  --- Logical volume ---
  LV Name                /dev/VolGroup_rhel6/rhelvol
  VG Name                VolGroup_rhel6
  LV UUID                o3RQMB-O3Lu-TB2h-7pSm-A2kI-sh1W-rXb1Ce
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                11.99 GiB
  Current LE             3070
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

  --- Logical volume ---
  LV Name                /dev/VolGroup/lv_root
  VG Name                VolGroup
  LV UUID                1f4tl8-rCgZ-yI9J-xCsI-Hrh2-5DUS-DJF5N2
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                9.54 GiB
  Current LE             2442
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Logical volume ---
  LV Name                /dev/VolGroup/lv_swap
  VG Name                VolGroup
  LV UUID                Kpw601-Wcvj-EM8b-FJnh-v2f6-5CqT-rV2JdT
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                1.97 GiB
  Current LE             504
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

7. Creating a file with the mke2fs command :

[root@rhel6 ~]# mke2fs -j /dev/VolGroup_rhel6/rhelvol
[root@rhel6 ~]# mke2fs -j /dev/VolGroup_rhel6/rhelvol
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
786432 inodes, 3143680 blocks
157184 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=3221225472
96 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 37 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@rhel6 ~]# e2label /dev/VolGroup_rhel6/rhelvol /opt
[root@rhel6 ~]# vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Wed Jan  4 03:41:29 2012
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/VolGroup-lv_root /                       ext4    defaults        1 1
/dev/VolGroup_rhel6/rhelvol /opt                       ext4    defaults        1 1
UUID=0e03e7c9-6971-4783-8fb9-fc251febf486 /boot                   ext4    defaults        1 2
/dev/mapper/VolGroup-lv_swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
[root@rhel6 /]# mount /opt
[root@rhel6 /]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                      9.4G  2.1G  6.9G  23% /
tmpfs                 504M     0  504M   0% /dev/shm
/dev/sda1             485M   29M  432M   7% /boot
/dev/mapper/VolGroup_rhel6-rhelvol
                       12G  159M   12G   2% /opt

Type the mount command with no arguments to shows the updated mounted filesystems. /dev/mapper/VolGroup_rhel6-rhelvol now exist at the bottom :

[root@rhel6 ~]# mount
/dev/mapper/VolGroup-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/mapper/VolGroup_rhel6-rhelvol on /opt type ext4 (rw)

How to Check Memory and I/O with vmstat on Linux CentOS 5/CentOS 6/RHEL 5/RHEL 6 server – System Performance

vmstat command is a utility that will provides interesting information abaout processes, memory, i/O and CPU activity. When you run vmstat utility command without any arguments, you will see the output as below. This post will guide you on how to check memory and I/O with vmstat on Linux CentOS 5/CentOS 6/RHEL 5/RHEL 6 server to optimize the linux system performance.

[root@rhel6 ~]# vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0      0 888252  28976  63004    5    0     0    11   15   18  0  0 99  0  0

Below are the description of above vmstat output :
1. The procs fields show the number of processes
– Waiting for run time (r)
-Blocked (b)
-Swapped out (w)

2. The memory fields show the kilobytes of swap memory,free memory, buffered memory and Cached memory

3. The swap fields show the kilobytes per second of memory
-Swapped in from disk (si)
-Swapped out to disk (so)

4. The io fields show the number of blocks per second
-Sent to block devices (bi)
-Received from block devices (bo)

5. The system shows the number of
-Interrupts per second (in)
-Context switches per second (cs)

6. The cpu field shows the percentage of total CPU time as
-User time (us)
-System time (sy)
-Idle (id) time

To prints the vmstat version, run this command :

[root@rhel6 ~]# vmstat -V
procps version 3.2.8

We can let the vmstat to run automatically by execute this command :

[root@rhel6 ~]# vmstat 

Where nsec is the number of seconds you want it to wait before another update.

To run vmstat on every 10 seconds :

[root@rhel6 ~]# vmstat 10
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0      0 888072  29088  63004    4    0     0    11   14   18  0  0 99  0  0
 0  0      0 888064  29088  63004    0    0     0     0   12   15  0  0 100  0  0
 0  0      0 888064  29088  63004    0    0     0     0   13   16  0  0 100  0  0

Other vmstat usage as below :

usage: vmstat [-V] [-n] [delay [count]]
              -V prints version.
              -n causes the headers not to be reprinted regularly.
              -a print inactive/active page stats.
              -d prints disk statistics
              -D prints disk table
              -p prints disk partition statistics
              -s prints vm table
              -m prints slabinfo
              -t add timestamp to output
              -S unit size
              delay is the delay between updates in seconds.
              unit size k:1000 K:1024 m:1000000 M:1048576 (default is K)
              count is the number of updates.

Transfer Files Between Servers in Linux

SSH File Transfer Protocol also called Secret File Transfer Protocol or Secure FTP, or SFTP is a network protocol that provides file access, file transfer, and file management functionality over the network. In this post i will show how to transfer the files using sftp command on Linux Red Hat Enterprise Linux 6 (RHEL 6). Assumed that the following servers presented on your network.

Transfer Files Between Servers using sftp Command

rhel 6 = 192.168.2.43 –> Local working directory: /root/rhel6
CentOS 5.7 = 192.168.2.45 –> Remote working directory: /root/centos57

1. From local working directory rhel6, sftp to centos57 (192.168.2.45) using root with password as below :

[root@rhel6 ~]# sftp root@192.168.2.45
Connecting to 192.168.2.45...
The authenticity of host '192.168.2.45 (192.168.2.45)' can't be established.
RSA key fingerprint is 59:4a:13:85:f0:60:9d:c1:1d:49:95:c7:58:56:5d:4c.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.2.45' (RSA) to the list of known hosts.
root@192.168.2.45's password:

2. Change the directory on the local computer using lcd command. In this case i will Change the directory to /root/rhel6 :

sftp> lcd /root/rhel6

3. Show the current directory (present working directory) on the local computer. In this case local working directory is /root/rhel6 :

sftp> lpwd
Local working directory: /root/rhel6

Display local directory listing

sftp> lls
testing.tar.gz

4. Copy/upload a file from the local computer to the remote computer using put command. This scenario consider equivalent with uploading process. At first, only testfile1 and testfile2 exist in /root/centos57. In this case, i will copy the testing.tar.gz from /root/rhel6 to /root/centos57 :

sftp> put testing.tar.gz
Uploading testing.tar.gz to /root/centos57/testing.tar.gz
testing.tar.gz                                                    100%  169     0.2KB/s   00:00

Display remote working directory :

sftp> pwd
Remote working directory: /root/centos57

Display remote directory listing :

sftp> ls
testfile1       testfile2       testing.tar.gz

5. Change the directory on the remote computer using cd command. In this case i will Change the directory to /root/centos57 :

sftp> cd /root/centos57

6. Show the current directory (present working directory) on the remote server. In this case remote working directory is /root/centos57 :

sftp> pwd
Remote working directory: /root/centos57

Display remote directory listing :

sftp> ls
testfile1  testfile2

7. Copy/download a file from the remote computer to the local computer using get command. This scenario consider same as downloading process. At first, only testing.tar.gz exist in /root/rhel6. In this case, i will copy the testfile1 from /root/centos57 to /root/rhel6 :

sftp> get testfile1
Fetching /root/centos57/testfile1 to testfile1
/root/centos57/testfile1                                          100%    5     0.0KB/s   00:00

Display local working directory :

sftp> lpwd
Local working directory: /root/rhel6

Display local directory listing :

sftp> lls
testfile1  testing.tar.gz
sftp>

8. Display this help text :

sftp> help
Available commands:
bye                                Quit sftp
cd path                            Change remote directory to 'path'
chgrp grp path                     Change group of file 'path' to 'grp'
chmod mode path                    Change permissions of file 'path' to 'mode'
chown own path                     Change owner of file 'path' to 'own'
df [-hi] [path]                    Display statistics for current directory or
                                   filesystem containing 'path'
exit                               Quit sftp
get [-P] remote-path [local-path]  Download file
help                               Display this help text
lcd path                           Change local directory to 'path'
lls [ls-options [path]]            Display local directory listing
lmkdir path                        Create local directory
ln oldpath newpath                 Symlink remote file
lpwd                               Print local working directory
ls [-1aflnrSt] [path]              Display remote directory listing
lumask umask                       Set local umask to 'umask'
mkdir path                         Create remote directory
progress                           Toggle display of progress meter
put [-P] local-path [remote-path]  Upload file
pwd                                Display remote working directory
quit                               Quit sftp
rename oldpath newpath             Rename remote file
rm path                            Delete remote file
rmdir path                         Remove remote directory
symlink oldpath newpath            Symlink remote file
version                            Show SFTP version
!command                           Execute 'command' in local shell
!                                  Escape to local shell
?                                  Synonym for help
sftp>

How to Check Apache Error Log and Access Log file

The purpose of logging in a server is to diagnose some issues. The common way to start the troubleshooting is to look at logs. For apache httpd server, all the log is normally stored at “/var/log/httpd” as below :

    [root@centos62 ~]# ls /var/log/httpd/
    access_log  error_log
    

How to Continuously Check Apache Error Log file :

    [root@centos62 ~]# tail -f /var/log/httpd/error_log
    

Example :

    [root@centos62 ~]# tail -f /var/log/httpd/error_log
    [Thu Feb 16 18:23:08 2012] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
    [Thu Feb 16 18:23:08 2012] [notice] Digest: generating secret for digest authentication ...
    [Thu Feb 16 18:23:08 2012] [notice] Digest: done
    [Thu Feb 16 18:23:09 2012] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.3.3 configured -- resuming normal operations
    [Thu Feb 16 19:56:33 2012] [error] [client 192.168.1.52] File does not exist: /var/www/html/favicon.ico
    [Thu Feb 16 23:47:07 2012] [notice] caught SIGTERM, shutting down
    [Sat Feb 18 20:39:26 2012] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
    [Sat Feb 18 20:39:26 2012] [notice] Digest: generating secret for digest authentication ...
    [Sat Feb 18 20:39:26 2012] [notice] Digest: done
    [Sat Feb 18 20:39:27 2012] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.3.3 configured -- resuming normal operations
    

How to Continuously Check Apache Access Log file :

    [root@centos62 ~]# tail -f /var/log/httpd/access_log
    

Example :

    [root@centos62 ~]# tail -f /var/log/httpd/access_log
    192.168.1.52 - - [16/Feb/2012:23:03:50 +0800] "GET /adminer/externals/jush/jush.css HTTP/1.1" 304 - "http://192.168.1.44/adminer/adminer/?server=localhost&username=root" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
    192.168.1.52 - - [16/Feb/2012:23:03:52 +0800] "GET /adminer/adminer/static/loader.gif HTTP/1.1" 200 673 "http://192.168.1.44/adminer/adminer/?server=localhost&username=root" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
    192.168.1.52 - - [16/Feb/2012:23:03:52 +0800] "GET /adminer/adminer/?server=localhost&username=root&database= HTTP/1.1" 200 4739 "http://192.168.1.44/adminer/adminer/?server=localhost&username=root" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
    192.168.1.52 - - [16/Feb/2012:23:03:52 +0800] "GET /adminer/adminer/static/plus.gif HTTP/1.1" 200 72 "http://192.168.1.44/adminer/adminer/?server=localhost&username=root&database=" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
    192.168.1.52 - - [16/Feb/2012:23:03:56 +0800] "GET /adminer/adminer/?server=localhost&username=root HTTP/1.1" 200 2977 "http://192.168.1.44/adminer/adminer/?server=localhost&username=root" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
    192.168.1.52 - - [16/Feb/2012:23:03:56 +0800] "GET /adminer/adminer/?server=localhost&username=root&script=connect HTTP/1.1" 200 109 "http://192.168.1.44/adminer/adminer/?server=localhost&username=root" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
    192.168.1.52 - - [16/Feb/2012:23:04:16 +0800] "GET /adminer/adminer/?server=localhost&username=root&status= HTTP/1.1" 200 19629 "http://192.168.1.44/adminer/adminer/?server=localhost&username=root" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
    192.168.1.52 - - [18/Feb/2012:20:39:32 +0800] "GET / HTTP/1.1" 200 1394 "-" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
    192.168.1.52 - - [18/Feb/2012:20:39:32 +0800] "GET /icons/compressed.gif HTTP/1.1" 200 1038 "http://192.168.1.44/" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
    192.168.1.52 - - [18/Feb/2012:20:44:17 +0800] "GET / HTTP/1.1" 200 1394 "-" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
    

How to Install vim on RHEL 6

In this post, i will show on how to install vim on Redhat Enterprise Linux 6 (RHEL 6) Linux server. Vim stands for ‘Vi Improved’. Vi is one of the most popular and powerful editors in the Unix systems. Vim is an advanced text editor, alternative editor for VI and it’s highly configurable text editor built to enable efficient text editing. It is an improved version of the vi editor distributed with most UNIX systems. If your RHEL 6 server doesn’t have vim installed, you will get the following error :

    [root@rhel6 ~]# vim /etc/httpd/conf/httpd.conf
    -bash: /usr/bin/vim: No such file or directory
    

Assumed that you have set up local yum repository using your DVDrom. If you haven’t set up the local yum repository, please proceed to this steps :
How to Setup Local Yum Repository from CD-ROM/DVD-ROM image on RHEL 6

Simply run this command to install vim on RHEL 6 :

    [root@rhel6 ~]# yum install vim-enhanced -y
    Loaded plugins: rhnplugin
    This system is not registered with RHN.
    RHN support will be disabled.
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package vim-enhanced.i686 2:7.2.411-1.4.el6 set to be updated
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ====================================================================================================
     Package               Arch          Version                    Repository                     Size
    ====================================================================================================
    Installing:
     vim-enhanced          i686          2:7.2.411-1.4.el6          DVD-RHEL6-Repository          839 k
    
    Transaction Summary
    ====================================================================================================
    Install       1 Package(s)
    Upgrade       0 Package(s)
    
    Total download size: 839 k
    Installed size: 1.8 M
    Downloading Packages:
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing     : 2:vim-enhanced-7.2.411-1.4.el6.i686                                          1/1
    
    Installed:
      vim-enhanced.i686 2:7.2.411-1.4.el6
    
    Complete!
    

You can check the details of this vim-enhanced package using this command :

    [root@rhel6 ~]# yum info vim-enhanced
    Loaded plugins: rhnplugin
    This system is not registered with RHN.
    RHN support will be disabled.
    Installed Packages
    Name       : vim-enhanced
    Arch       : i686
    Epoch      : 2
    Version    : 7.2.411
    Release    : 1.4.el6
    Size       : 1.8 M
    Repo       : installed
    From repo  : DVD-RHEL6-Repository
    Summary    : A version of the VIM editor which includes recent enhancements
    URL        : http://www.vim.org/
    License    : Vim and GPLv2+ and BSD and LGPLv2+ and Open Publication
    Description: VIM (VIsual editor iMproved) is an updated and improved version of the
               : vi editor.  Vi was the first real screen-based editor for UNIX, and is
               : still very popular.  VIM improves on vi by adding new features:
               : multiple windows, multi-level undo, block highlighting and more.  The
               : vim-enhanced package contains a version of VIM with extra, recently
               : introduced features like Python and Perl interpreters.
               :
               : Install the vim-enhanced package if you'd like to use a version of the
               : VIM editor which includes recently added enhancements like
               : interpreters for the Python and Perl scripting languages.  You'll also
               : need to install the vim-common package.
    

Note that you must be the root/administrator to install the package.

How to Install wget on RHEL 6

Symptoms :
When i try to download the software package using wget command, i get the following error :

    -bash: wget: command not found
    

Solutions :
wget command does not exist on your Redhat Enterprise Linux 6 (RHEL 6) Linux server. Wget is a free network utility for linux to download files from the Web. Therefore, there is simple step to install the wget command utility into your RHEL 6 server. Assumed that you have set up local yum repository using your DVDrom. If you haven’t set up the local yum repository, please proceed to this steps ;

How to Setup Local Yum Repository from CD-ROM/DVD-ROM image on RHEL 6

    [root@rhel6 ~]# yum install wget -y
    Loaded plugins: rhnplugin
    This system is not registered with RHN.
    RHN support will be disabled.
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package wget.i686 0:1.12-1.4.el6 set to be updated
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ====================================================================================================
     Package          Arch             Version                   Repository                        Size
    ====================================================================================================
    Installing:
     wget             i686             1.12-1.4.el6              DVD-RHEL6-Repository             481 k
    
    Transaction Summary
    ====================================================================================================
    Install       1 Package(s)
    Upgrade       0 Package(s)
    
    Total download size: 481 k
    Installed size: 1.8 M
    Downloading Packages:
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing     : wget-1.12-1.4.el6.i686                                                       1/1
    
    Installed:
      wget.i686 0:1.12-1.4.el6
    
    Complete!
    

How to Check Hard Disk Size and Hard Disk Usage on CentOS 6.2

In this post, i will share the simple command to check the Hard Disk size and usage on CentOS 6.2. This command is a basic command for linux operating system.

To view and list of the usage of each partition in the server :

    [root@centos62 ~]# df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/mapper/vg_centos62-lv_root
                           13G  1.8G   10G  15% /
    tmpfs                 504M     0  504M   0% /dev/shm
    /dev/sda1             485M   48M  412M  11% /boot
    

df command will displays the total, used, and available free space on all currently mounted filesystems.

To list the size of a specific directory, run the following command :

    [root@centos62 ~]# du -sh /root
    2.6M    /root
    

du command reports disk usage. It will shows the disk space used by the files and directories in a directory. The -h option makes the output easier to read by user.