Creating a yum repository (repo) and Creating a yum group to install + kickstart

转载 2011年01月09日 18:37:00

Creating a yum repository is fairly easy, the only command you need is createrepo and some rpms. This is a quick guide to making a repo, I have a more complete example in my howto make an install server .

Make a directory to contain your rpms, it’s nice to name the directory the same as the repo name. Even better, segregate the rpms by architecture, i386, i686, noarch, SRPMS, etc. Copy the rpms into the appropriate directories and run create repo on that directory. Ensure you sign your rpms with your gpg key
Example: 
[user@machine] mkdir -p MyRepo/i386 MyRepo/noarch MyRepo/i686 MyRepo/SRPMS
[user@machine] mv myrpm.noarch.rpm MyRepo/noarch
[user@machine] mv myrpm.src.rpm MyRepo/SRPMS
[user@machine] mv mybinrpm.i386.rpm MyRepo/i386
[user@machine] createrepo MyRepo

Groups File (comps.xml)

Now, if you want to install all the rpms in your repo, or a specific subset, you’ll need to create a groups file otherwise known as comps.xml. For our example, if we wanted myrpm.noarch.rpm to be installed by default and mybinrpm.i386.rpm to be an optional install, we would create a comps.xml file like this: 
<comps>
<!--  <meta> -->
<!-- Meta information will go here eventually -->
<!--  </meta> -->
  <group>
    <id>mygroup</id>
    <name>MyGroup</name>
    <default>true</default>
    <description>Default RPMS from MyRepo</description>
    <uservisible>true</uservisible>
    <packagelist>
      <packagereq type="default">myrpm</packagereq>
      <packagereq type="optional">mybinrpm</packagereq>
    </packagelist>
  </group>
</comps>
Now we need to rerun createrepo so that clients will know our group assignments. 
[user@machine] createrepo -g comps.xml MyRepo

/etc/yum.repos.d

Now, if we want to install this group on a machine, we create a .repo file in /etc/yum.repos.d like this: 
[MyRepo]
name=My Repository
baseurl=http://path/to/MyRepo
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-MyRepo
If you didn’t sign your rpms and do not wish to verify signatures, set gpgcheck=0 in your .repo file. If you did sign your rpms, then you’ll need to export your gpg key into a file so yum can import the file into the rpm database.

Exporting your GPG-Key for RPM/YUM

First, find the name of your key if you don’t already know it.

[thomas@host ~] gpg --list-keys
/home/thomas/.gnupg/pubring.gpg
-------------------------------------------
pub   1024D/79E7E0DB 2007-10-08
uid                  Repository Owner <repository@example.org>
sub   2048g/04F5FDBA 2007-10-08
Then export the key into a file:

[thomas@host ~]$ gpg --export -a "Repository Owner <repository@example.org>" >RPM-GPG-KEY-example.org
[thomas@host ~]$ cat RPM-GPG-KEY-example.org 
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.5 (GNU/Linux)
 
mQGiBEcKQlgRBACLKP/FOWmTf75UjfShH84YkbLFnQqOlfdYKQ7ss57cRYn1v8lj
UoQjmPDhVLH+SpREAkDAoPjxiTln32nHoMWdIEJ/cdfBvhAg+PyHW4MCdyJu1hSO
UpqNQTUnnZ6dvTE5n/7fGepI/W24rOKzqrHqaolIx8sopMbF1UUck7lySwCg12Me
HOqFXWB6iiAmYYBwxJbE90ED/0b02K4xNJ5EFrZ8YcJmFlLnMfmICZiYveU4yqHY
CqtzNyCDFq6ZapNdzhAZC1VtUQGvTfXDvvjXv6rs8Z3SrJDjiwboJePTQS/sfT+p
iNlhBOd/yejf4w7XgXaEbw+BVy8EzDdvzEXjcBRLFoK7Dill+7Leba7G6kLcsPbr
B013A/0a+fgXYXFM8WYPsHZpG1SnPGQriwQppSVKVdeQomd7nppIa0f+UJyvQboQ
Hooivc75kAWmIIVCu4IK1LugH0ke5XbbvDBw3wiSGHcS6NPlSLzKXwOb53uGC47I
k1BK7aDnUnIKcEOneQSJkgfGmmzUr9jf2i8eX+LYZxgMU1eFY7QpUmVwb3NpdG9y
eSBPd25lciA8cmVwb3NpdG9yeUBleGFtcGxlLm9yZz6IYAQTEQIAIAUCRwpCWAIb
AwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEOC722t55+DbUnoAoLNhzDmVORR9
xh+rsz812yV78wfUAKCLhHgzM/EuIsyE8UHCl0bHAKI6CLkCDQRHCkJeEAgAmrgk
pBazmB6Mcm6mWds7dLXPVCRNknYz0J0NcIQEA43nUveWCtJpay8gs9QAfC8RLaT3
CMsCRPDGrm3tjd1KpCK/ENUHA9OtctVXqPdTOJN0lEWLkPAxtA5aEzEKUXLrzn8g
EHU6Ik9gyFjs74r4/e60OZWAeNMn7e1XK39BO+qWVgg717pkbh4EsMJcSO6mppTc
Z92QF/Kkl0qPpLsekWnIIC666+FcDr2O/e1TUGK/dsl3UvEknBZMsHY3IEmRWVEC
68dUbz7oY1AsU2Ck5lX+UuXnlnIp7jkW/eqWq1HHtfDQJ/Leb6f4tjlRJfyyWaqQ
F50bupAdVhgsjBA7awADBQgAjRZ11CODlZTboW/r1mdxnW9oMJvqq6xGBQ9/3PPf
WnGY6pxGNR5uuhgwl1gb2882u4ynL7DTkwuK1rg0febulpbNgqqx7sdKDSy7Xiwz
TAYE+8Q2Z1A7jlblU0I5srFz20LMCW4xCYg5DmPqPY8BVxYGyGowBtTcO2skkyjX
BW5UWGLRxM6b5kt53jUQlTC2z88BK+E2RLeZE9/Ln9fVFG1aRf9McXaQcj8jRiuR
8D30E927RosyUJ9t/IBOlkfIyYqP6sYOsnrZhyWAh4iDVrB5nSdruDYHawme72We
b6UggUonKXWmra6XuGKLV8Q5pCharQzJ7nBKWK4NrbvFIIhJBBgRAgAJBQJHCkJe
AhsMAAoJEOC722t55+DbTHkAn3Hjp5XTfcdEPVMnbPrmdQVwRjhJAJ400WMsJD1E
BJSAdiyou23Z2seraQ==
=+H8a
-----END PGP PUBLIC KEY BLOCK-----
Then move this file to the location specified in the .repo file. Yum will install the key into the rpm database for you. To install the key manually, you can do the following:

[root@host thomas]# rpm --import RPM-GPG-KEY-example.org
[root@host thomas]# rpm -q gpg-pubkey
gpg-pubkey-b2980b13-3c1d0597
gpg-pubkey-f51839ac-46362566
gpg-pubkey-79e7e0db-470a4258
We can see that our key (gpg-pubkey-79e7e0db-470a4258) was installed into the rpm database).
Now, to install this group. 
[user@machine] yum groupinstall mygroup
This will install any default or mandatory rpms as listed in comps.xml, any optional rpms will not be installed.

Kickstart

To install our packages via kickstart, we’ll need to add the repo to our kickstart file 
repo --name=MyRepo --baseurl=http://path/to/MyRepo

 

转自:http://scanty.blog.51cto.com/242145/217782

什么是EPEL 及 Centos上安装EPEL

转自:http://www.unxmail.com/read.php?67 RHEL以及他的衍生发行版如CentOS、Scientific Linux为了稳定,官方的rpm repository提...
  • yasi_xi
  • yasi_xi
  • 2013年09月16日 19:41
  • 34066

关于CocoaPod安装常见问题

新拿到一台Mac装cocoapods,老是装不上,查找网上资料最终解决了下面总结下 CocoaPods的安装问题: 1.首先用淘宝的Ruby镜像来访问CocoaPods,打开终端输入以下命令: (1)...
  • DuBianJun
  • DuBianJun
  • 2016年06月19日 10:42
  • 11341

在Linux上,使用MySQL的yum仓库,安装MySQL

部分翻译了“refman-5.7-en.pdf”的“2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository”部分。书写的时候使用了...
  • u013600225
  • u013600225
  • 2016年06月18日 16:03
  • 2975

centos yum的配置文件 repo文件详解

什么是repo文件?repo文件是Fedora中yum源(软件仓库)的配置文件,通常一个repo文件定义了一个或者多个软件仓库的细节内容,例如我们将从哪里下载需要安装或者升级的软件包,repo文件中的...
  • testcs_dn
  • testcs_dn
  • 2014年11月24日 17:54
  • 38084

Linux学习笔记 --- Linux 下 yum源配置文件 repo 文件学习

Linux学习笔记 --- Linux 下 yum源配置文件 repo 文件学习
  • u012965373
  • u012965373
  • 2016年09月29日 17:24
  • 3569

使用yum安装oracle的包

在rhel上安装oracle需要一些必备的包,如binutils compat-db compat-libstdc++-33 control-center gcc gcc-c++ glibc glib...
  • techsupporter
  • techsupporter
  • 2016年08月20日 20:49
  • 2193

CentOS下使用yum安装Git具体步骤

Git是一个开源的分布式版本控制系统,用以有效、高速的处理从很小到非常大的项目版本管理。Git是 Linus Torvalds 为了帮助管理 Linux 内核开发而开发的一个开放源码的版本控制软件。G...
  • jackshiny
  • jackshiny
  • 2016年07月13日 19:53
  • 4632

Linux服务器用yum安装中文包 (实际案例详细记录)

背景:报表升级后,R135版本报表的图中汉字无法正常显示。 解决方案:用yum重新安装中文包。 环境限制:无Internet链接,纯内网。报表服务器上面的OS为 RHEL 5.4。 必备的材料:RHE...
  • CAS_wycherley
  • CAS_wycherley
  • 2015年04月10日 02:34
  • 10710

CentOS 7.0本地yum源地址及 配置yum地址优先级

首先附上本地centos7.0yun源基础地址及epel源地址: vi /etc/yum.repos.d/CentOS-local.repo ...
  • tantexian
  • tantexian
  • 2014年08月28日 11:27
  • 73391

Kubernetes 1.4 基础篇:kubeadm方式安装

kubernetes在9月份推出了1.4的版本,在这个版本中最招人眼球的就是它推出了kubeadm的方式进行安装,简化了很多流程。终于,至少这个版本的kubernetes像docker1.12内置的s...
  • liumiaocn
  • liumiaocn
  • 2016年10月17日 22:16
  • 5412
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Creating a yum repository (repo) and Creating a yum group to install + kickstart
举报原因:
原因补充:

(最多只允许输入30个字)