1.安装 Ubuntu18.0.4
1. 修改为桥接方式
1.在virtualbox配置页面设置为桥接模式
2.修改IP为固定IP
1.修改/etc/network/interfaces 文件
auto enp0s3
iface enp0s3 inet static
address 192.168.1.201
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 223.5.5.5
2.刷新IP
sudo ip addr flush enp0s3
sudo systemctl restart networking.service
3.重启系统
4.修改/etc/NetworkManager/NetworkManager.conf
将“managed=false”修改为“managed=true”
5.重启network manager
sudo service network-manager restart
3.配置虚拟机支持ssh(完成ssh就可以通过xshell等进行连接)
sudo apt-get update
sudo apt-get install openssh-server
sudo ps -e |grep ssh //出现sshd则说明安装成功
ssh gch@192.168.1.201 进行测试
如果安装openssh-server 报错 请参考
ubuntu安装openssh-server报依赖错误的解决方法
2. 更换下载源
1. 首先备份源列表
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup
2. 编辑/etc/apt/sources.list文件, 在文件最前面添加阿里云镜像源
# 阿里源
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
然后将文件下面的其他内容都注释掉。
3. 刷新列表
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential
2. 设置python3为默认的python
ln -s /usr/bin/python3 /usr/bin/python