apt離線安裝套件的方法

https://www.jinnsblog.com/2020/11/linux-ubuntu-offline-install-package.html#google_vignette

1
2
3
apt-get clean #先清除不必要的檔案
apt-get install --download-only --reinstall $(apt-cache depends --recurse --no-recommends --no-suggests --no-conflicts --no-breaks --no-replaces --no-enhances 套件名稱 | grep "^\w" | sort -u) #下載的套件會被儲存到/var/cache/apt/archives資料夾,會同時下載相依套件,而且就算已經安裝過這個指令也會進行下載
sudo dpkg -i *.deb #把整個archives資料夾移動到離線的主機中必且安裝
Author

Steven

Posted on

2024-02-26

Updated on

2025-12-09

Licensed under

Comments