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 Answers
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 thereposync
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.

- 6,575
-
also check out : https://access.redhat.com/discussions/3988321 – ron Jan 17 '23 at 16:31
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.

- 99
-
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?. 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
-
-
@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 – 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
-
-