制作
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| ls /var/cache/apt/archives/
rm -rf /var/cache/apt/archives/*
apt-get -d install <pkg-name> && apt-get -d install <pkg-name> $(apt-cache depends <pkg-name> | grep Depends | cut -d: -f2)
mkdir -p /opt/pkgs/ touch /opt/pkgs/Packages.gz chmod 777 -R /opt/pkgs
cp -r /var/cache/apt/archives/* /opt/pkgs/
apt-get install dpkg-dev
cd /opt/pkgs && dpkg-scanpackages -m . > Packages
|
使用
本地使用
1 2 3 4
| mv /etc/apt/sources.list /etc/apt/sources.list.bak
echo "deb [trusted=yes] file:///opt/pkgs ./" >> /etc/apt/sources.list
|
网络使用
1 2 3 4
| mv /etc/apt/sources.list /etc/apt/sources.list.bak
echo "deb [trusted=yes] http(s)://example.com/pkgs ./" >> /etc/apt/sources.list
|
参考资料
Linux基础-制作本地apt仓库(离线安装软件)
如何创建一个简单 APT 仓库