createrepo是linux下的创建仓库的软件包。create是创建的意思,repo是repository的缩写,是仓库的意思。
yum(Yellowdog Updater,Modified)主要的功能是方便添加、删除和更新rpm软件包。可以解决软件包依存问题,更便于管理大量的系统更新问题。
1,通过rpm -ivh <package>命令手动安装。
还有一种情况是最麻烦的,就是提示缺少某些函数库(例如XML::Parser),当你不知道这个函数库包含在哪个软件包里的时候,就束手无策了
2,通过注册RHN(Red Hat Network)帐号,然后由yum连接到RHNSatellite服务器上去解决更新和软件包依存关系等问题。这种方法需要能连接到internet。
如果我没有RHN帐号怎么办呢?注册一个,或使用本地yum仓库。本地yum仓库就是把系统安装光盘里的内容复制到本地磁盘中,通过配置yum,让其访问这个本地磁盘,解决软件包依存关系,但不能更新软件包。
在制作yum仓库时需要一个软件包:createrepo-0.4.11-3.el5.noarch.rpm
可以用rpm -qa|grep createrepo命令查看是否安装了这个软件包。

==============================================Yum服务端==================================================================

[root@yum01 rhel6]# mount /dev/cdrom /mnt

[root@yum01 rhel6]# cp -rv /mnt/* .

[root@yum01 repo]# find /var/repo/rhel6/ -name *.rpm |wc -l
3763

[root@yum01 rhel6]# rpm -qa | grep createrepo
[root@yum01 rhel6]# yum install createrepo

[root@yum01 repo]# pwd
/var/repo
[root@yum01 repo]# ls
rhel6
[root@yum01 repo]# createrepo . [create local repo]
Spawning worker 0 with 3763 pkgs
Worker 0:
Worker 0: iso-8859-1 encoding on Ville Skyttä <ville.skytta@iki.fi> - 2.8.2-2
Worker 0:
Workers Finished
Gathering worker results

Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

[root@yum01 var]# pwd
/var
[root@yum01 var]# createrepo --update repo/ [update repo]

Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

[root@yum01 repo]# ls -al repodata/
total 16320
drwxr-xr-x 2 root root 4096 May 26 08:08 .
drwxr-xr-x 4 root root 4096 May 26 08:08 ..
-rw-r--r-- 1 root root 3351485 May 26 08:08 02ba3bcea83b70ed3503f6422bde9ad670a46d7362f271bfdd52c62020eee875-primary.sqlite.bz2
-rw-r--r-- 1 root root 1810736 May 26 08:08 276ef6038aaa04b71a03fbaef23361cb9d3a776cafd9a2727dc0a9bbc96798b9-primary.xml.gz
-rw-r--r-- 1 root root 4077328 May 26 08:08 5bf793cff6ffa05500c6e3b30eda7a9ed83c718acb5f35b8619820fa0f0b81ba-filelists.sqlite.bz2
-rw-r--r-- 1 root root 1971688 May 26 08:08 5f0a940829039e76d8f03ed8e6697dbd917739a3990991b4e95c5c0bdb844972-other.xml.gz
-rw-r--r-- 1 root root 3683005 May 26 08:08 ae782c5a33530ffeb0606a617c36efba8ded1403edc00d7fec96e95e0c1d4e19-filelists.xml.gz
-rw-r--r-- 1 root root 1788710 May 26 08:08 be63e7d58fd72ffea2ef85f81fce5825201decc877b0d5bca47a459552daa39f-other.sqlite.bz2
-rw-r--r-- 1 root root 3018 May 26 08:08 repomd.xml

[root@yum01 repo]# sudo rpm --import /var/repo/rhel5/RPM-GPG-KEY-redhat-beta /var/repo/rhel5/RPM-GPG-KEY-redhat-release [if any GPG error]

[root@yum01 repo]# yum install httpd

[root@yum01 repo]# vim /etc/httpd/conf.d/repo.conf
Alias /repo/ "/var/repo/"

[root@yum01 repo]# /etc/init.d/httpd reload
Reloading httpd:

[root@yum01 repo]# yum install lynx

[root@yum01 repo]# lynx http://localhost/repo/repodata/repomd.xml [verify can access]

==============================================Yum客户端==================================================================

[root@redhat01 yum.repos.d]# cat /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=3

[main]
cachedir:yum缓存的目录,yum在此存储下载的rpm包和数据库,一般是/var/cache/yum。
debuglevel:除错级别,0-10,默认是2。
logfile:yum的日志文件,默认是/var/log/yum.log。
pkgpolicy:包的策略。一共有两个选项,newest和last,这个作用是如果你设置了多个repository,而同一软件在不同的repository中同时存在,yum应该安装哪一个,如果是newest,则yum会安装最新的那个版本。如果是last,则yum会将服务器id以字母表排序,并选择最后的那个服务器上的软件安装。一般都是选newest。
distroverpkg:指定一个软件包,yum会根据这个包判断你的发行版本,默认是redhat-release,也可以是安装的任何针对自己发行版的rpm包。
exactarch,有两个选项1和0,代表是否只升级和你安装软件包cpu体系一致的包,如果设为1,则如你安装了一个i386的rpm,则yum不会用1686的包来升级。
retries,网络连接发生错误后的重试次数,如果设为0,则会无限重试。
tolerent,也有1和0两个选项,表示yum是否容忍命令行发生与软件包有关的错误,比如你要安装1,2,3三个包,而其中3此前已经安装了,如果你设为1,则yum不会出现错误信息。默认是0。

除了上述之外,还有一些可以添加的选项,如

exclude=,排除某些软件在升级名单之外,可以用通配符,列表中各个项目要用空格隔开,这个对于安装了诸如美化包,中文补丁的朋友特别有用。
gpgchkeck= 有1和0两个选择,分别代表是否是否进行gpg校验,如果没有这一项,默认好像也是检查的。

[root@redhat01 yum.repos.d]# cp rhel-source.repo yum01.repo
[root@redhat01 yum.repos.d]# mv rhel-source.repo /root/
[root@redhat01 yum.repos.d]# cat yum01.repo
[yum01-source]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=http://10.122.1.101/repo/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[....] 代表这个库的名字,必须是唯一的,不可以重复。
name= 是这个库的说明,没有太大的实际意义,只是一个字段说明。
baseurl= 说明采取什么方式传输,具体路径在哪里,可以使用的方式有,file://,ftp://,http://等
enabled=1 说明启用这个更新库,0表示不启用。
gpgcheck=1 表示使用gpg文件来检查软件包的签名
gpgkey= 表示gpg文件所存放的位置,此处也可以有http方式的位置。

[root@redhat01 yum.repos.d]# yum clean all
Loaded plugins: rhnplugin, security
Cleaning repos: rhel-x86_64-server-6
Cleaning up Everything

[root@redhat01 ~]# yum repolist -v
Loading "rhnplugin" plugin
Loading "security" plugin
Config time: 0.059
This system is not registered with RHN.
RHN Satellite or RHN Classic support will be disabled.
Yum Version: 3.2.29
Setting up Package Sacks
pkgsack time: 0.036
Repo-id : yum01-source
Repo-name : THS RHEL 6Server - x86_64 - Source
Repo-revision: 1401094261
Repo-updated : Mon May 26 08:53:21 2014
Repo-pkgs : 3,763
Repo-size : 3.3 G
Repo-baseurl : http://10.122.1.101/repo/
Repo-expire : 21,600 second(s) (last: Wed May 28 06:12:42 2014)

repolist: 3,763

[root@redhat01 ~]# yum repolist all
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN Satellite or RHN Classic support will be disabled.
repo id repo name status
yum01-source THS RHEL 6Server - x86_64 - Source enabled: 3,763

搭建自己的YUM源HTTP服务器的更多相关文章

  1. 搭建内网Yum源

    搭建内网yum源 阅读(2,238) 一:因内网服务器 众多,当统一安装一些比较大的rpm的时候全部从外网下载就比较慢,而且还占用了一定的出口流量,因此在内网部署了一台yum服务器,将阿里云的epel ...

  2. 基于本地iso 搭建的本地yum源 安装部署openldap

    1,yum openldap-servers,openldap-clients 基于iso-cd1搭建的本地yum源(具体搭建参看ruige的repo本地快速搭建,在右边 找找看中输入repo key ...

  3. [转发]centos7搭建自己的yum源

    centos7搭建自己的yum源 https://www.cnblogs.com/juandx/p/6136621.html 还是需要学习呢 自己之前记得 查过 但是忘记了.     http://w ...

  4. linux 搭建局域网YUM源仓库服务器

    yum简介 Yum(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及CentOS中的Shell前端软件包管理器.基于RPM包管理,能够从指定的服 ...

  5. 使用tomcat搭建centos的yum源

    最近在折腾大数据,需要搭建一个yum源.一般的做法是在CentOS中安装httpd,然后将rpm包放入/var/www/html下面,再执行[createrepo .]即可. 不过虚拟机对传文件终归是 ...

  6. 基于虚拟机的centos6.5 搭建本地光盘yum源

    在线yum安装必须要保持服务器能够连入网络并且他下载的还会比较慢因为地址大部分多是国外的下载站.另外yum在线下载的都是比较新的软件包,可能不是很稳定,那么使用yum的本地资源就是光盘里的RPM包,让 ...

  7. 97、配置yum源仓库服务器

    (服务端(双(外,内)网卡)--客户端(内网)) YUM主要用于自动安装.升级rpm软件包,它能自动查找并解决rpm包之间的依赖关系.要成功的使用YUM工具安装更新软件或系统, 就需要有一个包含各种r ...

  8. Linux 本地yum源搭建和网络yum源搭建

    一.本地yum源搭建 首先挂载上光盘 [root@www /]# mount /dev/cdrom /media/cdrom/ 系统默认已经安装了可使用yum的软件包,所以可以直接配置: [root@ ...

  9. RadHat搭建内网YUM源server

    前言:随着内网linuxserver越来越多,在每台server上安装软件.都要先把安装盘上传上去.在配置本地yum服务,即麻烦又费时.能够在内网的一台linuxserver上安装yum服务,然后其它 ...

随机推荐

  1. php扩展开发-MINFO

    我们在用PHPinfo函数或命令行的php -i命令查看php环境相关的信息,当我们开发完成一个自己的扩展,除非这个扩展就是你自己所使用,否则你就需要对扩展进行相关的介绍,或者显示扩展用到的ini配置 ...

  2. TP3.2.3 页面跳转后 Cookie 失效 —— 参考解决方案

    一.问题描述 接手一个项目,使用ThinkPhp3.2.3,在线上环境( Centos7.4 + Nginx1.14 + MySQL5.7 + PHP7.2.4 )运行没有问题, 在本地环境( php ...

  3. C语言字符篇(一)字符串转换函数

      #include <stdlib.h>   double atof(const char *nptr);  将字符串转换成双精度浮点数 int atoi(const char *npt ...

  4. Numpy 索引及切片

    1.一维数组的索引及切片 ar = np.arange(20) print(ar) print(ar[4]) print(ar[3:6]) print(ar[:4:2]) #索引到4 按2的步长 pr ...

  5. [Bzoj3991]寻宝游戏(dfs序+set)

    Description 题目链接 Solution 用set按dfs序维护当前的宝物序列,那么答案为相邻2个点的距离加上头尾2个的距离 Code #include <cstdio> #in ...

  6. ACM 最大化平均值问题总结

    主要是应用c(x)的满足条件有共通之处: c(x)表示要求解的那个表达式不小于x 可以找到表达式 v/w>=x 如果 v-x*w>0 说明有贡献 那就把贡献最大的找出来 如果找出来之后 s ...

  7. vue webpack build 打包过滤console.log()日志

    vue cli创建项目在 webpack.prod.conf.js文件 //打包时清除页面中所有打印及debugger断点 new webpack.optimize.UglifyJsPlugin({ ...

  8. linpack_2

    Run linpack in server 1.Get computer nodal information lscpu dmidecode -t memory | head -45 | tail - ...

  9. 2 semantic ui 框架的应用

    为什么使用css框架 1.使用基础样式 :  ui segment 分段:内容片段 <link rel="stylesheet" href="css/semanti ...

  10. runloop的mode作用是什么?

    用来控制一些特殊操作只能在指定模式下运行,一般可以通过指定操作的运行mode来控制执行时机,以提高用户体验 系统默认注册了5个Mode kCFRunLoopDefaultMode:App的默认Mode ...