Debian OS本地及局域网apt源搭建

2023-05-16

Debian OS本地及局域网apt源搭建

    • 一、本地apt源搭建
      • 1.1、上传ISO镜像到本地OS
      • 1.2、挂载ISO镜像
      • 1.3、编辑apt配置文件
      • 1.4、验证apt源
    • 二、局域网apt源搭建
      • 2.3、编辑本地apt配置文件
      • 2.4、验证apt源

一、本地apt源搭建

1.1、上传ISO镜像到本地OS

上传dvd1.iso,dvd2.iso,dvd3iso镜像到系统下

# mkdir /root/ISO
# ls -l debian-10.6.0-amd64-DVD-*
-rw-r--r-- 1 root root 3972317184 Apr 18 08:55 debian-10.6.0-amd64-DVD-1.iso
-rw-r--r-- 1 root root 4686921728 Apr 18 08:55 debian-10.6.0-amd64-DVD-2.iso
-rw-r--r-- 1 root root 4640186368 Apr 18 08:54 debian-10.6.0-amd64-DVD-3.iso

1.2、挂载ISO镜像

  • 手动挂载
# mkdir /mnt/source{1..3}
mount -o loop  /root/ISO/debian-10.6.0-amd64-DVD-1.iso /mnt/source1
mount -o loop  /root/ISO/debian-10.6.0-amd64-DVD-2.iso /mnt/source2
mount -o loop  /root/ISO/debian-10.6.0-amd64-DVD-3.iso /mnt/source3
  • 设置开机自动挂载
    在/etc/fstab后追加如下内容设置开机自动挂载
# vim /etc/fstab
/root/ISO/debian-10.6.0-amd64-DVD-1.iso /mnt/source1 udf,iso9660 user,loop 0 0
/root/ISO/debian-10.6.0-amd64-DVD-2.iso /mnt/source2 udf,iso9660 user,loop 0 0
/root/ISO/debian-10.6.0-amd64-DVD-3.iso /mnt/source3 udf,iso9660 user,loop 0 0

1.3、编辑apt配置文件

# vim /etc/apt/sources.list

deb [trusted=yes] file:///mnt/source1 buster contrib main
deb [trusted=yes] file:///mnt/source2 buster contrib main
deb [trusted=yes] file:///mnt/source3 buster contrib main

配置文件中 buster 是debian10的代号,若为其他版本需要改为对应代号

  • Debian 11 (bullseye) — 當前的穩定(stable)版
  • Debian 10(buster) — 當前的舊的穩定(oldstable)版,現有長期支持
  • Debian 9(stretch) — 更舊的穩定(oldoldstable)版,現有擴展長期支持
  • Debian 8(jessie) — 已存檔版本,現有擴展長期支持

1.4、验证apt源

apt update
apt install vim

二、局域网apt源搭建

此文搭建apt源的http Server配置如下

OS: CentOS 7U6,
IP: 192.168.15.10

2.1、 安装Http服务和xml生成工具,由于安装系统时已经顺便安装了相应的安装包,所以此处无须再进行安装。

[root@simonlinux ~]# yum install httpd createrepo
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Repository base is listed more than once in the configuration
Package httpd-2.4.6-88.el7.x86_64 already installed and latest version
Package createrepo-0.9.9-28.el7.noarch already installed and latest version
Nothing to do

2.2、 新建存放yum源文件的目录并将相关文件复制进去

[root@simonlinux smb]# ls -l
-rw-r--r-- 1 root root 3972317184 Apr 18 08:55 debian-10.6.0-amd64-DVD-1.iso
-rw-r--r-- 1 root root 4686921728 Apr 18 08:55 debian-10.6.0-amd64-DVD-2.iso
-rw-r--r-- 1 root root 4640186368 Apr 18 08:54 debian-10.6.0-amd64-DVD-3.iso
[root@simonlinux smb]# mkdir  /mnt/source{1..3}
[root@simonlinux smb]# mount -o loop debian-10.6.0-amd64-DVD-1.iso /mnt/source1
mount: /dev/loop0 is write-protected, mounting read-only
[root@simonlinux smb]# mount -o loop debian-10.6.0-amd64-DVD-2.iso /mnt/source2
mount: /dev/loop0 is write-protected, mounting read-only
[root@simonlinux smb]# mount -o loop debian-10.6.0-amd64-DVD-3.iso /mnt/source3
mount: /dev/loop0 is write-protected, mounting read-only
[root@simonlinux ~]# mkdir -p /var/www/html/apt_sosurce/debian/10u6/source{1..3}
[root@simonlinuxt ~]# rsync -avh /mnt/source1 /var/www/html/apt_source/debian/10u6/source1
[root@simonlinux ~]# rsync -avh /mnt/source2 /var/www/html/apt_source/debian/10u6/source2
[root@simonlinux ~]# rsync -avh /mnt/source3 /var/www/html/apt_source/debian/10u6/source3

2.3、启动http服务

[root@simonlinux ~]# systemctl restart httpd
[root@simonlinux ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2023-04-19 22:26:29 CST; 7s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 15983 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
 Main PID: 15989 (httpd)
   Status: "Processing requests..."
    Tasks: 8
   CGroup: /system.slice/httpd.service
           ├─15989 /usr/sbin/httpd -DFOREGROUND
           ├─15990 /usr/libexec/nss_pcache 491523 off
           ├─15994 /usr/sbin/httpd -DFOREGROUND
           ├─15995 /usr/sbin/httpd -DFOREGROUND
           ├─15996 /usr/sbin/httpd -DFOREGROUND
           ├─15997 /usr/sbin/httpd -DFOREGROUND
           └─15998 /usr/sbin/httpd -DFOREGROUND

Apr 19 22:26:29 simonlinux.com systemd[1]: Starting The Apache HTTP Server...
Apr 19 22:26:29 simonlinux.com systemd[1]: Started The Apache HTTP Server. 

发现网页端无法打开,将网站端口添加到防火墙规则里并重启防火墙

[root@simonlinux ~]# firewall-cmd --add-port=80/tcp --permanent 
success
[root@simonlinux ~]# systemctl restart firewalld.service
[root@simonlinux ~]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: eno1
sources: 
services: dhcpv6-client ssh
ports: 5901-5905/tcp 80/tcp
protocols: 
masquerade: no
forward-ports: 
source-ports: 
icmp-blocks: 
rich rules: 

设置http服务开机启动

[root@simonlinux ~]# systemctl enable httpd

2.3、编辑本地apt配置文件

# vim /etc/apt/sources.list

deb [trusted=yes] http://192.168.15.10/apt_source/debian/10u6/source1 buster contrib main
deb [trusted=yes] http://192.168.15.10/apt_source/debian/10u6/source2 buster contrib main
deb [trusted=yes] http://192.168.15.10/apt_source/debian/10u6/source3 buster contrib main

配置文件中 buster 是debian10的代号,若为其他版本需要改为对应代号

  • Debian 11 (bullseye) — 當前的穩定(stable)版
  • Debian 10(buster) — 當前的舊的穩定(oldstable)版,現有長期支持
  • Debian 9(stretch) — 更舊的穩定(oldoldstable)版,現有擴展長期支持
  • Debian 8(jessie) — 已存檔版本,現有擴展長期支持

2.4、验证apt源

apt update
apt install vim
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Debian OS本地及局域网apt源搭建 的相关文章

随机推荐

  • 如何在Windows下安装ubuntu子系统

    TOCM 如何在Windows下安装ubuntu子系统 1 windows设置 首先打开控制面板 xff0c Windows设置 xff0c 勾选Windows下的linux系统 外链图片转存失败 源站可能有防盗链机制 建议将图片保存下来直
  • R语言批量生成CaseWhen的解决方案

    近期写R代码 xff0c 经常用dplyr case when结合stringr str detect进行条件判断 痛点 xff1a 判断条件可能会改或增删 xff0c 全写在case when里 xff0c 代码冗余且不利于复制和维护 x
  • R新管道操作符 |> 使用体验

    R users应该对magrittr的 gt 管道符都不陌生 然后R官方估计看如此普及不能再装看不见了 xff0c 于是4 1版本官方也出了个管道操作符 gt xff0c 简直就是baseR党的福音啊 虽然我不是忠实的baseR党 xff0
  • R包bs4Dash控件效果对照图

    记录一下bs4Dash各个控件的效果 xff0c 方便查找和对照 案例均来自于官方文档 accordion accordion span class token punctuation span id span class token op
  • 用一个公式列出R语言所有的数据集

    做了个app xff0c 点R datasets快速查看数据集 测试数据 xff0c 经常用到R语言的数据集 xff0c 于是就开始寻思怎么用尽可能短的代码把所有的数据集一次性全列出来 xff0c 再慢慢挑选 代码如下 xff1a data
  • R语言用dbplyr操作数据库解决丢失连接以持久化tbl查询的方案

    在我看来 xff0c R语言tidyverse包里 xff0c 最高价值的包是dbplyr xff08 dplyr的数据库版 xff09 xff0c 用起来非常爽 xff0c 但最怕的是丢失数据库连接 xff0c 一丢则流畅感瞬间崩塌 xf
  • iPad使用UTM SE装Win7

    因工作需要 xff0c 有的公文只能在windows系统下才能通过vpn及专用控件情况下审批 xff0c 带个电脑嫌笨重 xff0c 经测试 xff0c 在ipad上通过虚拟机成功安装win7系统 xff0c 当然还可以安装linux ma
  • Excel内置函数参数为整列是否会有性能损失

    比如 xff0c sumif a a b c c 的性能是否会比限定范围的公式sumif a1 a10 b c1 c10 的性能更差 答案是 xff0c 不会 看微软官方的回答 所以 xff0c 放心大胆的用sumif 43 entire
  • 远程代码执行(RCE)漏洞

    文章目录 1 fastjson 远程代码执行漏洞2 简单复现3 反弹shell3 1 正向反弹shell3 2 反向反弹shell 1 fastjson 远程代码执行漏洞 最近读到一篇文章 fastjson 远程代码执行漏洞分析 xff0c
  • 洛谷 P4180 【模板】严格次小生成树

    题目链接 https www luogu org problem P4180 分析 根据Kruskal算法的思想 xff0c xff08 非 xff09 严格次小生成树应该是来自最小生成树的 xff1b 具体来说 xff0c 是将某条非树边
  • Pyinstaller打包高级用法

    前段时间在制作词云制作小工具的时候 xff0c 直接在命令行用pyinstaller F 工具 py指令打包成功后 xff0c 启动exe可执行文件的时候各种报错 今天 xff0c 我们就分享一下踩坑经过 目录 xff1a 1 安装pyin
  • yum无法找到xorg-x11-xkb-utils-devel包的解决方法

    缘由 使用robotgo开发 xff0c 需要安装依赖如下 xff08 官方文档要求 xff09 96 96 96 Fedora sudo dnf install libxkbcommon devel libXtst devel libxk
  • Ubuntu中突然断网了

    使用命令行 xff0c 网络恢复 sudo service network manager restart
  • Windows 平台 VSCode 使用 SSH 免密登录 docker 中的 Ubuntu 虚拟机

    可以先了解一下 SSH 免密登录的原理 xff08 不了解也不影响 xff09 xff1a SSH 设置密钥对实现免密码连接 知乎 参考了 xff1a Docker下多机器免密码SSH登录 腾讯云开发者社区 腾讯云 该博客的场景较为复杂 x
  • 最新codeforces的rating评级(等级

    一 xff1a 在你没有打任何Codeforces的比赛前 xff0c 你是 unrated xff08 暂未评级 xff09 xff0c 名字颜色是黑色 rating 61 1500 xff08 不显示 xff0c 只有打了比赛之后才会体
  • W: GPG 错误:file:/var/cuda-repo-ubuntu2004-11-1-local Release: 由于没有公钥,无法验证下列签名: NO_PUBKEY F60F4B3D7FA

    记录一下学习 今天安装cuda11 1的时候 在解压包的时候遇到的问题 W span class token punctuation span GPG 错误 xff1a span class token builtin file span
  • virt-install工具创建虚拟机命令介绍(详细)

    virt install介绍 virt span class token operator span install是一个命令行工具 xff0c 它能够为 span class token constant KVM span Xen或其它支
  • 什么是状态机?用C语言实现进程5状态模型

    前言 状态机在实际工作开发中应用非常广泛 xff0c 在刚进入公司的时候 xff0c 根据公司产品做流程图的时候 xff0c 发现自己经常会漏了这样或那样的状态 xff0c 导致整体流程会有问题 xff0c 后来知道了状态机这样的东西 xf
  • 希腊字母与对应的Unicode码

    希腊字母 xff08 大小写各24个 xff09 xff1a 大写 xff1a xff08 对应Unicode码为 xff1a 913 937 xff0c 无930 xff09 小写 xff1a xff08 对应Unicode码为 xff1
  • Debian OS本地及局域网apt源搭建

    Debian OS本地及局域网apt源搭建 一 本地apt源搭建1 1 上传ISO镜像到本地OS1 2 挂载ISO镜像1 3 编辑apt配置文件1 4 验证apt源 二 局域网apt源搭建2 3 编辑本地apt配置文件2 4 验证apt源