Friday, October 29, 2010

Stopping Ping Replies

Hi Guys,

I have a new trick for you. I recently read saw somewhere on the net a trick to stop ping replies from a server but i found it a long and complex because i can do that in just one line.
I mean when we ping a server using its name or IP it give replies to us. For example: when i ping 4.2.2.2 i get result as:

PING 4.2.2.2 (4.2.2.2) 56(84) bytes of data.
64 bytes from 4.2.2.2: icmp_seq=1 ttl=53 time=288 ms
64 bytes from 4.2.2.2: icmp_seq=2 ttl=53 time=287 ms
.....so on

So we can stop these replies from our server just by editing permissions of the ping command.

Check the permissions of the command ping by the following command:

# ll /bin/ping
It will return results something like:
-rwsr-xr-x. 1 root root 42008 Mar  5  2010 /bin/ping

Now, As we can see that it has the sticky bit for the user ("s" in the permission). This helps to run the command as a root at the execution time.

To stop replies just remove this sticky bit from the permission and you are done.
# chmod u-s /bin/ping

Now, Your server won't reply to the pings.

Making your own YUM Server

Hi Guys,

I am here to tell you how to setup YUM server. I hope that you know what is a YUM server, if not no worries. A YUM server is rpms/packages manager which resolves the various dependencies needed by the packages and installs the software. For further details on YUM server you can google it.....:)

We can setup our YUM Server on any Distribution that supports it. I am using Fedora13 to setup a YUM server for the fedora13 itself. Same procedure will also be useful for RHEL(Redhat Enterprize Linux) users. They can use this tutorial to setup YUM server for RHEL.

Prerequisites:
- A fedora13 ISO or DVD
- A fedora13 Linux Box installed

Steps to go:

1) First of all mount the DVD of the Fedora 13 or fedora13 ISO if you have ISO.
(# mount -o loop Fedora13.iso /mnt) For ISO users

2) Then move in the media i.e. DVD or the ISO.
# cd /media/fedora13-DVD
or
# cd /mnt (for iso users if they mounted it under /mnt or put the custom location if you are using another mount point)

3) Now cd into the directory Packages, this directory contains all the official packages for the Fedora13 that are included in the fedora13.
# cd Packages

4) For creating a YUM server we can either use HTTP or FTP. In my case i am using FTP. So install the rpm package "vsftpd" from the directory Packages.
# rpm -ivh vsftpd-2.2.2-3.fc13.i686

Also install the package "createrepo"
# rpm -ivh createrepo-0.9.8-4.fc13.noarch


5) Now, Copy the Packages directory to the location /var/ftp/pub
# cp -rfv Packages /var/ftp/pub

6) Now copy the file from the DVD (or /mnt in case of ISO) named as "fce31f091be8211a394d8942fcf4f6cbeffa3d40d87b61af55a97b1a88b46987-Fedora-13-comps.xml" to the location /var/ftp/pub/Packages
# cp fce31f091be8211a394d8942fcf4f6cbeffa3d40d87b61af55a97b1a88b46987-Fedora-13-comps.xml /var/ftp/pub/Packages

7) Now cd into the directory /var/ftp/pub/Packages and create repo with the following command:
# cd /var/ftp/pub/Packages
# createrepo -vg fce31f091be8211a394d8942fcf4f6cbeffa3d40d87b61af55a97b1a88b46987-Fedora-13-comps.xml .
( remember the "." in the last it represents the current directory)

8) Now create the repo file for the YUM Server. I am naming the as "server.repo", you can have any name you want to this file but file extension should be ".repo" only.
# vim /etc/yum.repo.d/server.repo
[Server]
name=YUM Server
baseurl=file:///var/ftp/pub/Packages
gpgcheck=0
enabled=1


Remember I have disabled gpgcheck since i am not using the gpgkeys. If you want to use the gpgcheck you can use.

Now just make YUM Clients and have fun installing applications. If you are installing applications on the same Box on which you have configured the YUM Server then you don't need to create a client repo file.

For other systems you have to create a client repo file in /etc/yum.repo.d as:
# vim /etc/yum.repo.d/server.repo
[Client]
name=YUM Client
baseurl=ftp://youripaddress/pub/Packages
gpgcheck=0
enabled=1



YUM server is ready to rock...:) have fun......Enjoy....:)

Tuesday, October 26, 2010

How to use Custom Splash Boot Image

Hi Guys,

Are you bored of same boot splash image which comes in the background of the Grub menu? If yes then I am gonna tell you how to change it and use a custom splash boot image.

Prerequisites:
- Any Image to be used as boot splash image(aman.jpg in my case)
- Gimp or similar tool to edit image.

Steps to go:

1) first of open the "image" in the program "gimp". Scale it and make it to 640x480.
Then, in gimp go to "Mode" and select "indexed" and then save it in png format.(aman.png in my case)

2) Now, convert this .png image into .xpm image using th command:
- convert aman.png -colors 14 aman.xpm
Now, compress it with gzip
- gzip aman.xpm.gz

3) Now, Copy the file aman.xpm.gz to /boot/grub (remember you need super user privilieges to do this)
- cp aman.xpm.gz /boot/grub

4) Now edit grub.conf to make splash image entry in it.
- vim /etc/grub.conf
    #edit the line starting with word "splashimage" as
   splashimage=(hd0,1)/grub/aman.xpm.gz
 save and exit
remember aman.xpm.gz is the file you copied in the /boot/grub directory.

5) Reboot now and check the new splash image at you grub boot screen. You are done. Enjoy...:)

Installing Fedora 13 without CD/DVD, pen/flash drives or any external source

Hi,

I have learnt this method today and i am sharing this with you. Its not a new trick but its very useful trick for those who want to try and install new linux distros without wasting bucks on buying CD/DVD to burn ISOs. Many people might have done it many times but its still very useful. The aim of sharing this trick to you is to tell you how to install Fedora 13 without using a CD/DVD or any external hardware to boot. This will be helpful not in case of fedora 13 only but in many other similar distros.

Prerequisites:
- a working bootable linux box having grub installed
- a CD/DVD ISO image of Fedora 13 ISO

Steps to go:

1) Boot into your linux box (in my case its RHEL 5.5 i am using)

2) Create a directory /mnt/fedora13 and put fedora 13 DVD iso in this folder
- mkdir /mnt/fedora13
- cp /path/of/your/iso /mnt/fedora13

3) Now, we need to mount this fedora 13 ISO to some temporary mount point or location(in my case i am mount it under /tmp2. I have created this directory in my box).
- mkdir /tmp2
- mount -o loop Fedora13-DVD.iso /tmp2

4) Now, Goto the mounted directory and cd into isolinux. Copy the kernel files(vmlinuz and initrd) to /boot of your box with a different name so that the it doesn't override the your current system files say like vmlinuz-fc13 and initrd-fc13.img
- cd /tmp2/isolinux
- cp vmlinuz /boot/vmlinuz-fc13
- cp initrd /boot/initrd-fc13.img

5) Now. Copy the "images" folder from the mounted filesystem (from directory /tmp2) to /mnt/fedora13. This images folder contains the install image for the operating system.
- cp -rfv images/ /mnt/fedora13

6) Now, Edit the grub configuration file /etc/grub.conf or /boot/grub/grub.conf and make new entry for the fedora system install as:
- vim /etc/grub.conf
   title Fedora 13 installation
      kernel vmlinuz-fc13
      initrd initrd-fc13.img

save and exit. You can specify the root partition in grub.conf but not necessary in my case.

7) Now, reboot your machine and select Fedora 13 installation in the grub menu at the time of boot.

8) Now, it will ask for the install image location. Select your partition in the list means the partition of the previous linux system where you have kept the ISO in /mnt/fedora13 directory (in my case it is /dev/sda3). Provide the directory containing install image, in my case it is "/mnt/fedora13".

9) Now, install as you install usually. Have fun....:) Finished

In short, we are actually using grub to boot and a hard drive partition to install OS on a different partition. Enjoy...:)

Saturday, October 9, 2010

10 Best Linux Admin Tricks

HI Guys,

This is my first blog ever. I was learning different linux distributions. So i just thought that it would be the easiest way to remember what we learn is to share, thats why the idea of writing a blog came into my mind.

I read some tricks for linux administrators on a website i.e. http://www.ibm.com/developerworks/linux/library/l-10sysadtips/ and i found them really interesting to learn. These trick must be helpful to any admin whether he is working in the industry or working in his home distribution.

Try it! you will love it..:)