Skip to content
Advertisement

How to force yum to update only to exact minor OS version

I have a default AWS image with the version CentOS 6.7. If I run

yum update

I am getting CentOS 6.9.

Is there any way to force yum to update only to version 6.8 and not 6.9?

Advertisement

Answer

Yes it is possible. Follow these steps:

  • Find a mirror that is closer to you using: http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os.
  • Replace 6.9 with 6.8, e.g., the URL would look like:http://mirrors.gigenet.com/centos/6.8/os/x86_64/.
  • Create a yum repo file in /etc/yum.repos.d. Let’s name the file User-Stepped.repo.

  • Content of the file would look like the following:

    ~]# cat /etc/yum.repos.d/User-Stepped.repo
    [User_Stepped]
    name=A stepped repo - CentOS 6.8
    baseurl=http://mirrors.gigenet.com/centos/6.8/os/x86_64/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
    
  • Execute the following command to update to CentOS 6.8

    ~]# yum clean all
    ~]# yum --disablerepo='*' --enablerepo=User_Stepped update
    

Use the same name in --enablerepo as you used inside the square brackets of the User-Stepped.repo file.

Advertisement