网站对应的ip地址吗,软件开发管理制度,软件技术论文题目,爱网站长尾关键词挖掘工具Ubuntu制作本地安装源 应用场景离线安装包的制作#xff08;可联网电脑#xff09;更新源安装软件 生成依赖关系在另外一台Ubuntu上离线安装安装 使用deb http方式安装安装nginx更新ubuntu数据库#xff0c;并安装应用 应用场景
当我们需要在多台电脑安装同一个软件,并且软… Ubuntu制作本地安装源 应用场景离线安装包的制作可联网电脑更新源安装软件 生成依赖关系在另外一台Ubuntu上离线安装安装 使用deb http方式安装安装nginx更新ubuntu数据库并安装应用 应用场景
当我们需要在多台电脑安装同一个软件,并且软件很大下载需要很长时间需要安装软件的ubuntu不能上网。
离线安装包的制作可联网电脑
可联网电脑要与不能联网电脑系统一致修改可联网电脑源使用国内源加快软件下载速度系统ubuntu20.0.4
更新源
sudo vi /etc/apt/sources.listdeb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu xenial-security main restricted
deb http://mirrors.aliyun.com/ubuntu xenial-security universe
deb http://mirrors.aliyun.com/ubuntu xenial-security multiverse安装软件
sudo apt-get -y install python3-pip执行完上述指令后XXXX软件的安装包就下载到了/var/cache/apt/archives目录下
生成依赖关系
### 新建一个文件夹
sudo mkdir /offlinePackage# 将下载的deb包拷贝到上述新建的文件夹下
sudo cp -r /var/cache/apt/archives /offlinePackage# 修改文件夹权限
sudo chmod 777 -R /offlinePackage/# 建立deb包的依赖关系
sudo dpkg-scanpackages /offlinePackage/ /dev/null |gzip /offlinePackage/Packages.gz 如果出现错误sudo: dpkg-scanpackages: command not found,则需要安装dpkg-dev工具 sudo apt-get install dpkg-dev # 打包成压缩包
sudo tar zcvf offlinePackage.tar.gz /offlinePackage/保存打包后的offlinePackage.tar.gz文件到U盘或服务器
在另外一台Ubuntu上离线安装
#
# 将offlinePackage.tar.gz复制到根目录下解压
sudo tar zxvf offlinePackage.tar.gz -C /# 将安装包所在和源路径添加到系统源source.list
sudo vi /etc/apt/sources.list
deb [trustedyes] file:/// offlinePackage/注意offlinePackage前面有一个空格 # 更新源
sudo apt-get updateW: The repository file: offlinePackage/ Release does not have a Release file.N: Data from such a repository cant be authenticated and is therefore potentially dangerous to use.N: See apt-secure(8) manpage for repository creation and user configuration details.# 大概意思是这是不安全的更新源安装
此时在没有网络的情况下我们就可以安装我们之间下载的XXXX软件了。比如安装python3-pip注意由于上面已经提示不安全了所以安装软件时必须要加--allow-unauthenticated否则报错 E: There were unauthenticated packages and -y was used without --allow-unauthenticated
sudo apt-get -y install python3-pip --allow-unauthenticated使用deb http方式安装
上线使用的是file方式只能本机使用。那么其他服务器要使用就不行了 这个时候需要使用http方式。可以让局域网的其他服务器使用
安装nginx
sudo apt-get install -y nginx# 搭建项目索引页
sudo vim /etc/nginx/nginx.conf# 找到以下内容将sites-enabled注释掉
include /etc/nginx/conf.d/*.conf;
#include /etc/nginx/sites-enabled/*;# 进入目录conf.d新建文件deb.conf
vim /etc/nginx/conf.d/deb.conf
server {listen 80;server_name localhost;root /offlinePackage;location / {autoindex on;}}# 检查配置文件是否正确
sudo nginx -t# 加载配置
nginx -s reload更新ubuntu数据库并安装应用
# 编辑配置文件
sudo vim /etc/apt/sources.list
# 最后一行增加, 最后一个是斜杠。 注意保证有空格否则会提示格式错误。
# 添加 [trustedyes] 后使用apt-get install 安装时不用再添加--allow-unauthenticated否则安装时需要一定要带--allow-unauthenticated 安装命令为 apt-get install -y 软件名 --allow-unauthenticated
deb [trustedyes] http://nginx_ip /# 使用apt-get update来更新一下
sudo apt-get update