ubuntu如何修改IP地址和apt源
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ubuntu如何修改IP地址和apt源相关的知识,希望对你有一定的参考价值。
新安装的ubuntu没有vim,使用vi修改自己的IP地址[email protected]:~# cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto ens3
iface ens3 inet static
address 192.168.200.7
netmask 255.255.255.0
gateway 192.168.200.1
dns-nameserver 192.168.200.200
ubuntu系统如何修改apt源,使用aliyun源为例:
将旧版本内容做好备份。
[email protected]:~# cp /etc/apt/sources.list /etc/apt/sources.list_bak
添加以下内容
[email protected]:~# cat /etc/apt/sources.list
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
更新自己的源,即可
[email protected]:~# apt update
[email protected]:~# apt-get update
接下来验证源是否正常使用:
[email protected]:~# apt install -y openssh-server vim net-tools lrzsz
以上是关于ubuntu如何修改IP地址和apt源的主要内容,如果未能解决你的问题,请参考以下文章