如何创建redhat的yum的本地源和使用163服务器的源
2016-07-26 22:28
495 查看
==============本地源1======================
这里边利用iso镜像文件提供的包作为rpm包源
1:首先将镜像文件中的rpm包拷贝到一个文件中,如:/usr/mysoft/yum/Packages 中,
2:创建本地源需要createrepo 工具来处理依赖关系,所以需要先从上述的rpm包中安装createrepo 工具。
首先检测系统是否已经安装了这个工具
如果还没有安装,则需要安装
其中会遇到一些依赖关系,需要一一安装
3:利用createrepp 处理rpm包之间的依赖关系(需要10分钟左右,提示:Spawning worker 0 with 3720 pkgs,等待就好)
4:配置yum源配置文件,在vi /etc/yum.repos.d/rhel-source.repo中
5:yum 清除之前的缓存,
6:yum 跟新
====================本地源2========================
和第一种一样,也是利用iso镜像文件,但是这个时候不需要拷贝镜像文件,只需要挂载镜像文件就行了。(推荐使用)
1:挂载操作系统的镜像文件到一个指定的目录下,默认挂载在/mnt/cdrom下
mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom/
2:安装yum之后,在/etc/yum.repos.d下会有一些默认的配置文件,如果没有,则在下面创建一个
CentOS-Media.repo (名字没有严格要求,只要后缀为.repo就行了
===================内容如下==============
[local]
baseurl=file:///mnt/cdrom/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
3:运行yum list来加载yum的rpm包即可
yum list
4:思考
为什么配置文件只需要配置到baseurl=file:///mnt/cdrom/就可以知道rpm包存在什么地方了呢?
那个依赖关系的xml文件在哪里?
答案:这是因为在iso里面,就已经存在一个依赖文件repomd.xml,位置在repodata/repomd.xml中
=================使用163的服务器=================
1:到http://mirrors.163.com的 centos帮助文档中下载CentOS6-Base-163.repo文件,存放到/etc/yum.repos.d中
:2:将Centos6-Base-163.repo中的$releasever改为对应的Centos的版本号即可,这里给大家一个网友修改好的文件
3:清除yum缓存
4:更新yum
这里边利用iso镜像文件提供的包作为rpm包源
1:首先将镜像文件中的rpm包拷贝到一个文件中,如:/usr/mysoft/yum/Packages 中,
cp /media/RHEL_6.4\ x86_64\ Disc\ 1/Packages/* /usr/mysoft/yum/Packages/
2:创建本地源需要createrepo 工具来处理依赖关系,所以需要先从上述的rpm包中安装createrepo 工具。
首先检测系统是否已经安装了这个工具
rpm -aq | grep create*
如果还没有安装,则需要安装
rpm -ivh createrepo-0.9.9-17.el6.noarch.rpm
其中会遇到一些依赖关系,需要一一安装
3:利用createrepp 处理rpm包之间的依赖关系(需要10分钟左右,提示:Spawning worker 0 with 3720 pkgs,等待就好)
createrepo /usr/mysoft/yum/Packages/
4:配置yum源配置文件,在vi /etc/yum.repos.d/rhel-source.repo中
[base] name=base baseurl=file:///usr/mysoft/yum/Packages enabled=1 gpgcheck=0
5:yum 清除之前的缓存,
yum clean all
6:yum 跟新
yum update
====================本地源2========================
和第一种一样,也是利用iso镜像文件,但是这个时候不需要拷贝镜像文件,只需要挂载镜像文件就行了。(推荐使用)
1:挂载操作系统的镜像文件到一个指定的目录下,默认挂载在/mnt/cdrom下
mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom/
2:安装yum之后,在/etc/yum.repos.d下会有一些默认的配置文件,如果没有,则在下面创建一个
CentOS-Media.repo (名字没有严格要求,只要后缀为.repo就行了
===================内容如下==============
[local]
baseurl=file:///mnt/cdrom/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
3:运行yum list来加载yum的rpm包即可
yum list
4:思考
为什么配置文件只需要配置到baseurl=file:///mnt/cdrom/就可以知道rpm包存在什么地方了呢?
那个依赖关系的xml文件在哪里?
答案:这是因为在iso里面,就已经存在一个依赖文件repomd.xml,位置在repodata/repomd.xml中
=================使用163的服务器=================
1:到http://mirrors.163.com的 centos帮助文档中下载CentOS6-Base-163.repo文件,存放到/etc/yum.repos.d中
http://mirrors.163.com/.help/CentOS6-Base-163.repo
:2:将Centos6-Base-163.repo中的$releasever改为对应的Centos的版本号即可,这里给大家一个网友修改好的文件
# CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-6 - Base - 163.com baseurl=http://mirrors.163.com/centos/6/os/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=6$releasever&arch=$basearch&repo=os gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 #released updates [updates] name=CentOS-6 - Updates - 163.com baseurl=http://mirrors.163.com/centos/6/updates/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=6$releasever&arch=$basearch&repo=updates gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 #additional packages that may be useful [extras] name=CentOS-6 - Extras - 163.com baseurl=http://mirrors.163.com/centos/6/extras/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=6$releasever&arch=$basearch&repo=extras gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-6 - Plus - 163.com baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=6$releasever&arch=$basearch&repo=centosplus gpgcheck=1 enabled=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 #contrib - packages by Centos Users [contrib] name=CentOS-6 - Contrib - 163.com baseurl=http://mirrors.163.com/centos/6/contrib/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=6$releasever&arch=$basearch&repo=contrib gpgcheck=1 enabled=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
3:清除yum缓存
yum clean all
4:更新yum
yum update
相关文章推荐
- Centos6 编译安装Python
- centos下删除用yum安装的软件
- 利用yum安装Redis的方法详解
- CentOS 5.5使用yum来安装LAMP(php运行环境)
- centos6利用yum安装php mysql gd的步骤
- CentOS系统下编译安装MySQL以及设置相关yum源的教程
- 详解Centos 使用YUM安装MariaDB
- yum命令安装php7和相关扩展
- Linux下yum常用命令汇总
- CentOS 6.5下yum安装 MySQL-5.5全过程图文教程
- CentOS 5 上安装yum的方法
- CentOS 6.5系统中使用yum安装MongoDB 2.6 教程
- centos yum 安装 mongodb 以及php扩展
- 使用光盘配置本地yum源的方法 yum源配置
- 阿里云云服务器Linux系统更新yum源Shell脚本
- linux下的yum命令原理和详解
- CentOS7系统下用YUM安装Nginx详解
- 从Oracle Public Yum为Oracle Linux建立本地的Yum源
- vmware下安装rhel6.7
- 【笔记】CentOS