Apr 24, 2010

YUM Server Configuration

YUM Server Configuration

1) Install the below packages

    #rpm -ivh createrepo*
    #rpm -ivh vsftpd*

2) Create one directory to save all rpm and share it via ftp.

    #mkdir /data/yum

3) Mount the DVD media and copy all the rpm files to the created folder.
   
    #mount /dev/cdrom /mnt
    #cd /mnt/RHEL5.0 DVD/Server
    #cp . -rf /data/yum

4) Change the default ftp location to /data

    #vi /etc/vsftpd/vsftpd.conf

        add the below entry at the end of the file.
   
    anon_root=/data

5) create a repomd (xml-based rpm metadata) repository from a set of rpms.

    #createrepo -v /data/yum

6) Create a repo file

    #vi /etc/yum.repos.d/yum.repo
    [yum]
    name=yum
    baseurl=file:///mugu/yum
    enabled=1
    gpgcheck=0

7) Now check the configuration by install or remove on group of package

    #yum install dhcpd



Client Side Configuration:

8) Create a repo file

    #vi /etc/yum.repos.d/yum.repo
    [yum]
    name=yum
    baseurl=ftp://IPADDRESS(server)/yum
    enabled=1
    gpgcheck=0

Note:

    If you are using yum server means in both server and client always have ftp service running

9) In both server and client start the ftp service

    #service vsftpd start
    #chkconfig vsftpd on

Apr 13, 2010

Making a Script Executable

Making a Script Executable

Now we have our script file, we can run it in two ways. The simpler way is to invoke the shell with the name of the script file as a parameter, thus:

#/bin/sh first.sh

This should work, but it would be much better if we could simply invoke the script by typing its name, giving it the respectability of other UNIX commands.

We do this by changing the file mode to make the file executable for all users using the chmod command:

#chmod +x first.sh

Important Of course, this isn't the only way to use chmod to make a file executable. Use man chmod to find out more about octal arguments and other options.
We can then execute it using the command:

#first.sh

This may not work and you may get an error saying the command wasn't found. This is probably because the shell environment variable PATH isn't set to look in the current directory. To fix this, either type PATH=$PATH:. on the command line, or edit your .bash_profile file to add this command to the end of the file, then log out and back in again Alternatively, type ./first.sh in your scripts directory to give the shell the relative path to the file.

Apr 9, 2010

Change display resolution in Linux


Change display resolution in Linux



To change the VGA card display resolution in RHEL5

1) First check all the possible resolutions supported by your graphics card using the following command.

            "xrandr"

It will display all possible resolutions.


2) Change resolution.

Suppose your graphics card support 1024x768 resolution then you can change it using the following command.

"xrandr -s 1024x768"



If you don't have "1024x768" in that “xrandr” output, try below one this might be help to get “1024x768”.


In “/etc/X11/xorg.conf” file just check the entries


            SubSection "Display"
                        Viewport  0 0
                        Depth     24
                        Modes "1024x768"
            EndSubSection


Check the entry “Modes”. If it is not present just add this line and check.

Apr 2, 2010

Backup Using TAR Command

TAR Backup


The tar program is a utility originally designed for making magnetic tape backups, but is useful for any kind of archiving purpose.

Red Hat Linux includes the GNU version of tar. It includes some extensions to the older standard versions of tar, including multivolume archiving.

Multi-volume archiving is an automated process in which tar prompts for new media to be inserted whenever it runs out of space.

Syntax:

tar –cvf [destination] [source]


Note: Copying files to a tape using the ‘c’ option to tar destroys any files already on the tape. If you want to preserve the files already on the tape, use the ‘r’ option described in "Appending Files to a Tape (tar)" later.

TAR OPTIONS
Command Explanation
A Append the contents of the given tar files to the specified tar archive.
C Create a new tar archive and add the given files to it. Overwrite an existing tar archive. To append files use r or A.
D Find differences between what’s in the tar archive and what’s in the file system.
R Append the given files to the specified tar archive.
T List the contents of the specified tar archive.
U Append the given files to the specified tar archive, but only if they are newer than the files in the tar archive.
X Extract the given files from the specified tar archive.


Examples for tar backup

• tar -cf /dev/st0 /home

Creates an archive of all files under /home on the SCSI tape drive /dev/st0.

• tar –cvf /backup/home.tar /home

Creates an archive of all files under /home on the /backup directory with the name of home.tar.

• tar –xvf /backup/home.tar

Extracts the entire archive stored in the file /backup/home.tar into the current directory.

• tar -czWf /backup/home.tar.gz /home

Creates a gzipped archive file named home.tar.gz in the /backup directory. After writing the archive, tar verifies it.

• tar -zxvf /backup/home.tar.gz

Extracts the entire archive stored in the file /tmp/images.tar.bz2 into the current directory