[部署] -VirtualBox安装linux虚拟机

virtualbox设置

增强功能包

选择安装“增强功能”,系统光驱会自动挂载镜像。若没有则到对应目录下运行sudo ./VBoxLinuxAdditions.run
[部署] -VirtualBox安装linux虚拟机_第1张图片

网络连接

为了主机与虚拟机互通,虚拟机设置->网络->网卡1里选择"桥接网卡",混杂模式选“全部允许”。
[部署] -VirtualBox安装linux虚拟机_第2张图片

共享目录

虚拟机设置->共享文件夹->添加共享文件夹,设置好文件夹名称(后面要用到)。选择“自动挂载”,“自动分配”。
[部署] -VirtualBox安装linux虚拟机_第3张图片

共享粘贴板

虚拟机设置->常规->高级->共享粘贴板->双向。
[部署] -VirtualBox安装linux虚拟机_第4张图片
虚拟机设置->存储->控制器->使用主机输入输出。
[部署] -VirtualBox安装linux虚拟机_第5张图片
虚拟机设置->存储->控制器->vdi->固态驱动器。
[部署] -VirtualBox安装linux虚拟机_第6张图片
没有生效重启看看。

其他

右ctrl + home唤出界面菜单栏。

Ubuntu

版本:ubuntu-20.04-desktop-amd64.iso
ubuntu开发环境配置

固定ip

ubuntu20的ip设置与之前的版本不一样。现在使用/etc/netplan/xxx.yaml来配置固定ip。
在这之前,先查看网卡信息,ifconfig,得知网卡名称为enp0s3
[部署] -VirtualBox安装linux虚拟机_第7张图片
编辑配置文件,我的是01-network-manager-all.yaml,ip改为10.0.0.111
[部署] -VirtualBox安装linux虚拟机_第8张图片
执行命令
sudo netplan try
sudo netplan apply
[部署] -VirtualBox安装linux虚拟机_第9张图片

更改源

修改/etc/apt/sources.list,修改前请记得备份。(命令:复制cp,移动mv

#添加阿里源
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

##中科大源
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

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

##清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

挂载共享文件夹

挂载 sudo mount -t vboxsf 共享文件夹名称(在设置页面设置的) 挂载的目录
卸载挂载 sudo umount -f 挂载的目录

你可能感兴趣的:(部署与配置,Linux,linux,virtualbox)