Tanti Technology

My photo
Bangalore, karnataka, India
Multi-platform UNIX systems consultant and administrator in mutualized and virtualized environments I have 4.5+ years experience in AIX system Administration field. This site will be helpful for system administrator in their day to day activities.Your comments on posts are welcome.This blog is all about IBM AIX Unix flavour. This blog will be used by System admins who will be using AIX in their work life. It can also be used for those newbies who want to get certifications in AIX Administration. This blog will be updated frequently to help the system admins and other new learners. DISCLAIMER: Please note that blog owner takes no responsibility of any kind for any type of data loss or damage by trying any of the command/method mentioned in this blog. You may use the commands/method/scripts on your own responsibility. If you find something useful, a comment would be appreciated to let other viewers also know that the solution/method work(ed) for you.

Friday 1 November 2013

YUM Repository in linux


How to create YUM repository on a RHEL Server :

1. Insert and then mount the cdrom as /media

# mount /dev/cdrom /media

2. Create a directory called /myrepo

# mkdir /myrepo

3. Copy all the RPMs from the cd to the local directory

# cp /media/Packages/*.rpm /myrepo

4. Copy the xml file from the CD to the local directory

# cp /media/Server/repodata/6b21fc619d1eccd6fb49237c666f0ce4c68f-comps-rhel-Server.xml /myrepo

5. Create a YUM repository based on the cdrom. This can be done by creating the below file.

# cat > /etc/yum.repos.d/myrepo

[myrepo]
name=rhel6
baseurl=file:///media
enabled=1
gpgcheck=0

^d

Now you can install any rpm using yum command which will install the software from /media ie., your cdrom

6. Install createrepo rpm ( including its dependents)

# yum install createrepo

7. Create a local repository

# cd /myrepo
# createrepo -g 96b21fc619d1eccd6fb49237c666f0ce4c68f-comps-rhel-Server.xml -x /myrepo

8. Finally you have to change the below file

/etc/yum.repos.d/myrepo :

[myrepo]
name=rhel6
baseurl=file:///media
enabled=1
gpgcheck=0

9. Now you have finished creating a local repository on your server.
You can install any individual rpm or groups by just invoking yum command.

Here are few commands to show different ways to use yum command:

1. To install an individual rpm and also install its dependents

# yum install package-name

2. To install a group of rpms

# yum groupinstall group-name

3. To list all the packages available in the repository

# yum list

4. To list only the packages that are installed
# yum list installed

5. To list all the groups available in the repository

# yum grouplist

6. To display information of a group of packages

# yum groupinfo group-name

7. To display information of a package
# yum info package-name

8. To uninstall a package
# yum remove package-name

9. To uninstall a group of packages
# yum groupremove group-name

10. To update a package
# yum update package-name

11. To update a group of packages
# yum update group-name


12. To search for a package using a keyword
# yum search keyword

13. To know which package a file belongs to
# yum provides /usr/bin/screen

14. To list your current (enabled) yum repositories
# yum repolist

15. To list all yum repositories
# yum repolist all

Few other info,

yum conf file:   /etc/yum.conf
yum repo file: /etc/yum.repos.d/


You still have a lot to learn about YUM. So keep reading.

No comments:

Post a Comment