1.更新apt-get
sudo apt-get update
sudo apt-get upgrade
2.更换vi Ubuntu中,进入vi命令的编辑模式,发现按方向键不能移动光标,而是会输出ABCD,以及退格键也不能正常删除字符。这是由于Ubuntu预装的是vim-tiny,而我们需要使用vim-full,解决方法很简单,只需要以下两步:
sudo apt-get remove vim-common
sudo apt-get install vim
3.make命令无效
sudo apt-get install build-essential
4.设置静态ip
旧版16及以下版本
编辑文件 /etc/network/interfaces
sudo vi /etc/network/interfaces
并用下面的行来替换有关eth0的行
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.2.1
gateway 192.168.2.254
netmask 255.255.255.0
#network 192.168.2.0
#broadcast 192.168.2.255
将eth0的IP分配方式修改为静态分配(static)后,为其制定IP、网关、子网掩码等信息。
将上面的Ubuntu IP地址等信息换成你自己就可以了。
用下面的命令使网络设置生效:
sudo /etc/init.d/networking restart
新版17
1)查询网卡名称
2)在17.10版本里配置静态IP是设置“01-netcfg.yaml”文件,类似Docker的yaml文件
ethernets:
ens160: #配置的网卡名称
dhcp4: no #dhcp4关闭
dhcp6: no #dhcp6关闭
addresses: [192.168.1.105/24] #设置本机IP及掩码
gateway4: 192.168.1.1 #设置网关
nameservers:
addresses: [202.96.209.133, 8.8.8.8] #设置DNS
3)执行如下命令让配置生效,静态IP就配置好了
netplan apply