mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-10 22:21:11 +08:00
translated
This commit is contained in:
parent
17213bbec1
commit
f5ba5647e1
@ -1,121 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (apt-clone : Backup Installed Packages And Restore Those On Fresh Ubuntu System)
|
||||
[#]: via: (https://www.2daygeek.com/apt-clone-backup-installed-packages-and-restore-them-on-fresh-ubuntu-system/)
|
||||
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
|
||||
|
||||
apt-clone : Backup Installed Packages And Restore Those On Fresh Ubuntu System
|
||||
======
|
||||
|
||||
Package installation is become more easier on Ubuntu/Debian based systems when we use apt-clone utility.
|
||||
|
||||
apt-clone will work for you, if you want to build few systems with same set of packages.
|
||||
|
||||
It’s time consuming process if you want to build and install necessary packages manually on each systems.
|
||||
|
||||
It can be achieved in many ways and there are many utilities are available in Linux.
|
||||
|
||||
We have already wrote an article about **[Aptik][1]** in the past.
|
||||
|
||||
It’s one of the utility that allow Ubuntu users to backup and restore system settings and data
|
||||
|
||||
### What Is apt-clone?
|
||||
|
||||
[apt-clone][2] lets allow you to create backup of all installed packages for your Debian/Ubuntu systems that can be restored on freshly installed systems (or containers) or into a directory.
|
||||
|
||||
This backup can be restored on multiple systems with same operating system version and architecture.
|
||||
|
||||
### How To Install apt-clone?
|
||||
|
||||
The apt-clone package is available on Ubuntu/Debian official repository so, use **[apt Package Manager][3]** or **[apt-get Package Manager][4]** to install it.
|
||||
|
||||
Install apt-clone package using apt package manager.
|
||||
|
||||
```
|
||||
$ sudo apt install apt-clone
|
||||
```
|
||||
|
||||
Install apt-clone package using apt-get package manager.
|
||||
|
||||
```
|
||||
$ sudo apt-get install apt-clone
|
||||
```
|
||||
|
||||
### How To Backup Installed Packages Using apt-clone?
|
||||
|
||||
Once you have successfully installed the apt-clone package. Simply give a location where do you want to save the backup file.
|
||||
|
||||
We are going to save the installed packages backup under `/backup` directory.
|
||||
|
||||
The apt-clone utility will save the installed packages list into `apt-clone-state-Ubuntu18.2daygeek.com.tar.gz` file.
|
||||
|
||||
```
|
||||
$ sudo apt-clone clone /backup
|
||||
```
|
||||
|
||||
We can check the same by running the ls Command.
|
||||
|
||||
```
|
||||
$ ls -lh /backup/
|
||||
total 32K
|
||||
-rw-r--r-- 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.gz
|
||||
Hostname: Ubuntu18.2daygeek.com
|
||||
Arch: amd64
|
||||
Distro: bionic
|
||||
Meta: libunity-scopes-json-def-desktop, ubuntu-desktop
|
||||
Installed: 1792 pkgs (194 automatic)
|
||||
Date: Sat Apr 20 19:06:43 2019
|
||||
```
|
||||
|
||||
As per the above output, totally we have 1792 packages in the backup file.
|
||||
|
||||
### How To Restore The Backup Which Was Taken Using apt-clone?
|
||||
|
||||
You can use any of the remote copy utility to copy the files on remote server.
|
||||
|
||||
```
|
||||
$ scp /backup/apt-clone-state-ubunt-18-04.tar.gz Destination-Server:/opt
|
||||
```
|
||||
|
||||
Once you copy the file then perform the restore using apt-clone utility.
|
||||
|
||||
Run the following command to restore it.
|
||||
|
||||
```
|
||||
$ sudo apt-clone restore /opt/apt-clone-state-Ubuntu18.2daygeek.com.tar.gz
|
||||
```
|
||||
|
||||
Make a note, The restore will override your existing `/etc/apt/sources.list` and will install/remove packages. So be careful.
|
||||
|
||||
If you want to restore all the packages into a folder instead of actual restore, you can do it by using the following command.
|
||||
|
||||
```
|
||||
$ sudo apt-clone restore /opt/apt-clone-state-Ubuntu18.2daygeek.com.tar.gz --destination /opt/oldubuntu
|
||||
```
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.2daygeek.com/apt-clone-backup-installed-packages-and-restore-them-on-fresh-ubuntu-system/
|
||||
|
||||
作者:[Magesh Maruthamuthu][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.2daygeek.com/author/magesh/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.2daygeek.com/aptik-backup-restore-ppas-installed-apps-users-data/
|
||||
[2]: https://github.com/mvo5/apt-clone
|
||||
[3]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/
|
||||
[4]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/
|
@ -0,0 +1,121 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (apt-clone : Backup Installed Packages And Restore Those On Fresh Ubuntu System)
|
||||
[#]: via: (https://www.2daygeek.com/apt-clone-backup-installed-packages-and-restore-them-on-fresh-ubuntu-system/)
|
||||
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
|
||||
|
||||
apt-clone:备份已安装的软件包并在新的 Ubuntu 系统上恢复它们
|
||||
======
|
||||
|
||||
当我们在基于Ubuntu/Debian 的系统上使用 apt-clone,包安装会变得更加容易。
|
||||
|
||||
如果你需要在少量系统上安装相同的软件包时,apt-clone 会适合你。
|
||||
|
||||
如果你想在每个系统上手动构建和安装必要的软件包,这是一个耗时的过程。
|
||||
|
||||
它可以通过多种方式实现,Linux 中有许多程序可用。
|
||||
|
||||
我们过去曾写过一篇关于 **[Aptik][1]** 的文章。
|
||||
|
||||
它是能让 Ubuntu 用户备份和恢复系统设置和数据的程序之一。
|
||||
|
||||
### 什么是 apt-clone?
|
||||
|
||||
[apt-clone][2] 能让你为 Debian/Ubuntu 系统创建所有已安装软件包的备份,这些软件包可以在新安装的系统(或容器)或目录中恢复。
|
||||
|
||||
该备份可以在相同操作系统版本和架构的多个系统上还原。
|
||||
|
||||
### 如何安装 apt-clone?
|
||||
|
||||
apt-clone 包可以在 Ubuntu/Debian 的官方仓库中找到,所以,使用 **[apt 包管理器][3]** 或 **[apt-get 包管理器][4]** 来安装它。
|
||||
|
||||
使用 apt 包管理器安装 apt-clone。
|
||||
|
||||
```
|
||||
$ sudo apt install apt-clone
|
||||
```
|
||||
|
||||
使用 apt-get 包管理器安装 apt-clone。
|
||||
|
||||
```
|
||||
$ sudo apt-get install apt-clone
|
||||
```
|
||||
|
||||
### 如何使用 apt-clone 备份已安装的软件包?
|
||||
|
||||
成功安装 apt-clone 之后。只需提供一个保存备份文件的位置。
|
||||
|
||||
我们将在 `/backup` 目录下保存已安装的软件包备份。
|
||||
|
||||
apt-clone 会将已安装的软件包列表保存到 `apt-clone-state-Ubuntu18.2daygeek.com.tar.gz` 中。
|
||||
|
||||
```
|
||||
$ sudo apt-clone clone /backup
|
||||
```
|
||||
|
||||
我们同样可以通过运行 ls 命令来检查。
|
||||
|
||||
```
|
||||
$ ls -lh /backup/
|
||||
total 32K
|
||||
-rw-r--r-- 1 root root 29K Apr 20 19:06 apt-clone-state-Ubuntu18.2daygeek.com.tar.gz
|
||||
```
|
||||
|
||||
运行以下命令,查看备份文件的详细信息。
|
||||
|
||||
```
|
||||
$ apt-clone info /backup/apt-clone-state-Ubuntu18.2daygeek.com.tar.gz
|
||||
Hostname: Ubuntu18.2daygeek.com
|
||||
Arch: amd64
|
||||
Distro: bionic
|
||||
Meta: libunity-scopes-json-def-desktop, ubuntu-desktop
|
||||
Installed: 1792 pkgs (194 automatic)
|
||||
Date: Sat Apr 20 19:06:43 2019
|
||||
```
|
||||
|
||||
根据上面的输出,备份文件中总共有 1792 个包。
|
||||
|
||||
### 如何恢复使用 apt-clone 进行备份的软件包?
|
||||
|
||||
你可以使用任何远程复制程序来复制远程服务器上的文件。
|
||||
|
||||
```
|
||||
$ scp /backup/apt-clone-state-ubunt-18-04.tar.gz Destination-Server:/opt
|
||||
```
|
||||
|
||||
复制完成后,使用 apt-clone 执行还原。
|
||||
|
||||
使用以下命令进行还原。
|
||||
|
||||
```
|
||||
$ sudo apt-clone restore /opt/apt-clone-state-Ubuntu18.2daygeek.com.tar.gz
|
||||
```
|
||||
|
||||
请注意,还原将覆盖现有的 `/etc/apt/sources.list` 并安装/删除包。所以要小心。
|
||||
|
||||
如果你要将所有软件包还原到文件夹而不是实际还原,可以使用以下命令。
|
||||
|
||||
```
|
||||
$ sudo apt-clone restore /opt/apt-clone-state-Ubuntu18.2daygeek.com.tar.gz --destination /opt/oldubuntu
|
||||
```
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.2daygeek.com/apt-clone-backup-installed-packages-and-restore-them-on-fresh-ubuntu-system/
|
||||
|
||||
作者:[Magesh Maruthamuthu][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.2daygeek.com/author/magesh/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.2daygeek.com/aptik-backup-restore-ppas-installed-apps-users-data/
|
||||
[2]: https://github.com/mvo5/apt-clone
|
||||
[3]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/
|
||||
[4]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/
|
Loading…
Reference in New Issue
Block a user