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

由于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

至此,搞定!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值