0

I want to upgrade my Centos version 7.8 to 7.9 or 8. But my system is not connected to the internet. And I can reach remotely with ssh and sftp to the this server. Is there a way to do this update remotely from cli? I will be glad if you help.

2 Answers2

0

Is there a way to do this update remotely from cli?

yes, make the repo available locally...

I had previously stated to just use the CentOS-7-x86_64-DVD-2009.iso as downloaded from http://isoredirect.centos.org/centos/7/isos/x86_64/... if you

  • mount -o loop CentOS-7-x86_64-DVD-2009.iso /centos79

  • mkdir /root/repo; mkdir /root/repo/centos-7.9

  • cp -r /centos79/* /root/repo/centos-7.9`

  • umount /centos79; rmdir /centos79

  • cp /root/repo/centos-7.9/media.repo /etc/yum.repos.d/centos-7.9-iso.repo

  • edit /etc/yum.repos.d/centos-7.9-iso.repo to be the following

    [centos-7.9-iso] name = centos-7.9-iso baseurl = file:///root/repo/centos-7.9 gpgcheck = 0 enabled = 1

That will create an offline repository. Doing a yum update will then see the contents of this centos-7.9 repository. However this will not allow you to realistically do an update. For a update to work, as you would expect it to without problems, you will need to download the entire CentOS7 repository, will likely be over 100gb. In addition most likely the entire EPEL7 repository as well, about 15gb. Then make those available to your system like I mentioned above with /etc/yum.repos.d/centos-7.9-iso.repo

reposync: Here is how you can download the repository completely, in order to perform an offline update (using RHEL8 as a pithy example) :

reposync --repoid=rhel-8-for-x86_64-baseos-rpms       --norepopath --download-path=/repodisk/BaseOS
reposync --repoid=rhel-8-for-x86_64-appstream-rpms    --norepopath --download-path=/repodisk/AppStream
reposync --repoid=epel                                --norepopath --download-path=/repodisk/EPEL

createrepo /repodisk/BaseOS createrepo /repodisk/AppStream createrepo /repodisk/EPEL

tar -cf BaseOS.tar /repodisk/BaseOS tar -cf AppStream.tar /repodisk/AppStream tar -cf EPEL.tar /repodisk/EPEL

  • copy the tar files to your offline system, this will be > 100gb
  • untar the repos
  • create a /etc/yum.repos.d/local.repo file with the necessary contents pointing to these copied in repos.
  • change the repoid= of the reposync when doing this on an online system to match your repos in its registered /etc/yum.repos.d/redhat.repo file (or the corresponding CentOS repo file)
  • as of 2024 CentOS is now Rocky8_Linux, so change syntax accordingly.
ron
  • 6,575
-1

You will need to download the ISO image from the CentOS website, then burn the ISO image onto a CD or DVD. Once the disc is burned, you can boot your system from the disc and use the command line to run the upgrade process.