New Naming Scheme for the Network Interface on RHEL 7/CentOS 7

Red Hat Enterprise Linux 7 (RHEL 7) and CentOS 7 come with the new naming scheme for the network devices.

These features change the name of network interfaces on a system in order to make the network interfaces fully predictable, fully automatic, easier to differentiate and that broken hardware can be replaced seamlessly.

This affects both network adapters embedded on the motherboard (Lan-on-Motherboard, or additional adapters such as PCI network card and etc.

Traditionally, network interfaces in Linux used eth[0123…]. In RHEL7/CentOS7, the default network interface name is based on firmware, topology, and location information.

The following different naming schemes for network interfaces are now supported by udev natively:

  • Names incorporating Firmware or BIOS provided index numbers for on-board devices (example: eno1)
  • Names incorporating Firmware or BIOS provided PCI Express hotplug slot index numbers (example: ens1)
  • Names incorporating physical location of the connector of the hardware (example: enp2s0)
  • Names incorporating the interface’s MAC address (example: enx78e7d1ea46da)
  • The traditional unpredictable kernel-native ethX naming (example: eth0)

The names have two character prefixes based on the type of interface:

  • en for Ethernet,
  • wl for wireless LAN (WLAN),
  • ww for wireless wide area network (WWAN).
FormatDescription
o<index>on-board device index number
s<slot>[f<function>][d<dev_id>]hotplug slot index number
x<MAC>MAC address
p<bus>s<slot>[f<function>][d<dev_id>]PCI geographical location
p<bus>s<slot>[f<function>][u<port>][..][c<config>][i<interface>]USB port number chain

ifconfig utility is not installed by default in minimal installation. You can use “ip link show“, “ip addr” or “ip address” to display the auto assigned devices name :

[root@centos7 ~]# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT qlen 1000
    link/ether 00:0c:29:ba:3e:fe brd ff:ff:ff:ff:ff:ff
[root@centos7 ~]# ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:0c:29:ba:3e:fe brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.18/24 brd 192.168.0.255 scope global dynamic ens160
       valid_lft 604707sec preferred_lft 604707sec
    inet6 fe80::20c:29ff:feba:3efe/64 scope link
       valid_lft forever preferred_lft forever

How to Setup nmon – Monitor Linux Performance

Nmon (Nigel’s Monitor) is a great performance monitoring tool for Linux operating system.

It was written initially for AIX to monitor system performance. nmon for Linux can be used to collect informations on CPU, memory, network, disk I/O, top processes etc.

System administrator can use nmon as a tuner or benchmark tool that will provide performance information in one go.

It can output the data on the screen or can be save the data into a comma separated file for analysis and longer term data capture.

Steps to setup nmon on linux operating system.

1. How to Add the RPMforge Repository on CentOS 6/RHEL 6 Linux Server

2. Rum yum command to install nmon :

# yum install nmon -y

3. Example of nmon command usage :

Type command :

# nmon

Sample output :
setup nmon

nmon keyboard shortcuts

q – To stop and exit nmon.
h – To see quick help (hint) screen and press h again to remove the hints.
Use the following command to turn on or off stats:
c – See cpu stats.
m – See memory stats.
d – See disk stats.
k – See kernel stats.
n – See network stats.
N – See NFS stats.
j – See file system stats.
t – See top process.
V – See virtual memory stats.
. – See only busy disks/procs.
v – Verbose mode (display as Ok/warning/danger on screen).

Sample outputs :
setup nmon

4. If you prefer to run nmon as a daemon in the background, run the below command, nmon will complete the data file collection and it will save in a file *.nmon file such as oss_140817_2359.nmon with the details of the command as below :

# nmon -f -s2 -c 30
-f : Start data collect mode and output in spreadsheet format.
-s 2 : Wait between 2 seconds or capture data every 2 seconds.
-c30 : Total number of refreshes (30).

7 Useful Linux Utilities

Linux UtilitiesThere are 7 useful linux utilities that you must install on new linux server. Most Linux distributions are equipped with tons of linux command utility, but if you have installed minimal operating system, all these software will not exist. These tools will very useful in your troubleshooting and will help to find possible causes of a problem. Most of the utilities have the same function in CentOS or Red Hat Enterprise Linux (RHEL).

You can easily identify whether the utility installed on your linux operating system or not. You will see one or more below warning :

[root@rhel62 ~]# wget
-bash: wget: command not found
[root@rhel62 ~]# telnet
-bash: telnet: command not found
[root@rhel62 ~]# scp
-bash: scp: command not found
[root@rhel62 ~]# man scp
-bash: man: command not found
[root@rhel62 ~]# nslookup
-bash: nslookup: command not found
[root@rhel62 ~]# dig
-bash: dig: command not found
[root@rhel62 ~]# host
-bash: host: command not found

7 Useful Linux Utilities

1. What is wget ?
Wget is a network utility to retrieve files from the Web using http and ftp, the two most widely used Internet protocols.

Example :

[root@rhel62 ~]# wget http://files2.zimbra.com/downloads/8.0.2_GA/zcs-8.0.2_GA_5569.RHEL6_64.20121210115059.tgz

2. What is telnet ?
Telnet is a network protocol used on the Internet or local area networks. Telnet is a user command and an underlying TCP/IP protocol for accessing remote computers and very useful for troubleshooting and verify the opened ports.

Example :

[root@rhel62 ~]# telnet localhost 25
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 rhel62.ehowstuff.local ESMTP Postfix

3. What is scp ?
scp also call secure copy, is remote file copy utility between hosts on a network. It uses ssh for data transfer and provides the same authentication and same level of security as ssh.

Example :

[root@rhel62 ~]# scp root@192.168.2.60:/tmp/VMwareTools-9.2.2-893683.tar.gz .
The authenticity of host '192.168.2.60 (192.168.2.60)' can't be established.
RSA key fingerprint is 76:78:87:36:44:c1:46:fa:c4:b4:61:4a:e5:b3:be:e3.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.2.60' (RSA) to the list of known hosts.
root@192.168.2.60's password:
VMwareTools-9.2.2-893683.tar.gz                                                       100%   63MB  63.3MB/s   00:01

4. What is man ?
man is used to display the manual page for other commands It’s help to explain the functions for the commands that commonly used. The term “man” is short for manual.

Example :

[root@rhel62 ~]# man wget
WGET(1)                            GNU Wget                            WGET(1)

NAME
       Wget - The non-interactive network downloader.

SYNOPSIS
       wget [option]... [URL]...

DESCRIPTION
       GNU Wget is a free utility for non-interactive download of files from the Web.  It supports HTTP,
       HTTPS, and FTP protocols, as well as retrieval through HTTP proxies.

       Wget is non-interactive, meaning that it can work in the background, while the user is not logged on.
       This allows you to start a retrieval and disconnect from the system, letting Wget finish the work.
       By contrast, most of the Web browsers require constant userâs presence, which can be a great
       hindrance when transferring a lot of data.

       Wget can follow links in HTML, XHTML, and CSS pages, to create local versions of remote web sites,
       fully recreating the directory structure of the original site.  This is sometimes referred to as
       "recursive downloading."  While doing that, Wget respects the Robot Exclusion Standard (/robots.txt).
       Wget can be instructed to convert the links in downloaded files to point at the local files, for
       offline viewing.

5. What is nslookup, dig, host ?
nslookup, dig and host are part of the bind utilities.These utilities are the basic tools for DNS client and DNS server troubleshooting.

Examples :

[root@rhel62 ~]# nslookup
> set type=mx
> ehowstuff.com
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
ehowstuff.com   mail exchanger = 0 ehowstuff.com.

Authoritative answers can be found from:
>
[root@rhel62 ~]# dig ehowstuff.com

; < <>> DiG 9.7.3-P3-RedHat-9.7.3-8.P3.el6 < <>> ehowstuff.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<
[root@rhel62 ~]# host -t mx ehowstuff.com
ehowstuff.com mail is handled by 0 ehowstuff.com.

How to install wget, scpt, telnet, man, nslookup, dig and host utilities ?

Simply run the following commands :

[root@rhel62 ~]# yum install wget telnet openssh-clients bind-utils man -y

How to Install Red Hat Enterprise Linux 6.2 (RHEL 6.2)

Red Hat Enterprise Linux 6 (RHEL 6) is a Linux-based operating system developed by Red Hat that offers greatly enhanced scalability and well equipped operating system to handle future technological advances. In this post, i will shows the steps to install Red Hat Enterprise Linux 6.2 (RHEL 6.2).

1. Download a copy of the Red Hat iso.dvd and burn the iso.dvd file to a DVD using an image burning program.
2. Boot to the installation DVD or CD and choose the first option “Install or Upgrade an existing system”.
3. If desired, your can begin testing the media before start the installation. However, this is optional. To continue with the installation choose “Skip”.
4. Click “Next”.
1
5. Select the language you’d like to use during the installation.
2
6. Select the keyboard type you using.
3
7. Choose “Basic Storage Devices” and click “Next“.
4
8. Click “Yes” discard any data.
5
9. Hostname information can be entered in the box if you have this information present. In this case, i have entered rhel62.ehowstuff.local. If you do not know your hostname, leave the default hostname “localhost.localdomain” alone. This information can be edited after the installation is complete. Click “Next“.
6
10. Select your time zone.
7
11. Enter a custom root password.
8
12. If you were prompted weak password, you can proceed and click “Use Anyway” if desired.
9
13. For users making a fresh install of Red Hat on their computer, select the ” Create Custom Layout” option and click, “Next“. Click check a box “Review and modify partitioning layout” to configure partitions manually.
10
14.  Select “Standard Partition“.
11
15. Assign Swap space.
12
16. Assign / and use ext4 as a file system. Select “Fill to Maximum allowable size” and click OK.
13
17. Click “Next” button if it’s OK all.
14
18. Click ‘Format’ if it’s OK all.
15
19. Click ‘Write Changes to Disk’ if it’s OK all.
16
20. Let’s the formatting process running.
17
21. Click ‘Next’ button with keeping default. If you set some parameters for bootloader, Configure it.
18
22.  Select ‘Minimal’ and go next.
19
23. Installation starts. This may take a few minutes.
20
24. Installation completed. Click “Reboot” button.
21
25. Now you can login to your RHEL6.2 system.
22

How to Setup MailWatch on CentOS 6.3

mailwatch logoMailWatch for MailScanner is a open source or free web-based front-end to Mailscanner that use to displays the inbound/outbound mail queue, spam, viruses and blocked content on each page header. MailWatch has been written in PHP, MySQL and JpGraph. By using Mailwatch, it allows you to delete, release or run sa-learn across any messages that was quarantined. This post describes how to setup MailWatch on CentOS 6.3 and assumed that you already installed MailScanner and postfix.

1. Install required php and mysql :

[root@mx1 ~]# yum install php mysql-server mysql php-gd php-mysql -y

2. Modify the php.ini :

[root@mx1 ~]# vim /etc/php.ini

PHP should have the following set in php.ini

 short_open_tag = On
 safe_mode = Off
 register_globals = Off
 magic_quotes_gpc = On
 magic_quotes_runtime = Off
 session.auto_start = 0

3. Download the latest version from mailwatch.sourceforge.net :

[root@mx1 ~]# wget http://sourceforge.net/projects/mailwatch/files/mailwatch/1.1.5.1/mailwatch-1.1.5.1.tar.gz

4. Extract downloaded mailwatch package :

[root@mx1 ~]# tar xzvf mailwatch-1.1.5.1.tar.gz

5. Start mysql service :

[root@mx1 ~]# service mysqld start
Initializing MySQL database:  WARNING: The host 'mx1.ehowstuff.local' could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h mx1.ehowstuff.local password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

                                                           [  OK  ]
Starting mysqld:                                           [  OK  ]

6. Enter extracted mailwatch-x.x directory :

[root@mx1 mailwatch-1.1.5.1]# ls
CHANGELOG   fix_quarantine_permissions  LICENSE  mailscanner               Remote_DB.txt  upgrade.php  USER_FILTERS
create.sql  INSTALL                     luser    MailScanner_perl_scripts  tools          UPGRADING
[root@mx1 mailwatch-1.1.5.1]# mysql -p < create.sql

7. Create the database and import create.sql. The following commands below should be run as the ‘root’ :

[root@mx1 mailwatch-1.1.5.1]# mysql -p < create.sql
Enter password:

8. Login to mysql as a root :

[root@mx1 mailwatch-1.1.5.1]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.67 Source distribution

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

9. Proceed to create a MySQL user and then set password and configure MailScanner for SQL logging :

mysql> GRANT ALL ON mailscanner.* TO mailwatch@localhost IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT FILE ON *.* TO mailwatch@localhost IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mailscanner        |
| mysql              |
| test               |
+--------------------+
4 rows in set (0.00 sec)

10. Edit MailWatch.pm and change the database values accordingly :

a. Enter to the perl_scripts’s folder :

[root@mx1 mailwatch-1.1.5.1]# cd MailScanner_perl_scripts
[root@mx1 MailScanner_perl_scripts]# pwd
/root/mailwatch-1.1.5.1/MailScanner_perl_scripts

b. Edit MailWatch.pm :

[root@mx1 MailScanner_perl_scripts]# vim MailWatch.pm

c.Modify this as necessary for your configuration

my($db_name) = 'mailscanner';
my($db_host) = 'localhost';
my($db_user) = 'mailwatch';
my($db_pass) = 'password';

11. Move MailWatch.pm to /usr/lib/MailScanner/MailScanner/CustomFunctions :

[root@mx1 MailScanner_perl_scripts]# cp MailWatch.pm /usr/lib/MailScanner/MailScanner/CustomFunctions

12. Create a MailWatch web user. This user will able to monitor the mailscanner through MailWatch web interface.

[root@mx1 ~]# mysql mailscanner -u mailwatch -p
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.1.67 Source distribution

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> INSERT INTO users SET username = 'admin', password = md5('password'), fullname = 'MAilwatch Administrator', type ='A';
Query OK, 1 row affected (0.00 sec)

13. Install & Configure MailWatch :
a. Enter to mailwatch directory :

[root@mx1 ~]# cd mailwatch-1.1.5.1

b. Move mailscanner folder for web root folder. For apache, default root folder is /var/www/html :

[root@mx1 mailwatch-1.1.5.1]# mv mailscanner /var/www/html/

c. Enter to mailscanner folder in web root directory :

[root@mx1 ~]# cd /var/www/html/mailscanner

d. Verify and check the permissions of /var/www/html/mailscanner/images and /var/www/html/images/cache. The permissions and ownerships should be as below :

[root@mx1 mailscanner]# chown root:apache images
[root@mx1 mailscanner]# chmod ug+rwx images
[root@mx1 mailscanner]# chown root:apache images/cache
[root@mx1 mailscanner]# chmod ug+rwx images/cache

14. Create conf.php by copying conf.php.example. Edit the values to any details as you created earlier :

a. Copy the conf.php :

[root@mx1 mailscanner]# cp conf.php.example conf.php

b. Open conf.php :

[root@mx1 mailscanner]# vim conf.php

c. Edit the details as below :

define('DB_TYPE', 'mysql');
define('DB_USER', 'mailwatch');
define('DB_PASS', 'password');
define('DB_HOST', 'localhost');
define('DB_NAME', 'mailscanner');

15. Before setup the mailscanner, make sure it’s Stopped. Run 3 to 4 times to ensure the mailscanner completely stop. The status will FAILED if mailscanner completely stop.

[root@mx1 ~]# service MailScanner stop
Shutting down MailScanner daemons:
         MailScanner:                                      [  OK  ]
         incoming postfix:                                 [  OK  ]
         outgoing postfix:                                 [  OK  ]
[root@mx1 ~]# service MailScanner stop
Shutting down MailScanner daemons:
         MailScanner:                                      [  OK  ]
         incoming postfix:                                 [  OK  ]
         outgoing postfix:                                 [  OK  ]
[root@mx1 ~]# service MailScanner stop
Shutting down MailScanner daemons:
         MailScanner:                                      [  OK  ]
         incoming postfix:                                 [  OK  ]
         outgoing postfix:                                 [  OK  ]
[root@mx1 ~]# service MailScanner stop
Shutting down MailScanner daemons:
         MailScanner:                                      [  OK  ]
         incoming postfix:                                 [  OK  ]
         outgoing postfix:                                 [  OK  ]
[root@mx1 ~]# service MailScanner stop
Shutting down MailScanner daemons:
         MailScanner:                                      [FAILED]
         incoming postfix:                                 [  OK  ]
         outgoing postfix:                                 [  OK  ]

16. Edit /etc/MailScanner/MailScanner.conf.

[root@mx1 ~]# vim /etc/MailScanner/MailScanner.conf

Make sure that the following options are set:

 Always Looked Up Last = &MailWatchLogging
 Detailed Spam Report = yes
 Quarantine Whole Message = yes
 Quarantine Whole Message As Queue Files = no
 Include Scores In SpamAssassin Report = yes
 Quarantine User = root
 Quarantine Group = apache (this should be the same group as your web server)
 Quarantine Permissions = 0660

17. Start MailScanner :

[root@mx1 ~]# service MailScanner start
Starting MailScanner daemons:
         incoming postfix:                                 [  OK  ]
         outgoing postfix:                                 [  OK  ]
         MailScanner:                                      [  OK  ]

18. Restart httpd service :

[root@mx1 ~]# service httpd restart

19. Make sure all the related service such as httpd, mysql and MailScanner configured to start at boot :

[root@mx1 ~]# chkconfig mysqld on
[root@mx1 ~]# chkconfig httpd on
[root@mx1 ~]# chkconfig MailScanner on
[root@mx1 ~]# chkconfig spamassassin on
[root@mx1 ~]# chkconfig postfix on

20. Check the mail log.

[root@mx1 ~]# tail -f /var/log/maillog

You should see something as below :

Mar  5 22:14:42 mx1 MailScanner[1718]: Using locktype = flock
Mar  5 22:14:43 mx1 MailScanner[1697]: Requeue: C297BA1C3F.AA850 to E7373A1DD6
Mar  5 22:14:43 mx1 postfix/qmgr[1687]: E7373A1DD6: from=<root@mx1.ehowstuff.local>, size=609, nrcpt=1 (queue active)
Mar  5 22:14:43 mx1 MailScanner[1697]: Uninfected: Delivered 1 messages
Mar  5 22:14:43 mx1 MailScanner[1697]: Deleted 1 messages from processing-database
Mar  5 22:14:43 mx1 MailScanner[1697]: Logging message C297BA1C3F.AA850 to SQL
Mar  5 22:14:43 mx1 postfix/local[1768]: E7373A1DD6: to=<root@mx1.ehowstuff.local>, orig_to=, relay=local, delay=166894, delays=166894/0.13/0/0.02, dsn=2.0.0, status=sent (delivered to mailbox)
Mar  5 22:14:43 mx1 postfix/qmgr[1687]: E7373A1DD6: removed
Mar  5 22:56:25 mx1 postfix/postfix-script[1869]: fatal: the Postfix mail system is already running
Mar  5 23:01:08 mx1 update.bad.phishing.sites: Delaying cron job up to 600 seconds

21. Login to mailwatch web interface :
1

2

How to Remove Volume Group and Physical Volume on LVM

icon-redhatlinuxBasically, adding and removing LVM will always involves these three logical “layers” which are Physical volumes (pv), Volume groups (vg) and Logical volumes (lv). This post assumed that the Logical volumes haven’t created. In certain situation, linux administrators are required to remove the existing Physical Volume or Volume Group only. It is possible to perform the required task if that system administrator has the right skill on linux. The steps as below :

1. Display the physical volumes and Volume Group using pvdisplay command :

[root@centos63 ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               vg_data
  PV Size               4.99 GiB / not usable 2.41 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              1278
  Free PE               1278
  Allocated PE          0
  PV UUID               qTmTeq-8qoL-xxEk-Dj5V-zOjl-vEag-P6Jl7L

2. Remove the Volume Group using vgremove command :

[root@centos63 ~]# vgremove vg_data
  Volume group "vg_data" successfully removed

3. Remove Physical Volume using pvremove command :

[root@centos63 ~]# pvremove /dev/sdb1
  Labels on physical volume "/dev/sdb1" successfully wiped

Additional Note :
How to Remove a Logical Volume on CentOS 6.3/RHEL6

Prerequisites Checking Before Install Zimbra Collaboration Suite 8 on CentOS 6.3

zimbraBefore you start installing Zimbra Collaboration Suite (ZCS) 8.0.1 or 8.0.2, there are a few prerequisites checking have to be performed. This is to ensure that the installation running smoothly without any interruption while saving your time to troubleshoot. I have installed Zimbra Collaboration Suite 8.0.1 and 8.0.2 on many CentOS 6.3 and i would like to share my experiences.

1. Make sure your target mail domain (e.g ehowstuff.local) has mx record on your DNS server.

[root@mail ~]# host -t mx ehowstuff.local
ehowstuff.local mail is handled by 0 ehowstuff.local.

2. Stop and disabled the following services :

[root@mail ~]# service iptables stop
[root@mail ~]# service ip6tables stop
[root@mail ~]# service sendmail stop
[root@mail ~]# service postfix stop

3. Disabled auto start the following services :

[root@mail ~]# chkconfig ip6tables off
[root@mail ~]# chkconfig iptables off
[root@mail ~]# chkconfig sendmail off
[root@mail ~]# chkconfig postfix off

4. Disabled Selinux :

[root@mail ~]# setenforce 0
[root@mail ~]# vi /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

5. Make sure the following dependencies software has been installed :

[root@mail ~]# yum install perl nc sudo sysstat -y

How to Setup and Configure Openfiler iSCSI Storage on VMware

This post describes on how to setup and configure hosted Openfiler iSCSI storage target on a VMware ESX/ESXi or VMware server 1.x or 2.x host using the freely available Openfiler appliance. However this configuration and setting not a suitable solution for a production environment as it does not include any iSCSI CHAP authentication or datastore multipathing. But it’s good for troubleshooting and learning. Openfiler is an Open Source Network Attached Storage and Storage Area Network Solution.

Pre-Requisites :

  • a. VMware ESX/ESXi/Server 2.0/Vmware workstations/VMware player as a host with a minimum of 5GB of free space on the local datastore.
  • b.Addional Space for extra logical volume on Openfiler iSCSI Storage (e.g dev/sdb)
  • c.Openfiler appliance source file. (e.g openfiler-2.3-x86_64.vmware.tar.gz) You may download at this URL :
    http://www.openfiler.com/community/download/
  • Disk /dev/sdb (30GB) has been added as below :
[root@storage01 ~]# fdisk -l

Disk /dev/sda: 2355 MB, 2355978240 bytes
16 heads, 63 sectors/track, 4565 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        4565     2300696   83  Linux

Disk /dev/sdb: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        3917    31457279+  ee  EFI GPT

TCP/IP Configuration :

The procedure detailed below is based on the following configuration. Openfiler appliance assigned the hostname and TCP/IP configuration details:

HOSTNAME=storage01
IPADDR=192.168.1.56
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
nameserver 202.188.0.133
nameserver 202.188.1.5

Steps and Procedure on How to Setup and Configure Openfiler iSCSI Storage :

1. Extract the contents of the downloaded Openfiler tar.gz file (one .vmx file and two .vmdk files) into a directory, the name of which reflects the hostname you wish to use for the Openfiler appliance (example: storage01).

2. Login to ESXi/ESX/VMware Server/Vmware Workstation console, add extracted Openfiler tar.gz file to inventory.

3. Skipped this step on VMware Server 1.x, VMware Server 2.x and VMware Workstation. In ESXi/ESX server edit the Openfiler appliance settings and add a second disk of the size determined.(example: 30GB).

4. Modify the vCPU and Memory setting to meet your requirement.

5. Power on the Openfiler appliance. By default, the Openfiler appliance will attempt to obtain an IP address via DHCP, but best practice is to assign a static Ip address and this such configuration is typically done via the Openfiler web interface. On the Screen capture, hostname and static ip address has been assigned as below :

HOSTNAME=storage01
IPADDR=192.168.1.56

openfiler1

6. Logon to the console as root. By default, no root password is set so you will not be prompted. Set a root password by entering the command passwd, pressing Enter and following the prompts.

Note: A password must be set in order to permit a remote root login from a SSH client.

[root@dhcp01 ~]# passwd
Changing password for user root.
New UNIX password:

7. Browse to https:/DHCP_IP_Address:446, or to the IP address if not using DNS, and ignore the certificate warning. Logon to the Openfiler web interface with the default administrator. Username openfiler and default Password password.

Note: The default administrative port number is 446.

openfiler2

8. To Change to static IP, Select the System tab then scroll down to the “Network Interface Configuration” click “Configure“. On the Network Interface Configuration”, change default Boot Protocol, DHCP to Static for eth0. Then Enter the IP Address, Netmask and leave default for MTU.

openfiler3

9. To configure network range allowed, select the System tab and scroll down to the “Network Access Configuration” section. Define the allowed networks that accept connections from Openfiler appliance. You also can specify individual host IP addresses and ranges. Click Update after entering each set of details.

openfiler4

10. To add the the new logical disk select the Volumes tab and click the Block Devices link. Confirm the presence of disk /dev/sdb.

Please note that the isk /dev/sda is the disk that Openfiler is running on; /dev/sdb is the second disk that was added and that will be provisioned as iSCSI storage.

openfiler7

Click the /dev/sdb link and scroll down to the Create a partition in /dev/sdb section. By default, a partition will be created that fills the entire disk. Accept the defaults and click Create.

Openfiler8

11. To add volume Group,select the Volumes tab. Click the Volume Groups link and enter a Volume Group name “datagroup” (the name is not critical), select /dev/sdb1 (30GB) and click Add volume group.
openfiler9

12. To Create a volume in “datagroup“, select the Volumes tab. Click the Add Volume link. The only existing volume group of volumegroup (datagroup) will be selected by default. Scroll down to the Create a volume in “volumegroup” section. Enter a Volume Name of volume (the name is not critical), a Volume Description of vmware (the description is not critical), adjust the required Space slider up to the maximum, select a Filesystem/Volume type of iSCSI and click Create.
openfiler10

13. This steps is to enable iSCSI target and disable iSCSI initiator. Select the Services tab. Click the Enable link adjacent to iSCSI target server. Click the Disable link adjacent to iSCSI initiator.

openfiler11

14. To Add new iSCSI target, select the Volumes tab and click the iSCSI Targets link from the Volumes Section menu. Modify the auto-generated Target IQN to include the Openfiler name (iqn.2012.openfilerlab1.local in this example) and click Add.

openfile12

Then select the LUN Mapping sub-tab and click Map to map the previous defined volume as a LUN to the newly created iSCSI target (accepting all the defaults).

openfiler13

Finally, select the Network ACL sub-tab and change the Access from Deny to Allow. Click Update.

openfiler14

15. Congratulation!! Now the iSCSI target is accessible to any iSCSI requester on the permitted network/s or IP addresses.

How to Fix “-bash: man: command not found” on CentOS 6.3

centos6This quick post shows the step to install “man” command on Linux. In linux CentOS 6.2 and CentOS 6.3 operating system, “man” command has not been installed automatically. The Linux command “man” is used to display the manual page for other command and also will help you to explain the functions for the commands that commonly used. The term “man” is short for manual.

If you typed “man” command on the linux server that has not been installed with man command, you will get the following message :

[root@centos63 ~]# man tar
-bash: man: command not found

To install “man“, simply run this command :

[root@centos63 ~]# yum install man -y
Loaded plugins: fastestmirror, presto, priorities
Loading mirror speeds from cached hostfile
 * base: centos.ipserverone.com
 * extras: centos.ipserverone.com
 * updates: centos.ipserverone.com
base                                                                         | 3.7 kB     00:00
extras                                                                       | 3.0 kB     00:00
updates                                                                      | 3.5 kB     00:00
updates/primary_db                                                           | 2.3 MB     00:19
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package man.i686 0:1.6f-30.el6 will be installed
--> Processing Dependency: lzma for package: man-1.6f-30.el6.i686
--> Running transaction check
---> Package xz-lzma-compat.i686 0:4.999.9-0.3.beta.20091007git.el6 will be installed
--> Processing Dependency: xz = 4.999.9-0.3.beta.20091007git.el6 for package: xz-lzma-compat-4.999.9-0.3.beta.20091007git.el6.i686
--> Running transaction check
---> Package xz.i686 0:4.999.9-0.3.beta.20091007git.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                Arch         Version                                     Repository    Size
====================================================================================================
Installing:
 man                    i686         1.6f-30.el6                                 base         260 k
Installing for dependencies:
 xz                     i686         4.999.9-0.3.beta.20091007git.el6            base         137 k
 xz-lzma-compat         i686         4.999.9-0.3.beta.20091007git.el6            base          16 k

Transaction Summary
====================================================================================================
Install       3 Package(s)

Total download size: 413 k
Installed size: 864 k
Downloading Packages:
Setting up and reading Presto delta metadata
Processing delta metadata
Package(s) data still to download: 413 k
(1/3): man-1.6f-30.el6.i686.rpm                                              | 260 kB     00:01
(2/3): xz-4.999.9-0.3.beta.20091007git.el6.i686.rpm                          | 137 kB     00:00
(3/3): xz-lzma-compat-4.999.9-0.3.beta.20091007git.el6.i686.rpm              |  16 kB     00:00
----------------------------------------------------------------------------------------------------
Total                                                               138 kB/s | 413 kB     00:02
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : xz-4.999.9-0.3.beta.20091007git.el6.i686                                         1/3
  Installing : xz-lzma-compat-4.999.9-0.3.beta.20091007git.el6.i686                             2/3
  Installing : man-1.6f-30.el6.i686                                                             3/3
  Verifying  : xz-4.999.9-0.3.beta.20091007git.el6.i686                                         1/3
  Verifying  : man-1.6f-30.el6.i686                                                             2/3
  Verifying  : xz-lzma-compat-4.999.9-0.3.beta.20091007git.el6.i686                             3/3

Installed:
  man.i686 0:1.6f-30.el6

Dependency Installed:
  xz.i686 0:4.999.9-0.3.beta.20091007git.el6 xz-lzma-compat.i686 0:4.999.9-0.3.beta.20091007git.el6

Complete!

Once man command has been installed successfully, you will be able to read the manual pages :

[root@centos63 ~]# man tar
TAR(1)                           User Commands                          TAR(1)

NAME
       tar - manual page for tar 1.23

SYNOPSIS
       tar [OPTION...] [FILE]...

DESCRIPTION
       GNU  âtarâ  saves  many  files together into a single tape or disk archive, and can
       restore individual files from the archive.

EXAMPLES
       tar -cf archive.tar foo bar
              # Create archive.tar from files foo and bar.

       tar -tvf archive.tar
              # List all files in archive.tar verbosely.

       tar -xf archive.tar
              # Extract all files from archive.tar.

..
..

How to Get Kernel Version, Kernel Release, Processor type and Hardware Platform On Linux

This post show you the quick guide on how you can get the uname information for your linux server shell command. Sometimes it is required to quickly get and print kernel information.

1. Print help to view the basic syntax of the uname command :

[root@centos63 ~]# uname --help
Usage: uname [OPTION]...
Print certain system information.  With no OPTION, same as -s.

  -a, --all                print all information, in the following order,
                             except omit -p and -i if unknown:
  -s, --kernel-name        print the kernel name
  -n, --nodename           print the network node hostname
  -r, --kernel-release     print the kernel release
  -v, --kernel-version     print the kernel version
  -m, --machine            print the machine hardware name
  -p, --processor          print the processor type or "unknown"
  -i, --hardware-platform  print the hardware platform or "unknown"
  -o, --operating-system   print the operating system
      --help     display this help and exit
      --version  output version information and exit

Report uname bugs to bug-coreutils@gnu.org
GNU coreutils home page: 
General help using GNU software: 
For complete documentation, run: info coreutils 'uname invocation'

2. Print the kernel version :

uname -v

Examples :

[root@centos63 ~]# uname -v
#1 SMP Tue Jul 10 12:30:45 UTC 2012

3. Print the kernel release :

uname -r

Examples :

[root@centos63 ~]# uname -r
2.6.32-279.1.1.el6.i686

4. Print the processor type :

uname -p

Examples :

[root@centos63 ~]# uname -p
i686

5. Print the hardware platform :

uname -i

Examples :

[root@centos63 ~]# uname -i
i386

How to Install yum-priorities on CentOS 6.3

centos6The priorities plugin can be used to enforce ordered protection of repositories, by associating priorities to repositories. Theoretically, the repositories with the lowest numerical priority number have the highest priority. This is one of the method to prevents mistakes such as accidentally running yum upgrade with everything. This post cover the quick step to install yum-priorities on CentOS 6.3.

[root@centos63 ~]# yum install yum-priorities -y

Examples :

[root@centos63 ~]# yum install yum-priorities -y
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
 * base: centos.ipserverone.com
 * extras: centos.ipserverone.com
 * updates: centos.ipserverone.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package yum-plugin-priorities.noarch 0:1.1.30-14.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                          Arch              Version                   Repository       Size
====================================================================================================
Installing:
 yum-plugin-priorities            noarch            1.1.30-14.el6             base             22 k

Transaction Summary
====================================================================================================
Install       1 Package(s)

Total download size: 22 k
Installed size: 28 k
Downloading Packages:
Setting up and reading Presto delta metadata
Processing delta metadata
Package(s) data still to download: 22 k
yum-plugin-priorities-1.1.30-14.el6.noarch.rpm                               |  22 kB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : yum-plugin-priorities-1.1.30-14.el6.noarch                                       1/1
  Verifying  : yum-plugin-priorities-1.1.30-14.el6.noarch                                       1/1

Installed:
  yum-plugin-priorities.noarch 0:1.1.30-14.el6

Complete!

How to Setup Webmin 1.590-1 on CentOS 6.3 using RPM

webminWebmin is a web-based interface for system administration for Linux. By using webmin at the browser, you can setup user accounts, Apache, DNS, file sharing and much more. This post covers the steps to setup Webmin 1.590-1 on CentOS 6.3 using RPM.

1. Download Webmin :

[root@centos63 ~]# wget http://prdownloads.sourceforge.net/webadmin/webmin-1.590-1.noarch.rpm

Examples :

[root@centos63 ~]# wget http://prdownloads.sourceforge.net/webadmin/webmin-1.590-1.noarch.rpm
--2012-08-02 22:49:07--  http://prdownloads.sourceforge.net/webadmin/webmin-1.590-1.noarch.rpm
Resolving prdownloads.sourceforge.net... 216.34.181.59
Connecting to prdownloads.sourceforge.net|216.34.181.59|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://downloads.sourceforge.net/project/webadmin/webmin/1.590/webmin-1.590-1.noarch.rpm [following]
--2012-08-02 22:49:08--  http://downloads.sourceforge.net/project/webadmin/webmin/1.590/webmin-1.590-1.noarch.rpm
Resolving downloads.sourceforge.net... 216.34.181.59
Reusing existing connection to prdownloads.sourceforge.net:80.
HTTP request sent, awaiting response... 302 Found
Location: http://cdnetworks-kr-2.dl.sourceforge.net/project/webadmin/webmin/1.590/webmin-1.590-1.noarch.rpm [following]
--2012-08-02 22:49:08--  http://cdnetworks-kr-2.dl.sourceforge.net/project/webadmin/webmin/1.590/webmin-1.590-1.noarch.rpm
Resolving cdnetworks-kr-2.dl.sourceforge.net... 211.39.135.163
Connecting to cdnetworks-kr-2.dl.sourceforge.net|211.39.135.163|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 18926818 (18M) [application/x-rpm]
Saving to: âwebmin-1.590-1.noarch.rpmâ

100%[==========================================================>] 18,926,818  72.2K/s   in 6m 28s

2012-08-02 22:55:37 (47.7 KB/s) - âwebmin-1.590-1.noarch.rpmâ

2. Add the GPG Key :

[root@centos63 ~]# rpm --import http://www.webmin.com/jcameron-key.as

3. Install webmin :

[root@centos63 ~]# rpm -Uvh webmin-1.590-1.noarch.rpm
Preparing...                ########################################### [100%]
Operating system is CentOS Linux
   1:webmin                 ########################################### [100%]
Webmin install complete. You can now login to http://centos63.ehowstuff.local:10000/
as root with your root password.

4. Start webmin service and check webmin status :

[root@centos63 ~]# /etc/init.d/webmin start
[root@centos63 ~]# /etc/init.d/webmin status
Webmin (pid 2676) is running

5. Configure webmin service to start at boot :

[root@centos63 ~]# chkconfig webmin on

6. Login the webmin web interface :

http://youripaddress:10000