Centos No-IP setup

Howto Install no-ip utility in CentOS to fix dynamic ip issues using a subdomain from no-ip.org.

First go to no-ip webpage http://www.no-ip.com

Register and confirm your email, then login your account and add a host. Download the linux client As user root execute:

cd;wget "https://www.no-ip.com/client/linux/noip-duc-linux.tar.gz"
tar -xvf noip-duc-linux.tar.gz
cd noip-2.1.9-1
make
make install

Create a configuration file:

noip2 -C

The script will ask you which ethernet port to use, then write your email account you use to register with no-ip, then the password, finaly choose the host you will be using.

Now lets create init file to wake up the deamon every time we start our box.

cd /etc/init.d
nano noip2d

Add the following in noip2d :

# chkconfig: 345 20 80
# description: Starts noip2 deamon to check for dynamic ip \
# and updates new ip to no-ip.org dns cache.
#######################################################
#! /bin/sh
# . /etc/rc.d/init.d/functions # uncomment/modify for your killproc
case "$1" in
start)
echo "Starting noip2."
/usr/local/bin/noip2
;;
stop)
echo -n "Shutting down noip2."
echo "."
for i in `noip2 -S 2>&1 | grep Process | awk '{print $2}' | tr -d ','`
do
noip2 -K $i
done

##killproc -TERM /usr/local/bin/noip2
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
exit 0
#######################################################

Save and Exit, now lets work on the permits:

 chmod +x /etc/init.d/noip2d
 chmod 700 /usr/local/bin/noip2
 chown root:root /usr/local/bin/noip2
 chkconfig --levels 3 noip2d on
 noip2d start

Verify the deamon is running:

 ps aux | grep noip2

If everything goes as plan, you have no-ip service in your box and will be updating every time your ip changes.

Finaly try to see your machine in your browser. http://myhostname.no-ip.org

Thanks for reading.

Adding a XFS filesystem to CentOS 5

Howto use enterprise Linux ‘extras’ to mount a XFS filesystem on a CentOS v5.2 VM

Install RPM’s
Note: Due to this bug (3205), install binutils to overcome the error “xargs: nm: No such file or directory” while installing kmod-xfs-xen.

# yum install binutils
# yum install xfsprogs yum-kmod kmod-xfs-xen

# mkfs.xfs -f /dev/sda1

Check

A chunk of disk (2TB) has been allocated to a LVM partition for the VM, which is formatted with XFS. The device is mapped into the VM as /dev/xvdc1 (i.e. a whole device, c.f. partitioned device).

Before using the filesystem, perform a check:

# xfs_check /dev/xvdc1

Note: xfs_check requires a significant chunk of memory to run. With 2Gbyte of swap and 1Gbyte of RAM a check was unsuccessful.

Mount
Mount the disk by using it’s volume label. The label can be verified with the xfs_admin program:

# xfs_admin -l /dev/xvdc1
label = “purple-files”

Add the mount entry to ‘/etc/fstab’ so that the filesystem is automatically mounted at the next restart.

LABEL=purple-files /files xfs defaults 0 0
Mount the filesystem

# mount /files

NOTE: CENTOS 6.X

Centos 6.X (64bit) already supports XFS in kernel. You only need to
install xfsprogs package to mount xfs filesystems.

just yum install xfsprogs (it is included in centos 6.2 base)

Appendices

# yum install xfsprogs yum-kmod kmod-xfs-xen

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
kmod-xfs-xen x86_64 0.4-2 extras 256 k
xfsprogs x86_64 2.9.4-1.el5.centos extras 1.3 M
yum-kmod noarch 1.1.10-9.el5.centos base 15 k

Transaction Summary
=============================================================================
Install 3 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 1.6 M

Search entire filesystem for text in Linux

To search for text through the entire filesystem from the current path down in Linux use the following :

find / -type f -print0 | xargs -0  grep -l  "string to search" 2>/dev/null

Force fsck on next boot

Since live systems are near to impossible to fsck when running (unless you can pull one side of the mirror then clone it to the other (very messy).

Become Root

sudo su –

or

su –

As root create file in root folder a file named forcefsck

touch /forcefsck

Restart the system.

shutdown -r now


        

Nagios fail to run ifstatus

/usr/local/nagios/libexec/check_ifstatus -H localhost

&nbsp

Can’t locate Net/SNMP.pm in @INC (@INC contains: /usr/local/nagios/libexec /usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5 /usr/share/perl5 .) at ./check_ifstatus line 38.

BEGIN failed–compilation aborted at ./check_ifstatus line 38.

 

Solution:

yum install perl-Net-SNMP

iptraf boxes do not show up well

On one of my servers running CentOS 6 I had iptraf not displaying the boxes in dialogues correctly.  It’s usually fixed by updating the session configuration on putty to translate to utf-8 but in this case that did not work.

While the system is a clone from another machine where it works well (puppet confirms) all I had to do is create an alias in my ./bashrc for iptraf to NCURSES_NO_UTF8_ACS=1  iptraf as such :

# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

alias iftop='NCURSES_NO_UTF8_ACS=1 iftop'
alias iptraf='NCURSES_NO_UTF8_ACS=1  iptraf'

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

As you can deduce the same issue and solution happened with iftop. 🙂

Oh the result :

Ejnoy 🙂

Quick How to install tomcat

# yum install yum-priorities

# rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

Install the JPackage Project repository.

(more…)

mkpasswd on Centos 6.x

I happened to need mkpasswd command in CentOS 6.3 minimal:

While there is no package for the tool it can be found in expect command. So run as shown :

yum install expect

(more…)

Install Exim on centOS

Exim is no longer available as a standard package, but as with most pieces of Linux software, it’s still only a few commands away. If you want to install Exim to use, or just to try, all you need do is:

Install the EPEL (Extra Packages for Enterprise Linux) repository:

wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm
rpm -i epel-release-6-5.noarch.rpm

Install the Exim package

yum install -y exim-mysql

Disable Postfix (the default MTA)

service postfix stop
chkconfig postfix off

Set Exim as the default MTA

alternatives --config mta

And finally start Exim

chkconfig exim on
service exim start

You should now be running Exim, and probably want to visit the official documentation site.