debian配置网络及apt-get源

来源:互联网 发布:漫威电影宇宙知乎 编辑:程序博客网 时间:2024/06/05 22:35
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 interfaceauto loiface lo inet loopback
    增加如下选项
iface eth0 inet staticaddress 192.168.1.18netmask 255.255.255.0gatway 192.168.1.1
    配置完成后文件信息为

    使网络配置生效
root@debian:~# ifdown eth0root@debian:~# 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 interfaceauto loiface lo inet loopback
    增加如下选项
allow-hotplug eth0iface eth0 inet dhcp
    配置完成后文件信息为

    使网络配置生效
root@debian:~# ifdown eth0root@debian:~# ifup eth0
    2.2 配置apt-get源
    2.2.1 默认从cd介质安装

    2.2.2 更改为网络源

root@debian:~# vi /etc/apt/sources.list
    首先屏蔽掉本地源
deb cdrom:[Debian GNU/Linux 7.7.0 _Wheezy_ - Official amd64 DVD Binary-1 20141018-13:06]/ wheezy contrib main

    然后添加列表到sources.list文件里
#在配置文件中增加163软件源。deb http://mirrors.163.com/debian wheezy main non-free contribdeb-src http://mirrors.163.com/debian wheezy main non-free contrib#在配置文件中增加163软件更新源。deb http://mirrors.163.com/debian wheezy-updates main non-free contribdeb-src http://mirrors.163.com/debian wheezy-updates main non-free contrib#在配置文件中增加163安全软件更新源。deb http://security.debian.org/ wheezy/updates maindeb-src http://security.debian.org/ wheezy/updates main
    更新配置
root@debian:~# apt-get update
    测试安装一个htop组件
root@debian:~# apt-get install htopReading package lists... DoneBuilding dependency tree       Reading state information... DoneSuggested packages:  strace ltraceThe following NEW packages will be installed:  htop0 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
    博客主页:http://blog.csdn.net/jesseyoung
****************************************************************************************
0 0
原创粉丝点击