I have a work desktop, a home desktop, and a laptop. All of them use Fedora 31. When I need a package, I need to install it three times on all the computers. Is there any way to sync my computers in terms of software and package?
Sure!
Here is one way to do it:
First, open your favorite text editor (vim, gedit
… you choose), and type the names of the packages you wish to sync (separated by spaces or new line). Save that text file as ‘packages.sync
’ or whatever name you prefer
copy that file to each of the machine and run the following as root:
dnf install $(cat packages.sync | xargs)
You are probably unhappy with the idea of plugging three machines to the internet independently to run the same commands … all draining your bandwidth. Hey! You can still sync all three with only one machine accessing the internet. You need a local repository.
What’s that?
It is a repository that you build by yourself, one that recides on your machine. When you create a local repo, you can connect all machines in a local network and sync all of them from that repo. You do need packages to build a local repo.
Building a local repo (the crash course):
On the main machine – the one with internet access – do the following:
- Collect copies of packages you install by caching dnf transactions. You do that by adding “
keepcache=1
” into/etc/dnf/dnf.conf
. - Now run the command above (
dnf install $(cat packages.sync | xargs)
). If you have already installed them, change the “install
” in the command to “reinstall
” - After the dnf session, go to
/var/cache/dnf/rawhide-xxxxxxxxxxxxxxx/packages/
and copy the packages to a folder inside a USB or external HDD. You can call that folder “localrepo
”. Thexxxxxxxxx
in the path above is an alpha-numeric number that is probably unique in every computer. - Now change directory to the localrepo (e.g. “
cd /run/media/bobo/usb-name/localrepo
”) createrepo ./
- The step above creates your local repository inside the folder localrepo.
The next issue would be how to make the repo accessible to all the machines and run the same command. Well, you could ferry the drive to each machine and tell each one to use the localrepo. You can also create a network where they all access the localrepo stored in one of the machines. In any case, you will have to describe the location of the localrepo to each machine by adding the corresponding config file into /etc/yum.repos.d/
Read up on creating configuration files for repositories. I got to run.
This would be a one-time sync. As far as I understood, @Bobo wants to keep the packages in sync continuously…
I am not aware of any service readily made for that but it could be done manually. Assuming you don’t have a ‘master’ machine, wou want the same user-installed packages on all three PCs no matter on which one you add a package. Maybe something like running a daily cron job to export the installed packages into a list (as described by @twohot), share the list online with the other two computers, and on each computer having a hourly or daily cron job that reads the list and installs all packages listed.
Sort of ugly but it would work. If you ask me, too complicated. You will also run into problems if hardware of the three machines is different and you user-install a package that is a driver or something hardware-specific…
I’ve been using python3-dnf-plugin-local for the last few years now with great success. Install the plugin on any Fedora machine, create a NFS mount to my local storage location and point the plugin to it. Any packages that are downloaded by any of my several Fedora installs are saved to the local storage location. Subsequently any other machine that is updated and has the plugin installed and configured gets it’s files from the local storage location instead of downloading files again.
This is an extremely simple and effective way of saving bandwidth if that is your goal.
The updates still need to be done individually so this method may not be what you are looking for to “sync” machines.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.