Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to back up installed packages and restore them on a new Ubuntu system

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to back up installed software packages and restore them on the new Ubuntu system". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's ideas to study and learn "how to back up installed software packages and restore them on the new Ubuntu system".

What is apt-clone?

Apt-clone allows you to create backups of all installed packages for your Debian/Ubuntu system, which can be restored in a newly installed system (or container) or directory.

The backup can be restored on multiple systems with the same operating system version and architecture.

How do I install apt-clone?

The apt-clone package can be found in Ubuntu/Debian 's official repository, so use the apt package manager or the apt-get package manager to install it.

Use the apt package manager to install apt-clone.

$sudo apt install apt-clone

Use the apt-get package manager to install apt-clone.

How does $sudo apt-get install apt-clone use apt-clone to back up installed packages?

After successfully installing apt-clone. Just provide a location to save the backup file. We will save the installed package backup in the / backup directory.

Apt-clone saves the list of installed packages to apt-clone-state-Ubuntu18.2daygeek.com.tar.gz.

$sudo apt-clone clone / backup

We can also check by running the ls command.

$ls-lh / backup/total 32K Murray rwmurf RW Murray Rafe-1 root root 29K Apr 20 19:06 apt-clone-state-Ubuntu18.2daygeek.com.tar.gz

Run the following command to view the details of the backup file.

$apt-clone info / backup/apt-clone-state-Ubuntu18.2daygeek.com.tar.gzHostname: Ubuntu18.2daygeek.comArch: amd64Distro: bionicMeta: libunity-scopes-json-def-desktop, ubuntu-desktopInstalled: 1792 pkgs (automatic) Date: Sat Apr 2019: 06:43 2019

Based on the above output, there are a total of 1792 packages in the backup file.

How do I restore a software package that uses apt-clone for backup?

You can use any remote copy program to copy files on the remote server.

$scp / backup/apt-clone-state-ubunt-18-04.tar.gz Destination-Server:/opt

After the replication is complete, use apt-clone to perform the restore.

Use the following command to restore.

$sudo apt-clone restore / opt/apt-clone-state-Ubuntu18.2daygeek.com.tar.gz

Note that the restore will overwrite the existing / etc/apt/sources.list and install / remove the package. So be careful.

If you want to restore all packages to folders instead of actually restoring them, you can use the following command.

$sudo apt-clone restore / opt/apt-clone-state-Ubuntu18.2daygeek.com.tar.gz-- destination / opt/oldubuntu Thank you for reading, this is the content of "how to back up installed packages and restore them on a new Ubuntu system". After the study of this article, I believe you have a deeper understanding of how to backup installed packages and restore them on the new Ubuntu system. The specific use situation still needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report