How to Install osCommerce on CentOS 7.1

Open Source Commerce (osCommerce) is a solution for online store software and alternative to Magento. It is indeed a complete software, easily installed and configured through a web-based installation procedure. It can be used on any web server with PHP and MySQL as the basic software. In this article, I will show you how to install osCommerce on CentOS 7.1 virtual private server (VPS). Before we proceed with step osCommerce installation, this tutorial assumes CentOS 7.1 server has been installed and LAMP or LEMP software also has been setup. The steps maybe similar to RHEL 7.1 and Oracle Linux 7.

Install osCommerce software on CentOS 7.1, RHEL 7.1 and Oracle Linux 7 via command line

1. Download osCommerce Online Merchant v2.3.4 Full Package and store it on web server root directory. This post use httpd web server and /var/www/html/ as the default root directory :

# cd /var/www/html/
# wget http://www.oscommerce.com/files/oscommerce-2.3.4.zip
# unzip oscommerce-2.3.4.zip

2. The webserver is not able to save the installation parameters to its configuration files. The following files need to have their file permissions set to world-writeable (chmod 777):

# cp -Rp oscommerce-2.3.4 oscommerce
# chmod 777 /var/www/html/oscommerce/catalog/includes/configure.php
# chmod 777 /var/www/html/oscommerce/catalog/admin/includes/configure.php

3. Setup database :

# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 5.5.40-MariaDB MariaDB Server

Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.

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

MariaDB [(none)]> CREATE DATABASE oscommercedb;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> CREATE USER oscommerceuser@localhost IDENTIFIED BY 'oscommercepassword';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES on oscommercedb.* to oscommerceuser@localhost;
Query OK, 0 rows affected (0.01 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit
Bye

osCommerce Web Installation via Browser

4. Start osCommerce Web installation by browse the osccomerce URL as below :

http://192.168.0.70/oscommerce/catalog/install/index.php

Note : Replace IP address your own server IP address :

a. Press Start:

install osCommerce

b. Enter database information :

install osCommerce

c. You will notice that there is a message “The database structure is now being imported. Please be patient during this procedure.”. Just wait untill it proceed to next page below. Click continue to proceed.

install osCommerce

d. Enter online store information :
install osCommerce

e. If you see this page, you already have a working osCommerce installed in CentOS 7.0.

install osCommerce

I hope this article gives you some ideas and essential guidance on how to install osCommerce on linux / CentOS 7.1 / RHEL 7.1 / Oracle Linux 7.

 

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 CentOS Web panel(CWP) on CentOS 6

There are many open source control panel to run linux web hosting on the internet like ISPConfig, Webmin, Virtualmin and Open Panel. In this post, I want to share how to install CentOS Web panel (CWP) on CentOS 6. CentOS Web panel is a free Web Hosting panel designed for easy management of servers ( VPS & Dedicated ) without the need to use their expertise and knowledge in the linux command line and without SSH access to the server.

From the CWP official website, they do not provide uninstaller and reinstall the server to remove it. CWP should be install on the fresh CentOS operating system without any non-default configuration.

Follow the following step to install CWP on CentOS 6.6.

1. Install Fresh CentOS 6.6 with direct internet connection :
2. Allocate atleast 512MB RAM for 32 bit systems and 1024MB for 64 bit systems. In this example we will allocate 4GB RAM.

3. Configure your server hostname :
a. Modify the hostname and reboot the server to take effect:

# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=centos66.ehowstuff.local
GATEWAY=192.168.0.1

a. Verify hostname :

[root@centos66 ~]# hostname
centos66.ehowstuff.local

4. Update your server before begin. Reboot the server to take effect the changes :

# yum update -y

5. Install CWP:
a. Change directory to /usr/local/src/ directory:

# cd /usr/local/src

b. Download the installer via wget :

# wget http://centos-webpanel.com/cwp-latest

Or try the following URL if above url not working :

# wget http://dl1.centos-webpanel.com/files/cwp-latest

c. Start CWP installer

# sh cwp-latest

6. The installation will take up to 50 minutes, depend on your internet connection speed :

cmp-2

7. Once the installation completed, you will see the the screen below. In this case i leave mySQL root password blank.
cmp-3

Press Enter to reboot the server.

8. Go to your browser and enter CWP ip address with 2030 port number. You will see login page as below. CentOS WebPanel Admin GUI at http://SERVER-IP:2030/

Username: root
Password: your server root password

cmp-4

9. You can start configure your CWP via dasgboard panel below. Get consult from official website, and the CWP forum to proceed the configuration.

cmp-5

10. You can start configure your CWP server and then start hosting your website.

  • Setup nameservers
  • Setup shared ip (must be your public IP address)
  • Setup at least one hosting package (or edit default package)
  • Setup root email
  • & now you are ready to host domains…

11. Install Softaculous Apps Installer via command :

# /usr/local/src/install.sh --quick
-----------------------------------------------
 Welcome to Softaculous Apps Installer
-----------------------------------------------

///////////////////////////////
// INSTALLING SOFTACULOUS :
// 1) CONFIGURING universal.php
// 2) FETCHED A LICENSE
// 3) UPDATING Categories
// 4) UPDATING Scripts List
// 5) UPDATING Installed Scripts List
// 6) SETTING A CRON JOB
// 7) DOWNLOADING SCRIPTS
///////////////////////////////

ln: creating symbolic link `/usr/local/cwpsrv/conf.d/softaculous.conf': File exists
cwpsrvd: Could not reliably determine the server's fully qualified domain name, using centos66.ehowstuff.local for ServerName
=====================================================
Congratulations, Softaculous was installed successfully
Softaculous has been installed at:
Path : /usr/local/softaculous
Scripts Path : /var/softaculous

We request you to please register for updates and notifications at :
http://www.softaculous.com/board/index.php?act=register
It also inspires us when you register. Registration is free and just a one minute job.

If you need any support you can always count on us. Just drop in at our Support Board:
http://www.softaculous.com/board
Alternatively, you can contact us via Email at support@softaculous.com

Thank you for using Softaculous

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 Collectl – Linux Performance Monitoring

Collectl is a linux performance monitoring tools that grabs as much detail as possible from the /proc filesystem and it does a lot more than most other tools. Compare to sar, collectl has some capabilities that sar does not have. Collectl can gather and post-process the performance data and also can save the performance data for later analysis. Please refer to below guide on how you can setup collectl on linux CentOS 6.5 and the sample usage of collectl :

1. Install collectl. Make sure additional repository (EPEL repository) has been installed :
a. For Red Hat based distro :

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

b. For debian bas distro :

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

2. Display collectl command help :

[root@oss ~]# collectl -h
This is a subset of the most common switches and even the descriptions are
abbreviated.  To see all type 'collectl -x', to get started just type 'collectl'

usage: collectl [switches]
  -c, --count      count      collect this number of samples and exit
  -f, --filename   file       name of directory/file to write to
  -i, --interval   int        collection interval in seconds [default=1]
  -o, --options    options    misc formatting options, --showoptions for all
                                d|D - include date in output
                                  T - include time in output
                                  z - turn off compression of plot files
  -p, --playback   file       playback results from 'file' (be sure to quote
                              if wild carded) or the shell might mess it up
  -P, --plot                  generate output in 'plot' format
  -s, --subsys     subsys     specify one or more subsystems [default=cdn]
      --verbose               display output in verbose format (automatically
                              selected when brief doesn't make sense)

Various types of help
  -h, --help                  print this text
  -v, --version               print version
  -V, --showdefs              print operational defaults
  -x, --helpextend            extended help, more details descriptions too
  -X, --helpall               shows all help concatenated together

  --showoptions               show all the options
  --showsubsys                show all the subsystems
  --showsubopts               show all subsystem specific options
  --showtopopts               show --top options

  --showheader                show file header that 'would be' generated
  --showcolheaders            show column headers that 'would be' generated
  --showslabaliases           for SLUB allocator, show non-root aliases
  --showrootslabs             same as --showslabaliases but use 'root' names

Copyright 2003-2014 Hewlett-Packard Development Company, L.P.
collectl may be copied only under the terms of either the Artistic License
or the GNU General Public License, which may be found in the source kit

3. According to the man page, collectl identifies the following subsystems :

SUMMARY SUBSYSTEMS

OptionDescription
bBuddy information (memory fragmentation)
cCPU information
dDisk
fNFS information
iinode information
jInterrupts
lLustre
mMemory
nNetworks
sSockets
tTCP
xInterconnect
ySlabs

DETAIL SUBSYSTEMS

OptionDescription
CCPU
DDisk
EEnvironmentals via ipmitool
FNFS data
JInterrupts
MMemory node data (including numa)
NNetworks
TSixty-five TCP counters (only in plot format)
XInterconnect
YSlabs
ZProcesses

 

4. Monitor cpu subsystem :

[root@oss ~]# collectl -sc
waiting for 1 second sample...
#< --------CPU-------->
#cpu sys inter  ctxsw
   0   0    34     37
   0   0    56     40
   0   0    38     44
   0   0    31     35
   0   0    36     44
[root@oss ~]# collectl -sC
waiting for 1 second sample...

# SINGLE CPU STATISTICS
#   Cpu  User Nice  Sys Wait IRQ  Soft Steal Idle
      0     0    0    0    0    0    0     0  100
      1     0    0    0    0    0    0     0  100
      0     0    0    0    0    0    0     0  100
      1     0    0    0    0    0    0     0  100
      0     0    0    0    0    0    0     0  100
      1     0    0    0    0    0    0     0  100
      0     0    0    0    0    0    0     0  100
      1     0    0    0    0    0    0     0  100
      0     0    0    0    0    0    0     0  100
      1     0    0    0    4    0    0     0   96
      0     0    0    0    0    0    0     0   99
      1     0    0    0    0    0    0     0   99
      0     0    0    0    0    0    0     0  100
      1     0    0    0    0    0    0     0  100
      0     0    0    0    0    0    0     0  100
      1     1    0    0    0    0    0     0   99
      0     0    0    0    0    0    0     0  100
      1     0    0    0    0    0    0     0  100
      0     0    0    0    0    0    0     0  100
      1     0    0    0    0    0    0     0  100
      0     0    0    0    0    0    0     0  100
      1     0    0    0    0    0    0     0  100

5. Monitor memory subsystem :

[root@oss ~]# collectl -sm
waiting for 1 second sample...
#< -----------Memory----------->
#Free Buff Cach Inac Slab  Map
   3G  19M 166M  50M  36M  34M
   3G  19M 166M  50M  36M  34M
   3G  19M 166M  50M  36M  34M
   3G  19M 166M  50M  36M  34M
   3G  19M 166M  50M  36M  34M
   3G  19M 166M  50M  36M  34M
   3G  19M 166M  50M  36M  34M
   3G  19M 166M  50M  36M  34M
[root@oss ~]# collectl -sM
waiting for 1 second sample...

# MEMORY STATISTICS
# Node    Total     Used     Free     Slab   Mapped     Anon   Locked    Inact   Hit%
     0    4095M  565208K    3543M   37112K    9408K   25492K        0   51756K 100.00
     0    4095M  565208K    3543M   37112K    9408K   25492K        0   51756K 100.00
     0    4095M  565208K    3543M   37108K    9408K   25492K        0   51756K 100.00
     0    4095M  565208K    3543M   37108K    9408K   25492K        0   51756K 100.00
     0    4095M  565208K    3543M   37108K    9408K   25492K        0   51756K 100.00
     0    4095M  565208K    3543M   37108K    9408K   25492K        0   51760K 100.00
     0    4095M  565208K    3543M   37036K    9408K   25492K        0   51760K 100.00
     0    4095M  565184K    3543M   37028K    9408K   25492K        0   51760K 100.00
     0    4095M  565184K    3543M   37028K    9408K   25492K        0   51760K 100.00
     0    4095M  565184K    3543M   37024K    9408K   25492K        0   51760K 100.00
     0    4095M  565184K    3543M   37024K    9408K   25492K        0   51760K 100.00
     0    4095M  565184K    3543M   37016K    9408K   25492K        0   51760K 100.00
     0    4095M  565168K    3543M   36972K    9408K   25492K        0   51760K 100.00
     0    4095M  565168K    3543M   36972K    9408K   25492K        0   51760K 100.00
     0    4095M  565168K    3543M   36972K    9408K   25492K        0   51760K 100.00
     0    4095M  565168K    3543M   36968K    9408K   25492K        0   51760K 100.00
     0    4095M  565160K    3543M   36932K    9408K   25492K        0   51760K 100.00
     0    4095M  565160K    3543M   36932K    9408K   25492K        0   51760K 100.00
     0    4095M  565160K    3543M   36932K    9408K   25492K        0   51760K 100.00
     0    4095M  565160K    3543M   36900K    9408K   25492K        0   51760K 100.00
     0    4095M  565160K    3543M   36900K    9408K   25492K        0   51760K 100.00
     0    4095M  565160K    3543M   36900K    9408K   25492K        0   51760K 100.00

6. Monitor disk subsystem :

[root@oss ~]# collectl -sd
waiting for 1 second sample...
#< ----------Disks----------->
#KBRead  Reads KBWrit Writes
      0      0      0      0
      0      0      0      0
      0      0      0      0
      0      0      0      0
      0      0     16      3
      0      0      0      0
      0      0      0      0
      0      0      0      0
      0      0      0      0
      0      0      0      0
[root@oss ~]# collectl -sD
waiting for 1 second sample...

# DISK STATISTICS (/sec)
#           Pct
#Name       KBytes Merged  IOs Size  KBytes Merged  IOs Size  RWSize  QLen  Wait SvcTim Util
sda              0      0    0    0       0      0    0    0       0     0     0      0    0
sda              0      0    0    0       0      0    0    0       0     0     0      0    0
sda              0      0    0    0      16      1    3    5       5     1    13     10    3
sda              0      0    0    0       0      0    0    0       0     0     0      0    0
sda              0      0    0    0       0      0    0    0       0     0     0      0    0
sda              0      0    0    0       0      0    0    0       0     0     0      0    0
sda              0      0    0    0       0      0    0    0       0     0     0      0    0
sda              0      0    0    0       0      0    0    0       0     0     0      0    0
sda              0      0    0    0       0      0    0    0       0     0     0      0    0

7. collectl like iotop :

[root@oss ~]# collectl --top iokb

Sample output :

# TOP PROCESSES sorted by iokb (counters are /sec) 13:35:14
# PID  User     PR  PPID THRD S   VSZ   RSS CP  SysT  UsrT Pct  AccuTime  RKB  WKB MajF MinF Command
    1  root     20     0    0 S   18M    1M  0  0.00  0.00   0  00:01.13    0    0    0    0 /sbin/init
    2  root     20     0    0 S     0     0  0  0.00  0.00   0  00:00.02    0    0    0    0 kthreadd
    3  root     RT     2    0 S     0     0  0  0.00  0.00   0  00:00.04    0    0    0    0 migration/0
    4  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.09    0    0    0    0 ksoftirqd/0
    5  root     RT     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 migration/0
    6  root     RT     2    0 S     0     0  0  0.00  0.00   0  00:00.30    0    0    0    0 watchdog/0
    7  root     RT     2    0 S     0     0  1  0.00  0.00   0  00:00.38    0    0    0    0 migration/1
    8  root     RT     2    0 S     0     0  1  0.00  0.00   0  00:00.00    0    0    0    0 migration/1
    9  root     20     2    0 S     0     0  1  0.00  0.00   0  00:00.22    0    0    0    0 ksoftirqd/1
   10  root     RT     2    0 S     0     0  1  0.00  0.00   0  00:00.28    0    0    0    0 watchdog/1
   11  root     20     2    0 S     0     0  0  0.00  0.00   0  00:08.15    0    0    0    0 events/0
   12  root     20     2    0 S     0     0  1  0.00  0.00   0  01:21.61    0    0    0    0 events/1
   13  root     20     2    0 S     0     0  1  0.00  0.00   0  00:00.00    0    0    0    0 cgroup
   14  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 khelper
   15  root     20     2    0 S     0     0  1  0.00  0.00   0  00:00.00    0    0    0    0 netns
   16  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 async/mgr
   17  root     20     2    0 S     0     0  1  0.00  0.00   0  00:00.00    0    0    0    0 pm
   18  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.84    0    0    0    0 sync_supers
   19  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.82    0    0    0    0 bdi-default
   20  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 kintegrityd/0
   21  root     20     2    0 S     0     0  1  0.00  0.00   0  00:00.00    0    0    0    0 kintegrityd/1
   22  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.15    0    0    0    0 kblockd/0

Display only top 10 processes :

[root@oss ~]# collectl --top iokb,10

Sample output :

# TOP PROCESSES sorted by iokb (counters are /sec) 13:42:37
# PID  User     PR  PPID THRD S   VSZ   RSS CP  SysT  UsrT Pct  AccuTime  RKB  WKB MajF MinF Command
    1  root     20     0    0 S   18M    1M  0  0.00  0.00   0  00:01.13    0    0    0    0 /sbin/init
    2  root     20     0    0 S     0     0  0  0.00  0.00   0  00:00.02    0    0    0    0 kthreadd
    3  root     RT     2    0 S     0     0  0  0.00  0.00   0  00:00.04    0    0    0    0 migration/0
    4  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.09    0    0    0    0 ksoftirqd/0
    5  root     RT     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 migration/0
    6  root     RT     2    0 S     0     0  0  0.00  0.00   0  00:00.30    0    0    0    0 watchdog/0
    7  root     RT     2    0 S     0     0  1  0.00  0.00   0  00:00.39    0    0    0    0 migration/1
    8  root     RT     2    0 S     0     0  1  0.00  0.00   0  00:00.00    0    0    0    0 migration/1
    9  root     20     2    0 S     0     0  1  0.00  0.00   0  00:00.22    0    0    0    0 ksoftirqd/1
   10  root     RT     2    0 S     0     0  1  0.00  0.00   0  00:00.28    0    0    0    0 watchdog/1

Learn what fields the above list can be sorted :

[root@oss ~]# collectl --showtopopts
The following is a list of --top's sort types which apply to either
process or slab data.  In some cases you may be allowed to sort
by a field that is not part of the display if you so desire

TOP PROCESS SORT FIELDS

Memory
  vsz    virtual memory
  rss    resident (physical) memory

Time
  syst   system time
  usrt   user time
  time   total time
  accum  accumulated time

I/O
  rkb    KB read
  wkb    KB written
  iokb   total I/O KB

  rkbc   KB read from pagecache
  wkbc   KB written to pagecache
  iokbc  total pagecacge I/O
  ioall  total I/O KB (iokb+iokbc)

  rsys   read system calls
  wsys   write system calls
  iosys  total system calls

  iocncl Cancelled write bytes

Page Faults
  majf   major page faults
  minf   minor page faults
  flt    total page faults

Context Switches
  vctx   volunary context switches
  nctx   non-voluntary context switches

Miscellaneous (best when used with --procfilt)
  cpu    cpu number
  pid    process pid
  thread total process threads (not counting main)

TOP SLAB SORT FIELDS

  numobj    total number of slab objects
  actobj    active slab objects
  objsize   sizes of slab objects
  numslab   number of slabs
  objslab   number of objects in a slab
  totsize   total memory sizes taken by slabs
  totchg    change in memory sizes
  totpct    percent change in memory sizes
  name      slab names

8. collectl like top :

[root@oss ~]# collectl --top

Sample output :

# TOP PROCESSES sorted by time (counters are /sec) 13:45:00
# PID  User     PR  PPID THRD S   VSZ   RSS CP  SysT  UsrT Pct  AccuTime  RKB  WKB MajF MinF Command
 3266  root     20  2488    0 R  160M   21M  1  0.00  0.05   5  00:00.70    0    0    0   83 /usr/bin/perl
    1  root     20     0    0 S   18M    1M  0  0.00  0.00   0  00:01.13    0    0    0    0 /sbin/init
    2  root     20     0    0 S     0     0  0  0.00  0.00   0  00:00.02    0    0    0    0 kthreadd
    3  root     RT     2    0 S     0     0  0  0.00  0.00   0  00:00.04    0    0    0    0 migration/0
    4  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.09    0    0    0    0 ksoftirqd/0
    5  root     RT     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 migration/0
    6  root     RT     2    0 S     0     0  0  0.00  0.00   0  00:00.31    0    0    0    0 watchdog/0
    7  root     RT     2    0 S     0     0  1  0.00  0.00   0  00:00.39    0    0    0    0 migration/1
    8  root     RT     2    0 S     0     0  1  0.00  0.00   0  00:00.00    0    0    0    0 migration/1
    9  root     20     2    0 S     0     0  1  0.00  0.00   0  00:00.22    0    0    0    0 ksoftirqd/1
   10  root     RT     2    0 S     0     0  1  0.00  0.00   0  00:00.28    0    0    0    0 watchdog/1
   11  root     20     2    0 S     0     0  0  0.00  0.00   0  00:08.18    0    0    0    0 events/0
   12  root     20     2    0 S     0     0  1  0.00  0.00   0  01:21.97    0    0    0    0 events/1
   13  root     20     2    0 S     0     0  1  0.00  0.00   0  00:00.00    0    0    0    0 cgroup
   14  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 khelper
   15  root     20     2    0 S     0     0  1  0.00  0.00   0  00:00.00    0    0    0    0 netns
   16  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 async/mgr
   17  root     20     2    0 S     0     0  1  0.00  0.00   0  00:00.00    0    0    0    0 pm
   18  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.84    0    0    0    0 sync_supers
   19  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.83    0    0    0    0 bdi-default
   20  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 kintegrityd/0
   21  root     20     2    0 S     0     0  1  0.00  0.00   0  00:00.00    0    0    0    0 kintegrityd/1

More advance options can be found in the official collectl documentation :

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 Setup Monitorix – Network and System Monitoring Tool for Linux

Monitorix is an open source and lightweight system monitoring tool designed to monitor network and system resources in linux/UNIX operating system. Monitorix can collects network and system performce and also resources and then display the informations into graphs. it will help system adn network administrator to detect abnormal activities and detecting bottlenecks. This post will show to setup Monitorix on linux centOS 6.5.

1. Prepare additional repository (EPEL repository).
2. Install required packages :

[root@oss ~]# yum install rrdtool rrdtool-perl perl-libwww-perl perl-MailTools perl-MIME-Lite perl-CGI perl-DBI perl-XML-Simple perl-Config-General perl-HTTP-Server-Simple perl-IO-Socket-SSL -y

3. Install monitorix package :

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

Once succesfully installed, please take a look into the configuration file /etc/monitorix.conf to fit your system and enable or disable graphs.

4. Start Monitorix with below command :

[root@oss ~]# service monitorix start

Once started, Monitorix will start gathering the system information based on the configuration set in monitorix.conf file:

5. After a few minutes you should be able to see graph from your browser :

http://IP-Address:8080/monitorix/

install-monitorx-1

install-monitorx-2

install-monitorx-3

How to Install Zabbix 2.2 Server on CentOS 6.5

ZABBIX is an enterprise-class open source monitoring solution designed to monitor servers and various network services. Zabbix will perform simple checks can verify the availability and responsiveness of standard services. It was created by Alexei Vladishev. Follow this step to install zabbix 2.2 server on CentOS 6.5 :

1. Install httpd, php and MySQL :

[root@oss ~]# yum install php php-cli php-common php-devel php-pear php-gd php-mbstring php-mysql php-xml httpd httpd-devel mysql mysql-server -y

2. Zabbix package files are available at repo.zabbix.com :

[root@oss ~]# wget http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-release-2.2-1.el6.noarch.rpm
--2014-08-12 22:19:07--  http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-release-2.2-1.el6.noarch.rpm
Resolving repo.zabbix.com... 87.110.183.174
Connecting to repo.zabbix.com|87.110.183.174|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11256 (11K) [application/x-redhat-package-manager]
Saving to: âzabbix-release-2.2-1.el6.noarch.rpmâ

100%[==========================================================>] 11,256      7.09K/s   in 1.6s

2014-08-12 22:19:09 (7.09 KB/s) - âzabbix-release-2.2-1.el6.noarch.rpmâ
[root@oss ~]# ls
anaconda-ks.cfg  install.log  install.log.syslog  zabbix-release-2.2-1.el6.noarch.rpm
[root@oss ~]# rpm -Uvh zabbix-release-2.2-1.el6.noarch.rpm
warning: zabbix-release-2.2-1.el6.noarch.rpm: Header V4 DSA/SHA1 Signature, key ID 79ea5ed4: NOKEY
Preparing...                ########################################### [100%]
   1:zabbix-release         ########################################### [100%]

3. Install Zabbix server :

[root@oss ~]# yum install zabbix-agent zabbix-web-mysql zabbix-server-mysql zabbix-java-gateway -y

4. Editing PHP configuration for Zabbix frontend

Apache configuration file for Zabbix frontend is located in /etc/httpd/conf.d/zabbix.conf. Some PHP settings are already configured.

    php_value max_execution_time 300
    php_value memory_limit 128M
    php_value post_max_size 16M
    php_value upload_max_filesize 2M
    php_value max_input_time 300
    php_value date.timezone Asia/Kuala_Lumpur

5. Restart zabbix and make zabbix start at boot :

[root@oss ~]# service zabbix-server start
Starting Zabbix server:                                    [  OK  ]
[root@oss ~]# chkconfig zabbix-server on

6. Setup Zabbix database :

mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'password';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit

7. Import initial schema and data :

[root@oss ~]# cd /usr/share/doc/zabbix-server-mysql-2.2.5/create

[root@oss create]# mysql -u zabbix -p zabbix < schema.sql
Enter password:
[root@oss create]# mysql -u zabbix -p zabbix < images.sql
Enter password:
[root@oss create]# mysql -u zabbix -p zabbix < data.sql
Enter password:

8. Start zabbix installation wizard :

http://192.168.0.8/zabbix/setup.php
setup zabbix-1

setup zabbix-2

setup zabbix-3

setup zabbix-4

setup zabbix-5

setup zabbix-6

9. If the configuration file is not writable, manually edit database configuration in zabbix_server.conf as below :

# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=password

10. Open required port at iptables :

[root@oss ~]# netstat -plunt | grep LISTEN
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1124/sshd
tcp        0      0 0.0.0.0:10051               0.0.0.0:*                   LISTEN      4190/zabbix_server
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      4074/mysqld
tcp        0      0 :::80                       :::*                        LISTEN      1417/httpd
tcp        0      0 :::22                       :::*                        LISTEN      1124/sshd
tcp        0      0 :::10051                    :::*                        LISTEN      4190/zabbix_server
[root@oss ~]# vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 10051 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

Restart iptables :

[root@oss ~]# service iptables restart

11. Zabbix frontend is available at http://IP-address/zabbix in the browser.

The default username/password is Admin/zabbix.

setup zabbix-7

Zabbix server setup completed. You can start to setup zabbix agent now.

How to Setup Webmin 1.620 using YUM repository on CentOS 6.4 VPS

webminThis post will brief you on how to setup Webmin 1.620 using yum repository in CentOS 6.4 virtual private server (VPS). Webmin is an open source system administration and system configuration tool which provide you web-based interface to manage, administer and configure your CentOS VPS or dedicated server through web browser. It’s provide graphical interface remote administration instead of manually edit the configuration using command line from putty or console.

1. Enabling Yum repository for Webmin. Create the /etc/yum.repos.d/webmin.repo file containing :

[root@centos64 ~]# vi /etc/yum.repos.d/webmin.repo
[Webmin]
name=Webmin Distribution Neutral
#baseurl=http://download.webmin.com/download/yum
mirrorlist=http://download.webmin.com/download/yum/mirrorlist
enabled=1

2. Fetch and install my GPG key :

[root@centos64 ~]# wget http://www.webmin.com/jcameron-key.asc
[root@centos64 ~]# rpm --import jcameron-key.asc

3. Run “yum install” command to install all required dependencies :

[root@centos64 ~]# yum install webmin -y

Example :

[root@centos64 ~]# yum install webmin -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * Webmin: download.webmin.com
 * base: mirrors.hostemo.com
 * extras: mirrors.hostemo.com
 * updates: mirrors.hostemo.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package webmin.noarch 0:1.620-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                Arch                   Version                 Repository              Size
====================================================================================================
Installing:
 webmin                 noarch                 1.620-1                 Webmin                  21 M

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

Total download size: 21 M
Installed size: 21 M
Downloading Packages:
webmin-1.620-1.noarch.rpm                                                    |  21 MB     04:09
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : webmin-1.620-1.noarch                                                            1/1
Operating system is CentOS Linux
Webmin install complete. You can now login to http://centos64.ehowstuff.local:10000/
as root with your root password.
  Verifying  : webmin-1.620-1.noarch                                                            1/1

Installed:
  webmin.noarch 0:1.620-1

Complete!

4. By default Webmin runs on port 10000, therefore port 10000 need to be open in order to allow you to access web base interface remotely.

[root@centos64 ~]# vi /etc/sysconfig/iptables

Add the following rule to existing iptables firewall :

-A INPUT -m state --state NEW -m tcp -p tcp --dport 10000 -j ACCEPT

Restart IPtables :

[root@centos64 ~]# service iptables restart

5. Access and login to Webmin using URL http://serveripaddress:10000/

How to Prepare for Zimbra Collaboration Suite 8.0.2 Mail Server Installation on CentOS 6.4 x86_64

zimbraThis post will show the prerequisites setup before we enter to actual Zimbra Collaboration Suite (ZCS)installation. Zimbra Collaboration Suite (ZCS) is a groupware product created by Zimbra, Inc., located in Palo Alto, California, USA This post consist summary of the configuration and has been tested on CentOS 6.4 64 bit.

1. Prepare for Fully qualified domain name (FQDN) for your zimbra mail server and do the configuration of your dns server :
2. Configure /etc/hosts and hostname.
3. Disable iptables or configure iptables with zimbra ports.
4. Disabled SELINUX :

[root@centos64 ~]# vi /etc/sysconfig/selinux

# 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. Install the required packages and libraries using the following command :

[root@centos64 ~]# yum install nc sudo libidn gmp libstdc++ perl sysstat sqlite -y

6. Stop sendmail, postfix or any MTA service :

[root@centos64 ~]# service postfix stop
[root@centos64 ~]# chkconfig postfix off
[root@centos64 ~]# service sendmail stop
[root@centos64 ~]# chkconfig sendmail off

How to Install Google Chrome on CentOS 6.3

google chromeGoogle Chrome is a lightweight and fast browsing alternative browser that combines a minimal design with sophisticated technology to make the web faster, safer, and easier. It was designed to be simple and stylish not only on windows operating system, but in CentOS or other linux operating system as well. This post will show you the steps to install Google Chrome on CentOS 6.3.

1. Prepare repository :

[root@CentOS6 ~]# vi /etc/yum.repos.d/google-chrome.repo

Add the following into google-chrome.repo for CentOS 32 Bit:

[google-chrome]
name=google-chrome - 32-bit
baseurl=http://dl.google.com/linux/chrome/rpm/stable/i386
enabled=1
gpgcheck=1
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub

Add the following into google-chrome.repo for CentOS 64 Bit:

[google-chrome]
name=google-chrome - 64-bit
baseurl=http://dl.google.com/linux/chrome/rpm/stable/x86_64
enabled=1
gpgcheck=1
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub

2. Install the google chrome stable version :

[root@CentOS6 ~]# yum install google-chrome-stable -y