通过ISO镜像制作Debian本地源

本文详细介绍如何在Debian Linux中挂载ISO镜像并设置APT源,包括创建挂载目录、挂载ISO文件及配置sources.list文件的具体步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、假设*.iso存放在一个ext3分区/dev/hda2的/debian/debian-iso目录中。
2、新建挂载目录
# mkdir /apt
# mkdir /apt/iso /apt/cd01 /apt/cd02 /apt/cd03 /apt/cd04 /apt/cd05 /apt/cd06 /apt/cd07 /apt/cd08 /apt/cd09 /apt/cd10 /apt/cd11 /apt/cd12 /apt/cd13 /apt/cd14
3、挂载分区:# mount /dev/hda2 /apt/iso
3、挂载镜像:
# mount -t iso9660 -o loop /apt/iso/debian/debian-iso/debian-31r0a-i386-binary-1.iso /apt/cd01
# mount -t iso9660 -o loop /apt/iso/debian/debian-iso/debian-31r0a-i386-binary-2.iso /apt/cd02
# mount -t iso9660 -o loop /apt/iso/debian/debian-iso/debian-31r0a-i386-binary-3.iso /apt/cd03
# mount -t iso9660 -o loop /apt/iso/debian/debian-iso/debian-31r0a-i386-binary-4.iso /apt/cd04
# mount -t iso9660 -o loop /apt/iso/debian/debian-iso/debian-31r0a-i386-binary-5.iso /apt/cd05
# mount -t iso9660 -o loop /apt/iso/debian/debian-iso/debian-31r0a-i386-binary-6.iso /apt/cd06
# mount -t iso9660 -o loop /apt/iso/debian/debian-iso/debian-31r0a-i386-binary-7.iso /apt/cd07
# mount -t iso9660 -o loop /apt/iso/debian/debian-iso/debian-31r0a-i386-binary-8.iso /apt/cd08
# mount -t iso9660 -o loop /apt/iso/debian/debian-iso/debian-31r0a-i386-binary-9.iso /apt/cd09
# mount -t iso9660 -o loop /apt/iso/debian/debian-iso/debian-31r0a-i386-binary-10.iso /apt/cd10
# mount -t iso9660 -o loop /apt/iso/debian/debian-iso/debian-31r0a-i386-binary-11.iso /apt/cd11
# mount -t iso9660 -o loop /apt/iso/debian/debian-iso/debian-31r0a-i386-binary-12.iso /apt/cd12
# mount -t iso9660 -o loop /apt/iso/debian/debian-iso/debian-31r0a-i386-binary-13.iso /apt/cd13
# mount -t iso9660 -o loop /apt/iso/debian/debian-iso/debian-31r0a-i386-binary-14.iso /apt/cd14
4、设置apt源:
# apt-setup
(1)先进入“edit sources list by hand”项,用“#”注释掉全部源(也可全部删除),然后用“:wq”存盘退出。
(2)提示“Add another apt source? ”对话框,选“Yes”,再选“filesystem”项,输入“/apt/cd01”然后“OK”。
(3)重复(2)直到14张盘全部加进去(注意:/apt/cd01分别要改为/apt/cd02、/apt/cd03……/apt/cd14)。
(4)提示“Add another apt source? ”对话框,选“No”。
(5)提示“Use security updates from security.debian.org?”对话框,选“No”。

 

 

5. 设置debian sources.list

2008年09月24日 星期三 22:01

sources.list 是我们在安装软件前所必需配置的一个文件,它告诉linux你所希望安装文件的存放路径(也就是那里可以找到他们),这里可以使网络路径,即所谓的网络安装,也可以使本地的文件路径。下面是我的一些设置心得。

1。本地安装
首先,linux对设备的访问都是以文件的形式进行的,因此不管你是硬盘也好,cd-rom,或iso文件,你首先要通过mount命令加载。
如果你已经下载了安装文件(比如是对应第一张光盘的),放在你的fat分区,如第二个分区下的一个叫debian 1的目录,那么你先加载分区如:
cd /mnt ; mkdir d; mount -t vfat /dev/hda2 /mnt/d
可在sources.list中添加如下
deb file:///mnt/debian1/ woody main contrib
deb file:///mnt/debian1/ woody/non-US main contrib
这里是有规律的,你可先查一下debian1下的目录结构,其中有个目录dist是默认添加的,woody是dist目录下的一个最新的stable版 本,还有其他的老的或testing以及unstable版,main和contrib是woody下的两个目录(有些还包括一个叫non-free的目 录),non-US是非美国的,牵扯到一些由于版权以及加密的软件,它下面同样有main contrib(有几个目录都选上)。
iso文件安装
类似,首先加载iso文件,有些不同
cd /mnt ;mkdir d ;mount -t vfat /dev/hda2 /mnt/d ;mkdir iso1 ;mkdir iso2 ;......
cd d;看到你的iso文件了吧;
mount -t iso9660 -o loop youisofile1.iso /dev/iso1
mount -t iso9660 -o loop youisofile2.iso /dev/iso2
依此类推有几个全挂上,vi /etc/apt/sources.list
deb file:///mnt/iso1/ woody main contrib
deb file:///mnt/iso1/ woody/non-US main contrib
deb file:///mnt/iso2/ woody main contrib
deb file:///mnt/iso2/ woody/non-US main contrib
.......
2.网络安装相对简单,不过不同的mirrorsite,它的目录结构可能不同,你可用一下方法察看
如ftp ftp.jp.debian.org
anonymous
aaa@msn
ftp>ls
我的配置如下:
# Official Debian mirrors
#

# Debian "potato" (2.2)
#
#deb http://ftp.us.debian.org/debian potato main contrib non-free
#deb-src http://ftp.us.debian.org/debian potato main contrib non-free

# Debian "stable" (presently the same as "Woody")
#
deb http://ftp.us.debian.org/debian stable main contrib non-free
deb-src http://ftp.us.debian.org/debian stable main contrib non-free

# Debian "Woody" (3.0)
#
deb http://ftp.us.debian.org/debian woody main contrib non-free
deb-src http://ftp.us.debian.org/debian woody main contrib non-free

# Debian "testing" (presently the same as "Sarge")
#
deb http://ftp.us.debian.org/debian testing main contrib non-free
deb-src http://ftp.us.debian.org/debian testing main contrib non-free

# Debian "Sarge" (> 3.0)
#
deb http://ftp.us.debian.org/debian sarge main contrib non-free
deb-src http://ftp.us.debian.org/debian sarge main contrib non-free

# Debian "unstable" ("Sid" will always be unstable.)
#
#deb http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-src http://ftp.us.debian.org/debian unstable main contrib non-free

# Debian "Sid" (> 3.0)
#
#deb http://ftp.us.debian.org/debian sid main contrib non-free
#deb-src http://ftp.us.debian.org/debian sid main contrib non-free

# Debian "Potato" Non-US (crypto, 2.2)
#
#deb http://non-us.debian.org/ potato/non-US main contrib non-free
#deb-src http://non-us.debian.org/ potato/non-US main contrib non-free

# Debian "stable" Non-US (crypto)
#
deb http://non-us.debian.org/ stable/non-US main contrib non-free
deb-src http://non-us.debian.org/ stable/non-US main contrib non-free

# Debian "Woody" Non-US (crypto)
#
deb http://non-us.debian.org/ woody/non-US main contrib non-free
deb-src http://non-us.debian.org/ woody/non-US main contrib non-free

# Debian "testing" Non-US (crypto)
#
deb http://non-us.debian.org/ testing/non-US main contrib non-free
deb-src http://non-us.debian.org/ testing/non-US main contrib non-free

# Debian "Sarge" Non-US (crypto)
#
deb http://non-us.debian.org/ sarge/non-US main contrib non-free
deb-src http://non-us.debian.org/ sarge/non-US main contrib non-free

# Debian "unstable" Non-US (crypto)
#
#deb http://non-us.debian.org/ unstable/non-US main contrib non-free
#deb-src http://non-us.debian.org/ unstable/non-US main contrib non-free

# Debian "Sid" Non-US (crypto)
#
#deb http://non-us.debian.org/ sid/non-US main contrib non-free
#deb-src http://non-us.debian.org/ sid/non-US main contrib non-free
这里deb-src表示可获取源代码。
还有日本的ftp.jp.debian.org也很不错,只要把前面的ftp.us.debian.org的
us改为jp就好了。
不用的用#注释掉。
这里要注意,版本主要分为stable,testing,unstable版,现在stable为woody3.0,其中unstable的软件最新,但最不稳定,不推荐使用,而testing的软件相对较新比较稳定,推荐。
还要注意的是,你如果用了stable,同时用了testing,那么升级后为testing,类似,如果还选了unstable的,那么结果就为unstable,因此推荐只选stable和
testing的,这样的话装好后就比较稳定。
接着用一下命令升级
apt-get update
apt-get upgrade
apt-get dist-upgrade
装软件用apt-get install name
或用dselect ,tasksel ,aptitude等安装。
<think>好的,我现在需要帮助用户解决如何配置和使用Debian软件的问题。首先,我得回忆一下自己之前学过的关于Debian系统配置的知识。Debian的软件主要是通过编辑/etc/apt/sources.list文件来设置的,对吧?用户可能想知道具体的步骤,括备份原文件、选择合适的镜像、更新软件列表等步骤。 接下来,我需要确认用户的具体需求。用户提到可能是配置方法、列表地址或使用指南,所以应该覆盖这三个方面。首先,配置方法应该括修改sources.list文件,选择国内比如阿里云、清华等,然后更新。列表地址可能需要给出具体的URL示例,比如http://mirrors.aliyun.com/debian/这样的格式。使用指南可能涉及如何添加、更新软件列表、安装软件等基本操作。 然后,我需要考虑用户可能的系统版本,比如Debian 10、11或者更老的版本,不同版本的代号不同,比如Buster、Bullseye等,这会影响软件的正确配置。因此,在回答中需要提到版本代号的替换方法,提醒用户根据自己的系统版本调整。 另外,用户可能遇到的常见问题,比如如何备份原有文件,遇到GPG错误怎么办,或者如何添加非自由软件。这些也需要在注意事项里提到,帮助用户避免常见陷阱。 还要检查是否需要引用提供的参考内容。参考中提到的Debian10和11的配置,以及使用国内镜像的方法,比如阿里云,这些都需要整合到回答中,并正确标注引用。例如,引用[2]提到配置国内阿里镜像,引用[3]提到修改文件并更新。 最后,生成相关问题时要围绕软件配置的扩展,比如如何寻找其他镜像,处理更新错误,安全考虑,本地源制作等,这些问题能帮助用户进一步了解相关知识。 现在,把这些思路整理成结构化的步骤,确保每个部分清晰,并正确应用引用标注。同时,注意使用中文回答,行内公式用$...$,独立公式用$$...$$,但在这个问题中可能涉及较少数学公式,但如果有版本号或路径中的变量,可能需要用代码格式或强调显示。不过根据用户的问题,可能不需要数学公式,所以主要关注配置步骤和命令的正确格式,使用代码块来展示命令和配置文件内容。</think>### 如何配置和使用Debian软件 #### 1. 配置Debian软件 Debian软件配置文件为`/etc/apt/sources.list`,通过修改此文件可指定软件下载的镜像地址。以下是具体步骤: **步骤1:备份原有文件** ```bash sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak ``` **步骤2:编辑文件** 使用文本编辑器(如`nano`或`vim`)修改文件: ```bash sudo nano /etc/apt/sources.list ``` **步骤3:替换为国内镜像** 根据系统版本选择镜像地址(以**Debian 11 (Bullseye)**和阿里云镜像为例): ```text deb http://mirrors.aliyun.com/debian/ bullseye main contrib non-free deb-src http://mirrors.aliyun.com/debian/ bullseye main contrib non-free deb http://mirrors.aliyun.com/debian-security/ bullseye-security main contrib non-free deb-src http://mirrors.aliyun.com/debian-security/ bullseye-security main contrib non-free deb http://mirrors.aliyun.com/debian/ bullseye-updates main contrib non-free deb-src http://mirrors.aliyun.com/debian/ bullseye-updates main contrib non-free ``` - 若系统为**Debian 10 (Buster)**,将`bullseye`替换为`buster`[^2][^3]。 - 其他镜像(如清华):替换`mirrors.aliyun.com`为`mirrors.tuna.tsinghua.edu.cn`。 **步骤4:更新软件列表** ```bash sudo apt update ``` --- #### 2. 使用软件 配置完成后,可通过以下命令管理软件: - **安装软件**:`sudo apt install <软件名>` - **更新系统**:`sudo apt upgrade` - **搜索软件**:`apt search <关键词>` --- #### 3. 注意事项 1. **非自由软件支持**:若需安装驱动或软件,需在地址中保留`non-free`标签。 2. **GPG密钥错误**:若出现签名验证失败,执行`sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <缺失的密钥ID>`。 3. **本地源配置**:可使用ISO文件制作本地源(需挂载ISO并修改`sources.list`)[^1]。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值