Ubuntu automatic backup software package and local source

Source: Internet
Author: User
Article Title: Ubuntu automatic backup software package and local source. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Ubuntu has become one of the most popular versions in many Linux distributions. In addition to free application for the installation of CDs, Ubuntu has a major impact on the diversity of software and high speed. For example, if you want to install the Media Player mplayer, make sure that you only need one command after the network is connected: apt-get install mplayer, and all the work (solving dependencies, downloading and installing software, etc.) will be performed automatically on the computer; after the system is updated, you only need to enter apt-get dist-upgrade to update the system comprehensively. This kind of "stupid" (the real dumb is Window $, but its "silly" is obviously different from that of Linux, so we will not discuss it much) similar "installation and upgrade methods bring great convenience to users. However, with this convenient software installation and upgrade, the network speed and traffic problems occur. For example, after a long period of time, if someone's machine crashes due to improper personal operations and wants to perform system updates after Reinstallation, it may consume hundreds of megabytes of traffic, even if some broadband service providers do not charge fees based on traffic, the download time of these updates may be annoying if the network speed is not fast. For example, if one lab or LAN has multiple Ubuntu (or other Linux) users, if each user installs or updates software from the Internet, this is a waste of network traffic and time.

The solution to this problem is actually very simple: backup the software package downloaded during installation or update, and add the local source. This can save a lot of traffic and time, especially for those with low network speeds or with limited network traffic. This article is divided into two parts. The first part describes how to manually create and add the local source. The second part fixes the inconvenience caused by manual methods and provides an automatic solution.

1. manually create and add local sources

The software packages downloaded by the system during each install, including the packages on which each software depends, are stored in the/var/cache/apt/archives/directory, after you have installed all the software commonly used on the network, copy all the files in the folder to a partition that is not frequently formatted, it can be used as the local source for later system reinstallation. The specific steps are as follows.

Renewal package, such as mine:

Mkdir-p/media/sda7/Backup/Ubuntu/Pakcages

Mkdir-p/media/sda7/Backup/Ubuntu/Dists/hard/main/binary-amd64

The binary-amd64 varies depending on the type of your system, such as the binary-i386, and so on, depending on your machine.

2. copy the file to the created Folder:

Sudo cp/var/cache/apt/archives/*/media/sda7/Backup/Ubuntu/Pakcages

3rd, the packages.gz package will be created, which records the software package information under the packs folder, including the dependency information.

Dpkg-scanpackages Packages hadr | gzip> dists/hadr/main/binary-amd64/Packages.gz

4. Add local source

Sudo gedit/etc/apt/sources. list

Add deb file: // media/sda7/Backup/Ubuntu/hard main. Note that this is only the path on my computer. Modify it according to the actual location. If an error occurs, follow the system error prompt to set it accordingly.

5. The settings are complete.

After completing the above settings and copying files, you can start to use the local source normally and use the source on the network.

Sudo apt-get update

Sudo apt-get dist-upgrade

Sudo apt-get install XXX

This completes the manual configuration of the local source.

[1] [2] Next page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.