Installing Fio on CentOS 6.4 (minimal)

One of the very first things I am usually doing before I in-depthly set up a new server is testing its I/O Performance. As I am usually starting off from a Minimal install of a CentOS Release, here are the steps to install fio – the Flexible I/O benchmark program.

First, install prerequisites (of course, as root):

1
yum install libaio* gcc wget make

Then, get the current fio sources (as time of writing, the current version was 2.0.14)

1
wget http://brick.kernel.dk/snaps/fio-2.0.14.tar.gz

and unzip / configure them:

1
2
3
4
5
6
gunzip fio-2.0.14.tar.gz
tar -xf fio-2.0.14.tar
cd fio-2.0.14
./configure
make
make install

Kill Process in Linux or Terminate a Process in UNIX / Linux Systems

Linux and Unix-like operating system come with the kill command to terminates stalled or unwanted processes without having to log out or restart the server.

The kill command sends the specified signal such as kill process to the specified process or process groups. If no signal is specified, the TERM signal is sent. Please note that kill command can be internal as part of modern shells built-in function or external located at /bin/kill. Usage and syntax remain similar regardless internal or external kill command.

Tutorial details
Difficulty Easy (rss)
Root privileges Yes
Requirements kill
Estimated completion time 10 minutes

 

A list of common Term signals

Linux and Unix-like operating system supports the standard terminate signals listed below:

  1. SIGHUP (1) – Hangup detected on controlling terminal or death of controlling process. Use SIGHUP to reload configuration files and open/close log files.
  2. SIGKILL (9) – Kill signal. Use SIGKILL as a last resort to kill process. This will not save data or cleaning kill the process.
  3. SIGTERM (15) – Termination signal. This is the default and safest way to kill process.

What is a PID?

A Linux or Unix process is running instance of a program. For example, Firefox is a running process if you are browsing the Internet. Each time you start Firefox browser, the system is automatically assigned a unique process identification number (PID). A PID is automatically assigned to each process when it is created on the system. To find out PID of firefox or httpd process use the following command:

 
pidof httpd
pidof apache2
pidof firefox

OR use the combination of ps command and grep command:

 
ps aux | grep httpd
ps aux | grep apache2
ps aux | grep  firefox

Sample outputs:

Fig.01: Find the process ID (PID) of a running firefox program and apache2 server.

Fig.01: Find the process ID (PID) of a running firefox program and apache2 server.

kill command syntax

The syntax is:

 
kill [signal] PID
kill -15 PID
kill -9 PID
kill -SIGTERM PID
kill [options] -SIGTERM PID

What Linux or Unix permissions do I need to kill a process?

Rules are simple:

  1. You can kill all your own process.
  2. Only root user can kill system level process.
  3. Only root user can kill process started by other users.

kill command examples

In this example, I am going to kill lighttpd server.

Step #1: Find out the PID (process id)

Use the ps or pidof command to find out PID for any program. For example, if process name is lighttpd, you can use any one of the following command to obtain process ID:

 
pidof lighttpd

Sample outputs:

3486

OR

 
ps aux | grep lighttpd

Sample outputs:

lighttpd  3486  0.0  0.1   4248  1432 ?        S    Jul31   0:00 /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
lighttpd  3492  0.0  0.5  13752  3936 ?        Ss   Jul31   0:00 /usr/bin/php5-cg

Step #2: kill the process using a PID

The PID # 3486 is assigned to the lighttpd process. To kill the lighttpd server, you need to pass a PID as follows:
# kill 3486
OR
$ sudo kill 3486
This will terminate a process with a PID of 3486.

How do I verify that the process is gone / killed?

Use the ps or pidof command:
$ ps aux | grep lighttpd
$ pidof lighttpd

A note about sending stronger signal # 9 (SIGKILL)

If no signal specified in the kill command, signal # 15 (SIGTERM), is sent by default. So the kill 3486 command is same as the following command:
# kill -15 3486
# kill -SIGTERM 3486

OR
$ sudo kill -15 3486
$ sudo kill -SIGTERM 3486

Sometime signal # 15 is not sufficient. For example, lighttpd may not be killed by signal #15 due to open sockets. In that case process (PID) # 3486 would be killed with the powerful signal # 9:
# kill -9 3486
# kill -SIGKILL 3486

OR
$ sudo kill -9 3486
$ sudo kill -SIGKILL 3486

Where,

  • -9 or -SIGKILL – A special kill signal that nearly guarantee to kill the process with the iron fist.

How can I kill two or more PIDs?

The syntax is as follows to kill two or more PIDs as required can be used in a single command:

 
kill  pid1 pid2 pid3
kill -15  pid1 pid2 pid3
kill -9  pid1 pid2 pid3
kill  -9 3546 5557 4242

Say hello to killall command

This is a Linux only command. to kill processes by name. So no need to find the PIDs using the ‘pidof process’ or ‘ps aux | grep process’ command. Do not use killall command on Unix operating systems. This is a Linux specific command.

The syntax is

 
killall Process-Name-Here

To kill the lighttpd server, enter:
# killall -15 lighttpd
OR
# killall -9 lighttpd
To kill the Firefox web-browser process, enter:
# killall -9 firefox-bin

As I said earlier, the killall command on UNIX-like system does something else. It kills all process and not just specific process. Do not use killall on UNIX system.

Using Nginx with Virtualmin

Introduction to Nginx

Nginx is a lightweight webserver that supports most of the functionality of Apache, but is faster and uses less memory. It is suited to websites that have a large amount of static content, or virtual machines with limited memory. For more information, see http://wiki.nginx.org/Main

Installing Nginx Support

Switching a system from the Apache webserver (installed by default by Virtualmin) to Nginx should only be done if no virtual servers with websites have been created yet. Ideally the change should be done on a freshly installed system, running RHEL 6.0, CentOS 6.0 or Debian 6.0 or later. Virtualmin version 3.89 or above is also required.

The steps to remove Apache and install Nginx are :

  1. Shut down Apache with the command /etc/init.d/httpd stop ; service httpd off (on RHEL or CentOS), or /etc/init.d/apache2 stop ; update-rc.d apache2 remove (on Debian).
  2. Install Nginx with the command yum install nginx (on RHEL or CentOS) or apt-get install nginx (on Debian).
  3. Start the Nginx webserver with the command /etc/init.d/nginx start
  4. Install Virtualmin’s Nginx plugin with the command yum install wbm-virtualmin-nginx wbm-virtualmin-nginx-ssl (on RHEL or CentOS) or apt-get install webmin-virtualmin-nginx webmin-virtualmin-nginx-ssl (on Debian).

Once this is done, you can configure Virtualmin to use it as follows :

  1. Login to Virtualmin as root, and go to Webmin -> Servers -> Nginx Webserver and make sure that Nginx and its configuration files are found.
  2. If not, click on the Module Config link and set the config and command paths correctly.
  3. Return to Virtualmin, and go to System Settings -> Features and Plugins.
  4. Un-check the “Apache website” , “SSL website” and “DAV Login”, “Mailman”, “Protected web directories”, “AWstats reporting” and “Subversion repositories” features.
  5. Check the “Nginx website” and “Nginx SSL website” features, then click “Save”.
  6. If Virtualmin reports that any other features cannot be used without Apache, go back and de-select them too.
  7. Go to the System Information page and click Refresh system information in the top right.
  8. Verify that Nginx is shown as running in the “Status” section.

Using Nginx

Once Nginx support has been configured, you should be able to create virtual servers just as you would with Apache. However, on the Create Virtual Server page you will need to select Enable Nginx website? in the Enabled features section, instead of Enable Apache.

When creating a domain from the command-line API, you will need to use the --virtualmin-nginx flag instead of --web . For SSL websites, you will need to use --virtualmin-nginx-ssl instead of --ssl .

Similarly, when creating a domain via the remote API, you will need to use the virtualmin-nginx= parameter instead of web= .

Limitations of Nginx

Nginx as configured by Virtualmin lacks some features of Apache, such as :

  • Only one virtual server can have SSL enabled per IP address, even if a wildcard or UCC certificate would potentially allow multiple SSL sites to share the same IP.
  • Nginx does not support CGI, so any applications or Virtualmin scripts that use CGI will not work. Virtualmin should prevent the installation of scripts that require CGI, mod_perl or Apache-specific features.
  • PHP can only be executed via FastCGI, and all PHP scripts run with domain owner permissions. Execution via CGI or mod_php is not supported. For PHP to work, Virtualmin will setup a PHP FastCGI server process that Nginx communicates with for each virtual server.
  • Only one PHP version is supported, and Virtualmin will pick the highest version available on the system. This typically means that PHP v4 scripts cannot be run.

Ubuntu Linux NFS Server installation and Configuration

Q. How do I install and configure NFS 4 Server under Ubuntu Linux ?A. In order to set NFS server you need to install the following packages:

=> nfs-kernel-server – Linux NFS Server

=> nfs-common – NFS Common programs

=> portmap – The RPC portmapper

Ubuntu Linux install NFS Server

Use apt-get command to install all required packages:
$ sudo apt-get install nfs-kernel-server portmap nfs-common

Sharing directory with /etc/exports

The NFS file systems being exported / shared using /etc/exports file. You need to specify directory (file system) to share with rest of the nfs client computers. The file /etc/exports serves as the access control list for file systems which may be exported to NFS clients.
$ sudo vi /etc/exports
To export /data directory to 192.168.1.0/24 network enter the following in /etc/exports file:
/data 192.168.1.0/24(rw,rsync)
To export /sales to hostname tom and jerry, enter:
/sales tom(ro,sync) jerry(ro,sync)
To export /users to 192.168.1.0/24 in read write format, enter:
/users 192.168.1.0/24(ro,sync) jerry(rw,fsid=0,insecure,no_subtree_check,async)
Where,

  • rw : Allow clients to read as well as write access
  • ro : Read only access
  • insecure : Tells the NFS server to use unpriveledged ports (ports > 1024).
  • no_subtree_check : If the entire volume (/users) is exported, disabling this check will speed up transfers.
  • async : async will speed up transfers.

Save and close the file. Just restart nfs-server:
$ sudo /etc/init.d/nfs-kernel-server restart

Now your NFS sever is sharing /sales and /data directories.

How do I access shared directories from Linux client computer?

Login to Linux desktop system and enter the following command to mount shared directories. First, create a mountpoint on your client computer:
# mkdir /mnt/data
Mount the server:
# mount nfs-server:/data /mnt/data
You can also use following syntax for NFS client version 4:
# mount -t nfs4 -o proto=tcp,port=2049 nfs-server:/data /mnt/data
OR
# mount -t nfs4 -o proto=tcp,port=2049 192.168.1.100:/data /mnt/data
Where,

  • 192.168.1.100 : NFS Server IP address
  • proto=tcp,port=2049 : Force to use TCP protocol i.e. mount the NFS filesystem using TCP. The numeric value of the port to connect to the NFS server on. If the port number is 0 (the default) then query the remote host’s portmapper for the port number to use. If the remote host’s NFS daemon is not registered with its portmapper, the standard NFS port number 2049 is used instead.

How do I access my files?

To access shared files use regular commands or GUI file manager:
$ cd /mnt/data
$ ls
$ mkdir office
$ pwd

See Linux NFS client how to for more information.

To see mounted file system and available disk space use df command:
$ df -h
Output:

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              92G   23G   65G  26% /
varrun               1013M  128K 1013M   1% /var/run
varlock              1013M     0 1013M   0% /var/lock
udev                 1013M   84K 1013M   1% /dev
devshm               1013M     0 1013M   0% /dev/shm
/dev/sda1              98G   22G   77G  23% /media/sda1
/dev/sda5             274G   29G  245G  11% /share
/dev/sdb2             230G  4.9G  213G   3% /backup.iscsi
nfs-server:/data/     230G   31G  188G  14% /mnt/data

How do I see all shared directories from client computer?

Use showmount command to query the mount daemon (NFS Server) on a remote host for information about the state of the NFS server on that machine:
$ showmount -a
Output:

All mount points on nfs-server:
nfs-server:/olddisk
nfs-server:/sales
nfs-server:/data
nfs-server:/mp3s-video
nfs-server:/wwwroot

Source:

Ubuntu Linux NFS Server installation and Configuration

by on December 18, 2007 · 2 comments· LAST UPDATED December 18, 2007

in , ,

Q. How do I install and configure NFS 4 Server under Ubuntu Linux ?

A. In order to set NFS server you need to install the following packages:

=> nfs-kernel-server – Linux NFS Server

=> nfs-common – NFS Common programs

=> portmap – The RPC portmapper

Ubuntu Linux install NFS Server

Use apt-get command to install all required packages:
$ sudo apt-get install nfs-kernel-server portmap nfs-common

Sharing directory with /etc/exports

The NFS file systems being exported / shared using /etc/exports file. You need to specify directory (file system) to share with rest of the nfs client computers. The file /etc/exports serves as the access control list for file systems which may be exported to NFS clients.
$ sudo vi /etc/exports
To export /data directory to 192.168.1.0/24 network enter the following in /etc/exports file:
/data 192.168.1.0/24(rw,rsync)
To export /sales to hostname tom and jerry, enter:
/sales tom(ro,sync) jerry(ro,sync)
To export /users to 192.168.1.0/24 in read write format, enter:
/users 192.168.1.0/24(ro,sync) jerry(rw,fsid=0,insecure,no_subtree_check,async)
Where,

  • rw : Allow clients to read as well as write access
  • ro : Read only access
  • insecure : Tells the NFS server to use unpriveledged ports (ports > 1024).
  • no_subtree_check : If the entire volume (/users) is exported, disabling this check will speed up transfers.
  • async : async will speed up transfers.

Save and close the file. Just restart nfs-server:
$ sudo /etc/init.d/nfs-kernel-server restart

Now your NFS sever is sharing /sales and /data directories.

How do I access shared directories from Linux client computer?

Login to Linux desktop system and enter the following command to mount shared directories. First, create a mountpoint on your client computer:
# mkdir /mnt/data
Mount the server:
# mount nfs-server:/data /mnt/data
You can also use following syntax for NFS client version 4:
# mount -t nfs4 -o proto=tcp,port=2049 nfs-server:/data /mnt/data
OR
# mount -t nfs4 -o proto=tcp,port=2049 192.168.1.100:/data /mnt/data
Where,

  • 192.168.1.100 : NFS Server IP address
  • proto=tcp,port=2049 : Force to use TCP protocol i.e. mount the NFS filesystem using TCP. The numeric value of the port to connect to the NFS server on. If the port number is 0 (the default) then query the remote host’s portmapper for the port number to use. If the remote host’s NFS daemon is not registered with its portmapper, the standard NFS port number 2049 is used instead.

How do I access my files?

To access shared files use regular commands or GUI file manager:
$ cd /mnt/data
$ ls
$ mkdir office
$ pwd

See Linux NFS client how to for more information.

To see mounted file system and available disk space use df command:
$ df -h
Output:

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              92G   23G   65G  26% /
varrun               1013M  128K 1013M   1% /var/run
varlock              1013M     0 1013M   0% /var/lock
udev                 1013M   84K 1013M   1% /dev
devshm               1013M     0 1013M   0% /dev/shm
/dev/sda1              98G   22G   77G  23% /media/sda1
/dev/sda5             274G   29G  245G  11% /share
/dev/sdb2             230G  4.9G  213G   3% /backup.iscsi
nfs-server:/data/     230G   31G  188G  14% /mnt/data

How do I see all shared directories from client computer?

Use showmount command to query the mount daemon (NFS Server) on a remote host for information about the state of the NFS server on that machine:
$ showmount -a
Output:

All mount points on nfs-server:
nfs-server:/olddisk
nfs-server:/sales
nfs-server:/data
nfs-server:/mp3s-video
nfs-server:/wwwroot

Source: http://www.cyberciti.biz/faq/how-to-ubuntu-nfs-server-configuration-howto/