创建本地RPM源之更新系统旧版软件

事情起因:

系统版本为Centos6.6 ,因为之前同事没有采用最小化选择性安装,所以系统安装好后自带有mysql5.1的三个安装包:

[[email protected] ~]# rpm -qa | grep mysql
mysql-5.1.73-3.el6_6.x86_64
mysql-devel-5.1.73-3.el6_6.x86_64
mysql-lib-5.1.73-3.el6_6.x86_64

在安装新版本mysql前,只卸载掉了 mysql 和 mysql-devel,但没能成功卸载 mysql-libs,因为存在着依赖关系,所以打算采用rpm更新操作来将其更替:

[[email protected] ~/Downloads/V137788-01]# rpm -Uvh mysql-commercial-libs-5.7.12-1.1.el6.x86_64.rpm
warning: mysql-commercial-client-5.7.12-1.1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
    mysql-commercial-common(x86-64) = 5.7.12-1.1.el6 is needed by mysql-commercial-libs-5.7.12-1.1.el6.x86_64
    libmysqlclient.so.16()(64bit) is needed by (installed) postfix-2:2.6.6-6.el6_5.x86_64
    libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) postfix-2:2.6.6-6.el6_5.x86_64

看来还需要添加上:mysql-commercial-common

[[email protected] ~/Downloads/V137788-01]# rpm -U mysql-commercial-libs-5.7.12-1.1.el6.x86_64.rpm mysql-commercial-common-5.7.12-1.1.el6.x86_64.rpm
warning: mysql-commercial-libs-5.7.12-1.1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
    libmysqlclient.so.16()(64bit) is needed by (installed) postfix-2:2.6.6-6.el6_5.x86_64
    libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) postfix-2:2.6.6-6.el6_5.x86_64

但是这样还是没能解决,而且卸载postfix会引发更多的rpm包卸载,这样的实施成本就提高了,不是愿意看到的,所以又想到创建本地yum源来更新软件:

安装createrepo
[[email protected] ~/Downloads/V137788-01]# yum install -y createrepo

创建本地yum源目录
[[email protected] ~/Downloads/V137788-01]# mkdir /opt/soft; cd /opt/soft/
并将mysql的rpm包文件移动到这个目录下
#[[email protected] /opt/soft]# mv ~/Downloads/V137788-01/mysql* ./
=================================================================================查看
[[email protected] /opt/soft]# ls
libmcrypt-2.5.8-4.3.x86_64.rpm
libmcrypt-devel-2.5.8-4.3.x86_64.rpm
mysql-commercial-client-5.7.12-1.1.el6.x86_64.rpm
mysql-commercial-common-5.7.12-1.1.el6.x86_64.rpm
mysql-commercial-devel-5.7.12-1.1.el6.x86_64.rpm
mysql-commercial-embedded-5.7.12-1.1.el6.x86_64.rpm
mysql-commercial-embedded-devel-5.7.12-1.1.el6.x86_64.rpm
mysql-commercial-libs-5.7.12-1.1.el6.x86_64.rpm
mysql-commercial-libs-compat-5.7.12-1.1.el6.x86_64.rpm
mysql-commercial-server-5.7.12-1.1.el6.x86_64.rpm
mysql-commercial-test-5.7.12-1.1.el6.x86_64.rpm
nginx-1.9.15-1.el6.icefox.x86_64.rpm

使用createrepo创建本地yum源信息
[[email protected] /]# createrepo -v /opt/soft/
这时会在本地yum源目录中多出一个目录(存放有本地yum源的rpm包的文件信息)[[email protected] /opt/soft]# lslibmcrypt-2.5.8-4.3.x86_64.rpmlibmcrypt-devel-2.5.8-4.3.x86_64.rpmmysql-commercial-client-5.7.12-1.1.el6.x86_64.rpmmysql-commercial-common-5.7.12-1.1.el6.x86_64.rpmmysql-commercial-devel-5.7.12-1.1.el6.x86_64.rpmmysql-commercial-embedded-5.7.12-1.1.el6.x86_64.rpmmysql-commercial-embedded-devel-5.7.12-1.1.el6.x86_64.rpmmysql-commercial-libs-5.7.12-1.1.el6.x86_64.rpmmysql-commercial-libs-compat-5.7.12-1.1.el6.x86_64.rpmmysql-commercial-server-5.7.12-1.1.el6.x86_64.rpmmysql-commercial-test-5.7.12-1.1.el6.x86_64.rpmnginx-1.9.15-1.el6.icefox.x86_64.rpmrepodata=================================================================================编辑repo文件
[[email protected] /]# vim /etc/yum.repos.d/local.repo
[LC]
name=local-rpm
baseurl=file:///opt/soft
enabled=1
gpgcheck=0

安装新版mysql
[[email protected] /]# yum install mysql-commercial-libs mysql-commercial-server mysql-commercial-client mysql-commercial-devel...Installed:  mysql-commercial-client.x86_64 0:5.7.12-1.1.el6                                 mysql-commercial-devel.x86_64 0:5.7.12-1.1.el6                                  mysql-commercial-libs.x86_64 0:5.7.12-1.1.el6                                   mysql-commercial-libs-compat.x86_64 0:5.7.12-1.1.el6                            mysql-commercial-server.x86_64 0:5.7.12-1.1.el6                               

Dependency Installed:  mysql-commercial-common.x86_64 0:5.7.12-1.1.el6                               

Replaced:  mysql-libs.x86_64 0:5.1.73-3.el6_5                                            

Complete!

这里问题算是解决了,安装新版mysql并将旧版移除。

总结:

1) 在使用createrepo命令创建本地rpm源信息时,要使用绝对路径而非相对路径;

2) 如果有新的软件包需要放在本地yum源中,需要再次执行createrepo更新本地rpm源信息;

3) 本地yum源能很好解决旧版软件间的依赖关系,不再需要手动一步步解决。

时间: 2024-10-13 17:17:50

创建本地RPM源之更新系统旧版软件的相关文章

centos7创建本地 yum源 epel源

centos7创建本地 yum源 epel源 1.安装httpd服务,提供网页浏览 yum-y install httpd systemctlstart httpd systemctlenable httpd 2.创建yum仓库目录和epel目录 mkdir/var/www/html/yum 3.安装创建仓库软件包:createrepo yum-y install createrepo 4.初始化仓库索引文件 createrepo-p -d -o /var/www/html/yum/ /var/

redhat linux 5上创建本地yum源

1.挂载光驱 [[email protected] ~]#mkdir -p /mnt/cdrom [[email protected] ~]#mount /dev/cdrom /mnt/cdrom 2.将redhat光盘内容复制至本地硬盘 因为创建yum源的目录,必须是可以写入的的目录,所以需要将光盘中的文件全部复制到本地目录,如果在/mnt/cdrom光驱挂载目录执行创建yum源,会报"Directory /mnt/cdrom must be writable."错误 [[email

本地yum源及更新

创建本地yumrepo源 概述 在生产环境中,由于网络环境隔离,很多内网机器,无法直接通过网络下载安装相关软件包,所以这个时候就需要在内网搭建一个yum源,然后通过下载将需要的软件包rpm下载下来,然后添加进该yum源中,添加的过程很简单,分成两步: 下载软件包,复制进对应的目录 createrepo,创建repo文件 实验描述 在这里,我们使用的是CentOS7的官方镜像,作为本地的yum源,然后搭建了一个简单的http服务,来为其他的服务器提供yum软件安装源.在基础软件包中,没有zabbi

在CentOS 7下更改yum源与更新系统

在CentOS 7下更改yum源与更新系统. [1] 首先备份/etc/yum.repos.d/CentOS-Base.repo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup [2] 进入yum源配置文件所在文件夹 cd /etc/yum.repos.d/ [3] 下载163的yum源配置文件,放入/etc/yum.repos.d/(操作前请做好相应备份) wget http://mir

CentOS 7更改yum源与更新系统

在CentOS 7下更改yum源与更新系统. [1] 首先备份/etc/yum.repos.d/CentOS-Base.repo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup [2] 进入yum源配置文件所在文件夹 [[email protected] yum.repos.d]# cd /etc/yum.repos.d/ [3] 下载163的yum源配置文件,放入/etc/yum.rep

linux 下载rpm包到本地,createrepo:创建本地YUM源

如何下载rpm包到本地 设置yum安装时,保留rpm包. 1.编辑 /etc/yum.conf 将keepcache的值设置为1; 这样就可以将yum安装时的rpm包保存在 /var/cache/yum下面 2.或者使用yum-plugin-downloadonly插件, sudo yum install yum-plugin-downloadonly 用法:sudo yum install ceph-0.87.1-0.el7.centos.x86_64.rpm --downloadonly -

[转载]CentOS 7 创建本地YUM源

本文中的“本地YUM源”包括三种类型:一是直接使用CentOS光盘作为本地yum源,优点是简单便捷,缺点是光盘软件包可能不完整(centos 7 Everything 总共才6.57G):二是同步CentOS官方源到本地(相当于创建了一个公共镜像),优点是最靠谱,缺点是占空间费流量:三是创建完全自定义的本地源,优点是灵活性最大,缺点是只是作为其他源的补充. 一.使用CentOS光盘作为本地yum源 (1) 实体机上直接放入光盘(2) VMware Workstation 虚拟机:虚拟机-->可移

redhat7.2创建本地yum源

1.系统说明 Red Hat Enterprise Linux Server release 7.2 (Maipo) 2.操作方法 1)将服务器光驱中镜像挂在到服务器,并拷贝到服务器硬盘目录/var/mirror 判断光驱是否使用 [[email protected] yum.repos.d]# ls -l /dev/cdrom lrwxrwxrwx 1 root root 3 Sep 27  2016 /dev/cdrom -> sr0 将光驱挂在到/mnt下 [[email protecte

创建本地yum源仓库

1 更新本地yum源 2 yum仓库服务端配置如下 : 3 1. 创建yum仓库目录 4 5 mkdir -p /data/yum_data/ 6 cd /data/yum_data/ 7 #可以上传rpm包到此目录,此目录下面还可以包括文件夹 8 9 2. 安装createrepo软件 10 [[email protected] yum_data]# yum -y install createrepo 11 12 13 3. 初始化repodata索引文件 14 createrepo -pdo