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.
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