[问题]如何备份 apt 的 cache?

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
头像
neomi
帖子: 137
注册时间: 2006-08-11 13:03

[问题]如何备份 apt 的 cache?

#1

帖子 neomi » 2007-01-22 14:04

如题,我的网络速度不是很理想,所以打算备份一下 apt 下来的包

那些 deb 我倒是能找到,可是重装后该怎么用呢?
头像
skyx
论坛版主
帖子: 9202
注册时间: 2006-12-23 13:46
来自: Azores Islands
联系:

Re: [问题]如何备份 apt 的 cache?

#2

帖子 skyx » 2007-01-22 14:32

neomi 写了:如题,我的网络速度不是很理想,所以打算备份一下 apt 下来的包

那些 deb 我倒是能找到,可是重装后该怎么用呢?

其实在系统正常时,你用ghost或其它软件备份最省事,

在重装新系统前:你可以先备份cache到你的fat32分区

如 sudo cp /var/cache/apt/archives/*.deb /media/hdx/cache/


重装后:

cd /media/xxx/ your backup dir
sudo cp *.deb /var/cache/apt/archives/
sudo apt-get update

要保证update没有提示错误 ,如出错,重新 update,如果还是有错误 ,那就换个源

if update has no errors,then you can do as bellows:

sudo apt-get upgrade 这时你备份的大多数deb文件是用得着的
sudo apt-get dist-upgrade 这时你备份的大多数deb文件是用得着的

sudo apt-get install the software that you want to 这时你备份的大多数deb文件是用得着的,如果提示找不到你要的软件,那手动安装也是个好办法




cp可能会出现的问题,应该是你的cache 太大,我的cache备份有6G,直接用以下命令可能会:
sudo cp *.deb /var/cache/apt/archives/
bash: /usr/bin/sudo: Argument list too long


the reason above is possiblly that your deb bakup dir is too big

so you can try :

sudo cp a*.deb /var/cache/apt/archives/
sudo cp b*.deb /var/cache/apt/archives/

.................
sudo cp z*.deb /var/cache/apt/archives/



一个不用命令行,在图形界面下操作的方法,dapper edgy可用,7.04不可用


if you use edgy or dapper :

the most convenient way to cp *.deb is as belows:

sudo nautilus

然后在nautilus下你有生杀大权


then you can copy everything you want to as you like.

but be careful to do this !!!


good luck to u
上次由 skyx 在 2007-01-23 10:21,总共编辑 6 次。
no security measure is worth anything if an attacker has physical access to the machine
头像
neomi
帖子: 137
注册时间: 2006-08-11 13:03

#3

帖子 neomi » 2007-01-22 15:43

问题是,我想备份更新包,而不是单一的软件

这样也可以在不联网的情况下 apt-get update?
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#4

帖子 eexpress » 2007-01-22 16:01

update就是刷新包列表。备份有什么用。
● 鸣学
头像
SuperWar3Fan
帖子: 1263
注册时间: 2006-05-20 6:25
来自: 山东淄博
联系:

#5

帖子 SuperWar3Fan » 2007-01-22 18:51

用aptoncd可以弄成一张光盘。。
sudo apt-get install aptoncd
头像
neomi
帖子: 137
注册时间: 2006-08-11 13:03

#6

帖子 neomi » 2007-01-22 18:51

晕,手滑了一下,是 dist-upgrade
头像
skyx
论坛版主
帖子: 9202
注册时间: 2006-12-23 13:46
来自: Azores Islands
联系:

#7

帖子 skyx » 2007-01-22 22:29

update就是刷新包列表。备份有什么用。
如果重新安装系统的话,还是有用的,不是所有的deb都更新了。

ee老大曾建议过不要在本地建依赖关系的:
我基本是这样作的。省得和系统的update不兼容。其实复制回去更好。
上次由 skyx 在 2007-01-22 22:39,总共编辑 1 次。
no security measure is worth anything if an attacker has physical access to the machine
头像
skyx
论坛版主
帖子: 9202
注册时间: 2006-12-23 13:46
来自: Azores Islands
联系:

#8

帖子 skyx » 2007-01-22 22:33

再说apt-get update对网络要求不高啊,update都做不了,还能做什么呢?
no security measure is worth anything if an attacker has physical access to the machine
头像
skyx
论坛版主
帖子: 9202
注册时间: 2006-12-23 13:46
来自: Azores Islands
联系:

#9

帖子 skyx » 2007-01-22 22:49

这样也可以在不联网的情况下 apt-get update?
看这里:

viewtopic.php?t=32554
no security measure is worth anything if an attacker has physical access to the machine
头像
wyg1258
帖子: 654
注册时间: 2006-09-12 19:44
来自: whu

#10

帖子 wyg1258 » 2007-01-23 0:39

刚刚就备份了的 hoho :lol:


cp /var/cache/apt/archives/*.deb /mnt/win_e /apt (个人决定)
yohu
帖子: 955
注册时间: 2006-12-18 17:04
来自: 福建泉州

#11

帖子 yohu » 2007-01-23 6:10

这么麻烦做什么,还复制来复制去的,真是的,浪费自己时间。
我是这么备份的:

代码: 全选

sudo mv /var/cache/apt/archives /media/hda6
sudo ln -s /media/hda6/archives /var/cache/apt/archives
直接把目录转到其它分区,这样你更新的文件都可以放在其它分区上,重装系统再做个连接就可以了,简单有效,不用老复制来复制去的。
拥有超级牛力的搜索引擎:
http://www.google.com/linux
http://www.google.com/
头像
skyx
论坛版主
帖子: 9202
注册时间: 2006-12-23 13:46
来自: Azores Islands
联系:

#12

帖子 skyx » 2007-01-23 10:00

yohu 写了:这么麻烦做什么,还复制来复制去的,真是的,浪费自己时间。
我是这么备份的:

代码: 全选

sudo mv /var/cache/apt/archives /media/hda6
sudo ln -s /media/hda6/archives /var/cache/apt/archives
直接把目录转到其它分区,这样你更新的文件都可以放在其它分区上,重装系统再做个连接就可以了,简单有效,不用老复制来复制去的。
我不敢这样搞,原因是有可能会执行apt-get clean,如果做了个软链接,不小心clean了,那有可cache 备份能完了,我没试过,理论上在fat32上应该是。
sudo nautilus 后,在gui上复制回来也就是几分钟时间
用cp命令还要快,不过我的cache备份太大了,有6G,现在用ghost,。
no security measure is worth anything if an attacker has physical access to the machine
回复