CentOS下 使用yum update 更新,不更新

有时需要保留特定版本的软件不升级,但升级其他软件,这时就需求用到下面的技巧。当CentOS/RHEL/Fedora下的Linux服务器使用 yum update 时命令如何排除选定的包呢?Yum使用/etc/yum/yum.conf或/etc/yum.conf中的配置文件。您需要放置exclude指令来定义要更新或安装中排除的包列表。这应该是一个空格分隔的列表。允许使用通配符和?)。当我使用“yum update”时,如何排除php和内核包?打开/etc/yum.conf文件,输入:# vi /etc/yum.conf在[main]部分下面添加以下行,输入:exclude=php kernel最后,它应如下所示:[ main ]cachedir = /var/cache/yum keepcache = 0 debuglevel = 2 logfile = /var/log/yum.log distroverpkg = redhat-release tolerant = 1 exactarch = 1 obsoletes = 1 gpgcheck = 1 plugins = 1 exclude =php kernel*…保存并关闭文件。您现在可以照常使用yum命令,但不会安装某些软件包。如何禁用排除?您可以使用以下语法:yum –disableexcludes = all updateyum –disableexcludes = main install phpyum –disableexcludes = repoid install php httpd这里:all:禁用所有排除main:禁用yum.conf中[main]中定义的排除repoid:禁用为给定repo id定义的排除yum -exclude 命令行选项最后,您可以使用以下语法在命令行上跳过yum命令更新:注意:上述语法将按名称排除特定包,或者从所有存储库的更新中排除。# yum –exclude=package* update# yum –exclude=php* update# yum –exclude=kernel* update# yum -x ‘kernel*’ -x ‘php*’ update推荐读物有关更多信息,请使用以下命令查看yum命令的手册页:$ man yum$ man yum.conf ...

January 11, 2019 · 1 min · jiezi

yum 安装 2.x 版本的git

官方教程,在 Linux/Unix 系统中,通过工具在中安装 git,这种方式比较简单,便于升级卸载工具,网上搜到的全是源码编译安装。下面介绍在 CentOS 系统中,通过 yum 来安装 gitRed Hat Enterprise Linux, Oracle Linux, CentOS, Scientific Linux, et al.RHEL and derivatives typically ship older versions of git. You can download a tarball and build from source, or use a 3rd-party repository such as the IUS Community Project to obtain a more recent version of git.官方文档说 git 在 RHEL 和衍生产品通常都会发布旧版本的 git,我们需要源码编译安装,或者使用第三方存储库(如IUS社区项目)。现在我们通过,IUS社区下载 ius-release.rpm 文件进行安装# 注意下载不同的版本,本机 CentOS 7wget https://centos7.iuscommunity.org/ius-release.rpm# 安装rpm文件rpm -ivh ius-release.rpm查看可安装的git安装包repoquery –whatprovides git# git-0:1.8.3.1-13.el7.x86_64# git2u-0:2.16.5-1.ius.centos7.x86_64# git2u-0:2.16.2-1.ius.centos7.x86_64# git2u-0:2.16.4-1.ius.centos7.x86_64# git-0:1.8.3.1-14.el7_5.x86_64卸载我本机的 1.8.3 的 git,安装 2.16.5 的 git# 卸载老的版本yum remove git# 安装新的版本yum install git2u原文收录在这里 ...

October 29, 2018 · 1 min · jiezi