您的位置:首页 > 其它

修改Debian Wheezy 7.0 7.1的apt缓存路径

2015-11-04 08:02 337 查看
由于Fedora 18 x64的稳定性越发的不满足所需,权衡了一下软件的新旧程度和系统的稳定性,开始投奔Debian Wheezy 7.0/7.1。

投奔了Debian,就需要使用apt,就需要配置apt。

想配置apt-get的缓存路径,上网一顿搜索,找到的都不好用,而且还有很多重复的文章,可能是由于网上的配置是旧版Debian的。

于是开始查看官方的文档,猛敲如下命令:

man apt.conf

在文档发现了这么一句:

In general the sample configuration file in /usr/share/doc/apt/examples/apt.conf /usr/share/doc/apt/examples/configure-index.gz is a good guide for how it should look.

然后在/usr/share/doc/apt/examples/configure-index.gz中找到了如下内容:

...

// Directory layout

Dir "/"

{

...

// Location of the cache dir

Cache "var/cache/apt/" {

Archives "archives/";

// backup directory created by /etc/cron.daily/apt

...

这回知道怎么办了,编辑/etc/apt/apt.conf,没有则新建,敲入如下命令:

vim /etc/apt/apt.conf

添加如下内容并保存(your/own/apt/cache/directory/为新的缓存路径,注意前后是否应该有斜线):

Dir "/"

{

// Location of the cache dir

Cache "your/own/apt/cache/directory/" {

Archives "archives/";

// backup directory created by /etc/cron.daily/apt

Backup "backup/";

srcpkgcache "srcpkgcache.bin";

pkgcache "pkgcache.bin";

};

};

同时,注意到了“// backup directory created by /etc/cron.daily/apt”这句注释,

打开/etc/cron.daily/apt看看,发现其中含有var/cache/apt这个apt-get的默认缓存路径,

于是编辑/etc/cron.daily/apt,敲入如下命令:

vim /etc/cron.daily/apt

替换“var/cache/apt”为“your/own/apt/cache/directory”,使用如下vim替换命令:

:1,$s/var\/cache\/apt/your\/own\/apt\/cache\/directory/g

至此,搞定!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: