ubuntu更换apt cache目录

ubuntu更换apt cache目录的方法

apt默认会把下载下来的deb包丢到/var/cache/apt/archives目录下
如果想要永久修改下载目录,比如/download

    #sudo mkdir /download
    #sudo touch /etc/apt/apt.conf.d/99my-archive
    #sudo nano /etc/apt/apt.conf.d/99my-archive

增加此行
dir::cache::archives /download
保存退出立即生效
#sudo apt-get install packagename

  • 如果想要临时更改
    #sudo apt-get -o dir::cache::archives=”/download” install packagename
    或者创建软链接(警告:这种操作会清空你的cache)
    #sudo rm -rf /var/cache/apt/archives
    #sudo ln -s /download /var/cache/apt/archives

参考资料
Abz’s note
Debian.org

说点什么

avatar
  Subscribe  
提醒
Optimized with PageSpeed Ninja