初始安装时:image.png
启用NAT网络设置:
image.png

修改更新源

#先备份
sudo cp  /etc/apt/sources.list  /etc/apt/sources.list.backup


sudo gedit /etc/apt/sources.list 


# sources.list 
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

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

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

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src 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-backports main restricted universe multiverse

进程被占用

image.png

网络问题:

桥接模式失效,无奈启用NAT模式

image.png

使用nmcli,该命令可以完成网卡上所有的配置工作,并且可以写入配置文件,永久生效

sudo nmcli networking off
sudo nmcli networking on

最简单操作–>终端直接运行

sudo service network-manager restart

如未解决请继续往下看

1.虚拟机使用Ubuntu 18.04时,网络图标总消失,查询各种方法后,自己总结下以备己用:

sudo service network-manager stop
sudo rm /var/lib/NetworkManager/NetworkManager.state
sudo service network-manager start

sudo gedit /etc/NetworkManager/NetworkManager.conf
把false改成true

sudo service network-manager restart

2.当然了,如果想windows接入了互联网,也要把虚拟机的网络适配器配置为NAT(Network Address Translation)模式,Ubuntu才能访问互联网.
image.png

添加环境变量

sudo gedit ~/.bashrc

加入环境变量

source ~/.bashrc

Permission denied

sudo chmod 777 指定文件或者目录