一 更改國內源ubuntu
1 首先備份官方源,以避免設置錯誤可恢復。服務器
$ sudo cp /etc/apt/sources.list /etc/apt/sources.list.back
2 用編輯器打開 /etc/apt/sources.list文件。編輯器
$ sudo nano /etc/apt/sources.list
3 刪除原有的源,在編輯器中添加新源(阿里源,14.04)。如圖所示:spa
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
二 設置固定IPrest
1 編輯 /etc/network/interfacescode
$ sudo nano /etc/network/interfaces
2 註釋掉 iface eth0 inet dhcp這一行並添加以下內容,以設置爲固定IP 192.168.1.85爲例server
iface eth0 inet static address 192.168.1.85 netmask 255.255.255.0 gateway 192.168.1.1
3 重啓eth0,不是root的加sudoblog
$ ifconfig eth0 down $ ifconfig eth0 up
4 重啓網卡dns
$ /etc/init.d/networking restart
三 設置靜態dns服務器it
1 增長文件
$ sudo nano /etc/resolvconf/resolv.conf.d/tail
2 增長nameserver,以下:
nameserver 202.102.134.68 nameserver 8.8.8.8
3 重啓dns解析
$ sudo /etc/init.d/resolvconf restart