搭建yum本地仓库

1.安装createrepo
1.1挂载ios镜像
#mount /dev/sr0  /mnt
1.2安装createrepo依赖包和createrepo软件包
#rpm -ivh --test /mnt/Packages/createrepo-0.9.8-4.el6.noarch.rpm
warning: /mnt/Packages/createrepo-0.9.8-4.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
error: Failed dependencies:
    deltarpm is needed by createrepo-0.9.8-4.el6.noarch
    python-deltarpm is needed by createrepo-0.9.8-4.el6.noarch
    
#rpm -ivh /mnt/Packages/deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm

warning: /mnt/Packages/deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
   1:deltarpm               ########################################### [100%]

#rpm -ivh  /mnt/Packages/python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm

warning: /mnt/Packages/python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
   1:python-deltarpm        ########################################### [100%]

#rpm -ivh  /mnt/Packages/createrepo-0.9.8-4.el6.noarch.rpm
warning: /mnt/Packages/createrepo-0.9.8-4.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
   1:createrepo             ########################################### [100%]

2.在/root目录下新建Packages目录,作为软件源目录
2.1新建Packages目录
#mkdir /root/Packages
2.2复制软件源
#cp /mnt/Packages/* /root/Packages/
3.在/etc/yum.repos.d目录下创建my_yum.repo文件,作为本地源的配置文件
#cd /ect/yum.repos.d
#vim my_yum.repo 
       #文件名一定要以.repo后缀
    [my_yum]
    name=rhel_6.2_my_yum
    baseurl=file:///root/Packages        #指定软件源的目录
    enabled=1
    gpgcheck=0

    
4.创建yum仓库的数据元
#createrepo --database /root/Packages

3232/3596 - xorg-x11-drv-v4l-0.2.0-4.el6.x86_64.rpm                             
iso-8859-1 encoding on Ville [email protected]> - 2.8.2-2

3596/3596 - plymouth-graphics-libs-0.8.3-24.el6.x86_64.rpm                      
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

5.查看yum仓库

#yum repolist
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
my_yum                                                             | 2.7 kB     00:00 ...
my_yum/primary_db                                                  | 3.1 MB     00:00 ...
repo id                               repo name                                     status
my_yum                                rhel_6.2_my_yum                               3,596
repolist: 3,596

yum源本地仓库搭建成功,共有3596个软件可用。

你可能感兴趣的:(yum,本地,仓库,软件包)