网络配置

Ubuntu 重启后 /etc/resolv.conf 里面设置的nameserver就被清空
/etc/resolv.conf 其实是一个Link,指向 /run/resolvconf/resolv.conf;Ubuntu 有一个 resolvconf 服务,如果重启它,那么 /etc/resolv.conf 的内容会被修改成默认的样子。
要自定义 nameserver,有以下2个办法:

A 在网卡的配置文件里面加:

iface eth0 inet static
address 192.168.3.12 
netmask 255.255.255.0
gateway 192.168.3.1
dns-nameservers 144.144.144.144 218.30.19.50 61.134.1.5 4.4.2.2

B 修改 resolvconf服务的配置文件: /etc/resolvconf/resolv.conf.d/base

更新源

更新源: /etc/apt/sources.list

阿里更新源(18.04)

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

阿里更新源(14.04)

deb http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe

语言环境

Ubuntu Server 14.04选择中文安装后,默认的/etc/default/local会使某些中文日期乱码,执行ll和date可见.

/etc/default/locale 原来内容为:

LANG="zh_CN.UTF-8" 
LANGUAGE="zh_CN:zh" 
LC_NUMERIC="zh_CN" 
LC_TIME="zh_CN" 
LC_MONETARY="zh_CN" 
LC_PAPER="zh_CN" 
LC_NAME="zh_CN" 
LC_ADDRESS="zh_CN" 
LC_TELEPHONE="zh_CN" 
LC_MEASUREMENT="zh_CN" 
LC_IDENTIFICATION="zh_CN"

改为:

LANG="zh_CN.UTF-8" 
LANGUAGE="zh_CN:zh" 

重新登录后生效,执行ll和date可见,不再出现乱码,执行locale可见当前的语言环境.

如果你要使用英文环境,在~/.bashrc末尾加入以下内容,重新登录即可切换语言:

LANG="en_US.UTF-8"
LANGUAGE="en_US:en"

另外GRUB2引导菜单/boot/grub/grub.cfg存在乱码的话,执行sudo update-grub2重新生成即可.


zhoutk
2.6k 声望1.2k 粉丝

自由程序员,技术路线c,delphi,c++,c#,java,php,node.js,python,golang,typescript;超喜欢react.js的设计思路,全栈开发成为我的终极目标。开发机器macbook pro,或装ubuntu、fedora的机器,编程用vim...


引用和评论

0 条评论