CentOS7.6を7.5にダウングレード&7.5に固定
本番環境に合わせて、CentOS7.5を基準に動くつもりが、
開発環境だけ7.6にしてしまったので、その修正と、CentOSのバージョン固定をしたいと思います。
こちらのサイトを参考にさせていただきました。
su -
cd /etc/yum.repos.d
cp CentOS-Base.repo CentOS-Base.repo.orig
vi CentOS-Base.repo
# CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$releasever - Base mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$inf ra #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-$releasever - Updates mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 ~以下略~
こんな感じで、CentOSのことばかり書いてあるファイルを編集します。
7.5の正しいバージョン名?を確認したところ7.5.1804
でした。
$SHELL -c "echo 7.5.1804 > /etc/yum/vars/releasever"
これでバージョン名と同じreleaseverファイルができました。
そのうえでリポジトリの参照先を変えるために、以下のコマンドを打ちました。
vi CentOS-Base.repo
:%s/mirrorlist=/#millorlist=/g
:%s/#baseurl/baseurl/g
:%s/mirror.centos/vault.centos/g
# CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$releasever - Base #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$in fra baseurl=http://vault.centos.org/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-$releasever - Updates #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infr a=$infra baseurl=http://vault.centos.org/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 ~以下略~
正直ここまで手探り状態なのですが、開発環境ですし、あとはなるようになれでやってみます!!!
yum clean all
Loaded plugins: fastestmirror Cleaning repos: base extras updates
これでyumのキャッシュがクリアされるそうです。
そしてダウングレード。
yum distribution-synchronization
~前略~ Error: Trying to remove "systemd", which is protected
systemdを消さなきゃいけないんですね…。
systemdってなんだ?と思ったのですが、参考サイトのほうでそこまで網羅していました。すごい。
mv /etc/yum/protected.d/systemd.conf /etc/yum/protected.d/systemd.conf.bak
このコマンドでsystemdをバックアップファイルに変更して、systemdをなかったことにできました。
改めて
yum distribution-synchronization
~前略~ Removed: GeoIP.x86_64 0:1.5.0-13.el7 NetworkManager.x86_64 1:1.12.0-8.el7_6 NetworkManager-libnm.x86_64 1:1.12.0-8.el7_6 NetworkManager-team.x86_64 1:1.12.0-8.el7_6 NetworkManager-tui.x86_64 1:1.12.0-8.el7_6 audit.x86_64 0:2.8.4-4.el7 audit-libs.x86_64 0:2.8.4-4.el7 bash.x86_64 0:4.2.46-31.el7 bind-libs-lite.x86_64 32:9.9.4-72.el7 bind-license.noarch 32:9.9.4-72.el7 binutils.x86_64 0:2.27-34.base.el7 centos-release.x86_64 0:7-6.1810.2.el7.centos coreutils.x86_64 0:8.22-23.el7 cronie.x86_64 0:1.4.11-20.el7_6 cronie-anacron.x86_64 0:1.4.11-20.el7_6 cryptsetup-libs.x86_64 0:2.0.3-3.el7 curl.x86_64 0:7.29.0-51.el7 dbus.x86_64 1:1.10.24-12.el7 dbus-libs.x86_64 1:1.10.24-12.el7 device-mapper.x86_64 7:1.02.149-10.el7_6.2 device-mapper-libs.x86_64 7:1.02.149-10.el7_6.2 dmidecode.x86_64 1:3.1-2.el7 dracut.x86_64 0:033-554.el7 e2fsprogs-libs.x86_64 0:1.42.9-13.el7 elfutils-default-yama-scope.noarch 0:0.172-2.el7 elfutils-libelf.x86_64 0:0.172-2.el7 elfutils-libs.x86_64 0:0.172-2.el7 ethtool.x86_64 2:4.8-9.el7 file.x86_64 0:5.11-35.el7 file-libs.x86_64 0:5.11-35.el7 findutils.x86_64 1:4.5.11-6.el7 firewalld.noarch 0:0.5.3-5.el7 firewalld-filesystem.noarch 0:0.5.3-5.el7 freetype.x86_64 0:2.8-12.el7 fuse.x86_64 0:2.9.2-11.el7 fuse-libs.x86_64 0:2.9.2-11.el7 glib2.x86_64 0:2.56.1-2.el7 glibc.x86_64 0:2.17-260.el7 glibc-common.x86_64 0:2.17-260.el7 gobject-introspection.x86_64 0:1.56.1-1.el7 grub2.x86_64 1:2.02-0.76.el7.centos grub2-common.noarch 1:2.02-0.76.el7.centos grub2-pc.x86_64 1:2.02-0.76.el7.centos grub2-pc-modules.noarch 1:2.02-0.76.el7.centos grub2-tools.x86_64 1:2.02-0.76.el7.centos grub2-tools-extra.x86_64 1:2.02-0.76.el7.centos grub2-tools-minimal.x86_64 1:2.02-0.76.el7.centos grubby.x86_64 0:8.28-25.el7 gssproxy.x86_64 0:0.7.0-21.el7 hwdata.x86_64 0:0.252-9.1.el7 hyperv-daemons.x86_64 0:0-0.34.20180415git.el7 hyperv-daemons-license.noarch 0:0-0.34.20180415git.el7 hypervfcopyd.x86_64 0:0-0.34.20180415git.el7 hypervkvpd.x86_64 0:0-0.34.20180415git.el7 hypervvssd.x86_64 0:0-0.34.20180415git.el7 initscripts.x86_64 0:9.49.46-1.el7 iprutils.x86_64 0:2.4.16.1-1.el7 ipset.x86_64 0:6.38-3.el7_6 ipset-libs.x86_64 0:6.38-3.el7_6 iptables.x86_64 0:1.4.21-28.el7 kbd.x86_64 0:1.15.5-15.el7 kbd-legacy.noarch 0:1.15.5-15.el7 kbd-misc.noarch 0:1.15.5-15.el7 kernel.x86_64 0:3.10.0-957.1.3.el7 kernel-tools.x86_64 0:3.10.0-957.1.3.el7 kernel-tools-libs.x86_64 0:3.10.0-957.1.3.el7 kmod.x86_64 0:20-23.el7 kmod-libs.x86_64 0:20-23.el7 kpartx.x86_64 0:0.4.9-123.el7 krb5-libs.x86_64 0:1.15.1-34.el7 libbasicobjects.x86_64 0:0.1.1-32.el7 libblkid.x86_64 0:2.23.2-59.el7 libcollection.x86_64 0:0.7.0-32.el7 libcom_err.x86_64 0:1.42.9-13.el7 libcroco.x86_64 0:0.6.12-4.el7 libcurl.x86_64 0:7.29.0-51.el7 libdrm.x86_64 0:2.4.91-3.el7 libfastjson.x86_64 0:0.99.4-3.el7 libgcc.x86_64 0:4.8.5-36.el7 libgomp.x86_64 0:4.8.5-36.el7 libicu.x86_64 0:50.1.2-17.el7 libini_config.x86_64 0:1.3.1-32.el7 libldb.x86_64 0:1.3.4-1.el7 libmount.x86_64 0:2.23.2-59.el7 libmspack.x86_64 0:0.5-0.6.alpha.el7 libpath_utils.x86_64 0:0.2.1-32.el7 libref_array.x86_64 0:0.1.5-32.el7 libselinux.x86_64 0:2.5-14.1.el7 libselinux-python.x86_64 0:2.5-14.1.el7 libselinux-utils.x86_64 0:2.5-14.1.el7 libsemanage.x86_64 0:2.5-14.el7 libsepol.x86_64 0:2.5-10.el7 libssh2.x86_64 0:1.4.3-12.el7 libstdc++.x86_64 0:4.8.5-36.el7 libtalloc.x86_64 0:2.1.13-1.el7 libteam.x86_64 0:1.27-5.el7 libtevent.x86_64 0:0.9.36-1.el7 libtirpc.x86_64 0:0.2.4-0.15.el7 libuuid.x86_64 0:2.23.2-59.el7 libwbclient.x86_64 0:4.8.3-4.el7 linux-firmware.noarch 0:20180911-69.git85c5d90.el7 logrotate.x86_64 0:3.8.6-17.el7 man-db.x86_64 0:2.6.3-11.el7 nfs-utils.x86_64 1:1.3.0-0.61.el7 nss-pem.x86_64 0:1.0.3-5.el7 open-vm-tools.x86_64 0:10.2.5-3.el7 openldap.x86_64 0:2.4.44-20.el7 openssl.x86_64 1:1.0.2k-16.el7 openssl-libs.x86_64 1:1.0.2k-16.el7 policycoreutils.x86_64 0:2.5-29.el7 polkit.x86_64 0:0.112-18.el7 postfix.x86_64 2:2.10.1-7.el7 procps-ng.x86_64 0:3.3.10-23.el7 python.x86_64 0:2.7.5-76.el7 python-firewall.noarch 0:0.5.3-5.el7 python-libs.x86_64 0:2.7.5-76.el7 python-linux-procfs.noarch 0:0.4.9-4.el7 python-perf.x86_64 0:3.10.0-957.1.3.el7 python-urlgrabber.noarch 0:3.10-9.el7 qemu-guest-agent.x86_64 10:2.12.0-2.el7 rpcbind.x86_64 0:0.2.0-47.el7 rpm.x86_64 0:4.11.3-35.el7 rpm-build-libs.x86_64 0:4.11.3-35.el7 rpm-libs.x86_64 0:4.11.3-35.el7 rpm-python.x86_64 0:4.11.3-35.el7 rsyslog.x86_64 0:8.24.0-34.el7 samba-client-libs.x86_64 0:4.8.3-4.el7 samba-common.noarch 0:4.8.3-4.el7 samba-common-libs.x86_64 0:4.8.3-4.el7 selinux-policy.noarch 0:3.13.1-229.el7_6.6 selinux-policy-targeted.noarch 0:3.13.1-229.el7_6.6 setup.noarch 0:2.8.71-10.el7 sg3_utils.x86_64 0:1.37-17.el7 sg3_utils-libs.x86_64 0:1.37-17.el7 shadow-utils.x86_64 2:4.1.5.1-25.el7 sudo.x86_64 0:1.8.23-3.el7 systemd.x86_64 0:219-62.el7 systemd-libs.x86_64 0:219-62.el7 systemd-sysv.x86_64 0:219-62.el7 tar.x86_64 2:1.26-35.el7 teamd.x86_64 0:1.27-5.el7 tuned.noarch 0:2.10.0-6.el7 tzdata.noarch 0:2018g-1.el7 util-linux.x86_64 0:2.23.2-59.el7 vim-minimal.x86_64 2:7.4.160-5.el7 wpa_supplicant.x86_64 1:2.6-12.el7 xfsprogs.x86_64 0:4.5.0-18.el7 yum.noarch 0:3.4.3-161.el7.centos yum-plugin-fastestmirror.noarch 0:1.1.31-50.el7 yum-utils.noarch 0:1.1.31-50.el7 zlib.x86_64 0:1.2.7-18.el7 Installed: GeoIP.x86_64 0:1.5.0-11.el7 NetworkManager.x86_64 1:1.10.2-16.el7_5 NetworkManager-libnm.x86_64 1:1.10.2-16.el7_5 NetworkManager-team.x86_64 1:1.10.2-16.el7_5 NetworkManager-tui.x86_64 1:1.10.2-16.el7_5 audit.x86_64 0:2.8.1-3.el7_5.1 audit-libs.x86_64 0:2.8.1-3.el7_5.1 bash.x86_64 0:4.2.46-30.el7 bind-libs-lite.x86_64 32:9.9.4-61.el7_5.1 bind-license.noarch 32:9.9.4-61.el7_5.1 binutils.x86_64 0:2.27-28.base.el7_5.1 centos-release.x86_64 0:7-5.1804.5.el7.centos coreutils.x86_64 0:8.22-21.el7 cronie.x86_64 0:1.4.11-19.el7 cronie-anacron.x86_64 0:1.4.11-19.el7 cryptsetup-libs.x86_64 0:1.7.4-4.el7 curl.x86_64 0:7.29.0-46.el7 dbus.x86_64 1:1.10.24-7.el7 dbus-libs.x86_64 1:1.10.24-7.el7 device-mapper.x86_64 7:1.02.146-4.el7 device-mapper-libs.x86_64 7:1.02.146-4.el7 dmidecode.x86_64 1:3.0-5.el7 dracut.x86_64 0:033-535.el7_5.1 e2fsprogs-libs.x86_64 0:1.42.9-12.el7_5 elfutils-default-yama-scope.noarch 0:0.170-4.el7 elfutils-libelf.x86_64 0:0.170-4.el7 elfutils-libs.x86_64 0:0.170-4.el7 ethtool.x86_64 2:4.8-7.el7 file.x86_64 0:5.11-33.el7 file-libs.x86_64 0:5.11-33.el7 findutils.x86_64 1:4.5.11-5.el7 firewalld.noarch 0:0.4.4.4-15.el7_5 firewalld-filesystem.noarch 0:0.4.4.4-15.el7_5 freetype.x86_64 0:2.4.11-15.el7 fuse.x86_64 0:2.9.2-10.el7 fuse-libs.x86_64 0:2.9.2-10.el7 glib2.x86_64 0:2.54.2-2.el7 glibc.x86_64 0:2.17-222.el7 glibc-common.x86_64 0:2.17-222.el7 gobject-introspection.x86_64 0:1.50.0-1.el7 grub2.x86_64 1:2.02-0.65.el7.centos.2 grub2-common.noarch 1:2.02-0.65.el7.centos.2 grub2-pc.x86_64 1:2.02-0.65.el7.centos.2 grub2-pc-modules.noarch 1:2.02-0.65.el7.centos.2 grub2-tools.x86_64 1:2.02-0.65.el7.centos.2 grub2-tools-extra.x86_64 1:2.02-0.65.el7.centos.2 grub2-tools-minimal.x86_64 1:2.02-0.65.el7.centos.2 grubby.x86_64 0:8.28-23.el7 gssproxy.x86_64 0:0.7.0-17.el7 hwdata.x86_64 0:0.252-8.8.el7 hyperv-daemons.x86_64 0:0-0.32.20161211git.el7 hyperv-daemons-license.noarch 0:0-0.32.20161211git.el7 hypervfcopyd.x86_64 0:0-0.32.20161211git.el7 hypervkvpd.x86_64 0:0-0.32.20161211git.el7 hypervvssd.x86_64 0:0-0.32.20161211git.el7 initscripts.x86_64 0:9.49.41-1.el7_5.2 iprutils.x86_64 0:2.4.15.1-1.el7 ipset.x86_64 0:6.29-1.el7 ipset-libs.x86_64 0:6.29-1.el7 iptables.x86_64 0:1.4.21-24.1.el7_5 kbd.x86_64 0:1.15.5-13.el7 kbd-legacy.noarch 0:1.15.5-13.el7 kbd-misc.noarch 0:1.15.5-13.el7 kernel-tools.x86_64 0:3.10.0-862.14.4.el7 kernel-tools-libs.x86_64 0:3.10.0-862.14.4.el7 kmod.x86_64 0:20-21.el7 kmod-libs.x86_64 0:20-21.el7 kpartx.x86_64 0:0.4.9-119.el7_5.1 krb5-libs.x86_64 0:1.15.1-19.el7 libbasicobjects.x86_64 0:0.1.1-29.el7 libblkid.x86_64 0:2.23.2-52.el7_5.1 libcollection.x86_64 0:0.7.0-29.el7 libcom_err.x86_64 0:1.42.9-12.el7_5 libcroco.x86_64 0:0.6.11-1.el7 libcurl.x86_64 0:7.29.0-46.el7 libdrm.x86_64 0:2.4.83-2.el7 libfastjson.x86_64 0:0.99.4-2.el7 libgcc.x86_64 0:4.8.5-28.el7_5.1 libgomp.x86_64 0:4.8.5-28.el7_5.1 libicu.x86_64 0:50.1.2-15.el7 libini_config.x86_64 0:1.3.1-29.el7 libldb.x86_64 0:1.2.2-1.el7 libmount.x86_64 0:2.23.2-52.el7_5.1 libmspack.x86_64 0:0.5-0.5.alpha.el7 libpath_utils.x86_64 0:0.2.1-29.el7 libref_array.x86_64 0:0.1.5-29.el7 libselinux.x86_64 0:2.5-12.el7 libselinux-python.x86_64 0:2.5-12.el7 libselinux-utils.x86_64 0:2.5-12.el7 libsemanage.x86_64 0:2.5-11.el7 libsepol.x86_64 0:2.5-8.1.el7 libssh2.x86_64 0:1.4.3-10.el7_2.1 libstdc++.x86_64 0:4.8.5-28.el7_5.1 libtalloc.x86_64 0:2.1.10-1.el7 libteam.x86_64 0:1.27-4.el7 libtevent.x86_64 0:0.9.33-2.el7 libtirpc.x86_64 0:0.2.4-0.10.el7 libuuid.x86_64 0:2.23.2-52.el7_5.1 libwbclient.x86_64 0:4.7.1-9.el7_5 linux-firmware.noarch 0:20180220-62.2.git6d51311.el7_5 logrotate.x86_64 0:3.8.6-15.el7 man-db.x86_64 0:2.6.3-9.el7 nfs-utils.x86_64 1:1.3.0-0.54.el7 nss-pem.x86_64 0:1.0.3-4.el7 open-vm-tools.x86_64 0:10.1.10-3.el7_5.1 openldap.x86_64 0:2.4.44-15.el7_5 openssl.x86_64 1:1.0.2k-12.el7 openssl-libs.x86_64 1:1.0.2k-12.el7 policycoreutils.x86_64 0:2.5-22.el7 polkit.x86_64 0:0.112-14.el7 postfix.x86_64 2:2.10.1-6.el7 procps-ng.x86_64 0:3.3.10-17.el7_5.2 python.x86_64 0:2.7.5-69.el7_5 python-firewall.noarch 0:0.4.4.4-15.el7_5 python-libs.x86_64 0:2.7.5-69.el7_5 python-linux-procfs.noarch 0:0.4.9-3.el7 python-perf.x86_64 0:3.10.0-862.14.4.el7 python-urlgrabber.noarch 0:3.10-8.el7 qemu-guest-agent.x86_64 10:2.8.0-2.el7_5.1 rpcbind.x86_64 0:0.2.0-44.el7 rpm.x86_64 0:4.11.3-32.el7 rpm-build-libs.x86_64 0:4.11.3-32.el7 rpm-libs.x86_64 0:4.11.3-32.el7 rpm-python.x86_64 0:4.11.3-32.el7 rsyslog.x86_64 0:8.24.0-16.el7_5.4 samba-client-libs.x86_64 0:4.7.1-9.el7_5 samba-common.noarch 0:4.7.1-9.el7_5 samba-common-libs.x86_64 0:4.7.1-9.el7_5 selinux-policy.noarch 0:3.13.1-192.el7_5.6 selinux-policy-targeted.noarch 0:3.13.1-192.el7_5.6 setup.noarch 0:2.8.71-9.el7 sg3_utils.x86_64 0:1.37-12.el7 sg3_utils-libs.x86_64 0:1.37-12.el7 shadow-utils.x86_64 2:4.1.5.1-24.el7 sudo.x86_64 0:1.8.19p2-14.el7_5 systemd.x86_64 0:219-57.el7_5.3 systemd-libs.x86_64 0:219-57.el7_5.3 systemd-sysv.x86_64 0:219-57.el7_5.3 tar.x86_64 2:1.26-34.el7 teamd.x86_64 0:1.27-4.el7 tuned.noarch 0:2.9.0-1.el7_5.2 tzdata.noarch 0:2018f-2.el7 util-linux.x86_64 0:2.23.2-52.el7_5.1 vim-minimal.x86_64 2:7.4.160-4.el7 wpa_supplicant.x86_64 1:2.6-9.el7 xfsprogs.x86_64 0:4.5.0-15.el7 yum.noarch 0:3.4.3-158.el7.centos yum-plugin-fastestmirror.noarch 0:1.1.31-46.el7_5 yum-utils.noarch 0:1.1.31-46.el7_5 zlib.x86_64 0:1.2.7-17.el7 Complete!
ものすごい長い実行結果が出てきたのでかいつまんでいます。
最後にもう一度CentOSのバージョンを確認。
cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
今度こそ問題なさそうですね!