Download apt get to a repo

is there a possibility to download all the packages i need to a specific repo which i could bring it to another offline linux system.

I would need to download apt get packages in Linux mint and transfer them to a Redhat linux distribution on a LAN.

Let me rephrase my question.

I have a linux mint OS currently which i would need to download some packages.

After downloading these packages, i would like to store them in a repo or a folder which i could copy this entire folder/repo into a redhat linux OS. This OS is on a LAN with no internet access. How would i be able to achieve this?

Answer

The answer to your question

If you want to get the deb files needed for an installation, you can download-only on the internet pc and recover / copy them later :

apt update
rm -rf /var/cache/apt/archives/*
apt install --download-only software_name
mkdir ~/packages
cp /var/cache/apt/archives/*deb ~/packages

WARNING: It seems like a good solution but be careful, if you want to be able to copy paste the deb files and have a successful installation you will need to have an almost exact copy of the target system in order to download the files. Otherwise missing packages, kernel version errors, etc. will occurs.


The proper way to do it: apt-offline

The real good way of installing packages on an offline system is to use apt-offline. It as really few dependencies allowing you to install it on the offline system with dpkg -i.
Download the deb file on pkgs.org.

Example :

# Online is the computer connected to internet
# Offline is the computer disconnected from internet
# ---
# ## Install apt-offline ## 
# Online
apt update
apt install apt-offline

# ## Update System ##
# Offline
apt-offline set --update updates.sig
# Online
apt-offline get updates.sig --bundle updates.zip
# Offline 
apt-offline install updates.zip

# ## Upgrade System ##
# <!> Update must be done before.
# Offline
apt-offline set --upgrade upgrade.sig
# Online
apt-offline get upgrade.sig --bundle upgrades.zip
# Offline 
apt-offline install upgrades.zip
apt upgrade --no-download --fix-missing

# ## Install packages##
# <!> Update must be done before.
# pkg1, pkg2 & pkg3 being the packages you want to install
# Offline 
apt-offline set install.sig --install pkg1 pkg2 pkg3
# Online
apt-offline get install.sig --bundle install.zip
# Offline 
apt-offline install install.zip
apt install pkg1 pkg2 pkg3 --no-download --fix-missing

Important: Do not proceed to the update and upgrade/install at the same time. By doing so the upgrade is performed from the package list already installed on the computer, not after the update.

Important 2: apt-offline install and upgrade are not enough to get the packages installed. The only thing this command do, is to fill up the cache of apt (/var/cache/apt/archives) with the packages. That allows you to proceed with apt install --no-download --fix-missing.

Attribution
Source : Link , Question Author : aceminer , Answer Author : vinalti

Leave a Comment