Archive

Archive for the ‘Linux’ Category

signal 11 caught by ps | segmentation fault

November 15, 2009 1 comment

If you ever came across “segmentation fault” message in linux [in my case CentOS/RHEL], you know how annoying it can be. Basically it throws every time you invoke “ps | top | killall” – i.e any process related command.
Googleing gave me couple of tips. cyberciti, took my attention.

Since “ps” started to gave me the trouble, i decided to upgrade the “ps”

“ps” comes under a package, so fist i had to locate the package name which provide “ps”.
For that again i had to locate the “ps” executable :-
[root@server1 ~]# whereis ps
ps: /bin/ps /opt/mandriva_root/bin/ps /usr/share/man/man1p/ps.1p.gz

Then i locate the package name :-
[root@server1 ~]# rpm -qf /bin/ps
procps-3.2.7-11.1.el5

The procps package contains a set of system utilities that provide system information.

To update “procps” :-
[root@server1 ~]# yum update procps

“procps” update did the trick for me.

BR.

Categories: Linux

Little help on Perl

September 28, 2009 Leave a comment

What is Perl?

From the Perl documentation:

Perl is a high-level programming language with an eclectic heritage written by Larry Wall and a cast of thousands. It derives from the ubiquitous C programming language and to a lesser extent from sed, awk, the Unix shell, and at least a dozen other tools and languages. Perl’s process, file, and text manipulation facilities make it particularly well-suited for tasks involving quick prototyping, system utilities, software tools, system management tasks, database access, graphical programming, networking, and world wide web programming. These strengths make it especially popular with system administrators and CGI script authors, but mathematicians, geneticists, journalists, and even managers also use Perl. Maybe you should, too.

  • Get the Perl manual.
    • [root@goliath ~]# man perl
  • View Perl documentation.
    • [root@goliath ~]# man perldoc
  • Perl introduction for beginners.
    • [root@goliath ~]# perldoc perlintro
  • Perl OO tutorial for beginners.
    • [root@goliath ~]# perldoc perlboot
  • Perl OO tutorial, part 1.
    • [root@goliath ~]# perldoc perltoot
  • Perl OO tutorial, part 2.
    • [root@goliath ~]# perldoc perltooc
  • Perl OO tricks and examples.
    • [root@goliath ~]# perldoc perlbot
  • Perl regular expressions quick start.
    • [root@goliath ~]# perldoc perlrequick
  • Perl regular expressions tutorial.
    • [root@goliath ~]# perldoc perlretut
  • List the modules that come pre-installed with the standard Perl package.
    • [root@goliath ~]# perldoc perlmodlib
  • Lists the optional modules that are installed in your system that don’t come with Perl by default.
    • [root@goliath ~]# perldoc perllocal
  • Check if a module is installed
    • [root@goliath ~]# perl -MTie::Hash -e 1
  • Get a list of installed modules – Using a script
    • [root@goliath ~]# perl -MFile::Find=find -MFile::Spec::Functions -Tlw -e ‘find { wanted => sub { print canonpath $_ if /\.pm\z/ }, no_chdir => 1 }, @INC’

CPAN
CPAN is the Comprehensive Perl Archive Network, a large collection of Perl software and documentation. Note that CPAN is also the name of a Perl module, CPAN.pm, which is used to download and install Perl software from the CPAN archive.
Reference – http://www.cpan.org/

  • Automatic installation using the CPAN module
    • [root@goliath ~]# perl -MCPAN -e ‘install Net::DNS’
  • Installing cpan modules manually
    • unzip
    • perl Makefile.PL
    • make
    • make test
    • make install

Hope thses tip’s will help you to get on with perl.

Categories: Linux

Some book’s i value most

Here’s some of the books .. i simply can’t live with out …

  • Red Hat Certified Engineer Linux Study Guide – Michael Jang
  • Linux Administration Handbook – Evi Nemeth , Garth Snyder , Trent R. Hein
  • Open Source Web Development with LAMP – James Lee , Brent Ware
  • Using Unix – Peter Kuo
  • Beginning PHP5,Apache and MySQL Web Development – Elizabeth Naramore , Jason Gerner , Yann Le Scouarnec , Jeremy Stolz , Michael K. Glass
Categories: Linux

Vote for OrangeHRM here !

Love this application. It’s FREE and It’s open source.

Categories: Linux

Create RHEL/CentOS Boot Disk

Floppies no longer supported in RHEL/CentOS-5. So you need to create boot CD/DVD.

  • Put the RHEL/CentOS-5 DVD/first CD to CDROM/DVDROM -> mount the device.

IF you CD/DVD not get automount ->

  • First find the device -> dmesg | grep -i dvdrom -> then
  • mount the device -> mount /dev/device /mnt/destination

Locate the <images> directory from the CD/DVD contents. Get burn <boot.iso> image to CD/DVD. You can use either k3b OR cdrecord to get this done.

πŸ™‚

Categories: Linux

NFS kickstart installation

Installing Linux includes several steps. Installation will take some time depending on the number of packages you have selected. If you installing Linux to a single machine, then it’s no big deal. But if you have to perform installation on several machines, then the process is cumbersome.

So the solution is to have a installation server. We discuss in a previous post the setup steps involves in a NFS , FTP installation server. There you boot from a installation media and select installation method, then installation will start. But still need to go through all the installation steps. So in order to make life easy we can make the installation automated by the use of kickstart installation provided by RHEL/CentOS.

To start with kickstart. Invoke “system-config-kickstart” (shell) OR Applications->System Tools->Kickstart
If don’t have kickstart already installed, get it installed.

  • yum -y install system-config-kickstart

Fill all the necessary fields. Save the changes. Place it some where with in the reach of NFS. Let’s say, /var/ftp/pub/ks.cfg
/var/ftp/pub/ -> should be a exported file system by now.

  • showmount -e hostname -> will list the nfs shares of hostname.

Now you ready to start the installation. Boot the system from the boot DVD/CD. In the boot prompt, type :-

  • boot:linux ks=nfs:10.0.0.1:/var/ftp/pub/ks.cfg

Press Enter.System should get on with the installation.Β  CHEERS πŸ™‚

NOTE :- IP addresses used here are belong to IPV4 private ranges.Replace it with your’s.

Categories: Linux

RHEL/CentOS FTP Installation

As the first step of creating FTP installation server, create a directory under /var/ftp/pub. Let say CentOS-5.2. Copy all CD/DVD contents to the created directory.

  • mkdir -p /var/ftp/pub/CentOS-5.2

Then locate vsftpd configuration file.

  • vim /etc/vsftpd/vsftpd.conf – There …..

anonymous_enable=YES -> will give anonymous access to vsftp
local_enable=YES -> will allow access to local user’s
xferlog_file=/var/log/vsftpd.log -> will create separate log file for vsftp. Once done save the file.

  • service vsftpd restart -> will restart the vsftd service. vsftpd set up should be OK by now.

Next boot the system from boot CD/DVD. Select the Language , keyboard , installation method. Choose FTP for the installation method. Choose static OR DHCP under TCP/IP configuration.

NOTE :- If you choosing DHCP, you should have DHCP server in place already. I will be discussing steps involved in a DHCP server setup in a separate post. So watch out. πŸ™‚

Under the FTP setup ->
FTP site name:10.0.0.1 – type the IP address of the server.
ftp://10.0.0.1 -> WRONG FORMAT
CentOS/RHEL directory:pub/CentOS-5.2 – give the path relative to the /var/ftp directory
/var/ftp/pub/CentOS-5.2 -> WRONG FORMAT

In the vsftp.conf if you have set -> anonymous_enable=NO
Then in the FTP setup, check the “Use non-anonymous ftp” and provide the authentication information for the user.

If everything went right system should start the installation by now.Β  πŸ™‚

Categories: Linux

RHEL/CentOS NFS installation

To set up NFS installation server, first locate and edit /etc/exports with the preferred NFS path.

  • vim /etc/exports -> put the path. Let say, /var/ftp/pub/CentOS-5.2

NOTE :- For file editing you can use your favorite file editor. In this case I’m using “vim”, which I’m very much comfortable with. In your case it might be some thing else. Can be either nano , emacs OR gedit. If you newbie, then I’m recommending vim for you.

TO GET START WITH VIM, Type “vimtutor” in your shell. The Vim tutor.

Back on NFS again…..

  • exportfs -ua -> will umount all exported file systems
  • exportfs -ra -> will remount all exported file systems
  • showmount -e hostname -> will list all exported file systems in hostname

If iptables ON, nfs probably won’t work. Most probably your nfs ports must be blocked by firewall. First clarify whether the firewall is turned on OR off in you machine.

  • service iptables status – will give the iptables status

If iptables turned on, then get a list of applied iptables rules. To do so,

  • iptables -L | less – will list current iptables rules.

If you see four strings in the below format, probably nfs might work over the firewall for you.

iptables -A INPUT -s 192.x.x.x/24 -p tcp –dport 111 -j ACCEPT
iptables -A INPUT -s 192.x.x.x/24 -p udp –dport 111 -j ACCEPT
iptables -A INPUT -s 192.x.x.x/24 -p tcp –dport 2049 -j ACCEPT
iptables -A INPUT -s 192.x.x.x/24 -p udp –dport 2049 -j ACCEPT
NOTE :- IP addresses used here are belong to IPV4 private ranges. Replace it with yours.

If not we need to allow nfs over iptables. To allow NFS over iptables :-

  • iptables -A INPUT -j ACCEPT

NOTE :- More general rule that will allow all incoming traffic through the firewall. Later I’ll discuss nfs over firewall in much detail in some other post.

  • service iptables save; restorecon -R /etc/sysconfig/* – will save iptables settings and restore selinux context.
  • service iptables restart.

nfs should be OK over iptables by now. Let’s get start the installation.

Start system with the help of the boot CD/DVD. In the boot: prompt, Either you can press enter and go ahead with booting the system, which later prompt for the installation method OR Press F2 and go to options and invoke “linux askmethod”. In each you’ll be asked to select language , keyboard , and installation method. Select “NFS” for installation method.

To Configure TCP/IP, you can use either static IP or DHCP. If you have DCHP server in place use DHCP or use a correct static IP.

NOTE :- you will find DHCP settings in a up coming post.

In NFS setup ->

under the nfs server name : use name OR IP of the NFS server
under the CentOS/RHEL directory : /use/correct/path/

If everything went right system should start the installation. πŸ™‚

Categories: Linux