这是创建用于离线使用的存储库的正确方法吗? (对于:yum groupinstall“桌面”)

这是创建用于离线使用的存储库的正确方法吗? (对于:yum groupinstall“桌面”)

让我们为以下内容创建一个存储库:

yum groupinstall "Desktop"

首先,我创建一个名为“test”的文件夹

/root/Desktop/test

接下来我需要知道“桌面”组里面有什么。

yum groupinfo "Desktop"

结果:

Group: Desktop
 Description: A minimal desktop that can also be used as a thin client.
 Mandatory Packages:
   NetworkManager
   NetworkManager-gnome
   alsa-plugins-pulseaudio
   at-spi
   control-center
   dbus
   gdm
   gdm-user-switch-applet
   gnome-panel
   gnome-power-manager
   gnome-screensaver
   gnome-session
   gnome-terminal
   gvfs-archive
   gvfs-fuse
   gvfs-smb
   metacity
   nautilus
   notification-daemon
   polkit-gnome
   xdg-user-dirs-gtk
   yelp
 Default Packages:
   control-center-extra
   eog
   gdm-plugin-fingerprint
   gnome-applets
   gnome-media
   gnome-packagekit
   gnome-vfs2-smb
   gok
   openssh-askpass
   orca
   pulseaudio-module-gconf
   pulseaudio-module-x11
   rhn-setup-gnome
   vino
 Optional Packages:
   sabayon-apply
   tigervnc-server
   xguest

我认为可选包将被忽略,对于每个强制包和默认包,我将通过下载它们yumdownloader

让我们这样做:

 cd /root/Desktop/test

然后下载每一个:

# Mandatory Packages:
yumdownloader --resolve NetworkManager
yumdownloader --resolve NetworkManager-gnome
yumdownloader --resolve alsa-plugins-pulseaudio
yumdownloader --resolve at-spi
yumdownloader --resolve control-center
yumdownloader --resolve dbus
yumdownloader --resolve gdm
yumdownloader --resolve gdm-user-switch-applet
yumdownloader --resolve gnome-panel
yumdownloader --resolve gnome-power-manager
yumdownloader --resolve gnome-screensaver
yumdownloader --resolve gnome-session
yumdownloader --resolve gnome-terminal
yumdownloader --resolve gvfs-archive
yumdownloader --resolve gvfs-fuse
yumdownloader --resolve gvfs-smb
yumdownloader --resolve metacity
yumdownloader --resolve nautilus
yumdownloader --resolve notification-daemon
yumdownloader --resolve polkit-gnome
yumdownloader --resolve xdg-user-dirs-gtk
yumdownloader --resolve yelp
#Default Packages:
yumdownloader --resolve control-center-extra
yumdownloader --resolve eog
yumdownloader --resolve gdm-plugin-fingerprint
yumdownloader --resolve gnome-applets
yumdownloader --resolve gnome-media
yumdownloader --resolve gnome-packagekit
yumdownloader --resolve gnome-vfs2-smb
yumdownloader --resolve gok
yumdownloader --resolve openssh-askpass
yumdownloader --resolve orca
yumdownloader --resolve pulseaudio-module-gconf
yumdownloader --resolve pulseaudio-module-x11
yumdownloader --resolve rhn-setup-gnome
yumdownloader --resolve vino

好的,所有内容都已下载到“test”文件夹中。在这个“测试”文件夹中,让我们运行此命令来创建一个“桌面”组。

yum-groups-manager -n "Desktop" --id=desktop --save=Desktop.xml \
--mandatory  \
NetworkManager \
NetworkManager-gnome  \
alsa-plugins-pulseaudio  \
at-spi  \
control-center  \
dbus  \
gdm  \
gdm-user-switch-applet  \
gnome-panel  \
gnome-power-manager  \
gnome-screensaver  \
gnome-session  \
gnome-terminal  \
gvfs-archive  \
gvfs-fuse  \
gvfs-smb \
metacity \
nautilus  \
notification-daemon  \
polkit-gnome  \
xdg-user-dirs-gtk  \
yelp \
--default  \
control-center-extra  \
eog  \
gdm-plugin-fingerprint  \
gnome-applets  \
gnome-media  \
gnome-packagekit  \
gnome-vfs2-smb  \
gok  \
openssh-askpass  \
orca  \
pulseaudio-module-gconf  \
pulseaudio-module-x11  \
rhn-setup-gnome  \
vino

错误:

yum-groups-manager: error: no such option: --default

让我们删除“--default”,所以我认为一切都是“强制”的

yum-groups-manager -n "Desktop" --id=desktop --save=Desktop.xml \
--mandatory  \
NetworkManager \
NetworkManager-gnome  \
alsa-plugins-pulseaudio  \
at-spi  \
control-center  \
dbus  \
gdm  \
gdm-user-switch-applet  \
gnome-panel  \
gnome-power-manager  \
gnome-screensaver  \
gnome-session  \
gnome-terminal  \
gvfs-archive  \
gvfs-fuse  \
gvfs-smb \
metacity \
nautilus  \
notification-daemon  \
polkit-gnome  \
xdg-user-dirs-gtk  \
yelp \
control-center-extra  \
eog  \
gdm-plugin-fingerprint  \
gnome-applets  \
gnome-media  \
gnome-packagekit  \
gnome-vfs2-smb  \
gok  \
openssh-askpass  \
orca  \
pulseaudio-module-gconf  \
pulseaudio-module-x11  \
rhn-setup-gnome  \
vino

它创建了文件:Desktop.xml

让我们看看它是什么样子的:

[root@localhost test]# cat Desktop.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE comps PUBLIC "-//Red Hat, Inc.//DTD Comps info//EN" "comps.dtd">
<comps>

  <group>
   <id>desktop</id>
   <default>false</default>
   <uservisible>true</uservisible>
   <display_order>1024</display_order>
   <name>Desktop</name>
   <description></description>
    <packagelist>
      <packagereq type="mandatory">NetworkManager</packagereq>
      <packagereq type="mandatory">NetworkManager-gnome</packagereq>
      <packagereq type="mandatory">alsa-plugins-pulseaudio</packagereq>
      <packagereq type="mandatory">at-spi</packagereq>
      <packagereq type="mandatory">control-center</packagereq>
      <packagereq type="mandatory">control-center-extra</packagereq>
      <packagereq type="mandatory">dbus</packagereq>
      <packagereq type="mandatory">eog</packagereq>
      <packagereq type="mandatory">gdm</packagereq>
      <packagereq type="mandatory">gdm-plugin-fingerprint</packagereq>
      <packagereq type="mandatory">gdm-user-switch-applet</packagereq>
      <packagereq type="mandatory">gnome-applets</packagereq>
      <packagereq type="mandatory">gnome-media</packagereq>
      <packagereq type="mandatory">gnome-packagekit</packagereq>
      <packagereq type="mandatory">gnome-panel</packagereq>
      <packagereq type="mandatory">gnome-power-manager</packagereq>
      <packagereq type="mandatory">gnome-screensaver</packagereq>
      <packagereq type="mandatory">gnome-session</packagereq>
      <packagereq type="mandatory">gnome-terminal</packagereq>
      <packagereq type="mandatory">gnome-vfs2-smb</packagereq>
      <packagereq type="mandatory">gok</packagereq>
      <packagereq type="mandatory">gvfs-archive</packagereq>
      <packagereq type="mandatory">gvfs-fuse</packagereq>
      <packagereq type="mandatory">gvfs-smb</packagereq>
      <packagereq type="mandatory">metacity</packagereq>
      <packagereq type="mandatory">nautilus</packagereq>
      <packagereq type="mandatory">notification-daemon</packagereq>
      <packagereq type="mandatory">openssh-askpass</packagereq>
      <packagereq type="mandatory">orca</packagereq>
      <packagereq type="mandatory">polkit-gnome</packagereq>
      <packagereq type="mandatory">pulseaudio-module-gconf</packagereq>
      <packagereq type="mandatory">pulseaudio-module-x11</packagereq>
      <packagereq type="mandatory">vino</packagereq>
      <packagereq type="mandatory">xdg-user-dirs-gtk</packagereq>
      <packagereq type="mandatory">yelp</packagereq>
    </packagelist>
  </group>
</comps>

现在我需要在仓库中创建一个“组”?根据我读到的信息,我应该运行这个命令来“在存储库中创建一个组”,我认为我所做的基本上就是这样。我想还有另一个步骤吗?

[root@localhost test]# createrepo -g /root/Desktop/test/Desktop.xml /root/Desktop/test/
Spawning worker 0 with 60 pkgs
Workers Finished
Gathering worker results

Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@localhost test]# 

好吧,让我们现在运行ls看看这个文件夹里有什么test

[root@localhost test]# ls
alsa-lib-1.0.22-3.el6.i686.rpm
alsa-plugins-pulseaudio-1.0.21-3.el6.i686.rpm
alsa-plugins-pulseaudio-1.0.21-3.el6.x86_64.rpm
at-spi-1.28.1-2.el6.centos.i686.rpm
at-spi-1.28.1-2.el6.centos.x86_64.rpm
control-center-2.28.1-38.el6.i686.rpm
control-center-2.28.1-38.el6.x86_64.rpm
control-center-extra-2.28.1-38.el6.x86_64.rpm
dbus-1.2.24-7.el6_3.x86_64.rpm
Desktop.xml
eog-2.28.2-4.el6.x86_64.rpm
flac-1.2.1-6.1.el6.i686.rpm
gdm-2.30.4-39.el6.x86_64.rpm
gdm-plugin-fingerprint-2.30.4-39.el6.x86_64.rpm
gdm-user-switch-applet-2.30.4-39.el6.x86_64.rpm
gnome-applets-2.28.0-7.el6.centos.x86_64.rpm
gnome-media-2.29.91-6.el6.x86_64.rpm
gnome-packagekit-2.28.3-7.el6.x86_64.rpm
gnome-panel-2.30.2-14.el6.x86_64.rpm
gnome-power-manager-2.28.3-7.el6_4.x86_64.rpm
gnome-screensaver-2.28.3-24.el6_4.1.x86_64.rpm
gnome-session-2.28.0-18.el6.x86_64.rpm
gnome-terminal-2.31.3-8.el6.x86_64.rpm
gnome-vfs2-smb-2.24.2-6.el6.x86_64.rpm
gok-2.28.1-5.el6.x86_64.rpm
gvfs-archive-1.4.3-15.el6.x86_64.rpm
gvfs-fuse-1.4.3-15.el6.x86_64.rpm
gvfs-smb-1.4.3-15.el6.x86_64.rpm
libasyncns-0.8-1.1.el6.i686.rpm
libcanberra-0.22-1.el6.centos.i686.rpm
libcanberra-gtk2-0.22-1.el6.centos.i686.rpm
libgnomekbd-2.28.2-2.el6.i686.rpm
libgudev1-147-2.46.el6.i686.rpm
libogg-1.1.4-2.1.el6.i686.rpm
libsndfile-1.0.20-5.el6.i686.rpm
libtdb-1.2.10-1.el6.i686.rpm
libtool-ltdl-2.2.6-15.5.el6.i686.rpm
libudev-147-2.46.el6.i686.rpm
libvorbis-1.2.3-4.el6_2.1.i686.rpm
libwacom-0.5-4.el6.i686.rpm
libxkbfile-1.0.6-1.1.el6.i686.rpm
libxklavier-4.0-9.el6.i686.rpm
libXScrnSaver-1.2.2-2.el6.i686.rpm
libXtst-1.2.1-2.el6.i686.rpm
metacity-2.28.0-23.el6.i686.rpm
metacity-2.28.0-23.el6.x86_64.rpm
nautilus-2.28.4-19.el6.x86_64.rpm
NetworkManager-0.8.1-43.el6.x86_64.rpm
NetworkManager-gnome-0.8.1-43.el6.x86_64.rpm
notification-daemon-0.5.0-1.el6.x86_64.rpm
openssh-askpass-5.3p1-84.1.el6.x86_64.rpm
orca-2.28.2-1.el6.x86_64.rpm
polkit-gnome-0.96-3.el6.i686.rpm
polkit-gnome-0.96-3.el6.x86_64.rpm
pulseaudio-libs-0.9.21-14.el6_3.i686.rpm
pulseaudio-module-gconf-0.9.21-14.el6_3.x86_64.rpm
pulseaudio-module-x11-0.9.21-14.el6_3.x86_64.rpm
repodata
tcp_wrappers-libs-7.6-57.el6.i686.rpm
vino-2.28.1-8.el6_3.x86_64.rpm
xdg-user-dirs-gtk-0.8-7.el6.x86_64.rpm
yelp-2.28.1-17.el6_3.x86_64.rpm
[root@localhost test]# 

看起来已经创建了一个名为“repodata”的文件夹。

[root@localhost test]# cd repodata
[root@localhost repodata]# ls
02e6e67a0eedf0b7d561253fd5e7d71032a6e0054536b88e75563681822dd774-filelists.xml.gz
3fc84c02d6c0e033441e6f00353a98a7c2cc5530ff27f63206d5ef300890d9a0-primary.xml.gz
91fe015bc6db77cd159518699d5c70838143681955bf3d3c28804d08063c3f92-filelists.sqlite.bz2
af6d0c22babf5796feed2a24e1d74d5d0c6507f2625fbfa65c8acc8495856dc0-primary.sqlite.bz2
c18a67f5fc206032c0081bc55bee52a2ea258873c093cdb55cda89d68a7af4eb-other.xml.gz
c9913ed4169437a1728d021cce5d54f8b7bbf02e82fa5cab5345f653f97c64ae-other.sqlite.bz2
e5ad7753d9fe659de92967aaeb29de70e0cf4b9bc3e8a07970a236748299b486-Desktop.xml
f9c925984ac89f3772590032080c01bca01df81b9bf611041cfbaceaaf107114-Desktop.xml.gz
repomd.xml
[root@localhost repodata]# 

看起来像是很多乱码随机的东西。

但无论如何,现在我到底如何使用这个存储库来安装..

yum -y groupinstall "Desktop" 

更具体地说,鉴于我已经安装了它,我该如何测试它?

我只是想确保当我重新安装最小的 Linux 然后尝试从这个存储库安装它时它不会失败。

答案1

您可以使用媒体库

插入安装介质并使用以下命令安装它:

mount /dev/cdrom /mnt

编辑/etc/yum.repos.d/Media.repo

[c6-media]
name=CentOS-$releasever - Media
baseurl=file:///mnt
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

然后只需使用以下命令下载并安装:

yum --disablerepo=\* --enablerepo=c6-media groupinstall "Desktop"

相关内容