centos6.4搭建基于ftp的yum源让本地局域网服务器使用
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源让本地局域网服务器使用的更多相关文章
- 实验:基于http的yum源
实验:基于http的yum源 selinux,firewalld已经关闭',系统为CentOS7 repodata所在的目录就是yum源 下面介绍了如何把本地光盘通过httpd服务器变成yum源:多个 ...
- 如何搭建ftp的yum源
ftp的yum的搭建步骤 第一步:安装vsftpd程序包(系统已经安装) [root@station40 ~]# rpm -qa |grep vsftpd vsftpd-2.2 ...
- 内网环境上部署k8s+docker集群:集群ftp的yum源配置
接触docker已经有一年了,想把做的时候的一些知识分享给大家. 因为公司机房是内网环境无法连接外网,所以这里所有的部署都是基于内网环境进行的. 首先,需要通过ftp服务制作本地的yum源,可以从ht ...
- centos配置网络yum源 和本地yum源
一,网络yum源 1.备份 yum文件 cd /etc/ cp -r yum.repos.d yum.repos.d.bak 2.在系统联网的情况下执行下面命令下载 wget -O /etc/yu ...
- CentOS6.7搭建部署FTP服务 (详解主配置文件)
FTP传输 三种解析: username -->UID :/etc/passwd 将用户名转换成UID的库. hostname---> IP :DNS服务,/et ...
- 基于光盘配置yum源
#开启自动挂载服务 systemctl start autofs #设置开机自动挂载 systemctl enable autofs #光盘自动挂载路径/misc/cd “包含repoda ...
- yum管理——搭建iso镜像私有yum源仓库(1)
在服务器上一般是没有光驱的,那么我们怎么制作iso本地repo镜像源仓库? 通过本地iso镜像,copy到linux系统中一个目录中,进行伪文件系统挂载,执行如下命令: 挂载:mount -o loo ...
- 搭建基于Docker社区版的Kubernetes本地集群
Kubernetes的本地集群搭建是一件颇费苦心的活,网上有各种参考资源,由于版本和容器的不断发展,搭建的方式也是各不相同,这里基于Docker CE的18.09.0版本,在Mac OS.Win10下 ...
- 【Linux】YUM源搭建
YUM是什么? YUM是什么 基于rpm但更胜于rpm的软件管理工具: YUM有服务端和客户端: 如果服务端和客户端在同一台机器,这是本地YUM: 如果服务端和客户端不在同一台机器,这是网络YUM. ...
随机推荐
- CentOS下添加新硬盘
1.查看新硬盘 #fdisk –l 新添加的硬盘的编号为/dev/sdb 2.硬盘分区 1)进入fdisk模式 #/sbin/fdisk /dev/sdb 2)输入n进行分 ...
- PgSQL · 特性分析 · 谈谈checkpoint的调度
在PG的众多参数中,参数checkpoint相关的几个参数颇为神秘.这些参数与checkpoint的调度有关,对系统的稳定性还是比较重要的,下面我们为大家解析一下,这要先从PG的数据同步机制谈起. P ...
- 你可能不知道的 Linux 命令行网络监控工具
http://developer.51cto.com/art/201505/476651_2.htm 对任何规模的业务来说,网络监控工具都 是一个重要的功能.网络监控的目标可能千差万别.比如,监控活动 ...
- Python几个标准类型内建函数
Python提供了一些内建函数用于基本对象类型:cmp(),repr(),str(),type()和等同于repr()的(' ')操作符 (1)type() type的用法如下: type(objec ...
- linq中AsEnumerable和AsQueryable的区别
本文导读:用Linq来操作集合的时候会用到AsQueryable()和AsEnumerable(),何时该用AsQueryable()和何时该用AsEnumerable(),或许存在些疑惑.AsQue ...
- spring基于注解的配置文件
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...
- 阿里DNS
二.阿里公共DNS http://www.alidns.com 全球统一服务ip: 223.5.5.5 223.6.6.6
- DW(一):大数据DW架构参考
DW一直以来是企业信息与决策支持系统的核心组件,随着各类日志.社交.传感等非结构化数据的加入,企业内部数据按指数级增长,传统DW已经达到一个关键临界点——需要大量的资源投入到硬件.优化.支持和维护中, ...
- 封装类的方式访问数据库(封装字符串、json)
<?php class DBDA { public $host="localhost";//服务器地址 public $uid="root";//用户名 ...
- css中的继承、层叠、样式优先级机制
一.继承与层叠: