Ubuntu system offline installation resource package

A project has been deployed in the past few days, using the ubuntu operating system, and it is still not connected to the external network. As a result, some software resource packages required by my project cannot be installed directly from the Internet, and need to be uploaded and installed manually, but it was found during the installation Many resource packs are related. The premise of installing this resource pack is that you need to install other resource packs. Some are too complicated to install one by one, so I found a way to integrate resource packs and install them together. I found it, and I have sorted out several methods below, you can refer to it.

method one

Single Simple Resource Bundle

On the ubuntu computer with Internet access, use apt-get install to install the software, and then copy the installation package to the offline ubuntu computer in the /var/cache/apt/archives directory. For example, to install samba, the steps are as follows:
1. Download the required installation software

sudo apt-get install gcc

2. Find the /var/cache/apt/archives directory

cd /var/cache/apt/archives

3. Download to your own computer or U disk via ftp to save, then copy to an offline computer, and install with the following command (note: the file name may be slightly different, because the version is different, the installation method is the same)

sudo dpkg -i gcc.deb

This is a single software package, and there are some complex software packages that require many other resources, otherwise they cannot be installed, so there is also the operation of complex software package installation integration.

#重量style ## Complexity resource package A
complex software package needs to download all the resources it needs to form an installation package, and make an offline source.
1. First create a folder

sudo mkdir test
cd test

2. Download the resource pack, this download resource pack will download the resource packs he depends on together (packagename is the name of your package)

sudo apt-get download $(apt-cache depends --recurse --no-recommends --no-suggests --no-conflicts --no-breaks --no-replaces --no-enhances <packagename> | grep "^\w" | sort -u)

3. After downloading, there are many .deb files after downloading. This requires modifying permissions and establishing dependencies

sudo mkdir ./archives
sudo dpkg-scanpackages ./ /dev/null | gzip > ./archives/Packages.gz -r
sudo chmod 777 -R ./

Note: If you get the error: sudo: dpkg-scanpackages: command not found, you need to install the dpkg-dev tool:

sudo apt-get install dpkg-dev

If the dpkg-scanpackages command only outputs warning and info information, don’t worry about it, as long as it does not report an error.
4. Package the entire folder

sudo tar cvzf ../test.tar.gz ../test

5. Put the packaged files on an offline server for decompression, and I put them in the home directory

sudo tar -xvf test.tar.gz

6. Modify the source of the downloaded resource pack

mv /etc/apt/sources.list /etc/apt/sources.list.bak
echo "deb [trusted=yes] file:///home/test/ archives/" >> /etc/apt/sources.list

7. Update the source (Note: it is best to update the source every time you operate it. If there are several resource packages, it is best to update each time you decompress one)

sudo apt-get update

8. Install the offline resource package (just write the name of your own resource package, it will automatically resolve your dependencies from the source path you set)

sudo apt-get install gcc

If there is a dependency problem, you can use the following command to fix it

sudo apt-get install -f

Method Two

Go to the official website of ubuntu to download the software resource pack, but you can only download his own resource pack, not including the resource packs he depends on.

1. Download address of ubuntu official website: Ubuntu – Ubuntu Packages Search , click to access, find this location.

insert image description here

2. Click Search, and the search content will appear.

There are a lot of search content. Find what you want and click kinetic to enter.

3. After entering, the software package information and the resource names it depends on will appear
insert image description here

4. Swipe down to find this location.
insert image description here
Download the resource pack of your own hardware architecture according to your own needs. Generally, the required resource packs will provide what architecture you need.

5. After clicking the name of the hardware architecture, enter the download page
insert image description here

There are download links and file paths in it, just find and download. The file names may vary slightly.

6. Installation
The installation method is the same as method one.

sudo dpkg -i gcc.deb

At this point, the installation is complete. My personal suggestion is to use the associative to install, so as not to miss dependencies. Otherwise, it will be too troublesome to find and fight one by one. It is best to find a cloud server to download the associative dependencies and use your own Virtual machine downloads can not be downloaded from some websites, and the version may not be correct if you look for it yourself. My personal suggestion depends on your financial ability.

Guess you like

Origin blog.csdn.net/qq_45699784/article/details/128644347