1 简介
    初始安装完debian 7.7.0时,需要首先配置网络及apt-get源,才能正常使用。
2 debian各个版本配置
    2.1 debian 7.7.0配置网络及apt-get源
    2.1.1 配置网络-静态IP

    修改文件/etc/network/interfaces

[plain] view plain copy 在CODE上查看代码片派生到我的代码片

  1. vi /etc/network/interfaces  

  2. # This file describes the network interfaces available on your system  

  3. # and how to activate them. For more information, see interfaces(5).  

  4.   

  5.   

  6. # The loopback network interface  

  7. auto lo  

  8. iface lo inet loopback  

    增加如下选项

[plain] view plain copy 在CODE上查看代码片派生到我的代码片

  1. iface eth0 inet static  

  2. address 192.168.1.18  

  3. netmask 255.255.255.0  

  4. gatway 192.168.1.1  

    配置完成后文件信息为

    使网络配置生效

[plain] view plain copy 在CODE上查看代码片派生到我的代码片

  1. root@debian:~# ifdown eth0  

  2. root@debian:~# ifup eth0  

    2.1.2 配置网络-DHCP方式(访问外网)
    修改文件/etc/network/interfaces

[plain] view plain copy 在CODE上查看代码片派生到我的代码片

  1. vi /etc/network/interfaces  

  2. # This file describes the network interfaces available on your system  

  3. # and how to activate them. For more information, see interfaces(5).  

  4.   

  5.   

  6. # The loopback network interface  

  7. auto lo  

  8. iface lo inet loopback  

    增加如下选项

[plain] view plain copy 在CODE上查看代码片派生到我的代码片

  1. allow-hotplug eth0  

  2. iface eth0 inet dhcp  

    配置完成后文件信息为

    使网络配置生效

[plain] view plain copy 在CODE上查看代码片派生到我的代码片

  1. root@debian:~# ifdown eth0  

  2. root@debian:~# ifup eth0  

    2.2 配置apt-get源
    2.2.1 默认从cd介质安装

    2.2.2 更改为网络源

[plain] view plain copy 在CODE上查看代码片派生到我的代码片

  1. root@debian:~# vi /etc/apt/sources.list  

    首先屏蔽掉本地源

[plain] view plain copy 在CODE上查看代码片派生到我的代码片

  1. deb cdrom:[Debian GNU/Linux 7.7.0 _Wheezy_ - Official amd64 DVD Binary-1 2014101  

  2. 8-13:06]/ wheezy contrib main  


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

[plain] view plain copy

  1. #在配置文件中增加163软件源。  

  2. deb http://mirrors.163.com/debian wheezy main non-free contrib  

  3. deb-src http://mirrors.163.com/debian wheezy main non-free contrib  

  4. #在配置文件中增加163软件更新源。  

  5. deb http://mirrors.163.com/debian wheezy-updates main non-free contrib  

  6. deb-src http://mirrors.163.com/debian wheezy-updates main non-free contrib  

  7. #在配置文件中增加163安全软件更新源。  

  8. deb http://security.debian.org/ wheezy/updates main  

  9. deb-src http://security.debian.org/ wheezy/updates main  

    更新配置

[plain] view plain copy

  1. root@debian:~# apt-get update  

    测试安装一个htop组件

[plain] view plain copy 在CODE上查看代码片派生到我的代码片

  1. root@debian:~# apt-get install htop  

  2. Reading package lists... Done  

  3. Building dependency tree         

  4. Reading state information... Done  

  5. Suggested packages:  

  6.   strace ltrace  

  7. The following NEW packages will be installed:  

  8.   htop  

  9. 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.  

  10. Need to get 63.7 kB of archives.  

  11. After this operation, 209 kB of additional disk space will be used.  

  12. Get:1 http://mirrors.163.com/debian/ squeeze/main htop amd64 0.8.3-1 [63.7 kB]  

  13. Fetched 63.7 kB in 0s (99.9 kB/s)  

  14. Selecting previously unselected package htop.  

  15. (Reading database ... 25847 files and directories currently installed.)  

  16. Unpacking htop (from .../htop_0.8.3-1_amd64.deb) ...  

  17. Processing triggers for man-db ...  

  18. Setting up htop (0.8.3-1) ...  

    修改网络源成功!



****************************************************************************************
    原文地址:http://blog.csdn.net/jesseyoung/article/details/41387393
    博客主页:http://blog.csdn.net/jesseyoung
****************************************************************************************