欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Debian配置Networking 和 apt-get 源信息

程序员文章站 2022-03-05 08:09:41
...

 

1 简介


    初始安装完debian 7.7.0时,需要首先配置网络及apt-get源,才能正常使用。


2 debian配置


    2.1 debian 7.7.0配置网络及apt-get源
    2.1.1 配置网络-静态IP
    修改文件/etc/network/interfaces

vi /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

    配置完成后文件信息为

# The loopback network interface
$ auto lo
$ iface lo inet loopback
#    增加如下选项
$ iface eth0 inet static
$ address 192.168.1.18
$ netmask 255.255.255.0
$ gatway 192.168.1.1

 

    使网络配置生效

[email protected]:~# ifdown eth0
[email protected]:~# ifup eth0


    2.1.2 配置网络-DHCP方式(访问外网)

# 修改文件/etc/network/interfaces
$ vi /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).



    配置完成后文件信息为

# The loopback network interface
$ auto lo
$ iface lo inet loopback
# 增加如下选项
$ allow-hotplug eth0
$ iface eth0 inet dhcp

    使网络配置生效

[email protected]:~# ifdown eth0
[email protected]:~# ifup eth0


    2.2 配置apt-get源


    2.2.1 默认从cd介质安装

    2.2.2 更改为网络源

[email protected]:~# vi /etc/apt/sources.list


    首先屏蔽掉本地源

# 注释掉原来的apt-get源,这个是加载光盘的源,如果需要加载光盘中的源,而不用网络上的源,请不要注释
# deb cdrom:[Debian GNU/Linux 7.7.0 _Wheezy_ - Official amd64 DVD Binary-1 2014101
8-13:06]/ wheezy contrib main

    然后添加列表到sources.list文件里

# 设置apt-get源为163镜像站的源
$ deb http://mirrors.163.com/debian wheezy main non-free contrib
$ deb-src http://mirrors.163.com/debian wheezy main non-free contrib

 

#在配置文件中增加163软件更新源。
$ deb http://mirrors.163.com/debian wheezy-updates main non-free contrib
$ deb-src http://mirrors.163.com/debian wheezy-updates main non-free contrib

 


#在配置文件中增加163安全软件更新源。
$ deb http://security.debian.org/ wheezy/updates main
$ deb-src http://security.debian.org/ wheezy/updates main

 

   2.2 更新配置

# 更新配置
[email protected]:~# apt-get update
# 测试安装一个htop组件
[email protected]:~# apt-get install htop

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages: strace ltrace
The following NEW packages will be installed: htop
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 63.7 kB of archives.
After this operation, 209 kB of additional disk space will be used.
Get:1 http://mirrors.163.com/debian/ squeeze/main htop amd64 0.8.3-1 [63.7 kB]
Fetched 63.7 kB in 0s (99.9 kB/s)
Selecting previously unselected package htop.
(Reading database ... 25847 files and directories currently installed.)
Unpacking htop (from .../htop_0.8.3-1_amd64.deb) ...
Processing triggers for man-db ...
Setting up htop (0.8.3-1) ...

# 修改网络源成功!


转载来源:http://blog.csdn.net/jesseyoung/article/details/41387393
 

相关标签: Debian