sources.list 是我们在安装软件前所必需配置的一个文件,它告诉linux你所希望安装文件的存放路径(也就是那里可以找到他们),这里可以使网络路径,即所谓的网络安装,也可以使本地的文件路径。下面是我的一些设置心得。
1,本地安装
首先,linux对设备的访问都是以文件的形式进行的,因此不管你是硬盘也好,cd-rom,或iso文件,你首先要通过mount命令加载。
如果你已经下载了安装文件(比如是对应第一张光盘的),放在你的fat分区,如第二个分区下的一个叫debian1的目录,那么你先加载分区如:
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等安装。