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.

Can Atila
  • 1
  • 1

2 Answers2

0

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

i think so, what you would want to do is

  • http://isoredirect.centos.org/centos/7/isos/x86_64/
  • download CentOS-7-x86_64-DVD-2009.iso it is 4.4gb; this is version 7.9
  • scp that iso to your centos_7.8 server
  • mount -o loop CentOS-7-x86_64-DVD-2009.iso /abc
  • mkdir /root/repo; mkdir /root/repo/centos-7.9
  • cp -r /abc/* /root/repo/centos-7.9`
  • umount /abc; rmdir /abc
  • 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 just created an offline repository. Doing a yum update will then see the contents of this centos-7.9 repository and be a first step in the possibility of it updating to version 7.9. But I will be $1 that yum will squawk with many missing dependencies, which you will have to run down. And then as you gather those rpm files, my suggestion is simply set up a second offline repository such as /root/repo/updates and just populate this folder with however many rpm files. Upon first creation of this update folder and after any new rpm file is added to this folder, you will need to do a rm /root/repo/update/repodata; createrepo /root/repo/updates; yum clean all so yum will recognize the contents in there immediately afterward. Also cp /etc/yum.repos.d/centos-7.9-iso.repo /etc/yum.repos.d/update.repo and edit its contents accordingly simply by changing the centos references to updates as in /root/repo/updates.

You may need to get and make the CentOS-7.8.iso available as well as a repository; the hard part in doing what you want to do is following what yum update tells you is missing and then however getting those rpms.

tip: often a solution getting around missing dependencies is rather than finding a missing dependency which then leads to another, and another, is to delete the installed rpm that is causing the problem, but only if such a removal does not also cause 100+ rpms to also be uninstalled and you can make due with whatever you are removing in order to get through the offline update from 7.8 to 7.9.

ron
  • 5,749
  • 7
  • 48
  • 84
-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.

  • *use the command line to run the upgrade process* which is what? Never heard of such a tool. I know about rpm/dnf/yum but you can't just use them, and a Linux newbie won't be able to use them at all. – Artem S. Tashkinov Jan 16 '23 at 21:20
  • Yes @ArtemS.Tashkinov is right. I want to do local repository and run it. How can I do on command line? – Can Atila Jan 17 '23 at 06:31
  • If you boot from the CD, you can't update your already installed system. Or, more accurately, you can but it is complicated and you don't explain how. See [Is it possible to install a linux desktop environment from a live cd?](https://unix.stackexchange.com/a/112358). Less importantly, burn a CD or DVD? Many (most?) modern laptops don't even have optical media drives anymore, why in the world would you do that instead of just using a USB stick? – terdon Jan 17 '23 at 11:24
  • @terdon Can I do update with ssh and sftp? – Can Atila Jan 17 '23 at 12:16
  • @CanAtila please add all information to your question. Ssh to where? Sftp from where? It should be possible to download the necessary packages from another computer and use that to update, see [Update yum offline](https://unix.stackexchange.com/q/13347) – terdon Jan 17 '23 at 13:03
  • @terdon I have a offline server and I can do ssh and sftp to the machine. – Can Atila Jan 17 '23 at 13:11
  • Please edit your question and add all details there. – terdon Jan 17 '23 at 13:13
  • @terdon I did it – Can Atila Jan 17 '23 at 13:17