Linux: Sysstat (sar)

The sar utility which is use monitor the history system performance data on your system.

To use the sar command, simply enter sar from the system,

# sar

To check the memory statistic,

# sar -r

To check the disk statistic,

# sar -d

To check network statistic,

# sar -n

To check processor statistic,

# sar -P ALL

To check certain date statistic let say 8th of the month

# sar -f /var/log/sa/sar09

Linux: Command to check Perl Modules

instmodsh, a shell to examine installed modules. Used to easily list all the installed module from your server/PC.

[email protected] [~]# instmodsh
Available commands are:
   l            - List all installed modules
   m <module>   - Select a module
   q            - Quit the program
cmd?

By hitting ‘l’, it will show you the list of installed module,

cmd? l
Installed modules are:
   Acme::Spork
   Apache::Admin::Config
   AppConfig
   Archive::Tar
   Archive::Tar::Streamed
   Archive::Zip
   Attribute::Handlers
   Authen::Libwrap
   Authen::SASL
   BSD::Resource
   Bundle::Interchange
   Business::OnlinePayment
   Business::OnlinePayment::AuthorizeNet
   Business::UPS
...
...

 

Linux: disk usage command – du

du is a standard unix command to calculate disk space from Unix/Linux system.

To get the sum space of the directory,

du

To get sum space with human-readable,

du -sh

To get sub directories space

du -sh *

To get sub directories space with all hidden folder,

du -sk .[!.]* * | sort -n

Linux: Enable and Disable services during Startup

Do you ever wonder that how to setup CentOS (RedHat) Linux server startup service and how the services running?

With CentOS, you may use the command named chkconfig to configure your startup services.

First of all, you need to understand what is Linux runlevels, for more information, you may refer to the URL below,
http://www.mickgenie.com/understand-linux-runlevels/

In this example, let say we could like to set the runlevel at 2, 3, and 5 with httpd (Apache).

To enable the services in startup,

# chkconfig httpd --add
# chkconfig httpd on --level 235

To check which runlevel you have set,

# chkconfig --list httpd

To disable the startup,

# chkconfig httpd off

R1Soft: Replication driver missing

I was discovery that the R1Soft server hosted for client server getting the following error,

An exception occurred during the request. Replication driver missing; Unable to open driver at '/dev/hcp'; No such device or address.

To get this issue fixed, you should make sure that you have the kernel similar version with your kernel-header. Then you could verify if the Linux Hot Copy module is loaded. To verify the them,

To check the kernel version,

uname -r

To check the kernel-header version,

yum list kernel-devel

If you have PAE, xen or Enterprise kernel, use the corresponding version like kernel-PAE-devel, kernel-xen-devel or kernel-ent-devel.

Next, build the kernel header with source,

r1soft-setup --get-module --no-binary

Next, restart the CDP-Agent to load the new driver,

/etc/init.d/cdp-agent restart

After that, you may check if the module loaded

lsmod | grep hcpdriver

You have done and the error should away by now.

Understand Linux-based RAM and it’s cache

Linux Operating System that powered by Linux kernel have an advanced disk cache algorithm that used to store frequently access data from Hard disk.

This is to explain why some Linux server’s RAM still getting high memory usage even you upgrade your RAM.

To find out how much memory using by the Linux-based server, you may use the linux command “free” to track it. To get the detailed/actual memory usage, you may run the following command from your Linux box.

free -m

You should get some result as below,

             total       used       free     shared    buffers     cached
Mem:         15905       2879      13026          0        384        900
-/+ buffers/cache:       1593      14311
Swap:         3999          0       3999

With the result above, you may see that the used memory is 2879MB and free memory is 13026MB. However, the cached memory is 1593MB while the actual free memory will be 14311MB.

Understand Linux runlevels

runlevels is the term that the mode of operation running in one of the computer operating system that running with Unix box.

With runlevels, it determine what should be running from the system boot or operation. runlevel is typically come with level 0-6 though it do have 0-9 or 0-10 and even S as a level.

Typical Linux runlevel come with code below,
0 – Halt
1 – Single-User mode
2 – Multi-User mode
3 – Multi-User mode with networking
4 – Not used/user definable
5 – Start from system normally with appropriate display manager
6 –  Reboot

Linux: Generate SSL CSR Key with Apache Linux

Oops.. It is been a while MGe disappeared and here I come back again after long holiday for blogging. 🙂

This article used to guide you to create the CSR(Certificate Signing Request) from your Apache machine.

Web Server: Linux
Web Service: Apache

1. First of all, you will need to create a key pair.

openssl genrsa -out www.yourdomain-example.com.key 2048

– Replace the mickgenie.com with your domain name.
– The number of 2048 used to determined the bit-length of your certificate, where you are advise to have 2048 and above.

2. You will be asking for the pass phrase and you may enter any strong password.

3.  Next, you will need to generate the CSR.

openssl req -new -key www.mickgenie.com.key -out www.mickgenie.com.csr

Next, you will be asking for Country Name, State or Province, Locality or City, Company, Organizational Unit, Common Name and Email Address.

4. Get your CSR and purchase the SSL from SSL provider.