Install Ubuntu Server 20.04 in VirtualBox on Mac and connect with SSH

environment

procedure

Installing VirtualBox and Ubuntu Server

First, install VirtualBox.

$ brew cask install virtualbox

Next, start VirtualBox and create a new virtual machine from "New". Set the name of the virtual machine to "ubuntu-server-20.04". All you have to do is click the GUI with the default settings.

Click the "Start" icon and select the previously downloaded Ubuntu Server iso file to start the installation.

I thought ... but I got moss here. スクリーンショット 2020-09-22 15.00.49.png The error is 「/dev/loop2: Can't open blockdev」 「systemd[1]: Failed unmounting /cdrom.」

e? why?

No matter how many times I try, this screen appears and the virtual machine suddenly crashes. Then, the following error pops up. Screen Shot 2019-05-31 at 4.50.41 PM.png 「You must specify a machine to start, using the command line....」

It's true that the Mac mini doesn't have a DVD drive, so I wonder if unmounting will give an error ... But I put the iso file in the virtual drive and the installer actually started up from there ... etc. Thinking about it, tweaking the VirtualBox GUI here and there doesn't help.

For the time being, I started the virtual machine from the command line according to the error message.

$ VirtualBoxVM --startvm ubuntu-server-20.04 &

I don't know what it is, but it worked. To be precise, the error of "Can't open block dev" is displayed, but the error of "unmounting" does not appear, the installer runs as it is, and the installation is completed in a blink of an eye. スクリーンショット 2020-09-22 15.22.26.png Even after installation, pressing the "Start" button of VirtualBox does not start well, and it starts from the command line. I still don't know why.

It's okay because it starts without problems, but it's unpleasant not to know the reason, so please let me know.

Port forwarding settings and SSH connection

Set up NAT port forwarding (IP masquerade) to connect from the host OS (macOS) to the guest OS (Ubuntu Server) by SSH. Specifically, it is set so that packets that pass through port 2222 of the host OS are diverted to port 22 (SSH port) of the guest OS.

Select "Settings"-> "Network"-> "Advanced"-> "Port Forwarding" in VirtualBox, and set "TCP" as the protocol, "2222" as the host port, and "22" as the guest port (the name is appropriate). Is fine).

Alternatively, you can set it by hitting the following command.

$ VBoxManage modifyvm "ubuntu-server-20.04" --natpf1 "guestssh,tcp,,2222,,22"

Then, specify connection port 2222 and make an SSH connection.

[hajime-f@borneo:~]$ ssh -p 2222 localhost
hajime-f@localhost's password:

...(Omitted)...

Last login: Tue Sep 22 09:49:22 2020
hajime-f@tonga:~$

I was able to land safely from borneo to tonga (Reference: It is interesting to give the host name the name of the southern island).

Maybe instead of configuring a closed network with hosts and guests, you can add an adapter to the guest, assign it a private IP, and resolve it with `/ etc / hosts```, then `$ ssh I think I can connect with tonga```, but I stopped because it was troublesome.

In the same way, I set up another Ubuntu Server and named it "bali".

Next, I'll play with Docker using these two virtual machines.

Recommended Posts

Install Ubuntu Server 20.04 in VirtualBox on Mac and connect with SSH
Ssh to Ubuntu on VirtualBox on your Mac and do it until you install Docker
Install Veeam PN on Ubuntu in IBM Cloud VPC and connect with SSL VPN
Install Docker on Ubuntu Server 20.04
Install rbenv with apt on ubuntu and put ruby
Install docker and docker-compose on ubuntu in the shortest process
Install JDK and JRE on Ubuntu 16.10
Install ruby on Ubuntu 20.04 with rbenv
Steps to install Maven on Mac and use it in Eclipse
Run Ubuntu + ROS with Docker on Mac
Put Zabbix in Ubuntu with Docker and monitor Docker on the same host
Install java and android-sdk on Mac using homebrew
Build and install Wireshark Development Release (3.3.1) on Ubuntu
Publish MySQL externally and log in on Ubuntu
Set up an SSH server on WSL2 Ubuntu 20.04
Install SonarQube on Mac and challenge source analysis
Install and switch between multiple Javas on Ubuntu
Install gradle on mac
Install Ubuntu 20.04 in virtual box on windows10 and build a development environment using docker
Install Java on Mac
Install Oracle JDK 8 via PPA in AWS Ubuntu Server 16.04
Install pyqt5 on ubuntu
How to install NVIDIA driver on Ubuntu ssh destination
Create a private key / public key in CentOS8.2 and connect to SSH with VS Code
Install java and maven using brew on new mac
Install Gradle with ubuntu16.04
Install Eclipse on Mac and translate it into Japanese
Install Autoware on Ubuntu 18.04.5
I struggled with pip install on an M1 Mac
Install Rust in WSL2 Ubuntu environment and build WASM build environment
Install Homebrew on Ubuntu 20.04
Install ag (the silver searcher) [on CentOS / Ubuntu / Mac]
Install OpenJDK 8 on mac
Install mecab-ipadic-neologd on Sakura VPS (ubuntu18.04) with low memory and use it from python
What to do if you enable UFW on Ubuntu VM on GCP and you can't connect to SSH
How to Install Elixir and Phoenix Framework on Ubuntu 20.04 LTS
Build a CentOS 8 virtual environment on your Mac with VirtualBox
Set up Django on Ubuntu 16.04 with PostgreSQL and Gunicorn on ECS
Build VNC Server on Ubuntu 20.04
AWS CLI install in Ubuntu 20.04
Install CentOS Stream8 in VirtualBox
Install zabbix agent (5.0) on Ubuntu 18.04
Install Arudino IDE on Ubuntu 20
Install Ubuntu Desktop 20.10 on RaspberryPi4
Install Apache on CentOS on VirtualBox
Install raspi-config on Ubuntu 20.04 (LTS)
Install WordPress 5.5 on Ubuntu 20.04 LTS
Note: Install PostgreSQL 9.5 on Ubuntu 18.04
Install gem in Serverless Framework and AWS Lambda with Ruby environment
How to install and use Composer on an ECS instance on Ubuntu 16.04
I want to connect SONY headphones WH-1000XM4 with LDAC on ubuntu 20.04! !!
Install metrics-server with Helm on Kubernetes that comes with Docker for Mac
Install Golang / MariaDB on CentOS8, connect to DB and execute SQL
Steps to install samba on CentOS 8 and connect from Windows 10 Explorer
How to switch Java version with direnv in terminal on Mac
How to install and configure the monitoring tool "Graphite" on Ubuntu
How to install the language used in Ubuntu and how to build the environment
How to install Adopt OpenJDK on Debian, Ubuntu with apt (-get)
Install Ubuntu20.04 on RaspberryPi 4 and build Kubernetes to run the container
Install Docker on Ubuntu and set up remote connection using tls
[Ssh server] ubuntu ssh server construction-ssh connection from inside and outside the LAN