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
The system is ubuntu-16.04.5-server-amd64, python3 has been installed by default, and the version is 3.5.2
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
Create a new folder offlinePackage in the project root directory
sudo mkdir /offlinePackage
Copy the downloaded deb package to the newly created folder above
sudo cp -r /var/cache/apt/archives /offlinePackage
Modify the permissions of the folder, readable, writable and executable
sudo chmod 777-R /offlinePackage/
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
sudo tar zcvf offlinePackage.tar.gz /offlinePackage/
Save the offlinePackage.tar.gz file to a U disk or server
Insert the U disk or CD, copy offlinePackage.tar.gz to the root directory, and unzip
sudo tar zxvf offlinePackage.tar.gz -C /
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
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
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
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!
sudo apt-get install -y nginx
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 url: http://192.168.91.128/, the effect is as follows:
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: