yum之如何手动创建本地yum仓库

  1. 首先先安装createrepo-0.9.9-17.el6.noarch.rpm
           我之前搭建过yum,所以我直接用yum install直接安装

    我的系统是redhat6

[[email protected] rpm-gpg]# yum install createrepo
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package createrepo.noarch 0:0.9.9-17.el6 will be installed
--> Processing Dependency: python-deltarpm for package: createrepo-0.9.9-17.el6.noarch
--> Running transaction check
---> Package python-deltarpm.x86_64 0:3.5-0.5.20090913git.el6 will be installed
--> Processing Dependency: deltarpm = 3.5-0.5.20090913git.el6 for package: python-deltarpm-3.5-0.5.20090913git.el6.x86_64
--> Running transaction check
---> Package deltarpm.x86_64 0:3.5-0.5.20090913git.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
 Package            Arch      Version                      Repository      Size
================================================================================
Installing:
 createrepo         noarch    0.9.9-17.el6                 rhel-source     94 k
Installing for dependencies:
 deltarpm           x86_64    3.5-0.5.20090913git.el6      rhel-source     71 k
 python-deltarpm    x86_64    3.5-0.5.20090913git.el6      rhel-source     27 k
Transaction Summary
================================================================================
Install       3 Package(s)
Total download size: 192 k
Installed size: 518 k
Is this ok [y/N]: y
Downloading Packages:
--------------------------------------------------------------------------------
Total                                           667 kB/s | 192 kB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : deltarpm-3.5-0.5.20090913git.el6.x86_64                      1/3
  Installing : python-deltarpm-3.5-0.5.20090913git.el6.x86_64               2/3
  Installing : createrepo-0.9.9-17.el6.noarch                               3/3
rhel-source/productid                                    | 1.7 kB     00:00 ...
  Verifying  : python-deltarpm-3.5-0.5.20090913git.el6.x86_64               1/3
  Verifying  : createrepo-0.9.9-17.el6.noarch                               2/3
  Verifying  : deltarpm-3.5-0.5.20090913git.el6.x86_64                      3/3
Installed:
  createrepo.noarch 0:0.9.9-17.el6
Dependency Installed:
  deltarpm.x86_64 0:3.5-0.5.20090913git.el6
  python-deltarpm.x86_64 0:3.5-0.5.20090913git.el6
Complete!
You have new mail in /var/spool/mail/root
[[email protected] rpm-gpg]# rpm -qa | grep createrepo
createrepo-0.9.9-17.el6.noarch

我已经安装成功

2.  在/root下mkdir一个文件夹epel,我把我之前挂载在/mnt/Packages下的*.rpm  copy到/root/epel

3. 在/etc/yum.repos.d下修改rhel-source.repo文件(可能文件名称不同)

[[email protected] yum.repos.d]# pwd
/etc/yum.repos.d
[[email protected] yum.repos.d]# ls
rhel-source.repo
[[email protected] yum.repos.d]# cat rhel-source.repo
[rhel-Base]
name=Red Hat
baseurl=file:///mnt
enabled=1
gpgcheck=0
[epel]
name=epel
baseurl=file:///root/epel
enabled=1
gpgcheck=0
[[email protected] yum.repos.d]#

【epel】是我新添加的配置

4. 我们执行 yum repolist命令看一下

[[email protected] yum.repos.d]# yum repolist
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
file:///root/epel/repodata/repomd.xml: [Errno 14] Could not open/read file:///root/epel/repodata/repomd.xml
Trying other mirror.
repo id                               repo name                           status
epel                                  epel                                0
rhel-Base                             Red Hat                             0
repolist: 0
[[email protected] yum.repos.d]#

repo id  和repo name已经显示出了新添加的epel,但是出错了缺少repomd.xml,下面我来创建一个repomd.xml

5.

[[email protected] yum.repos.d]# createrepo /root/epel/
Spawning worker 0 with 15 pkgs
Workers Finished
Gathering worker results
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[[email protected] yum.repos.d]# ls /root/epel/
php-5.3.3-22.el6.x86_64.rpm         php-pear-1.9.4-4.el6.noarch.rpm
php-cli-5.3.3-22.el6.x86_64.rpm     php-pecl-apc-3.1.9-2.el6.x86_64.rpm
php-common-5.3.3-22.el6.x86_64.rpm  php-pecl-memcache-3.0.5-4.el6.x86_64.rpm
php-gd-5.3.3-22.el6.x86_64.rpm      php-pgsql-5.3.3-22.el6.x86_64.rpm
php-ldap-5.3.3-22.el6.x86_64.rpm    php-soap-5.3.3-22.el6.x86_64.rpm
php-mysql-5.3.3-22.el6.x86_64.rpm   php-xml-5.3.3-22.el6.x86_64.rpm
php-odbc-5.3.3-22.el6.x86_64.rpm    php-xmlrpc-5.3.3-22.el6.x86_64.rpm
php-pdo-5.3.3-22.el6.x86_64.rpm     repodata
[[email protected] yum.repos.d]#

我先yum clean all清除下缓存并yum repolist下看有没有出错

[[email protected] yum.repos.d]# yum clean all
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: epel rhel-Base
Cleaning up Everything
[[email protected] yum.repos.d]# yum repolist
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
epel                                                     | 2.9 kB     00:00 ...
epel/primary_db                                          |  14 kB     00:00 ...
rhel-Base                                                | 3.9 kB     00:00 ...
rhel-Base/primary_db                                     | 3.1 MB     00:02 ...
repo id                               repo name                           status
epel                                  epel                                   15
rhel-Base                             Red Hat                             3,648
repolist: 3,663
[[email protected] yum.repos.d]#

yum repolist没有出错,看来我们创建成功了。

6.  测试

yum list

yum list all

yum install 安装一个软件

[[email protected] epel]# yum install php-5.3.3-22.el6.x86_64.rpm
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-m   anager to register.
Setting up Install Process
Examining php-5.3.3-22.el6.x86_64.rpm: php-5.3.3-22.el6.x86_64
Marking php-5.3.3-22.el6.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.3.3-22.el6 will be installed
--> Processing Dependency: php-cli(x86-64) = 5.3.3-22.el6 for package: php-5.3.3-22.el6.x86_   64
--> Processing Dependency: php-common(x86-64) = 5.3.3-22.el6 for package: php-5.3.3-22.el6.x   86_64
--> Running transaction check
---> Package php-cli.x86_64 0:5.3.3-22.el6 will be installed
---> Package php-common.x86_64 0:5.3.3-22.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================
 Package           Arch          Version              Repository                       Size
============================================================================================
Installing:
 php               x86_64        5.3.3-22.el6         /php-5.3.3-22.el6.x86_64        3.5 M
Installing for dependencies:
 php-cli           x86_64        5.3.3-22.el6         epel                            2.2 M
 php-common        x86_64        5.3.3-22.el6         epel                            524 k
Transaction Summary
============================================================================================
Install       3 Package(s)
Total size: 6.2 M
Total download size: 2.7 M
Installed size: 13 M
Is this ok [y/N]: ^CExiting on user Command
[[email protected] epel]#
时间: 2024-10-05 18:26:33

yum之如何手动创建本地yum仓库的相关文章

[转载]CentOS 7 创建本地YUM源

本文中的“本地YUM源”包括三种类型:一是直接使用CentOS光盘作为本地yum源,优点是简单便捷,缺点是光盘软件包可能不完整(centos 7 Everything 总共才6.57G):二是同步CentOS官方源到本地(相当于创建了一个公共镜像),优点是最靠谱,缺点是占空间费流量:三是创建完全自定义的本地源,优点是灵活性最大,缺点是只是作为其他源的补充. 一.使用CentOS光盘作为本地yum源 (1) 实体机上直接放入光盘(2) VMware Workstation 虚拟机:虚拟机-->可移

centos7创建本地 yum源 epel源

centos7创建本地 yum源 epel源 1.安装httpd服务,提供网页浏览 yum-y install httpd systemctlstart httpd systemctlenable httpd 2.创建yum仓库目录和epel目录 mkdir/var/www/html/yum 3.安装创建仓库软件包:createrepo yum-y install createrepo 4.初始化仓库索引文件 createrepo-p -d -o /var/www/html/yum/ /var/

redhat linux 5上创建本地yum源

1.挂载光驱 [[email protected] ~]#mkdir -p /mnt/cdrom [[email protected] ~]#mount /dev/cdrom /mnt/cdrom 2.将redhat光盘内容复制至本地硬盘 因为创建yum源的目录,必须是可以写入的的目录,所以需要将光盘中的文件全部复制到本地目录,如果在/mnt/cdrom光驱挂载目录执行创建yum源,会报"Directory /mnt/cdrom must be writable."错误 [[email

CentOS7.3 创建本地YUM源和局域网YUM源

由于某某公司针对安全这一块做的比较严谨,服务器全部都不可以连接外网.由于开发环境只有局域网,没法使用网上的各种YUM源,来回拷贝rpm包安装麻烦,还得解决依赖问题.想着在CentOS7.3搭建个本地/局域网YUM源,方便自己跟同事安装软件. 创建本地YUM源 环境: [[email protected] ~]# cat /etc/centos-release CentOS Linux release 7.3.1611 (Core) 并且是Minimal Install. 准备rpm包 : 挂载C

Linux Study之--CentOS 创建本地yum库

Linux Study之--CentOS 创建本地yum库 系统环境:      操作系统:CentOS 65(64) 一.挂载系统光盘 [[email protected] yum.repos.d]# mount /dev/cdrom /media [[email protected] yum.repos.d]# ls /media/ EFI               images                    RELEASE-NOTES-hi-IN.html  RELEASE-NO

为RedHat创建本地yum库

RedHat安装完成后默认是无法直接安装rpm包的,需要自己修改yum库配置文件.本文记录我配置本地yum库的过程. step1:在home目录下创建目录repo,挂载安装镜像文件 mount /dev/cdrom /mnt/repo step2:复制镜像文件到磁盘 cp -rf /mnt/repo /home step3:备份原始yum库配置文件 cp /etc/yum.repos.d/rhel-source.repo /etc/yum.repos.d/rhel-source.repo .ba

更换yum源、创建本地yum源

系统版本: [[email protected] ~]# cat /etc/redhat-release CentOS release 6.7 (Final) [[email protected] ~]# uname -r 2.6.32-573.el6.x86_64 [[email protected] ~]# cat /etc/redhat-release CentOS Linux release 7.1.1503 (Core) [[email protected] ~]# uname -r

创建本地版本仓库

作为一名新时代程序员,不会Git怎么行?这两天看了廖雪峰老师的Git教程,收获颇丰,已经能够能掌握基本的Git使用方法了. 我是用的是windows开发平台(习惯了,我不觉得用windows就低人一等=.=),首先要安装Git for windows 打开Git bash命令行窗口创建一个空目录 $ mkdir learngit $ cd learngit $ pwd /d/learngit pwd 命令用于显示当前目录 用windows还是老老实实的用英文命名吧,最好确保目录名不包含中文 使用

Centos 6.5创建本地YUM仓库

本地搭建本地yum源采用的rpm全部来自CentOS-6.5-bin-DVD1&DVD2; 我的是在虚拟机环境安装,先检查我的操作系统版本: [[email protected] ~]$ uname -m i686 [[email protected] ~]$ cat /etc/centos-release  CentOS release 6.5 (Final) 3. 因为配置本地yum源需要修改/目录下的文件及/etc下面的配置文件,建议更换到root用户:"su -" 4.