How to publish a rpm package to YUM

拜拜、爱过 提交于 2020-12-26 23:26:54

问题


I have created a rpm package, and I need to publish it to YUM so that users can directly do yum install softwareName to install the application. I searched on google but can't find many resources. I'm new to this thing so I don't really know what I want to do is possible. I've tried to create a local yum repository for the application, but it seems work only for the local machine. Can anyone help please? Thank you.


回答1:


Assuming you've YUM installed on a Linux box.

You need to create a YUM repository that contains your RPM. For example,

./mydir/Packages/my.rpm

Use createrepo to create repository for that directory.

createrepo ./mydir

Above would create a repodata directory in ./mydir

Then tell YUM where that repository is by creating a repo file in /etc/yum.repos.d/my.repo. Contents of my.repo can be something like this:

[my_repo]
name=My YUM REPO
baseurl=file:///path/to/mydir
enabled=1

Then do, yum --enablerepo=* clean all. This should regenerate metadata for yum.

Finally,

`yum --enablerepo=* install my`

Above, my refers to my.rpm

In order to access this from other machines on the network, you need a web access,

Install http. Place your repository somewhere in, /var/www/html/repos/mydir/Packages/my.rpm

Then follow other steps and edit my.repo file to include hostname of the machine in the baseurl attribute :

 baseurl=http://myrepository.com/mydir


来源:https://stackoverflow.com/questions/42261557/how-to-publish-a-rpm-package-to-yum

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!