How to publish a rpm package to YUM

前端 未结 1 749
春和景丽
春和景丽 2021-01-23 23:56

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

相关标签:
1条回答
  • 2021-01-24 00:45

    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
    
    0 讨论(0)
提交回复
热议问题