How to Disable IPv6 on Redhat / CentOS 6 / CentOS 7

This howto will show you how to disable ipv6 on RHEL 6/7, CentOS 6 and CentOS7.

IPv6 is enabled by default. In this article I summarize 3 configuration which needs to be changed to completely disable ipv6.

Check the configuration of the existing network with the “ifconfig” command. If inet6 appears in the configuration, means IPv6 is enabled.

Disable IPv6 on Redhat

Here are details on how to disable IPv6 on Redhat / CentOS 6 / CentOS 7 :

1. Update /etc/sysctl.conf :

Method 1 :

# vi /etc/sysctl.conf

Add the following :

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

Run the following command to take effect.

# sysctl -p

Disable IPv6 on Redhat

Method 2 :

To disable ipv6 in the running system :

# echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
# echo 1 > /proc/sys/net/ipv6/conf/default/disable_ipv6

or

# sysctl -w net.ipv6.conf.all.disable_ipv6=1
# sysctl -w net.ipv6.conf.default.disable_ipv6=1

2. Update config file in/etc/sysconfig/network-scripts/ifcfg-eth0 and /etc/sysconfig/network-scripts/ifcfg-ens160 :

For CentOS 6 :

# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:0C:29:C5:36:7C
TYPE=Ethernet
UUID=f9db89e6-013a-4403-8893-ae0536c6306f
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=192.168.0.9
NETMASK=255.255.255.0
IPV6INIT=no

For CentOS 7 :

# vi /etc/sysconfig/network-scripts/ifcfg-ens160
TYPE="Ethernet"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="no"
IPV6_AUTOCONF="no"
IPV6_DEFROUTE="no"
IPV6_FAILURE_FATAL="yes"
NAME="ens32"
UUID="ccfd7425-20ab-40c9-a141-b71828a1b8bf"
DEVICE="ens160"
ONBOOT="yes"
IPADDR="192.168.0.100"
PREFIX="24"
GATEWAY="192.168.0.1"
DNS1="8.8.8.8"
DOMAIN="ehowstuff.local"
IPV6_PEERDNS="no"
IPV6_PEERROUTES="no"
IPV6_PRIVACY="no"

Disable IPv6 on Redhat

3. Edit /etc/sysconfig/network file and add “no” to NETWORKING_IPV6.

# vi /etc/sysconfig/network
NETWORKING_IPV6=no

Disable IPv6 on Redhat

I would advise you to restart network configuration as below :

For CentOS 6 :

# service network restart

For CentOS 7 :

# systemctl restart network

Source : https://wiki.centos.org/FAQ/CentOS6

How to Configure FTP Server in Linux RHEL 6

In this post i will show how to install Very Secure FTP (Vsftpd) and how to configure ftp server in linux Red Hat Enterprise Linux 6 (RHEL 6). Vsftpd is a GPL licensed FTP server for UNIX systems, including Linux. It is secure and extremely fast and it is stable.

As an example I will install and configure the vsftpd server and will also transfer files from the clients running on the Windows XP command prompt.

-A linux server with ip address 192.168.1.43 running on RHEL 6 Operating system
-A window client with ip address 192.168.1.52 running on Windows XP Pro
-RHEL 6 server Running portmap/rpcbind and xinetd services
-Firewall and SElinux should be off on server

how to configure ftp server in linux

How to Install FTP Server in Linux ?

1. Install vsftpd, rpcbind and xinetd service using the following command :

# yum install vsftpd rpcbind xinetd -y

2. Check vsftpd, xinetd and rpcbind/portmap exist and installed on the server :

# rpm -qa vsftpd
vsftpd-2.2.2-6.el6.i686

# rpm -qa xinetd
xinetd-2.3.14-29.el6.i686

# rpm -qa rpcbind
rpcbind-0.2.0-8.el6.i686

3. Make all these services auto start at boot :

# chkconfig vsftpd on
# chkconfig xinetd on
# chkconfig rpcbind on

4. Check the xinetd and rpcbind status :

# service xinetd status
xinetd (pid  1326) is running...

# service rpcbind status
rpcbind (pid  1178) is running...

5. Create the a new user named ftpuser and set password :

# useradd ftpuser
# passwd ftpuser
Changing password for user ftpuser.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

6. Login as ftpuser on other terminal and create a new files named “files”.

# su - ftpuser
[ftpuser@rhel6 ~]$ cat > files
This is file created on RHEL 6 ftp server

7. Start the vsftpd service :

# service vsftpd start
Starting vsftpd for vsftpd:                                [  OK  ]

8. Stop the iptables linux firewall and disabled selinux :

# service ip6tables stop
ip6tables: Flushing firewall rules:                        [  OK  ]
ip6tables: Setting chains to policy ACCEPT: filter         [  OK  ]
ip6tables: Unloading modules:                              [  OK  ]

# service iptables stop
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]
# setenforce 0
setenforce: SELinux is disabled

How to Configure FTP Server in Linux ?

9. It’s good to make backup of your original configuration file.

[root@rhel6 ~]# cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf-bak

10. login from user account and download the files :

D:\>ftp 192.168.1.43
Connected to 192.168.1.43.
220 (vsFTPd 2.2.2)
User (192.168.1.43:(none)): ftpuser
331 Please specify the password.
Password:
230 Login successful.
ftp> get files
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for files (42 bytes).
226 Transfer complete.
ftp: 42 bytes received in 0.00Seconds 42000.00Kbytes/sec.
ftp> quit
221 Goodbye.

11. Check the contain of downloaded files :

D:\>type files
This is file created on RHEL 6 ftp server

12. By default root account is not allowed to login the vsftpd server as it’s exist in /etc/vsftpd/ftpusers.

D:\>ftp 192.168.1.43
Connected to 192.168.1.43.
220 (vsFTPd 2.2.2)
User (192.168.1.43:(none)): root
530 Permission denied.
Login failed.
ftp>

13. Open /etc/vsftpd/ftpusers file. Remove or comment out the line for user “root” and add “ftpuser” instead. Users whose name are set in this file will not allowed to login from ftp.

[root@rhel6 ~]# vi /etc/vsftpd/ftpusers
# Users that are not allowed to login via ftp
#root
ftpuser
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
nobody

14. Open /etc/vsftpd/user_list file. Remove or comment out entry in /etc/vsftpd/user_list files. Remove or comment out the line for user “root” and add “ftpuser” instead. Users whose names are set in this file are also not allowed to login from ftp even they are not prompt for password.

# vi /etc/vsftpd/user_list
# vsftpd userlist
# If userlist_deny=NO, only allow users in this file
# If userlist_deny=YES (default), never allow users in this file, and
# do not even prompt for a password.
# Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers
# for users that are denied.
#root
ftpuser
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
nobody

15. Root now allowed to access ftp server :

D:\>ftp 192.168.1.43
Connected to 192.168.1.43.
220 (vsFTPd 2.2.2)
User (192.168.1.43:(none)): root
331 Please specify the password.
Password:
230 Login successful.
ftp> quit
221 Goodbye.

16. ftpuser now not allowed to access ftp server :

D:\>ftp 192.168.1.43
Connected to 192.168.1.43.
220 (vsFTPd 2.2.2)
User (192.168.1.43:(none)): ftpuser
530 Permission denied.
Login failed.
ftp>

17. How to set login banner for ftp server :
Open /etc/vsftpd/vsftpd.conf look for “ftpd_banner” :

# vi /etc/vsftpd/vsftpd.conf

Uncomment ftpd_banner and customize the login banner string as below :

# You may fully customise the login banner string:
ftpd_banner=Welcome to eHowStuff.com RHEL6 FTP server
#

18 Restart the ftp service :

# service vsftpd restart
Shutting down vsftpd:                                      [  OK  ]
Starting vsftpd for vsftpd:                                [  OK  ]

19. Try login to ftp server. Check the banner, it will appear before user login as below :

D:\>ftp 192.168.1.43
Connected to 192.168.1.43.
220 Welcome to eHowStuff.com RHEL6 FTP server
User (192.168.1.43:(none)):

If you encounter any issues on how to configure ftp server in linux, you can put a few questions in the comments below.

How to Install Linux FTP Server using Vsftpd

Vsftpd stands for Very Secure FTP Daemon. Vsftpd is not just another popular Unix / Linux FTP Server, but vsftpd delivering outstanding performance by taking less memory. It is running under xinetd and allows you run one process less because xinetd is shared among various other small services. For those webmasters or blogger who intend to run web server on Virtual Private Server (VPS) or Dedicated Server, Vsftpd would be the best choice. It is easy to install and can perform all that we expect from an FTP daemon while maintaining a higher level of security if configured properly. This article focuses on and covers the installation and configuration of the FTP server Vsftpd on CentOS Linux VPS.

1. Installing Linux FTP Server, vsftpd using yum command :

# yum install vsftpd -y

2. Makesure that xinetd has been installed :

# rpm -qa xinetd

If not installed, execute the following command :

# yum install xinetd -y

3. Make xinetd and Vsftpd daemon start at boot :

# chkconfig vsftpd on
# chkconfig xinetd on

4. It is recommended to do backup of your original configuration file, before do changes :

# cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf-bak

5. Configure Vsftpd :

# vi /etc/vsftpd/vsftpd.conf

a) Uncomment ftpd_banner and customize the login banner string as below :

# You may fully customise the login banner string:
ftpd_banner=Welcome to Linux FTP service.
#

b) This step is to configure not allowed users. By default root account is not allowed to login the vsftpd server as it’s existed on /etc/vsftpd/ftpusers. To allow it, open /etc/vsftpd/ftpusers files and remove or comment on the line of a user “root”. Users whose name are set in this file will not allow to login from ftp.

# cat /etc/vsftpd/ftpusers
# Users that are not allowed to login via ftp
root
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
nobody

6. Test root login from windows command prompt at client PC using user, ehowstuff :

C:\>ftp 192.168.2.54
Connected to 192.168.2.54.
220 Welcome to Linux CentOS FTP service.
User (192.168.2.54:(none)): ehowstuff
331 Please specify the password.
Password:
230 Login successful.
ftp>

If you encounter any issues when setting up linux ftp server, you can put a few questions in the comments below.

linux ftp server

Credit : www.unixmen.com

 

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 NetHogs – Monitor Bandwidth Usage Per Process in Linux

NetHogs is a opensource tools to monitor network bandwidth that was used by the process and program in linux operating system. NetHogs does not rely on a special kernel module to be loaded. When you hit the high network traffic issue on your linux server, you can immediately find which PID is causing the issue. NetHogs will give you real time statistics of your network bandwidth of per process usage. Follow this steps to install NetHogs on linux CentOS 6.5 and the sample nethogs usage.

1. Prepare additional repository (EPEL repository).

2. Install nethogs :

[root@oss ~]# yum install nethogs -y

3. NetHogs utility :

[root@oss ~]# nethogs

Sample output :
setup nethogs -1

4. NetHogs command option :
There are a few commad options when using nethogs. Using ‘-d‘ to add a refresh rate. As an example, to set 5 seconds as your refresh rate, then type the command as.

[root@oss ~]# nethogs -d 5

Other options :

-d     delay for refresh rate.
-h     display available commands usage.
-p     sniff in promiscious mode (not recommended).
-t     tracemode.
-V     prints Version info.

5. Monitor specific device (eth0 or eth1) network bandwidth only :

a) Monitor eth0 bandwidth :

[root@oss ~]# nethogs eth0

a) Monitor eth0 and eth1 bandwidth :

[root@oss ~]# nethogs eth0 eth1

Reference :

How to Setup psacct or acct – Monitor User Activity in Linux

It is very important to know what are the activities for applications and users in linux operating system. This will very useful in later time or in case of problems. For this purpose, i would recommend psacct or acct tools to be install. psacct or acct is a free monitoring program to monitor users and applications activity on linux server. This program will display how long user accessing the server, what command are they issuing, how many processes and display logs for commands. psacct and acct are similar tool, psacct is for RPM based linux but acct is for Debian based.

1. If you are runninng Linux CentOS or Redhat, you should use the following command to install pssacct :

[root@oss ~]# yum install psacct -y

But if you are running debian such as Ubuntu, you should install acct package instead of psacct :

[root@oss ~]# sudo apt-get install acct

2. By default psacct is disabled on Linux. We should manually start it :

[root@oss ~]# /etc/init.d/psacct status
Process accounting is disabled.
[root@oss ~]# /etc/init.d/psacct start
Starting process accounting:                               [  OK  ]

Start acct on Debian :

[root@oss ~]# sudo service acct start

3. The psacct or acct package provides several features for monitoring process activities.

Other usage from that come in psacct or acct package :

ac command prints the statistics of user logins/logouts (connect time) in hours.
lastcomm command prints the information of previously executed commands of user.
accton commands is used to turn on/off process for accounting.
sa command summarizes information of previously executed commands.
last and lastb commands show listing of last logged in users.

4. Total Connect Time :

[root@oss ~]# ac
        total      103.61

5. Display the statistics for total login time :

[root@oss ~]# ac -d
Dec  7  total        4.15
Dec  8  total        0.01
Jul 18  total        0.01
Aug  5  total       13.19
Aug  7  total       39.29
Aug 10  total        3.33
Aug 11  total        6.41
Aug 12  total        1.84
Aug 13  total        0.22
Aug 16  total        3.30
Aug 17  total       16.56
Aug 18  total        1.99
Aug 19  total        2.77
Today   total       10.55

6. Total login statistics of each user :

[root@oss ~]# ac -p
        ehowstuff                            0.76
        root                               103.00
        total      103.76

7. Print the summary of commands that were executed by users :

[root@oss ~]# sa
     135   12652.06re       0.00cp    11052k
      12       3.32re       0.00cp    23715k   ***other*
       2       2.78re       0.00cp    27072k   bash
       2       0.00re       0.00cp    26576k   service
       2   12645.72re       0.00cp        0k   flush-8:0*
      29       0.00re       0.00cp     1018k   ac
      23       0.00re       0.00cp    10197k   bash*
      10       0.00re       0.00cp     9709k   id
       6       0.01re       0.00cp    29328k   crond*
       6       0.00re       0.00cp    25232k   basename
       6       0.00re       0.00cp     1642k   lastcomm
       5       0.01re       0.00cp    25248k   sadc
       5       0.00re       0.00cp      981k   consoletype
       3       0.00re       0.00cp     2076k   hostname
       3       0.00re       0.00cp     1595k   grep
       3       0.00re       0.00cp     1561k   tput
       3       0.00re       0.00cp     1020k   dircolors
       3       0.00re       0.00cp     1017k   tty
       2       0.15re       0.00cp    16992k   sshd*
       2       0.09re       0.00cp    25232k   tail
       2       0.00re       0.00cp    28928k   ls
       2       0.00re       0.00cp    26512k   service*
       2       0.00re       0.00cp    25216k   logger
       2       0.00re       0.00cp     1545k   sa

8. Prints the number of processes and the number of CPU minutes :

[root@oss ~]# sa -m
                                      136   12652.06re       0.00cp    10978k
root                                   94   12650.94re       0.00cp    12223k
ehowstuff                              40       0.97re       0.00cp     7752k
sshd                                    2       0.15re       0.00cp    16992k

9. Use command sa -u to display individual users activity :

[root@oss ~]# sa -u
root       0.00 cpu      981k mem accton
root       0.00 cpu    26288k mem touch
root       0.01 cpu    26576k mem psacct
root       0.00 cpu     1018k mem ac
root       0.00 cpu     1018k mem ac
root       0.00 cpu     1018k mem ac
root       0.00 cpu     1018k mem ac
root       0.00 cpu     1018k mem ac
root       0.00 cpu     1018k mem ac
root       0.00 cpu     1018k mem ac
root       0.00 cpu     1018k mem ac
root       0.00 cpu     1018k mem ac
sshd       0.00 cpu    16992k mem sshd             *
root       0.00 cpu     2604k mem id
root       0.00 cpu     2826k mem bash             *
root       0.00 cpu     2076k mem hostname
root       0.00 cpu     2826k mem bash             *
root       0.00 cpu     1017k mem tty
root       0.00 cpu     1561k mem tput
root       0.00 cpu     2826k mem bash             *
root       0.00 cpu     1020k mem dircolors
root       0.00 cpu     2826k mem bash             *
root       0.00 cpu     1595k mem grep
root       0.00 cpu      981k mem consoletype
root       0.00 cpu    27040k mem bash             *
root       0.00 cpu    26288k mem id
root       0.00 cpu    27040k mem bash             *
ehowstuf   0.00 cpu     2604k mem id
ehowstuf   0.00 cpu     2826k mem bash             *
ehowstuf   0.00 cpu     2076k mem hostname
ehowstuf   0.00 cpu     2826k mem bash             *
ehowstuf   0.00 cpu     2604k mem id
ehowstuf   0.00 cpu     2826k mem bash             *
ehowstuf   0.00 cpu     2604k mem id

10. Printing sort by percentage

The command sa -c will show you the highest percentage of users:

[root@oss ~]# sa -c
     233  100.00%   12652.90re  100.00%       0.00cp  100.00%    16512k
      22    9.44%       3.32re    0.03%       0.00cp   44.44%    19491k   ***other*
       2    0.86%       2.78re    0.02%       0.00cp   22.22%    27072k   bash
       3    1.29%   12646.53re   99.95%       0.00cp   11.11%        0k   flush-8:0*
       2    0.86%       0.00re    0.00%       0.00cp   11.11%    26576k   service
       8    3.43%       0.01re    0.00%       0.00cp    5.56%    25248k   sadc
       2    0.86%       0.00re    0.00%       0.00cp    5.56%    26512k   run-parts
      30   12.88%       0.00re    0.00%       0.00cp    0.00%    26512k   sh
      29   12.45%       0.00re    0.00%       0.00cp    0.00%     1018k   ac
      23    9.87%       0.00re    0.00%       0.00cp    0.00%    10197k   bash*
      17    7.30%       0.00re    0.00%       0.00cp    0.00%    25232k   cat
      12    5.15%       0.02re    0.00%       0.00cp    0.00%    29328k   crond*
      10    4.29%       0.00re    0.00%       0.00cp    0.00%     9709k   id
       8    3.43%       0.00re    0.00%       0.00cp    0.00%    25232k   basename
       7    3.00%       0.00re    0.00%       0.00cp    0.00%    29079k   ls
       6    2.58%       0.00re    0.00%       0.00cp    0.00%     1642k   lastcomm
       6    2.58%       0.00re    0.00%       0.00cp    0.00%     1457k   sa
       5    2.15%       0.00re    0.00%       0.00cp    0.00%      981k   consoletype
       4    1.72%       0.00re    0.00%       0.00cp    0.00%    28064k   find
       4    1.72%       0.00re    0.00%       0.00cp    0.00%    25216k   logger
       3    1.29%       0.00re    0.00%       0.00cp    0.00%    26512k   sh*
       3    1.29%       0.00re    0.00%       0.00cp    0.00%    26304k   date
       3    1.29%       0.00re    0.00%       0.00cp    0.00%     2076k   hostname
       3    1.29%       0.00re    0.00%       0.00cp    0.00%     1595k   grep
       3    1.29%       0.00re    0.00%       0.00cp    0.00%     1561k   tput
       3    1.29%       0.00re    0.00%       0.00cp    0.00%     1020k   dircolors
       3    1.29%       0.00re    0.00%       0.00cp    0.00%     1017k   tty
       2    0.86%       0.15re    0.00%       0.00cp    0.00%    16992k   sshd*
       2    0.86%       0.09re    0.00%       0.00cp    0.00%    25232k   tail
       2    0.86%       0.00re    0.00%       0.00cp    0.00%    26512k   0anacron
       2    0.86%       0.00re    0.00%       0.00cp    0.00%    26480k   awk
       2    0.86%       0.00re    0.00%       0.00cp    0.00%    26512k   service*
       2    0.86%       0.00re    0.00%       0.00cp    0.00%    26512k   run-parts*

11. Display last executed commands :
[root@oss ~]# lastcomm
sa                      root     pts/0      0.00 secs Thu Aug 21 00:16
sa                      ehowstuf pts/2      0.00 secs Thu Aug 21 00:14
sa                      root     pts/0      0.00 secs Thu Aug 21 00:12
crond             SF    root     __         0.00 secs Thu Aug 21 00:10
sadc              S     root     __         0.00 secs Thu Aug 21 00:10
anacron            F    root     __         0.00 secs Thu Aug 21 00:01
crond             SF    root     __         0.00 secs Thu Aug 21 00:01
run-parts               root     __         0.01 secs Thu Aug 21 00:01
logger                  root     __         0.00 secs Thu Aug 21 00:01
basename                root     __         0.00 secs Thu Aug 21 00:01
awk                     root     __         0.00 secs Thu Aug 21 00:01
0anacron                root     __         0.00 secs Thu Aug 21 00:01
anacron                 root     __         0.00 secs Thu Aug 21 00:01
date                    root     __         0.00 secs Thu Aug 21 00:01
cat                     root     __         0.00 secs Thu Aug 21 00:01
logger                  root     __         0.00 secs Thu Aug 21 00:01
basename                root     __         0.00 secs Thu Aug 21 00:01
run-parts          F    root     __         0.00 secs Thu Aug 21 00:01
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
getconf                 nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
uptime                  nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
netstat                 nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
mount                   nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
df                      nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
ifconfig                nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
ls                      nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
ls                      nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
ls                      nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
ls                      nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
ls                      nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
sh                 F    nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
fdisk                   nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
sh                 F    nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
crond             SF    nobody   __         0.00 secs Thu Aug 21 00:00
nmon                    nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
sh                 F    nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
xargs                   nobody   __         0.00 secs Thu Aug 21 00:00
rm                      nobody   __         0.00 secs Thu Aug 21 00:00
find                    nobody   __         0.00 secs Thu Aug 21 00:00
crond             SF    root     __         0.00 secs Thu Aug 21 00:00
sadc              S     root     __         0.00 secs Thu Aug 21 00:00
pkill                   nobody   __         0.00 secs Thu Aug 21 00:00
flush-8:0          F    root     __         0.00 secs Wed Aug 20 23:25
crond             SF    root     __         0.00 secs Wed Aug 20 23:53
sa2                     root     __         0.00 secs Wed Aug 20 23:53
rmdir                   root     __         0.00 secs Wed Aug 20 23:53
find                    root     __         0.00 secs Wed Aug 20 23:53
find                    root     __         0.00 secs Wed Aug 20 23:53
find                    root     __         0.00 secs Wed Aug 20 23:53
sar                     root     __         0.02 secs Wed Aug 20 23:53
date                    root     __         0.00 secs Wed Aug 20 23:53
crond             SF    root     __         0.00 secs Wed Aug 20 23:50
sadc              S     root     __         0.01 secs Wed Aug 20 23:50
sa                      root     pts/0      0.00 secs Wed Aug 20 23:47
sa                      root     pts/0      0.00 secs Wed Aug 20 23:45
ac                      root     pts/0      0.00 secs Wed Aug 20 23:44
lastcomm                root     pts/0      0.00 secs Wed Aug 20 23:43
ac                      root     pts/0      0.00 secs Wed Aug 20 23:41
ac                      root     pts/0      0.00 secs Wed Aug 20 23:40
crond             SF    root     __         0.00 secs Wed Aug 20 23:40
sadc              S     root     __         0.00 secs Wed Aug 20 23:40
service                 root     pts/0      0.01 secs Wed Aug 20 23:39
basename                root     pts/0      0.00 secs Wed Aug 20 23:39
basename                root     pts/0      0.00 secs Wed Aug 20 23:39
service            F    root     pts/0      0.00 secs Wed Aug 20 23:39
consoletype             root     pts/0      0.00 secs Wed Aug 20 23:39
service                 root     pts/0      0.01 secs Wed Aug 20 23:39
basename                root     pts/0      0.00 secs Wed Aug 20 23:39
basename                root     pts/0      0.00 secs Wed Aug 20 23:39
service            F    root     pts/0      0.00 secs Wed Aug 20 23:39
consoletype             root     pts/0      0.00 secs Wed Aug 20 23:39
tail                  X root     pts/0      0.00 secs Wed Aug 20 23:39
bash               F    root     pts/0      0.00 secs Wed Aug 20 23:39
ls                      root     pts/0      0.00 secs Wed Aug 20 23:39
lastcomm                root     pts/0      0.00 secs Wed Aug 20 23:39
crond             SF    root     __         0.00 secs Wed Aug 20 23:30
sadc              S     root     __         0.00 secs Wed Aug 20 23:30
lastcomm                root     pts/0      0.00 secs Wed Aug 20 23:27
lastcomm                root     pts/0      0.00 secs Wed Aug 20 23:26
lastcomm                root     pts/0      0.00 secs Wed Aug 20 23:26
flush-8:0          F    root     __         0.00 secs Wed Aug 20 23:19
crond             SF    root     __         0.00 secs Wed Aug 20 23:20
sadc              S     root     __         0.00 secs Wed Aug 20 23:20
flush-8:0          F    root     __         0.02 secs Wed Aug 20 22:50
sa                      root     pts/0      0.00 secs Wed Aug 20 23:13
sa                      root     pts/0      0.00 secs Wed Aug 20 23:13
lastcomm                root     pts/0      0.00 secs Wed Aug 20 23:13
crond             SF    root     __         0.00 secs Wed Aug 20 23:10
sadc              S     root     __         0.00 secs Wed Aug 20 23:10
ac                      root     pts/0      0.00 secs Wed Aug 20 23:06
crond             SF    root     __         0.00 secs Wed Aug 20 23:01
run-parts               root     __         0.00 secs Wed Aug 20 23:01
logger                  root     __         0.00 secs Wed Aug 20 23:01
basename                root     __         0.00 secs Wed Aug 20 23:01
awk                     root     __         0.00 secs Wed Aug 20 23:01
0anacron                root     __         0.00 secs Wed Aug 20 23:01
date                    root     __         0.00 secs Wed Aug 20 23:01
cat                     root     __         0.00 secs Wed Aug 20 23:01
logger                  root     __         0.00 secs Wed Aug 20 23:01
basename                root     __         0.00 secs Wed Aug 20 23:01
run-parts          F    root     __         0.00 secs Wed Aug 20 23:01
crond             SF    root     __         0.00 secs Wed Aug 20 23:00
sadc              S     root     __         0.00 secs Wed Aug 20 23:00
ac                      root     pts/0      0.00 secs Wed Aug 20 22:59
ac                      root     pts/0      0.00 secs Wed Aug 20 22:59
ac                      root     pts/0      0.00 secs Wed Aug 20 22:59
sshd              S     root     __         0.05 secs Wed Aug 20 22:57
bash              S     root     pts/1      0.01 secs Wed Aug 20 22:57
su                S     root     pts/1      0.00 secs Wed Aug 20 22:57
bash              S     ehowstuf pts/1      0.03 secs Wed Aug 20 22:57
ac                      root     pts/0      0.00 secs Wed Aug 20 22:59
ac                      root     pts/0      0.00 secs Wed Aug 20 22:59
ac                      root     pts/0      0.00 secs Wed Aug 20 22:59
bash               F    ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
id                      ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
bash               F    ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
consoletype             ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
grep                    ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
bash               F    ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
dircolors               ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
bash               F    ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
tput                    ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
tty                     ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
bash               F    ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
id                      ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
bash               F    ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
id                      ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
bash               F    ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
hostname                ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
bash               F    ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
id                      ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
sshd              SF    sshd     __         0.00 secs Wed Aug 20 22:59
ac                      root     pts/0      0.00 secs Wed Aug 20 22:58
ac                      root     pts/0      0.00 secs Wed Aug 20 22:58
ac                      ehowstuf pts/1      0.00 secs Wed Aug 20 22:58
ac                      root     pts/0      0.00 secs Wed Aug 20 22:58
ac                      root     pts/0      0.00 secs Wed Aug 20 22:58
ac                      root     pts/0      0.00 secs Wed Aug 20 22:58
mkdir                   ehowstuf pts/1      0.00 secs Wed Aug 20 22:58
ls                      ehowstuf pts/1      0.00 secs Wed Aug 20 22:58
ac                      root     pts/0      0.00 secs Wed Aug 20 22:58
tail                  X root     pts/0      0.00 secs Wed Aug 20 22:58
ac                      root     pts/0      0.00 secs Wed Aug 20 22:58
ac                      root     pts/0      0.00 secs Wed Aug 20 22:58
ac                      root     pts/0      0.00 secs Wed Aug 20 22:58
bash               F    ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
id                      ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
bash               F    ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
consoletype             ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
grep                    ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
bash               F    ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
dircolors               ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
bash               F    ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
tput                    ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
tty                     ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
bash               F    ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
id                      ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
bash               F    ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
id                      ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
bash               F    ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
hostname                ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
bash               F    ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
id                      ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
bash               F    root     pts/1      0.00 secs Wed Aug 20 22:57
id                      root     pts/1      0.00 secs Wed Aug 20 22:57
bash               F    root     pts/1      0.00 secs Wed Aug 20 22:57
consoletype             root     pts/1      0.00 secs Wed Aug 20 22:57
grep                    root     pts/1      0.00 secs Wed Aug 20 22:57
bash               F    root     pts/1      0.00 secs Wed Aug 20 22:57
dircolors               root     pts/1      0.00 secs Wed Aug 20 22:57
bash               F    root     pts/1      0.00 secs Wed Aug 20 22:57
tput                    root     pts/1      0.00 secs Wed Aug 20 22:57
tty                     root     pts/1      0.00 secs Wed Aug 20 22:57
bash               F    root     pts/1      0.00 secs Wed Aug 20 22:57
hostname                root     pts/1      0.00 secs Wed Aug 20 22:57
bash               F    root     pts/1      0.00 secs Wed Aug 20 22:57
id                      root     pts/1      0.00 secs Wed Aug 20 22:57
sshd              SF    sshd     __         0.00 secs Wed Aug 20 22:57
ac                      root     pts/0      0.00 secs Wed Aug 20 22:57
ac                      root     pts/0      0.00 secs Wed Aug 20 22:57
ac                      root     pts/0      0.00 secs Wed Aug 20 22:57
ac                      root     pts/0      0.00 secs Wed Aug 20 22:57
ac                      root     pts/0      0.00 secs Wed Aug 20 22:57
ac                      root     pts/0      0.00 secs Wed Aug 20 22:57
ac                      root     pts/0      0.00 secs Wed Aug 20 22:56
ac                      root     pts/0      0.00 secs Wed Aug 20 22:56
ac                      root     pts/0      0.00 secs Wed Aug 20 22:56
psacct                  root     pts/0      0.01 secs Wed Aug 20 22:55
touch                   root     pts/0      0.00 secs Wed Aug 20 22:55
accton            S     root     pts/0      0.00 secs Wed Aug 20 22:55

12. Search Logs for Commands :

[root@oss ~]# lastcomm grep
grep                    ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
grep                    ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
grep                    root     pts/1      0.00 secs Wed Aug 20 22:57

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).

How to Check Linux System Reboot Date and Time

Question : How to check when was my linux system last rebooted and how long was the system running ?

Answer : The are several command to check last system rebooted.

1. Check last rebooted using “who -b” command :

[root@server ~]# who -b
         system boot  2014-08-16 09:34

2. Check last rebooted using “last reboot” command :

[root@server ~]# last reboot
reboot   system boot  2.6.32-431.el6.x Sat Aug 16 09:34 - 01:11  (15:36)
reboot   system boot  2.6.32-431.el6.x Tue Aug 12 19:39 - 00:13  (04:33)
reboot   system boot  2.6.32-431.el6.x Mon Aug 11 23:08 - 23:59  (00:50)
reboot   system boot  2.6.32-431.el6.x Tue Aug  5 11:47 - 05:41 (5+17:54)
reboot   system boot  2.6.32-431.el6.x Tue Aug  5 09:03 - 11:18  (02:15)
reboot   system boot  2.6.32-431.el6.x Tue Aug  5 08:58 - 09:03  (00:04)
reboot   system boot  2.6.32-431.el6.x Fri Jul 18 00:47 - 00:51  (00:04)
reboot   system boot  2.6.32-431.el6.x Sun Dec  8 11:22 - 11:23  (00:01)
reboot   system boot  2.6.32-431.el6.x Sun Dec  8 10:28 - 10:30  (00:01)
reboot   system boot  2.6.32-431.el6.x Sat Dec  7 21:54 - 22:40  (00:46)
reboot   system boot  2.6.32-431.el6.x Sat Dec  7 19:46 - 21:54  (02:08)

wtmp begins Sat Dec  7 19:46:12 2013

3. Check how long was the system running using “uptime” command :

[root@server ~]# uptime
 01:13:34 up 15:38,  1 user,  load average: 0.04, 0.08, 0.04

Use uptime command to deduce last reboot time. The uptime command will show the current time and how long the system was running.

How to Disable and Remove AppArmor on Ubuntu 14.04

remove AppArmor on UbuntuAppArmor is a Mandatory Access Control (MAC) and security extension that provides a variety of security policies for Linux kernel. It is an alternative application to SELinux and included with Ubuntu. Most of the time you don’t need it to configure a secure system, and it usually causes more problems because some service wasn’t working as expected. Below steps will show you how to disable and remove AppArmor on Ubuntu 14.04.

Steps to Disable and Remove AppArmor on Ubuntu

1. How to check AppArmor status :

ehowstuff@ubuntu14:~$ sudo apparmor_status
apparmor module is loaded.
4 profiles are loaded.
4 profiles are in enforce mode.
   /sbin/dhclient
   /usr/lib/NetworkManager/nm-dhcp-client.action
   /usr/lib/connman/scripts/dhclient-script
   /usr/sbin/tcpdump
0 profiles are in complain mode.
1 processes have profiles defined.
1 processes are in enforce mode.
   /sbin/dhclient (669)
0 processes are in complain mode.
0 processes are unconfined but have a profile defined.

2. Disable AppArmor and unload the kernel module by entering the following:

ehowstuff@ubuntu14:~$ sudo /etc/init.d/apparmor stop
ehowstuff@ubuntu14:~$ sudo update-rc.d -f apparmor remove

or

ehowstuff@ubuntu14:~$ sudo service apparmor stop
ehowstuff@ubuntu14:~$ sudo update-rc.d -f apparmor remove

3. Remove AppArmor software :

ehowstuff@ubuntu14:~$ sudo apt-get remove apparmor apparmor-utils -y

Example :

ehowstuff@ubuntu14:~$ sudo apt-get remove apparmor apparmor-utils -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  apparmor apparmor-utils
0 upgraded, 0 newly installed, 2 to remove and 119 not upgraded.
After this operation, 1,467 kB disk space will be freed.
(Reading database ... 93228 files and directories currently installed.)
Removing apparmor-utils (2.8.95~2430-0ubuntu5) ...
Removing apparmor (2.8.95~2430-0ubuntu5) ...
 * Clearing AppArmor profiles cache                                                          [ OK ]
All profile caches have been cleared, but no profiles have been unloaded.
Unloading profiles will leave already running processes permanently
unconfined, which can lead to unexpected situations.

To set a process to complain mode, use the command line tool
'aa-complain'. To really tear down all profiles, run the init script
with the 'teardown' option."
Processing triggers for man-db (2.6.7.1-1) ...

Note : this steps works on ubuntu 14.04 minimal installation without GUI.

Display Hard disk Infomation using hdparm

Hdparm is a free tool for linux to measure sequential disk performance which is primarily used to tune and optimize disk parameters or to set and view hard disk drive hardware parameters. It is working on SATA/ATA/IDE/SAS disk. The command below has been tested on CentOS 6.5 and running on VMware ESXi 4.1 virtual machine.

Install the hdparm :

[root@server ~]# yum install hdparm -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * Webmin: download.webmin.com
 * base: mirror.upsi.edu.my
 * epel: ftp.cuhk.edu.hk
 * extras: mirror.upsi.edu.my
 * updates: centos.mirror.secureax.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package hdparm.x86_64 0:9.43-4.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package               Arch                  Version                      Repository           Size
====================================================================================================
Installing:
 hdparm                x86_64                9.43-4.el6                   base                 81 k

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

Total download size: 81 k
Installed size: 150 k
Downloading Packages:
hdparm-9.43-4.el6.x86_64.rpm                                                 |  81 kB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : hdparm-9.43-4.el6.x86_64                                                         1/1
  Verifying  : hdparm-9.43-4.el6.x86_64                                                         1/1

Installed:
  hdparm.x86_64 0:9.43-4.el6

Complete!

To display the configuration of the hard disk :

[root@server ~]# hdparm /dev/sda

/dev/sda:
SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 multcount     =  0 (off)
 readonly      =  0 (off)
 readahead     = 256 (on)
 geometry      = 2871/255/63, sectors = 46137344, start = 0

To check the speed of the hard disk :

[root@server ~]# hdparm -Tt /dev/sda

/dev/sda:
 Timing cached reads:   2024 MB in  2.00 seconds = 1012.10 MB/sec
 Timing buffered disk reads: 534 MB in  3.00 seconds = 177.94 MB/sec

To measure how many MB/s your hard disk (SATA/IDE) can read :

[root@server ~]# hdparm -t --direct /dev/sda

/dev/sda:
 Timing O_DIRECT disk reads: 1122 MB in  3.00 seconds = 373.67 MB/sec

Ldapsearch Examples for 389 Directory

This post will show you the list of ldapsearch examples for 389 Directory. This ldapsearch examples assumes the following:

a)This ldapsearch is search for uid in the directory.
b)The 389 directory is configured to not support anonymous access, then the user “Directory Manager” and the password is required
c)This ldapsearch command has been run on the 389 server itself, so “localhost” for host is enough.
d)The server uses port number 389. Since this is the default port, the port number does not have to be sent in the search request.

-D binddn  bind DN
-b basedn  base dn for search
-h host    LDAP server
-w passwd  bind password (for simple authentication)
-W         prompt for bind password (Recommended to use this to hide password)
ldapsearch -h localhost -D "cn=Directory Manager" -W -b dc=ehowstuff,dc=local uid=user1

Example :

[root@ldapmaster-11 ~]# ldapsearch -h localhost -D "cn=Directory Manager" -W -b dc=ehowstuff,dc=local uid=user1
Enter LDAP Password:
# extended LDIF
#
# LDAPv3
# base  with scope subtree
# filter: uid=user1
# requesting: ALL
#

# user1, ehowstuff.local
dn: uid=user1,dc=ehowstuff,dc=local
uid: user1
givenName: user1
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetorgperson
sn: test
cn: user1 test
userPassword:: e1NTSEF9eTdNQTcyNUxnNjNPRXUxNUVkYk84TEJlTmp3M2d3Z3VoVEIreHc9PQ=
 =

# search result
search: 2
result: 0 Success

# numResponses: 2
# numEntries: 1

How to Install and Configure Subversion 1.8 on CentOS 6.5

Subversion is a open source version control system that will manages files and will keep the changes made to the files. With Subversion, it can help you to recovers the older files and directories and also to examine the history of your files and directories how they are changed all over time. This post will discuss how you can install and configure Subversion 1.8 on CentOS 6.5

1. Prepare WANdisco repo :

[root@centos6-05 ~]# wget opensource.wandisco.com/RPM-GPG-KEY-WANdisco -O /tmp/RPM-GPG-KEY-WANdisco
[root@centos6-05 ~]# wget opensource.wandisco.com/RPM-GPG-KEY-WANdisco -O /tmp/RPM-GPG-KEY-WANdisco
--2014-03-11 23:29:59--  http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco
Resolving opensource.wandisco.com... 54.248.108.17
Connecting to opensource.wandisco.com|54.248.108.17|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1759 (1.7K) [application/octet-stream]
Saving to: â/tmp/RPM-GPG-KEY-WANdiscoâ

100%[==========================================================>] 1,759       --.-K/s   in 0.003s

2014-03-11 23:30:00 (665 KB/s) - â/tmp/RPM-GPG-KEY-WANdiscoâ

2. Import RPM-GPG-KEY-WANdisco. Once imported, it safe to delete :

[root@centos6-05 ~]# rpm --import /tmp/RPM-GPG-KEY-WANdisco
[root@centos6-05 ~]# rm -rf /tmp/RPM-GPG-KEY-WANdisco

You can get more subversion file from the followings :
http://opensource.wandisco.com/rhel/6/svn-1.8/RPMS/x86_64/

3. Configure WANdisco repo file :

[root@centos6-05 ~]# vi /etc/yum.repos.d/WANdisco-1.8.repo
[WANdisco]
name=WANdisco SVN Repo 1.8
enabled=1
baseurl=http://opensource.wandisco.com/rhel/6/svn-1.8/RPMS/
gpgcheck=1

4. Install subversion using yum install :

[root@centos6-05 ~]# yum install subversion mod_dav_svn -y

Full installation screen :

[root@centos6-05 ~]# yum install subversion mod_dav_svn -y
Loaded plugins: fastestmirror
Determining fastest mirrors
epel/metalink                                                                | 5.2 kB     00:00
 * Webmin: download.webmin.com
 * base: centos.ipserverone.com
 * epel: epel.mirror.net.in
 * extras: centos.ipserverone.com
 * updates: centos.ipserverone.com
WANdisco                                                                     |  951 B     00:00
WANdisco/primary                                                             |  65 kB     00:00
WANdisco                                                                                    309/309
Webmin                                                                       |  951 B     00:00
Webmin/primary                                                               |  21 kB     00:00
Webmin                                                                                      168/168
base                                                                         | 3.7 kB     00:00
base/primary_db                                                              | 4.4 MB     00:45
epel                                                                         | 4.2 kB     00:00
epel/primary_db                                                              | 6.0 MB     01:51
extras                                                                       | 3.4 kB     00:00
extras/primary_db                                                            |  19 kB     00:00
updates                                                                      | 3.4 kB     00:00
updates/primary_db                                                           | 2.1 MB     00:18
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mod_dav_svn.x86_64 0:1.8.8-1 will be installed
---> Package subversion.x86_64 0:1.8.8-1 will be installed
--> Processing Dependency: libserf-1.so.1()(64bit) for package: subversion-1.8.8-1.x86_64
--> Running transaction check
---> Package serf.x86_64 0:1.3.2-2 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                   Arch                 Version                Repository              Size
====================================================================================================
Installing:
 mod_dav_svn               x86_64               1.8.8-1                WANdisco                77 k
 subversion                x86_64               1.8.8-1                WANdisco               2.2 M
Installing for dependencies:
 serf                      x86_64               1.3.2-2                WANdisco                43 k

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

Total download size: 2.3 M
Installed size: 7.8 M
Downloading Packages:
(1/3): mod_dav_svn-1.8.8-1.x86_64.rpm                                        |  77 kB     00:00
(2/3): serf-1.3.2-2.x86_64.rpm                                               |  43 kB     00:00
(3/3): subversion-1.8.8-1.x86_64.rpm                                         | 2.2 MB     00:19
----------------------------------------------------------------------------------------------------
Total                                                               112 kB/s | 2.3 MB     00:20
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : serf-1.3.2-2.x86_64                                                              1/3
  Installing : subversion-1.8.8-1.x86_64                                                        2/3
  Installing : mod_dav_svn-1.8.8-1.x86_64                                                       3/3
Stopping httpd: [  OK  ]
Starting httpd: [  OK  ]
  Verifying  : mod_dav_svn-1.8.8-1.x86_64                                                       1/3
  Verifying  : subversion-1.8.8-1.x86_64                                                        2/3
  Verifying  : serf-1.3.2-2.x86_64                                                              3/3

Installed:
  mod_dav_svn.x86_64 0:1.8.8-1                      subversion.x86_64 0:1.8.8-1

Dependency Installed:
  serf.x86_64 0:1.3.2-2

Complete!

5. Setting up SVN directories :

[root@centos6-05 ~]# mkdir /svn
[root@centos6-05 ~]# mkdir /svn/repos
[root@centos6-05 ~]# mkdir /svn/users
[root@centos6-05 ~]# mkdir /svn/permissions
[root@centos6-05 ~]# chown -R apache:apache /svn

6. Configure httpd Apache server as below :

[root@centos6-05 ~]# vim /etc/httpd/conf/httpd.conf
<VirtualHost *:80>
    ServerAdmin webmaster@svn.ehowstuff.local
    DocumentRoot /svn/repos
    ServerName svn.ehowstuff.local
    ErrorLog logs/svn.ehowstuff.local-error_log
    CustomLog logs/svn.ehowstuff.local-access_log common
</VirtualHost>

7. Do a backup of origial subversion file :

[root@centos6-05 ~]# mv /etc/httpd/conf.d/subversion.conf /etc/httpd/conf.d/subversion.conf.bak

8. Create and Configure subversion.conf :

[root@centos6-05 ~]# vi /etc/httpd/conf.d/subversion.conf
LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so

<Location /svn/repos>
        DAV svn
        SVNParentPath /svn/repos
        AuthType Basic
        AuthName "Authorization Realm"
        AuthUserFile /svn/users/passwords
        AuthzSVNAccessFile /svn/permissions/svnaccess
        Require valid-user
</Location>

9. Create first repository using svnadmin command :

[root@centos6-05 ~]# svnadmin create /svn/repos/testrepo
[root@centos6-05 ~]# chown -R apache:apache /svn/repos/testrepo

10. Create htpasswd user to access the testrepo repository :

[root@centos6-05 ~]# htpasswd -c /svn/users/passwords svnuser1
New password:
Re-type new password:
Adding password for user svnuser1

11. Create svnaccess file to access the testrepo repository :

[root@centos6-05 ~]# vi /svn/permissions/svnaccess

Add the following :

[testrepo:/]
svnuser1 = rw

12. Restart httpd :

[root@centos6-05 ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

13. Test your subversion server from browser :

http://svn.ehowstuff.local/svn/repos/testrepo/