Tuesday, July 26, 2011

Linux OS Image Backup & Restore Guide (Using PING Tool)

Using PING for backup and Restore Linux OS Images

PING (Ping is not Ghost) is a live Linux ISO, created to take image backups of HDD/partitions, either locally or over the network. It can be burnt on a CD and booted, or integrated into a PXE / RIS environment.


Its a good idea to take an image backup of all the servers. so that, if something goes wrong, we can restore easily.


Look at the Quick HOWTO Guide for Backup and Restore Linux Images using PING Tool


Download PING from here

Hope this Article will help System Admins. Using PING you can take image backup of Linux and Windows Operating Systems.

Upgrade iLO firmware from Linux shell


You can upgrade the iLO firmware from the Linux shell itself.
1. Download the right firmware version from HP site and upload it to the server which you want to upgrade.

2. Now login to the server and simply run the file which you downloaded from hp site.

mytestsrv1:/var/tmp # ./CP014890.scexe
FLASH_iLO2 v1.12 for Linux (Aug 31 2009)
Copyright 2009 Hewlett-Packard Development Company, L.P.
Firmware image: ilo2_206.bin
Current iLO 2 firmware version  2.01; Serial number ILOXXXXXXX
Component XML file: CP014890.xml
CP014890.xml reports firmware version 2.06
This operation will update the firmware on the
iLO 2 in this server with version 2.06.
Continue (y/N)?y
Current firmware is 2.01 (Aug 04 2010 11:16:29)
Firmware image is 0x300000 bytes
Committing to flash part...
******** DO NOT INTERRUPT! ********
Flashing completed!
Attempting to reset device.
Succeeded.
Waiting for iLO 2 to reboot...
iLO 2 reboot completed. 

That's all. you are done. iLO firmware has been upgraded to newer version.

Wednesday, July 20, 2011

12 Reasons Why Every Linux System Administrator Should be Lazy

System administrators job is not visible to other IT groups or end-users. Mostly they look at administrators and wonder why sysadmins don’t seem to have any work.

If you see a sysadmin who is always running around, and trying to put down fire, and constantly dealing with production issues, you might think he is working very hard, and really doing his job. But in reality he is not really doing his job.
If you see a sysadmin (UNIX/Linux sysadmin, or DBA, or Network Administrators), who doesn’t seem to be doing much around the office that you can see, he always seem to be relaxed, and he don’t seem to have any visible work, you can be assured that he is doing his job.
The following are the 12 reasons why a lazy sysadmin is the best sysadmin.
  1. Who is the boss? The main reason why lazy sysadmin is the best sysadmin is because of his attitude. They look at the machines little differently than how other IT departments looks at them. There is a difference between developers and sysadmins. Developers thinks they are here to serve the machines by developing code. There is nothing wrong in this approach, as developers have lot of fun developing the code. But, sysadmins think other way around. They think the machines are there to serve them. All they have to do is feed the machine and keep it happy, and let the machine do all the heavy duty job, while they can relax and just be lazy. The first step in being a lazy sysadmin is a slight change in attitutde, and letting the machine know that you are the boss.
  2. Write scripts for repeated jobs. Being lazy means being smart. A smart sysadmin is a master in all scripting languages (bash, awk, sed, etc.,). Anytime he is forced to do some work, and if there is a remote possibility that the work might be needed in the future, he writes a script to complete the job. This way, in the future when he was requested to do the same job, he doesn’t have to think; he just have to execute the script, and get back to being lazy.
  3. Backup everything. Being lazy means taking backup. A lazy sysadmin knows that he has to put little work in creating a backup process, and write backup scripts for all critical systems and applications. When the disk space is not an issue, he schedules the backup job for every application, even for those that are not critical. This way, when something goes wrong, he doesn’t have to break a sweat, and just have to restore from the backup, and get back to whatever lazy stuff he was doing before.
  4. Create a DR plan. Sysadmins doesn’t like to run around when things go wrong. When things are running smoothly, they take some time to create a DR plan. This way, when things go wrong, they can follow the DR plan and quickly get things back to normal, and get back to being lazy again.
  5. Configure highly redundant systems. Lazy sysadmins don’t like to get calls in the middle of the night because of some silly hardware failure problem. So, they make sure all the components are highly redundant. This includes both hardware and software. They have dual network card configured, they have dual power, they have dual hard drives, they have dual of everything. This way, when one component fails, the system still keeps running, and the lazy sysadmin can work on fixing the broken component after he wakes-up in the morning.
  6. Head room for unexpected growth. Lazy sysadmin never allows his system to run in full capacity. He always has enough head room for unexpected growth. He make sure the system has plenty of CPU, RAM and hard disk available. When the business unit decides to dump tons of data over night, he doesn’t have to think about how to handle that unexpected growth.
  7. Be proactive. Being lazy doesn’t mean you just sit and do nothing all the times. Being lazy means being proactive. Lazy sysadmins hate being reactive. They are always anticipating issues and anticipating growth. When they have some free time in their hand, they always work on proactive projects that helps them to avoid unexpected future issues, and to handle future growth.
  8. Loves keyboard shortcut. Lazy sysadmin knows all the keyboard shortcuts for all his favorite applications. If he spends significant time everyday on an application, the first thing he’ll do is to master the keyboard shortcut for that application. He likes to spends less them on the application to get his things done, and likes to get back to being lazy.
  9. Command line master. Every lazy sysadmin is a command line master. This applies to Linux sysadmin, dba, network administrator, etc. If you see an administrator launching a GUI, when the same task can be done from the command line, then you know he is not a lazy sysadmin. There are two reasons why lazy sysadmin loves command line. For one, he can do things quickly at the command line. For another, it makes him feel that he is the boss and not the system. When you use the command line, you are in control, you know exactly what you want to do. When you use GUI, you are at the mercy of the GUI workflow, and you are not in control.
  10. Learns from mistake. Lazy sysadmin never likes to make the same mistake twice. He hates to work on unexpected issues. But, when an unexpected issue happens, he works on fixing it, and thinks about why it happened, and he immediately puts necessary things in place so that the same issue doesn’t happen again. Working on the same problem twice is a sin according to lazy sysadmin. He likes to work on the problem only once, do things to prevent the same mistake from happening in the future, and get back to being lazy.
  11. Learn new technology. There is nothing wrong in learning a new technology to get a better job, or just to keep up with technology growth. But, lazy sysadmin doesn’t learn new technology for this reason. Instead, he learns new technology because he likes to be in control of the systems all the times. He knows he is the boss, and not the machine. So, when a new technology comes, he takes time to study them. Now he has new tools that he can use to keep the system busy, while he continue to be lazy. He learns new technology just for selfish lazy reason.
  12. Document everything. Not every lazy sysadmin does this. Only the best lazy sysadmins does this. You see, lazy sysadmin never likes to be disturbed when he is on the beach enjoying his vacation. So, what does he do? He documents everything, so that when he is not around, other junior sysadmins can do the routine job, and get things moving without disturbing his vacation. There is also another reason for the lazy sysadmin to document everything; because he forgets things. Since he is lazy, he tends to forget what he did a month ago. Since he never likes to think and research the same topic twice, he documents everything, and when he needs to do the same thing in the future, he goes back to his documentation to understand what he did earlier.
Probably you are now convinced that begin a lazy sysadmin is not that easy. It is lot of hard work. If you are not a sysadmin, you can now appreacie a lazy sysadmin when you see one. If you are sysadmin, and always running around, now you know what you need to do to be lazy.

Friday, July 15, 2011

Share Internet with squid & Iptables


implement a nice trick to share internet with squid and block website using port redirection.
open your sysctl.conf
vim /etc/sysctl.conf and change line
net.ipv4.ip_forward = 1 (by default its 0)
save & exit from file 
1. Install Squid
yum -y install squid*
2. Edit Squid.conf file 
To Block website apply copy and paste this below lines as per your source network
acl blocksite dstdomain .orkut.com
http_access deny blocksite 
acl our_networks src
http_access allow our_networks
vim /etc/squid/squid.conf then search for http_port you will see 3128 by default port there so change it to 8888
save & exit from file
3. service squid restart
4.Now share your internet using iptables by executing following command:-
iptables -t nat -A POSTROUTING -o eth1 < Live-IP-Lan-Card> -j MASQUERADE
5. Now redirect your 80 port to 8888 
iptables -t nat -A PREROUTING -i eth0 (Local-Lan-Card) -p -tcp –dport 80 -j REDIRECT –to-port 8888
Now your Outlook will work directly without doing anything but client will not able to surf block websites which you blocked in squid.

Mounting NTFS Partition on RHEL 5.x


irst Setup RPMForge Repository by running this command :- wget http://apt.sw.be/redhat/el5/en/i386/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
Install DAG’s GPG Key by executing following command:-
rpm – -import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
Verify the package you have downloaded:-
rpm -K rpmforge-release-0.3.6-1.el5.rf.*.rpm
Install the package :-
rpm -i rpmforge-release-0.3.6-1.el5.rf.*.rpm
or if you dont find packages here try some other repositories like rpmfusion, epel hope you will get it..
after this run yum list command if that runs completely
then Intall gcc packages from your RHEL CD/DVD or any other repository where gcc packages available.
GCC Packages is must for Mounting NTFS.
After GCC installed
run this command :-
yum -y install fuse fuse-ntfs-3g dkms dkms-fuse
if you are running xen kernel then only run this command
yum install kernel-xen-devel
if you are running PAE kernel then only run this command
yum install kernel-PAE-devel
Now Make Entry in your /etc/fstab file
make backup of your /etc/fstab by executing this command
cp /etc/fstab /etc/fstab.bkp
now open your /etc/fstab file in your favorite editor
vim /etc/fstab like below example
/dev/sda1          /mnt/ntfs      ntfs-3g      defaults       0  0

save & exit from file
Then execute this two commands in exact order
umount -a
mount -a
That’s it. Now You will able to see NTFS by executing df -kh or access your NTFS Volume from your mount point.

Fedora 10 Autologin


Took a small detour to Fedora land, I found no option how to enable autologin in gnome, so here’s how to do it.
Please remember to back up your files first! :
cp /etc/gdm/gdm.schemas /etc/gdm/gdm.schemas.backup
nano /etc/gdm/gdm.schemas
and locate
`
daemon/AutomaticLoginEnable
b
false  Change this to true.
`
And finally edit this:
`
daemon/AutomaticLogin
s
  Put the username here.
`
If you have look a bit further down, you’ll find options how to enable timed login too, if you use that instead you must leave auto login disabled.

10 obscure Linux distributions


1: Damn Vulnerable Linux

Damn Vulnerable Linux is exactly what it sounds like. According to the Web site, “Damn Vulnerable Linux (DVL) is everything a good Linux distribution isn’t. Its developers have spent hours stuffing it with broken, ill-configured, outdated, and exploitable software that makes it vulnerable to attacks.” What value would such a distribution hold? Training. The idea behind this distribution is to train Linux admins. And what better way to train someone than to hand them a broken distribution to fix? With older/broken versions of Apache, MySQL, PHP, FTP, and SSH, your admins in training will have their hands full.

2: CAINE Linux

CAINE Linux might be one of the niftiest of the niche Linux distributions. CAINE stands for Computer Aided INvestigative Environment. Basically, it’s CIS Linux designed for digital forensics. CAINE includes TheSleuthKit, Autopsy Forensic Browser, steganography tools, and plenty of tools for wiping hard drives. This distribution also includes a semi-automated tool for the compilation of the final report on a digital forensics investigation.

3: Zeroshell

Zeroshell is an interesting Linux distribution aimed at embedded systems — specifically, networking hardware. It’s administrated through a Web interface and can provide all networking services required for a LAN. With Zeroshell, you can set up Failover, RADIUS, Captive Portal, Quality of Service management, HTTP Proxy, Wireless Access Point, Host-to-LAN VPN, LAN-to-LAN VPN, Routing with Static or Dynamic IP Addressing, and much more.

4: Parted Magic

Parted Magic is similar to the Gparted Live CD, only it adds a few more tools (such as Clonezille, TestDisk, Partimage, Trucrypt, G4L, SuperGrubDisk, and ddrescue). This type of tool is ideal for managing partitions as well as troubleshooting drives and various issues. This particular Linux distribution works on x86 hardware and requires 256MB of RAM to operate in. Parted Magic can work with the following partition types: ext2, ext3, ext4, fat16, fat32, hfs, hfs+, jfs, linux-swap, ntfs, reiserfs, reiser4, and xfs.

5: Tiny Core

Tiny Core is exactly what the name implies. It’s a tiny Linux distribution, coming in at under 10 MB (with a GUI included). But don’t think Tiny Core is limited to tiny tasks. Once it’s installed, you can begin adding the applications you need. But by default, you will have a minimal X desktop with networking. Tiny Core is based on Tiny X, Busybox, Fltk, and the 2.6 kernel.

6: CAELinux

CAELinux focuses on computer aided engineering. It’s based on open source titles like Salome,Code_Aster, and OpenFOAM. CAELinux is an Ubuntu-based distribution that can simulate physics involving nonlinear thermo-mechanics, coupled fluid-structure dynamics, seismic/nonlinear explicit dynamics, contacts, visco-plasticity, fluid dynamics, heat exchange, convection heat transfer and radiation, and electro dynamics. This distribution offers a wiki with plenty of documentation for each application.

7: Musix

Musix is a Knoppix-Debian distribution aimed at artistic and educational uses in the field of music. It’s a live CD, so it can be run without installation. The two applications that draw the most attention on this distribution are Rosegarden and Ardour. Between these two applications, you will have everything you need for music composition and recording. You will also find tools like Inkscape, Blender for 3D animation, and Cinelerra for video editing.

8: SLAMPP

SLAMPP is a slackware-based Live distribution that is truly a one-stop-shop for system server needs. With this distribution running, you are ready with HTTP, FTP, DHCP, DNS, and many more servers. And this can all be achieved without even installing the distribution! That’s right. By using a live DVD, you can have all of those servers up and running in no time. SLAMPP is the “instant home server” distribution.

9: Ubuntu Christian Edition

Ubuntu Christian Edition is, as its name implies, an Ubuntu-based Linux distribution geared toward the Christian faith. This distribution includes a plethora of faith-based software (such as Xiphos,OpenSong, and E-Sword, along with tools for parental controls.

10: Ubuntu Satanic Edition

From its name, you might think Ubuntu Satanic Edition is a converse distribution to Ubuntu Christian Edition. It’s not. According to the Web site, USE “brings together the best free software and free metal music on one CD.” The “Undead CD” is based on Ubuntu 10.04 and includes all the standard software, along with a mélange of typically dark, heavy metal-esque themes, as well as a full 50-minute album of the best Creative Commons-licensed metal music. What else does USE offer that standard Ubuntu doesn’t? Nothing more than some serious attitude that will ensure your fellow workers know who rocks harder!