前言
实现在线缓冲需要的软件和对应依赖的包,离线进行安装 ,用于软件封装。
测试下载一个gcc和依赖环境,关闭默认在线源,测试离线安装gcc和依赖环境
-
兼容 debian ubuntu
-
/test 测试下载安装包到目录
vim /repo_download.sh
#!/bin/bash
-- coding: utf-8 --
Author: make.han
Email: CIASM@CIASM
Date: 2024/07/16
echo "Installing Basic Tools"
apt install -y sudo
apt install -y apt-utils apt-show-versions apt-rdependsecho "stop Interactive mode"
sed -i -e "s|#$nrconf{restart} = 'i';|#$nrconf{restart} = 'a';|g" /etc/needrestart/needrestart.confecho "create directory"
mkdir -p /test && cd /test#使用 xargs 和 apt-get 来下载所有依赖项和主包
echo "Download gcc and its dependencies"
apt-get download (apt-rdepends --state-follow=Installed firewalld curl | grep -v "^ " | grep -v "^")echo "backup Default Mirror Source Test"
mv /etc/apt/sources.list /etc/apt/sources.list.backupeecho "update repo"
apt update关闭源后,可用此方式解决离线安装的依赖问题,实现离线批量安装
echo "install gcc and its dependencies"
apt install -y /test/*.deb连接在线源批量安装插件,不能解决依赖只是安装。
#echo "install gcc"
#dpkg -i /test/*.deb
执行测试
bash /repo_download.sh