自己ubuntu系统安装了一个virtualBox虚拟机,里面又装了一个ubuntu-server系统;
1.先设置一下字符集,因为一开始装系统的时候选择的是中文,但里面始终无法支持中文,那就算了,反正英文也看得过去
vi /etc/default/locale
用下面两段覆盖掉
LANG="en_US.UTF-8"
LANGUAGE="en_CN:en"
退出保存,reboot重启下电脑;
2.apt-get update有时候会出错误,因为系统自带的sources.list文件里面的路径不正确,导致找不到资源报404错误
解决方法
① vi etc/apt/sources.list
② 将里面的内容替换成下面这些(artful可以更换,主要看http://mirrors.163.com/ubuntu/dists/下面有哪些可用的前缀自行更换)
deb http://mirrors.163.com/ubuntu/ artful main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ artful-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ artful-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ artful-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ artful-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ artful main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ artful-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ artful-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ artful-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ artful-backports main restricted universe multiverse 保存退出
执行apt-get update
3.主机可以ping通虚拟机,而虚拟机不能ping通主机
① 设置为桥接模式
② 在里面配置网址(这种方式配置,重启失效):
>ifconfig eth0 192.168.199.122 netmask 255.255.255.0 //配置网络
>route add defaut wg 192.168.199.1 //设置路由,否则可以ping主机,却ping不通外网
如果上面这种配置ping的通内网,却仍然无法ping通外网,
>vi /etc/resolv.conf
查看里面的nameserver指定的是哪里(dns)
应该制定为主机的路由 192.168.199.1 //视自己的情况而定
保存退出
再试试 >ping www.baidu.com
ok搞定;