ubuntu makes the implementation of the local source

  • 2020-05-14 05:53:41
  • OfStack

background

Usual apt - get install when installing software, download the deb files are stored in/var/cache/apt archives /, to the next reload or for others, especially when there is no network, these deb files actually can be put to use, which can use these deb source production costs. There is another application scenario for this approach:

1. Install apt-get install on a server with a network

2. Then make the local source

3. Copy the local source to a server without network, and then set sourcelist to point to the local source on that machine. At this point, the apt-get install installation can also be performed on the server without network.

Some feasible and practical local source fabrication steps are given below:

1. Create a directory under your own root directory to put all downloaded software packages. The directory name is whatever you like.


mkdir ~/ packs

Copy it and find that all the files in packs are from root account, which needs to be modified

Modify owner


sudo chown -R enadmin.enadmin *

Modify the permissions


sudo chmod ug+rw,o+r *

2. Copy the files into the packs folder.


sudo cp /var/cache/apt/archives/* ~/packs -r

3. Create the Packages.gz package, which records the package information under the packs folder, including the dependency information.


dpkg-scanpackages packs /dev/null |gzip > packs/Packages.gz -r 

Once this is done, copy the packs folder into a partition that is not often formatted for long-term use. For example, I put it on a partition of fat32 with a path of /media/packs

4. Add local sources


sudo gedit /etc/apt/sources.list

Add the following:


deb file:///media/ packs/ 

Notice that packs is followed by a slash and preceded by a space

5. Update the source


sudo apt-get update

Related articles: