Ubuntu offline installation package

1. Application scenario#

a. When we need to install the same software on multiple computers, and the software is large, the download takes a long time
b. The ubuntu that needs to install the software cannot access the Internet

2. Making offline installation package#

Environmental description##

The system is ubuntu-16.04.5-server-amd64, python3 has been installed by default, and the version is 3.5.2

Install customized software##

Change the update source of ubuntu to Alibaba Cloud, the default speed is too slow

sudo vi /etc/apt/sources.list

The content is as follows:

deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu xenial-security main restricted
deb http://mirrors.aliyun.com/ubuntu xenial-security universe
deb http://mirrors.aliyun.com/ubuntu xenial-security multiverse

Download the deb package required by the XXXX software through the following instructions, such as installing python3-pip

sudo apt-get-y install python3-pip

After executing the above instructions, the XXXX software installation package will be downloaded to the /var/cache/apt/archives directory

Generate dependencies##

Create a new folder###

Create a new folder offlinePackage in the project root directory

sudo mkdir /offlinePackage

Copy the downloaded deb package###

Copy the downloaded deb package to the newly created folder above

sudo cp -r /var/cache/apt/archives  /offlinePackage

Modify folder permissions###

Modify the permissions of the folder, readable, writable and executable

sudo chmod 777-R /offlinePackage/

Establish dependency of deb package###

sudo dpkg-scanpackages /offlinePackage//dev/null|gzip >/offlinePackage/Packages.gz

If an error occurs: sudo: dpkg-scanpackages: command not found

You need to install the dpkg-dev tool

sudo apt-get install dpkg-dev

Packed into a compressed package###

sudo tar zcvf offlinePackage.tar.gz /offlinePackage/

Save the offlinePackage.tar.gz file to a U disk or server

Three, offline installation on another Ubuntu##

Copy files to the root directory##

Insert the U disk or CD, copy offlinePackage.tar.gz to the root directory, and unzip

sudo tar zxvf offlinePackage.tar.gz -C /

Add to system source###

Note: We can back up the original source before adding

sudo cp /etc/apt/sources.list /etc/apt/sources.list.back

Add the location and source path of the installation package to the system source source.list

sudo vi /etc/apt/sources.list

The content is as follows:

deb file:/// offlinePackage/

Note: there is a space in front of offlinePackage

Update system source##

sudo apt-get update

Output:

W: The repository 'file: offlinePackage/ Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.N: See apt-secure(8) manpage for repository creation and user configuration details.

It probably means that this is an insecure update source

Offline installation##

At this point, without internet, we can install the XXXX software downloaded between us

For example, to install python3-pip, Note: As the above has prompted unsafe, so when installing the software, you must add --allow-unauthenticated

Otherwise an error E: There were unauthenticated packages and -y was used without --allow-unauthenticated

sudo apt-get-y install python3-pip --allow-unauthenticated

note:
Compatibility issues. If we use 64-bit ubuntu when making the installation package, then the offline package can only be installed on other 64-bit systems.
Some software is not compatible with ubuntu server and ubuntu desktop version. In short, the offline package made under what system is installed under what system.

View pip3 version

pip3 -V

Output:

pip 8.1.1from/usr/lib/python3/dist-packages(python 3.5)

The installation is successful!

Reference link for this article:

https://blog.csdn.net/wangqiulin123456/article/details/39582269

Fourth, use deb http method#

The file mode is used for online, which can only be used by this machine. Then other servers will not work!
At this time, you need to use http. Can be used by other servers on the LAN!

Install nginx

sudo apt-get install -y nginx

Build project index page##

No domain name is used here, just visit the IP address as the homepage!

Comment out the default homepage of nginx

sudo vim /etc/nginx/nginx.conf

Find the following content and comment out sites-enabled

include /etc/nginx/conf.d/*.conf;#include /etc/nginx/sites-enabled/*;

Enter the directory conf.d and create a new file deb.conf

vim /etc/nginx/conf.d/deb.conf

The content is as follows:

server {
 listen 80;
 server_name localhost;
 root /offlinePackage;

 location /{
  autoindex on;}}

Check if the configuration file is correct

sudo nginx -t

If the following prompt appears, it means ok

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Load configuration

nginx -s reload

Visit index page##

Visit url: http://192.168.91.128/, the effect is as follows:

Update ubuntu database##

Edit configuration file

sudo vim /etc/apt/sources.list

Increase the last line

deb http://192.168.91.128/

Note: Ensure that there are spaces, otherwise it will prompt a format error.

The last one is the slash

Use apt-get update to update

sudo apt-get update

After that, you can install the software!

Be sure to note: Use apt-get install -y software name, followed by --allow-unauthenticated, because it is private and has not been signed!

This article from the reference link:

https://www.jianshu.com/p/ee870d63c175

Recommended Posts

Ubuntu offline installation package
ubuntu offline installation python environment
Installation of deb package under Ubuntu
UBUNTU 16.04 installation diary
ubuntu 1804 installation details
Ubuntu package management
Ubuntu system installation
Ubuntu installation record
ubuntu 18.04 installation (UEFI+GBT)
ubuntu installation error
Manual for Ubuntu Installation
Ubuntu16.04 installation partition settings
ubuntu redis php installation
Ubuntu introduction and installation
Ubuntu make offline source
ubuntu nice font installation
LNMP installation under Ubuntu
Ubuntu CEPH quick installation
foreman ubuntu16 quick installation
Ubuntu 17.10 installation toss record
Ubuntu dual system installation
Github Project-OpenPose installation on Ubuntu
Ubuntu Server Chapter 3 Package Management
ubuntu view python installation path
Ubuntu16.04 installation and simple configuration
Detailed ubuntu 20.04 LTS installation record
Install Mysql offline on Ubuntu
CSI Tools installation Intel 5300 + Ubuntu 14.04
ubuntu19.04 installation tutorial (graphic steps)
Python installation impala package steps
Install Docker on Ubuntu 18.04 offline
Ubuntu PostgreSQL installation and configuration
Install rgl package under Ubuntu
Happy installation of Jenkins in ubuntu
Virtual machine Linux Ubuntu installation tutorial
VMware Ubuntu installation detailed process (pro-test)
ubuntu20.04 Chinese input method installation steps
Ubuntu18 super detailed common software installation
Ubuntu 20.04 Shuangpin input method installation steps
Redis installation under ubuntu and windows
Ubuntu 20.04 CUDA&cuDNN installation method (graphic tutorial)
Installation instructions for gitlab in Ubuntu
Ubuntu 16.04 installation graphic tutorial under VMware 12
Ubuntu 19.1 installation and configuration Chinese environment
Ubuntu16.04 real-time kernel RT Preempt installation
Installation of Docker CE under Ubuntu
Configuration and beautification after Ubuntu installation (1)
Nginx installation and configuration load (ubuntu12.04)
Ubuntu18.04 installation Anaconda3 and VSCode guide
Configure ring after installation on Ubuntu 16.04
Ubuntu configuration source and installation software
Docker CE for Ubuntu installation notes
Ubuntu16.04 mirror complete installation tutorial under VMware
ubuntu Docker installation and deployment of Rancher
Ubuntu Intel graphics driver installation (Ubuntu 14.04--Ubuntu 16.10 + Intel® Graphics Update Tool)
How to secure Redis installation on Ubuntu 14.04
Ubuntu18.04 system installation and prerequisite software installation guide
How to optimize Tomcat installation on Ubuntu 14.04
Installation and uninstallation of CUDA under Ubuntu 16.04
Ubuntu18.04 Server version installation and use (graphic)
Installation and deployment of Nginx in Ubuntu