Installing packages on a server without internet access

Overview

To install the system on a server that does not have internet access, you need to use a package installer.
It must be run on a local machine with internet access.
Using a docker container with an OS instance similar to the one installed on the server, the installer downloads the necessary packages, copies them to the server, and installs them there with all dependencies.

The process has about 10 steps and can take up to 15 minutes.

In the case of accessing the server via VPN, there may not be simultaneous access to the Internet on the local machine.
To do this, the installer script notifies the person to prepare and provide this or that connection, and waits for confirmation from the person.

After the installer script completes, all the necessary packages will be installed on the server, and during the main installation process you can select the installation mode without internet access.

Algorithm

1) Unzip or copy the installer. For example, in the directory /tmp

2) Install docker on the local machine.

sudo apt install -y docker-ce docker-ce-cli containerd.io

3) Run the prerequisites installer script.

cd /tmp/debian_ubuntu
bash prerequisites.sh

4) Enter the address of the server to which the installation is being performed and the user login on the server. When prompted, enter the user password.

Welcome to era prerequisites installer.
NOTE! You need docker installed on local host.

===============================================================
Install packages script started
===============================================================

Enter remote server IP-address: 192.168.0.115
Enter remote server login: admin

5) As the installer runs, confirm server and Internet connectivity on the local machine.

List of steps in the installation script

1) Connecting to a remote server via ssh, uploading scripts to the server.
2) Determining the type and version of the operating system on the server (osver.sh).
3) Determining the list of required packages that are missing on the server (filter_packages.sh).
4) Running a docker container on the local machine with an operating system similar to the remote server. Installing in the package container. (container_start.sh)
5) Build a dependency list for the required packages in the container (container_deps.sh).
6) Filtering the list of dependencies that are missing on the server (filter_packages.sh).
7) Downloading packages in a docker container to a folder with a connected volum to access from the host (container_download.sh).
8) Stopping the docker container.
9) Uploading downloaded packages to the server (upload.sh).
10) Installing downloaded packages on the server (install_packages.sh).

Package List

apt install -y rsync \
               net-tools \
               tree \
               curl \
               wget \
               zip \
               sshpass \
               sysstat \
               htop \
               iotop \
               dstat \
               smartmontools \
               tshark \
               locales \
               locales-all \
               nfs-kernel-server \
               nfs-common \
               apt-transport-https \
               ca-certificates \
               software-properties-common \
               gnupg-agent \
               docker-ce \
               docker-ce-cli \
               containerd.io \
               postgresql-14