1. 挂载centos6.4 DVD镜像
[root@centos64 ~]# mount /dev/cdrom /mnt

2. 安装vsftp软件,启动vsftpd服务,拷贝centos6.4 DVD内容到ftp的匿名用户某一目录。
[root@centos64 Packages]# rpm -ivh vsftpd-2.2.2-11.el6_3.1.x86_64.rpm
Preparing...                ########################################### [100%]
   1:vsftpd                 ########################################### [100%]
[root@centos64 Packages]#
[root@centos64 Packages]#
[root@centos64 Packages]# chkconfig vsftpd on
[root@centos64 Packages]#
[root@centos64 Packages]# cd /var/ftp/
[root@centos64 ftp]#
[root@centos64 ftp]#
[root@centos64 ftp]# ls
pub
[root@centos64 ftp]# rm -rf pub/
[root@centos64 ftp]# service vsftpd start
Starting vsftpd for vsftpd:                                [  OK  ]
[root@centos64 ftp]# mkdir centos6.4-x86_64 centos5.9-x86_64 ##顺便练centos5.9的软件源也一起搭建起来
[root@centos64 ftp]# cd centos6.4-x86_64/
[root@centos64 centos6.4-x86_64]#
[root@centos64 centos6.4-x86_64]# cp -rp /mnt/* .

3. 创建依赖关系数据库
[root@centos64 ~]# cd /mnt/Packages/
[root@centos64 Packages]# rpm -ivh createrepo-0.9.9-17.el6.noarch.rpm
[root@centos64 Packages]# createrepo -g /var/ftp/centos6.4-x86_64/repodata/repomd.xml /var/ftp/centos6.4-x86_64/
Spawning worker 0 with 3955 pkgs
Workers Finished
Gathering worker results

Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@centos64 Packages]#

4. yum的客户端需要修改yum配置文件:
移走/etc/yum.repos.d/所有的.repo文件。
[root@centos64 ~]# cd /etc/yum.repos.d/
[root@centos64 yum.repos.d]# ls
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo  CentOS-Vault.repo  epel.repo  epel-testing.repo
[root@centos64 yum.repos.d]# mkdir bak
[root@centos64 yum.repos.d]# mv CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo  CentOS-Vault.repo bak/
[root@centos64 yum.repos.d]# ls
bak  epel.repo  epel-testing.repo
[root@centos64 yum.repos.d]# vi centos6.4.repo
[root@centos64 yum.repos.d]#
[root@centos64 yum.repos.d]# more centos6.4.repo
[centos6.4]
name=centos6.4
baseurl=ftp://192.168.1.64/centos6.4-x86_64/
enabled=1
[root@centos64 yum.repos.d]#
[root@centos64 yum.repos.d]# yum list all
如果出现如下带有centos6.4的标记,说明成功
......
yum-plugin-aliases.noarch                                      1.1.30-14.el6                             centos6.4                               
yum-plugin-changelog.noarch                                    1.1.30-14.el6                             centos6.4                               
yum-plugin-downloadonly.noarch                                 1.1.30-14.el6                             centos6.4                               
yum-plugin-security.noarch                                     1.1.30-14.el6                             centos6.4  
......

5. 同样的方法搭建centos5.9的yum源
说明:这里有个大大的陷阱,当你把centos5.9的DVD源复制到centos6的系统,然后用centos6的createrepo命令创建依赖数据库的时候,发现虽然没有报错,但是这样的源,在centos5客户端yum 安装的时候,报效验错误的提示。如下:
[root@centos59 yum.repos.d]# yum list all
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
centos5.9/primary_db                                                                                                                            | 2.0 MB     00:00     
ftp://192.168.1.64/centos5.9-x86_64/repodata/d219ce6ac81a48dc4b3295d72b6e26ea0cecd3b03f9a1c1655132d53508ad965-primary.sqlite.bz2: [Errno -3] Error performing checksum
Trying other mirror.
Error: failure: repodata/d219ce6ac81a48dc4b3295d72b6e26ea0cecd3b03f9a1c1655132d53508ad965-primary.sqlite.bz2 from centos5.9: [Errno 256] No more mirrors to try.
[root@centos59 yum.repos.d]#
原因是:centos6中的createrepo 命令,是用的是 光碟 Rackages/路径,而centos5中用的是 CentOS/路径,所以问题就出来了。原来校验的时候,centos5的软件包只能用centos5中的createrepos命令。
解决方法是: 把centos6中的/var/ftp/ 用nfs挂载到 centos5的 /var/ftp/ 同样路径下,用centos5的createrepo命令生成依赖数据库。
在centos6下面,装上nfs并挂载,如下:
[root@centos64 centos5.9-x86_64]# more /etc/exports
/var/ftp *(rw,sync)
[root@centos64 centos5.9-x86_64]#
centos5.9上面挂载命令如下:  mount  192.168.1.65:/var/ftp   /var/ftp

下面是在centos5中执行的createrepo命令:

[root@centos59 CentOS]# createrepo -g /var/ftp/centos5.9-x86_64/repodata/repomd.xml /var/ftp/centos5.9-x86_64/
3579/3579 - CentOS/patch-2.5.4-31.el5.x86_64.rpm                                x86_64.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@centos59 CentOS]#
执行上面的命令后,还是发现错误依旧
[root@centos59 yum.repos.d]# yum list all
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
centos5.9/primary_db                                                                                                                           
| 2.0 MB     00:00     
ftp://192.168.1.64/centos5.9-x86_64/repodata/d219ce6ac81a48dc4b3295d72b6e26ea0cecd3b03f9a1c1655132d53508ad965-primary.sqlite.bz2:
[Errno -3] Error performing checksum
Trying other mirror.
Error:
failure:
repodata/d219ce6ac81a48dc4b3295d72b6e26ea0cecd3b03f9a1c1655132d53508ad965-primary.sqlite.bz2
from centos5.9: [Errno 256] No more mirrors to try.
[root@centos59 yum.repos.d]#
然后直接在centos6中清空掉 centos5.9-x86_64/repodata/ 中的垃圾数据,对比centos5.9 DVD源光盘镜像中的 repodata/ 目录,清空掉以前 centos6 的createrepo命令生成的垃圾文件,并且在centos5 中重命名一下centos5.9.repo 就好了。因为可能在centos5.9中有缓存的缘故。

===============以后碰到了如下问题:

以上方法只是解决了yum -y install XXXXX的 安装问题,但是对于 yum groupinstall 安装的时候,就会报错,如下:

[root@BG-DB:/etc/yum.repos.d]$yum grouplist
Setting up Group Process
centos5.9/group                                                                                         | 1.1 kB     00:00     
ftp://192.168.1.202/repodata/repomd.xml: [Errno -1] Metadata file does not match checksum
Trying other mirror.
Failed to add groups file for repository: centos5.9 - None
Error: No group data available for configured repositories
[root@BG-DB:/etc/yum.repos.d]$

原来没有在yum端创建组数据库,需要在yum源中

【centos5.X】需要如下方法执行:
[root@server202:/var/ftp/centos5.9-x86_64]$createrepo -g  repodata/comps.xml .   ##注意,这里和上面的不同,这个是组的数据库配置。
3579/3579 - CentOS/xorg-x11-drv-cirrus-1.1.0-2.fc6.x86_64.rpm                   pm6_64.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@server202:/var/ftp/centos5.9-x86_64]$

【centos6.X】需要如下方法执行:

[root@centos65dvd centos6.5-x86_64]# createrepo -g repodata/b4e0b9342ef85d3059ff095fa7f140f654c2cb492837de689a58c581207d9632-c6-x86_64-comps.xml .    ## centos6.X这里面的组文件和centos5.X 不一样
Spawning worker 0 with 3995 pkgs

--------------------------------------------------------------------------------------
做完上面的后,yum客户端用如下三条命令后,然后就可以“列出组软件包”了
yum clean all
yum makecache
yum list
如下:
[root@BG-DB:/etc/yum.repos.d]$more centos5.9.repo
[centos5.9]
name=centos5.9
baseurl=ftp://192.168.1.202/
enabled=1
gpgcheck=0
[root@BG-DB:/etc/yum.repos.d]$
[root@BG-DB:/etc/yum.repos.d]$yum grouplist
Setting up Group Process
Installed Groups:
   Administration Tools
   Dialup Networking Support
   Editors
   FTP Server
   Legacy Network Server
   Mail Server
   MySQL Database
   Network Servers
   System Tools
Available Groups:
   Authoring and Publishing
   Base
   Cluster Storage
   Clustering
   DNS Name Server
   Development Libraries
   Development Tools
   Eclipse
   Engineering and Scientific
   GNOME Desktop Environment
   GNOME Software Development
   Games and Entertainment
   Graphical Internet
   Graphics
   HyperV
   Java Development
   KDE (K Desktop Environment)
   KDE Software Development
   KVM
   Legacy Software Development
   Legacy Software Support
   News Server
   Office/Productivity
   OpenFabrics Enterprise Distribution
   PostgreSQL Database
   Printing Support
   Server Configuration Tools
   Sound and Video
   Text-based Internet
   Web Server
   Windows File Server
   X Software Development
   X Window System
   Xen
Done
[root@BG-DB:/etc/yum.repos.d]$

centos6.4搭建基于ftp的yum源让本地局域网服务器使用的更多相关文章

  1. 实验:基于http的yum源

    实验:基于http的yum源 selinux,firewalld已经关闭',系统为CentOS7 repodata所在的目录就是yum源 下面介绍了如何把本地光盘通过httpd服务器变成yum源:多个 ...

  2. 如何搭建ftp的yum源

                ftp的yum的搭建步骤 第一步:安装vsftpd程序包(系统已经安装) [root@station40 ~]# rpm -qa |grep vsftpd vsftpd-2.2 ...

  3. 内网环境上部署k8s+docker集群:集群ftp的yum源配置

    接触docker已经有一年了,想把做的时候的一些知识分享给大家. 因为公司机房是内网环境无法连接外网,所以这里所有的部署都是基于内网环境进行的. 首先,需要通过ftp服务制作本地的yum源,可以从ht ...

  4. centos配置网络yum源 和本地yum源

    一,网络yum源 1.备份 yum文件 cd /etc/ cp -r  yum.repos.d  yum.repos.d.bak 2.在系统联网的情况下执行下面命令下载 wget -O /etc/yu ...

  5. CentOS6.7搭建部署FTP服务 (详解主配置文件)

    FTP传输 三种解析: username -->UID  :/etc/passwd    将用户名转换成UID的库. hostname--->        IP   :DNS服务,/et ...

  6. 基于光盘配置yum源

    #开启自动挂载服务 systemctl start autofs #设置开机自动挂载 systemctl enable autofs #光盘自动挂载路径/misc/cd       “包含repoda ...

  7. yum管理——搭建iso镜像私有yum源仓库(1)

    在服务器上一般是没有光驱的,那么我们怎么制作iso本地repo镜像源仓库? 通过本地iso镜像,copy到linux系统中一个目录中,进行伪文件系统挂载,执行如下命令: 挂载:mount -o loo ...

  8. 搭建基于Docker社区版的Kubernetes本地集群

    Kubernetes的本地集群搭建是一件颇费苦心的活,网上有各种参考资源,由于版本和容器的不断发展,搭建的方式也是各不相同,这里基于Docker CE的18.09.0版本,在Mac OS.Win10下 ...

  9. 【Linux】YUM源搭建

    YUM是什么? YUM是什么 基于rpm但更胜于rpm的软件管理工具: YUM有服务端和客户端: 如果服务端和客户端在同一台机器,这是本地YUM: 如果服务端和客户端不在同一台机器,这是网络YUM. ...

随机推荐

  1. CSS和JS实现单行、多行文本溢出显示省略号(该js方法有问题不对)

    如果实现单行文本的溢出显示省略号同学们应该都知道用text-overflow:ellipsis属性来,当然还需要加宽度width属来兼容部分浏览. 实现方法: overflow: hidden; te ...

  2. 解决方法:loadrunner 场景下执行webservice脚本是---报错10492 Error: Exception was raised when calling per-process-init function in extens

    在vug下执行时,脚本无异常,但是在controller下执行时报下面错误,网上查了下,解决方法千奇百怪,但无一可行. 分析了下错误,似乎是初始化进程有关.想到rts中的设置习惯时以线程方式执行. 遂 ...

  3. ABBYY导出结果为PDF注意事项

    使用ABBYY FineReader Pro for Mac OCR文字识别软件识别文档时,可以将已识别的文本保存到文件中,还可以通过电子邮件发送已识别的文本,只要输出格式受FineReader支持. ...

  4. oracle参数与启停

    oracle随系统启动而启动 cs65-64桌面版orcle-11.2.0.4 启动监听器,后台进程,OEM. 注意: 如果只做一和三,只能启动后台进程,监听器不启动,如果只做二和三,只能启动监听器, ...

  5. wikioi 1205 单词倒排

    /*====================================================================== 1205 单词翻转 题目描述 Description ...

  6. select跳转

    <select onchange="window.open(this.options[this.selectedIndex].value)"><option> ...

  7. Oracle中replace函数的使用

    例: select filefullname from sys_frmattachmentdb 查询的结果为: e:\GengBaoFile\TYGW\<历城区项目立项审批流程>.1079 ...

  8. 目录操作工具类 CopyDir.java

    package com.util; import java.io.*; /** * 1,建立目的目录. 2,遍历源目录. 3,遍历过程中,创建文件或者文件夹. 原理:其实就是改变了源文件或者目录的目录 ...

  9. Spring的依赖注入(DI)三种方式

    Spring依赖注入(DI)的三种方式,分别为: 1.  接口注入 2.  Setter方法注入 3.  构造方法注入 下面介绍一下这三种依赖注入在Spring中是怎么样实现的. 首先我们需要以下几个 ...

  10. 关于SqlServer的DBHelper类以及数据分页

    前端: <My:AspNetPager class="arPage" PageSize="20" UrlPaging="true" r ...