Wednesday 29 May 2013

Enable EPEL Repository on RHEL/CentOS/Scientific Linux 6

What is EPEL

Extra Packages for Enterprise Linux (EPEL) is a volunteer based effort from the Fedora project community  to create a repository of high quality additional packages for Enterprise Linux and it's clones CentOS and Scientific Linux.

Most of the cases the required packages may not be available on the standard yum repositories like base, extra or updates and you need to download the source code from the corresponding open source project site, compile it and then install it on our system.

If you enable EPEL you can install most of the packages using the yum command.

How to check EPEL has enabled on your system

#rpm -qa | grep epel

or you can use yum repolist to see EPEL package has enabled or not.

How to enable EPEL

Install the appropriate EPEL package to enable the EPEL repository on your system.

RHEL/CentOS/SL 6 32-Bit
# rpm -ivh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

RHEL/CentOS/SL 6 64-Bit
# rpm -ivh  http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

Disable EPEL Repository

You can disable accidental updates from the repository by setting enabled = 0 in the repo definition file in /etc/yum.repos.d/epel.repo.

Now you can use yum to install the available packages from the EPEL Repository.
#yum install --enablerepo=epel package_name, say rsnapshot.


Note: The EPEL configuration file is located under /etc/yum.repos.d/epel.repo

Monday 27 May 2013

How SMART your hard disk is?

SMART stands for Self Monitoring Analysis and Reporting Technology and the command smartctl makes use of BIOS SMART error detection.

To use smartctl you need to download smartmontools from the Sourceforge and install manually.

Download the latest source tarball

# wget http://sourceforge.net/projects/smartmontools/files/smartmontools/6.1/smartmontools-6.1.tar.gz/download (If you don't have wget/curl install it)

Uncompress the tarball

# tar xvzf smartmontools-6.1.tar.gz

This step creates a directory called smartmontools-6.1 containing the code. Go to that directory, build, and install

# cd smartmontools-6.1
#  ./configure
#  make
#  make install

you can install using yum too

#yum install smartmontools*

There are many options available with smartctl, I'm writing only few of them. for more info type smartctl -h.

1. To see SMART feature has enabled

# smartctl -i /dev/sda

2. To check the health of the harddisk

# smartctl -H /dev/sda

3. To perform  offline/short/long tests

# smartctl -t <offline/short/long> /dev/sda

Nagios plugin check_ide_smart is based on smartctl while the Windows version, smartfpa.vbs is based on WMI (Windows Management Instrumentation), which is basically a visual basic script checks if any SCSI and IDE disks are reporting SMART/PFA errors.

Note: To run smartctl you require root permission or the member of sudoers. 

Tera Term with tabs: An Alternate option to secureCRT SSH client

Tera Term has tab option too. What you have to do is check the collector while installing the Tera Term. Run collector at the end of installation or you can start collector from the Start menu.

You can setup the Tera Term the way you like (you can change the default font or even set the font we like) and don't forget to save Menu-->Setup-->Save setup..

Now you can edit C:\Program files\teraterm\teraterm.ini to have title first then host/port (option 5)

; Title format
; format ID: 5(00101) <title> - <host/port> VT/TEK
; format ID: 13(01101) <host/port> - <title> VT/TEK
TitleFormat=5

Right click on collector bar Configuration (D)-->POS (A)-->UP(T) tabs will be shown on top of the Tera Term menu.

Thursday 23 May 2013

Install PHP Extensions using PECL on RHEL/CentOS/Scientific Linux

Installing PHP extension is very easy, if you install using PECL, PHP Extension Community Library, a repository of PHP extensions that are made available to you via PEAR packaging system. To enable PECL

# yum install php-pear (which will give you pecl command)

I'm going to show you how to install the following PHP extensions.

1. phpredis
# pecl install redis
To load the extension on PHP startup, add "extension=redis.so" to /etc/php.ini
Restart web services (service httpd restart)
To verify this
# php -m | grep redis

2. MongoDB
# pecl install mongo
To load the extension on PHP startup, add a line: "extension=mongo.so" to /etc/php.ini
Restart web services (service httpd restart)

3. AMQP/RabbitMQ
Amqp requires these two packages installed: librabbitmq (RabbitMQ client itself) and librabbitmq-dev (dev headers etc.)
# yum install librabbit*
# pecl install amqp
Once the installation has completed we should add "extension=amqp.so" to /etc/php.ini
Restart web services (service httpd restart)

Issues: What if the desired extension is not available with PECL?
You need to install manually. The phpize command (you need to install php-devel to get this) is used to prepare the build environment for a PHP extension.

Download the tarball from the website using wget/curl, unpack using tar, read README/INSTALL, configure, build and install.

# wget/curl <link address>
# tar xvzf phpextnname.tar.gz or tar xvjf phpextnname.tar.bz2
# cd phpextnname
# phpize
# ./configure
# make
# make install

A successful install will have created extname.so and put it into the PHP extensions directory. You'll need to and adjust php.ini and add an extension=extname.so line before you can use the extension.
Restart web services (service httpd restart)
You can verify this by
# php -m | grep <php_extension_name>

Note: Don't delete your Makefile, if you want to uninstall your program at a later stage.
# make uninstall