搭建自己的YUM源HTTP服务器
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服务器的更多相关文章
- 搭建内网Yum源
		
搭建内网yum源 阅读(2,238) 一:因内网服务器 众多,当统一安装一些比较大的rpm的时候全部从外网下载就比较慢,而且还占用了一定的出口流量,因此在内网部署了一台yum服务器,将阿里云的epel ...
 - 基于本地iso 搭建的本地yum源 安装部署openldap
		
1,yum openldap-servers,openldap-clients 基于iso-cd1搭建的本地yum源(具体搭建参看ruige的repo本地快速搭建,在右边 找找看中输入repo key ...
 - [转发]centos7搭建自己的yum源
		
centos7搭建自己的yum源 https://www.cnblogs.com/juandx/p/6136621.html 还是需要学习呢 自己之前记得 查过 但是忘记了. http://w ...
 - linux 搭建局域网YUM源仓库服务器
		
yum简介 Yum(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及CentOS中的Shell前端软件包管理器.基于RPM包管理,能够从指定的服 ...
 - 使用tomcat搭建centos的yum源
		
最近在折腾大数据,需要搭建一个yum源.一般的做法是在CentOS中安装httpd,然后将rpm包放入/var/www/html下面,再执行[createrepo .]即可. 不过虚拟机对传文件终归是 ...
 - 基于虚拟机的centos6.5 搭建本地光盘yum源
		
在线yum安装必须要保持服务器能够连入网络并且他下载的还会比较慢因为地址大部分多是国外的下载站.另外yum在线下载的都是比较新的软件包,可能不是很稳定,那么使用yum的本地资源就是光盘里的RPM包,让 ...
 - 97、配置yum源仓库服务器
		
(服务端(双(外,内)网卡)--客户端(内网)) YUM主要用于自动安装.升级rpm软件包,它能自动查找并解决rpm包之间的依赖关系.要成功的使用YUM工具安装更新软件或系统, 就需要有一个包含各种r ...
 - Linux 本地yum源搭建和网络yum源搭建
		
一.本地yum源搭建 首先挂载上光盘 [root@www /]# mount /dev/cdrom /media/cdrom/ 系统默认已经安装了可使用yum的软件包,所以可以直接配置: [root@ ...
 - RadHat搭建内网YUM源server
		
前言:随着内网linuxserver越来越多,在每台server上安装软件.都要先把安装盘上传上去.在配置本地yum服务,即麻烦又费时.能够在内网的一台linuxserver上安装yum服务,然后其它 ...
 
随机推荐
- JS之执行上下文
			
执行上下文(execution context),是JS中的一个很重要的概念.它对于我们理解函数定义,执行时都做了什么有着很大的意义.理解它我们才能明白我们常说的函数声明提升,作用域链,闭包等原理. ...
 - sql常用函数instr()和substr()
			
Decode decode(条件,值1,翻译值1,值2,翻译值2,...,缺省值) 该函数与程序中的 If...else if...else 意义一样 NVL 格式:NVL( string1, rep ...
 - SQL Server 数据库内部版本号
			
数据库还原或版本升级出现版本错误时可参考 可以利用SQL语句查看本机数据库版本:select @@VERSION 如果你不确定是源数据库的版本,下面的映射表的SQL Server版本的内部版本号,以便 ...
 - POJ:2976-Dropping tests(二分平均值)
			
Dropping tests Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 15508 Accepted: 5418 Descr ...
 - mysql学习第三天练习(流程控制函数)
			
-- 流程控制函数 -- 1.查询员工部门号,并赋予部门名 select empno,ename,deptno,case deptno then '10部门' then '20部门' else '30 ...
 - javascript类式继承模式#2——借用构造函数
			
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
 - 《Cracking the Coding Interview》——第9章:递归和动态规划——题目11
			
2014-03-21 20:20 题目:给定一个只包含‘0’.‘1’.‘|’.‘&’.‘^’的布尔表达式,和一个期望的结果(0或者1).如果允许你用自由地给这个表达式加括号来控制运算的顺序,问 ...
 - gradle构建
			
https://blog.csdn.net/baidu_30809315/article/details/77865414
 - Python学习-KindEditor-富文本编辑框
			
1.进入官网 2.下载 官网下载:http://kindeditor.net/down.php 本地下载:http://files.cnblogs.com/files/wupeiqi/kindedit ...
 - 孤荷凌寒自学python第四十七天通用跨数据库同一数据库中复制数据表函数
			
孤荷凌寒自学python第四十七天通用跨数据库同一数据库中复制数据表函数 (完整学习过程屏幕记录视频地址在文末) 今天继续建构自感觉用起来顺手些的自定义模块和类的代码. 今天打算完成的是通用的(至少目 ...