How to Update and Install Packages on a Server Without Internet Using Another Server

solidsnake

Member
Joined
Oct 6, 2021
Messages
50
Reaction score
2
Credits
654
Hello everyone,
I have two servers:
  • Server A (): This server has internet access.
  • Server B (): This server does not have internet access.
I want to use Server A as a local YUM repository so that I can update and install packages on Server B, even though it has no internet access.
 


The instructions are different depending on which distro you're using. You mentioned a YUM repo, is this
a fedora/redhat/rocky/alamLinux system? Are both computers the same version of Linux? ( they don't have to be, but it makes some things easier ).

Do you want a "full" repo, or a "partial" repo. Warning: these can take up 40GB of disk space or more.
The computer that has internet access will need a web server running on it, it doesn't matter too much which one. I use nginx, but apache/httpd works good too.
 
Last edited:
Warning: these can take up 40GB of disk space or more.

Doesn't doing this mean downloading the entirety of the software in the repositories?

(I simply don't know, thus the question.)
 
Yes, usually. Also 3rd party repos in many cases.

That's what I thought.

Which leads to my next question...

Is it only 40 GB? There are ~65,000 packages in the main Ubuntu repo. Granted, many of them are tiny. However... There are also many that are quite large. 40 GB sounds low to me.

Also, for fun, run this commend (in a Debian-based distro):

Code:
for f in /var/lib/apt/lists/*Packages; do
  printf '%5d %s\n' $(grep '^Package: ' "$f" | wc -l) ${f##*/}
done | sort -n

(Copy and paste all three lines into the terminal for anyone confused and curious.)
 
Is it only 40 GB? There are ~65,000 packages in the main Ubuntu repo.

Right new Fedora is around 38GB. That's about 43,000 packages.
If you add the rpmfusion repos it's about another 12GB.

The Debian world definitely has more packages, for example I think there are about 12 music players.
The fedora world only has 6 or 7. Fedora only has 4 browsers in their repo. I see firefox, chromium, badwolf, seamonkey and netsurf. There's also elinks, lynx, qutebrowser and browsh. So partly it's just fewer options.
But the other thing, is how long a repo holds on to "older versions". The Redhat 8 repo is quite a bit larger than the
fedora repo, even though it less appllication choices. How can that be? Well, for example fedora 42 have only had
12 kernel releases but it only hangs around about a year, then you have to upgrade. Redhat 8 on the other hand has
31 kernel releases because it has to hang around for 7 years.

How long is Ubuntu LTS supported? 5 years? That's 10 releases of fedora. I suppose it could be possible that if you had all the fedora repos from say... 31, 32, ... up to 41. The total sizes would be a lot closer.

I have noticed it's much the same Debian and other LTS distro's. The repos are bigger because they have to keep older versions of stuff. I notice for example Ubuntu 24 has gfortran 9, 10, 11, 12, 13 and 14. In fedora you only get 13 and 14.

But I wonder, for some distros, as more and more applications go to snap/appImage/flatPak, etc... will traditional repos still be a thing?
 
Last edited:
Right new Fedora is around 38GB. That's about 43,000 packages.
If you add the rpmfusion repos it's about another 12GB.

That's much smaller than I'd have expected and, yeah, Ubuntu has a ton of packages.

How long is Ubuntu LTS supported? 5 years? That's 10 releases of fedora.

If you use Ubuntu Pro (used to be 'Advantage' and free for 3 devices), it's 10 years. It was just for security stuff but now it's I want to say that it's for the full main repo.
 
The instructions are different depending on which distro you're using. You mentioned a YUM repo, is this
a fedora/redhat/rocky/alamLinux system? Are both computers the same version of Linux? ( they don't have to be, but it makes some things easier ).

Do you want a "full" repo, or a "partial" repo. Warning: these can take up 40GB of disk space or more.
The computer that has internet access will need a web server running on it, it doesn't matter too much which one. I use nginx, but apache/httpd works good too.
The system I use is oracle linux 7 and oracle linux 8

I will have to do it between different versions.

Instead of downloading all packages, it would actually be better if it only downloads the packages on the server I will update

I will investigate partial repo
 
Instead of downloading all packages, it would actually be better if it only downloads the packages on the server I will update

I will investigate partial repo

If you want to do partial, they have to be the same version.

Here is the quick and easy method.

On the server that has internet access.
Code:
dnf update -y --downloadonly --downloaddr=.

That doesn't install anything yet, it just downloads the rpms.
Next we need to copy them to your web server directory. Do not move them, copy them.
They need to exist in two locations temporarily.

Code:
cp -rvf *rpm /usr/share/nginx/oracle8-repo

Now you can do the actual update if you want to. Run this from the original directory that you downloaded the rpms to.
Code:
dnf update

This will delete the rpms after they are installed. That is why you had to copy the ones for your repo to another directory.
Now we need to run create repo.

Code:
createrepo /usr/share/nginx/oracle8-repo

Move all your current repo files to an archive directory
Code:
mv /etc/yum.repos.d/*repo /home/user/yum_repos

Create a new repo file. Maybe name it something like local-oracle8.repo
Put this /etc/yum.repos.d
Code:
[local-repo]
name=Local Repository
baseurl=http://10.0.0.66/oracle8-repo/
enabled=1
gpgcheck=0

I've simplifed this down to the basics. You will have to adjust for your situation. This is MUCH easier than running foreman.

Here is the problem with running two different versions. How does Oracle8 know which packages you need to do an update on Oracle7? (or vice versa, as the case may be) The dnf updates on Oracle 7 will download different files from a dnf update of Oracle8. In this case, you may have no choice but to use reposync to download everything (full repo) since you don't know which files you will need to do the update.
 
Last edited:


Members online


Latest posts

Top