做政府或则企业的项目,通常是本地部署或则私有云,为了防止无外网,或防止现场安装时难以寻找到依赖包的情况发生,需要在开发阶段就准备好所有线上需要的工具或服务,所以需要制作离线包。Ubuntu离线安装软件原理是,在正常有网的开发服务器上安装所有依赖内容,并制作为本地源包,在目标服务器上解压后映射本地源,进行无外网安装。
一、离线包制作
mv /etc/apt/sources.list /etc/apt/sources.list.bak cat >>/etc/apt/sources.list <<EOF deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse EOF apt-get update apt-get upgrade
apt-get install openssh-server apt-get install -y sysstat apt-get install -y gawk apt-get install -y bc apt-get install -y unzip apt-get install -y wget apt-get install -y iptables-persistent apt-get install -y psmisc apt-get install docker-compose apt-get install -y postgresql-11 apt-get install -y postgresql-11-postgis-2.5
cd /var/cache/apt/archives/ dpkg-scanpackages . | gzip -9c > Packages.gz tar -zcf packages.tar.gz ./*
packages.tar.gz
就是制作好的离线包
二、内网安装
上传之前制作的离线包packages.tar.gz
mkdir -p /offline/packages tar -zxvf packages.tar.gz -C /offline/packages/ mv /etc/apt/sources.list /etc/apt/sources.list.bak cat >>/etc/apt/sources.list <<EOF deb [trusted=yes] file:///offline/packages/ ./ EOF apt-get update
apt-get install -y wget apt-get install -y gawk apt-get install -y docker-ce apt-get install -y docker-compose apt-get install -y postgresql-11 apt-get install -y postgresql-11-postgis-2.5
附 网络配置
vim /etc/network/interfaces
eth0是网卡名称,ip addr查看
auto eth0 iface eth0 inet static address 192.168.3.113 netmast 255.255.255.0 gateway 192.168.3.5
vim /etc/resolv.conf
nameserver 114.114.114.114
原文链接:https://blog.csdn.net/yiquan_yang/article/details/109670854
© 版权声明
声明📢本站内容均来自互联网,归原创作者所有,如有侵权必删除。
本站文章皆由CC-4.0协议发布,如无来源则为原创,转载请注明出处。
THE END