Showing posts with label code. Show all posts
Showing posts with label code. Show all posts

Saturday, 9 July 2011

20 Linux System Monitoring Tools

20 Linux  System Monitoring Tools Every SysAdmin Should Know



Need to monitor Linux server performance? Try these built-in command and a few add-on tools. Most Linux distributions are equipped with tons of monitoring. These tools provide metrics which can be used to get information about system activities. You can use these tools to find the possible causes of a performance problem. The commands discussed below are some of the most basic commands when it comes to system analysis and debugging server issues such as:
  1. Finding out bottlenecks.
  2. Disk (storage) bottlenecks.
  3. CPU and memory bottlenecks.
  4. Network bottlenecks.

#1: top - Process Activity Command

Fig.01: Linux top commandThe top program provides a dynamic real-time view of a running system i.e. actual process activity. By default, it displays the most CPU-intensive tasks running on the server and updates the list every five seconds.

Commonly Used Hot Keys

The top command provides several useful hot keys:


Hot KeyUsage
tDisplays summary information off and on.
mDisplays memory information off and on.
ASorts the display by top consumers of various system resources. Useful for quick identification of performance-hungry tasks on a system.
fEnters an interactive configuration screen for top. Helpful for setting up top for a specific task.
oEnables you to interactively select the ordering within top.
rIssues renice command.
kIssues kill command.
zTurn on or off color/mono


#2: vmstat - System Activity, Hardware and System Information

The command vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity.


# vmstat 3
Sample Outputs:

Friday, 8 July 2011

Installation Guide : Fedora 15

Things you need to get started?

· You will need one of the Fedora 15 Live CD ISO images that corresponds to your hardware architecture (i386 or amd64), and which can be downloaded from fedora home page.
· You will need a 700 MB CD, because when the download will finish, you need to burn the ISO image with your favorite CD/DVD burning application (Brasero on Linux, or Nero, CDBurnerXP, Roxio on Windows).
· You must have a minimum of 10 GB free space on your hard drive, for the Fedora 15 installation.

Great, now let's begin. Insert or leave the CD in your CD/DVD-ROM device, and reboot the computer in order to boot from it. Hit the F8 or F12 key (depending on your BIOS) to select the CD/DVD-ROM as the boot device. Boot from the CD.



Fedora 15 will automatically boot in 10 seconds. 




Review image


Wait for the system to load.......


Wednesday, 6 July 2011

Installing Linux with no CD-ROM drive or modem

Most Linux distributions come on a CD-ROM. You can also download them from an FTP site, but that
requires an Internet connection. What if you have a system with no CD-ROM drive or Internet connection,
like an old 486 laptop? The trick here is to have another desktop system with a CD-ROM drive, and a
null-modem serial cable.
I will show you how to do it with Slackware. It is also possible with most other Linux distributions. Insert the
Linux CD-ROM in the drive on the desktop and copy the A (base) and N (networking) packages on diskettes.
You need at least those in order to use a serial cable to transfer the rest of the packages.
Now you need to enable NFS networking on the desktop, and allow the laptop to connect. You can give a
temporary IP address to the laptop, like 192.168.1.11 that you need to add to your /etc/exports file on your
desktop.


To link the two systems together, this is what you need to type on the laptop:

/usr/sbin/pppd -detach crtscts lock 192.168.1.11:192.168.1.10 /dev/ttyS1 115200

And this on the PC:

/usr/sbin/pppd -detach crtscts lock 192.168.1.10:192.168.1.11 /dev/ttyS1 115200

This is assuming the cable is linked to ttyS1 (COM2) on both systems.
With NFS, you can mount the CD-ROM drive remotely and tell the installation program to use a specific
path to install the remaining packages.


Mount the CD-ROM with a command like this:

mount -tnfs 192.168.1.10:/cdrom /mnt

Then run the installation program:
setup

and enter the new path for the packages files.

Tuesday, 5 July 2011

How To Create A linux Boot CD


The kernel in Fedora Core 2 and higher is too big to fit on a floppy disk, so you'll have to create a boot CD instead. Here are the steps.
1. Each installed kernel has a dedicated subdirectory for its modules in the /lib/modules directory. Get a listing of this directory. Here there are two installed kernels; versions 2.6.5-1.358custom and 2.6.8-1.521.
[root@bigboy tmp]# ls /lib/modules/
2.6.5-1.358custom  2.6.8-1.521
[root@bigboy tmp]#
2. Select the desired kernel and use the mkbootdisk command to create a CD ISO image named /tmp/boot.iso of one of the kernels, in this case 2.6.8-1.521:
[root@bigboy tmp]# mkbootdisk --iso --device /tmp/boot.iso \
                     2.6.8-1.521
3. Burn a CD using the image. This creates a boot CD with the specified kernel, named vmlinuz, and a scaled-down version of the grub.conf configuration file named isolinux.cfg, both located in the isolinux subdirectory of the CD. This example mounts the newly created CD-ROM and takes a look at the isolinux.cfg file to confirm that everything is okay.
[root@bigboy tmp]# mount /mnt/cdrom
[root@bigboy tmp]# ls /mnt/cdrom/isolinux/
boot.cat  boot.msg  initrd.img  isolinux.bin  isolinux.cfg   TRANS.TBL  vmlinuz
[root@bigboy tmp]# cat /mnt/cdrom/isolinux/isolinux.cfg
default linux
prompt 1
display boot.msg
timeout 100
label linux
        kernel vmlinuz
        append initrd=initrd.img ro  root=/dev/hda2
[root@bigboy tmp]#
When you reboot your system with the CD, the boot process automatically attempts to access your files in the /root partition and boot normally. The only difference being that the kernel used is on the CD.

Updating The Kernel Using RPMs

It is also possible to install a new standardized kernel from an RPM file. As you can see, it is much simpler than creating a customized one.
To create an additional kernel using RPMs, use the command
[root@bigboy tmp]# rpm -ivh kernel-file.rpm
To replace an existing kernel using RPMs, you need only one line
[root@bigboy tmp]# rpm -Uvh kernel-file.rpm

Conclusion

Building a customized Linux kernel is probably something that most systems administrators won't do themselves. The risk of having a kernel that may fail in some unpredictable way is higher when you modify it, and, therefore, many system administrators hire experts to do the work for them. After reading this chapter, at least you will have an idea of what is going on when the expert arrives, which can help considerably when things don't go according to plan.