How to install package in offline mode?

I am trying to install x11vnc on linux machine which doesn’t have internet on it.So i won’t able to install using sudo apt-get install x11vnc command. Can someone please help me install x11vnc with all the required dependencies using offline mode?

I tried installing with .tar.gz file but i am getting below error when tried ./configure command.

checking for gcc… no
checking for cc… no
checking for cc… no
checking for cl… no
configure: error: no acceptable C compiler found in $PATH

Hi yosuva,

Here I assume that you can transfer all dependency packages the to offline host via USB drive, NFS etc.

STEP 1:
On some other online system first download all packages and requirements. Preferably the system will be the same distro and version as the offline host.

To download all required packages you could do something like this:

$ sudo apt update
$ mkdir x11vnc; cd $_
$ for i in $(apt-cache depends --recurse  --no-suggests --no-conflicts --no-recommends --no-breaks --no-replaces --no-enhances x11vnc | grep "^\w"); do apt download $i; done

The above will download all required packages into the x11vnc directory.

STEP 2:

Copy the entire x11vnc to your offline system. On my test run this was exactly:

$ du -sh x11vnc
21M     x11vnc

Just for an illustration this is what the content of the x11vnc directory might look like:

~/x11vnc$ ls
cdebconf_0.250ubuntu2_amd64.deb              libc6_2.30-0ubuntu3_amd64.deb                libgpg-error0_1.36-7ubuntu1_amd64.deb        libselinux1_3.0-1_amd64.deb            libxcb1_1.13.1-3build1_amd64.deb         perl-base_5.30.0-9_amd64.deb
coreutils_8.30-3ubuntu2_amd64.deb            libcap2_1%3a2.27-1_amd64.deb                 libhogweed5_3.5.1+really3.5.1-2_amd64.deb    libslang2_2.3.2-4_amd64.deb            libxdamage1_1%3a1.1.5-1_amd64.deb        sensible-utils_0.0.12+nmu1_all.deb
debconf_1.5.73_all.deb                       libdb5.3_5.3.28+dfsg1-0.6ubuntu1_amd64.deb   libidn2-0_2.2.0-2_amd64.deb                  libssl1.1_1.1.1d-2ubuntu3_amd64.deb    libxdmcp6_1%3a1.1.3-0ubuntu1_amd64.deb   tar_1.30+dfsg-6_amd64.deb
dpkg_1.19.7ubuntu2_amd64.deb                 libdbus-1-3_1.12.16-2ubuntu2_amd64.deb       libjpeg8_8c-2ubuntu8_amd64.deb               libsystemd0_244.1-0ubuntu2_amd64.deb   libxext6_2%3a1.3.4-0ubuntu1_amd64.deb    tcl8.6_8.6.10+dfsg-1_amd64.deb
fontconfig-config_2.13.1-2ubuntu2_all.deb    libdebian-installer4_0.110ubuntu3_amd64.deb  libjpeg-turbo8_2.0.3-0ubuntu1_amd64.deb      libtasn1-6_4.15.0-2_amd64.deb          libxfixes3_1%3a5.0.3-1_amd64.deb         tcl_8.6.9+1_amd64.deb
fonts-dejavu-core_2.37-1_all.deb             libelogind0_241.3-1+debian2_amd64.deb        liblz4-1_1.9.2-2_amd64.deb                   libtcl8.6_8.6.10+dfsg-1_amd64.deb      libxft2_2.3.3-0ubuntu1_amd64.deb         tk8.6_8.6.10-1_amd64.deb
fonts-liberation_1%3a1.07.4-10_all.deb       libexpat1_2.2.9-1_amd64.deb                  liblzma5_5.2.4-1_amd64.deb                   libtextwrap1_0.1-14.2_amd64.deb        libxi6_2%3a1.7.10-0ubuntu1_amd64.deb     tk_8.6.9+1_amd64.deb
gcc-10-base_10-20200202-1ubuntu1_amd64.deb   libffi7_3.3-3_amd64.deb                      liblzo2-2_2.10-2_amd64.deb                   libtk8.6_8.6.10-1_amd64.deb            libxinerama1_2%3a1.1.4-2_amd64.deb       ttf-bitstream-vera_1.10-8_all.deb
libacl1_2.2.53-5ubuntu1_amd64.deb            libfontconfig1_2.13.1-2ubuntu2_amd64.deb     libnettle7_3.5.1+really3.5.1-2_amd64.deb     libunistring2_0.9.10-2_amd64.deb       libxrandr2_2%3a1.5.2-0ubuntu1_amd64.deb  tzdata_2019c-3_all.deb
libattr1_1%3a2.4.48-5_amd64.deb              libfreetype6_2.10.1-2_amd64.deb              libnewt0.52_0.52.21-3ubuntu1_amd64.deb       libuuid1_2.34-0.1ubuntu5_amd64.deb     libxrender1_1%3a0.9.10-1_amd64.deb       ucf_3.0038+nmu1_all.deb
libavahi-client3_0.7-4ubuntu6_amd64.deb      libgcc1_1%3a10-20200202-1ubuntu1_amd64.deb   libp11-kit0_0.23.19-2_amd64.deb              libvncclient1_0.9.12+dfsg-8_amd64.deb  libxss1_1%3a1.2.3-1_amd64.deb            x11-common_1%3a7.7+19ubuntu13_all.deb
libavahi-common3_0.7-4ubuntu6_amd64.deb      libgcc-s1_10-20200202-1ubuntu1_amd64.deb     libpcre2-8-0_10.34-7_amd64.deb               libvncserver1_0.9.12+dfsg-8_amd64.deb  libxtst6_2%3a1.2.3-1_amd64.deb           x11vnc_0.9.16-3_amd64.deb
libavahi-common-data_0.7-4ubuntu6_amd64.deb  libgcrypt20_1.8.5-3ubuntu1_amd64.deb         libpng16-16_1.6.37-1_amd64.deb               libx11-6_2%3a1.6.8-1_amd64.deb         libzstd1_1.4.4+dfsg-1_amd64.deb          zlib1g_1%3a1.2.11.dfsg-1ubuntu3_amd64.deb
libbsd0_0.10.0-1_amd64.deb                   libgmp10_2%3a6.1.2+dfsg-4_amd64.deb          libsasl2-2_2.1.27+dfsg-2_amd64.deb           libx11-data_2%3a1.6.8-1_all.deb        lsb-base_11.1.0ubuntu2_all.deb
libbz2-1.0_1.0.8-2_amd64.deb                 libgnutls30_3.6.11.1-2ubuntu2_amd64.deb      libsasl2-modules-db_2.1.27+dfsg-2_amd64.deb  libxau6_1%3a1.0.9-0ubuntu1_amd64.deb   openssl_1.1.1d-2ubuntu3_amd64.deb

STEP 3:

On the offline system enter the x11vnc directory you just copied and execute:

$ sudo dpkg -i *

This should install all packages including dependencies as well as the x11vnc package. Note you might encounter some errors as some of the packages might already be installed etc. Analyse the output and rectify the issues if necessary or post here for a further assistance.

Hope this helps

Lubos

Thanks @Lubos for the detailed steps. I will try and let you know the outcome.