[LINUX] ubuntu 20.04 + VirtalBox installation procedure summary

Since ubuntu 20.04 was introduced, the procedure is summarized.

The installation proceeded by creating a VirtualBox virtual machine in advance and mounting the ISO image.

Get the installer

Click here to get the ubuntu installer. I got the latest version 20.04 LTS at the time of writing the article.

https://jp.ubuntu.com/download

Installation procedure

The installation was done with GUI. Enter only the user name. When I selected the disk as standard without customizing it, it was installed in UEFI mode.

Disk configuration after installation

The virtual disk size assigned to VirtalBox is 16GB VDI format. The display of the df and fdsik commands is as follows.

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            1.6G     0  1.6G   0% /dev
tmpfs           325M  1.4M  324M   1% /run
/dev/sda5        16G  7.4G  7.1G  51% /
tmpfs           1.6G     0  1.6G   0% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           1.6G     0  1.6G   0% /sys/fs/cgroup
/dev/loop0       55M   55M     0 100% /snap/core18/1880
/dev/loop1       56M   56M     0 100% /snap/core18/1944
/dev/loop2      256M  256M     0 100% /snap/gnome-3-34-1804/36
/dev/loop3      218M  218M     0 100% /snap/gnome-3-34-1804/60
/dev/loop4       63M   63M     0 100% /snap/gtk-common-themes/1506
/dev/loop5       65M   65M     0 100% /snap/gtk-common-themes/1514
/dev/loop6       50M   50M     0 100% /snap/snap-store/467
/dev/loop7       52M   52M     0 100% /snap/snap-store/518
/dev/loop8       30M   30M     0 100% /snap/snapd/8542
/dev/loop9       32M   32M     0 100% /snap/snapd/10492
/dev/sda1       511M  4.0K  511M   1% /boot/efi
tmpfs           325M   36K  325M   1% /run/user/125
tmpfs           325M  8.0K  325M   1% /run/user/1000
$ sudo fdisk /dev/sda
:
command(Help with m): p
disk/dev/sda: 16 GiB,17179869184 bytes,33554432 sector
Disk model: VBOX HARDDISK
unit:sector(1 * 512 =512 bytes)
Sector size(logic/Physics):512 bytes/512 bytes
I/O size(minimum/Recommendation):512 bytes/512 bytes
Disc label type: dos
Disc identifier: 0x89cd8bc1

Device boot start position Last sector size Id type
/dev/sda1  *        2048  1050623  1048576   512M  b W95 FAT32
/dev/sda2        1052670 33552383 32499714  15.5G 5 extended area
/dev/sda5        1052672 33552383 32499712  15.5G 83 Linux

Version confirmation

There are two types of confirmation methods. / etc/lsb-release is enough, but is it/etc/os-release that makes it easier to remember the path?

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.1 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.1 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

root password setting

By default ubuntu does not have a password set for root and cannot do su -. Set as follows.

$ sudo passwd root
new password:
Please re-enter your new password:
passwd:Password updated correctly

network settings

Immediately after installation, the IP address is assigned as shown below by default, a NAT interface is created, and you can connect to the Internet.

$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:5b:a0:4c brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic noprefixroute enp0s3
       valid_lft 58625sec preferred_lft 58625sec
    inet6 fe80::6a5e:debe:3fe6:d921/64 scope link noprefixroute
       valid_lft forever preferred_lft forever

Set the host-only adapter on the VirtualBox side for TeraTerm access from the terminal. The network address should be different on the terminal side and ubuntu side in the same segment.

image.png

The ubuntu side is also set with GUI. Where is the network configuration file ...

image.png

DNS settings

DNS is also set, and name resolution is possible. Almost never set.

$ nslookup google.com
Server:         127.0.0.53
Address:        127.0.0.53#53

Non-authoritative answer:
Name:   google.com
Address: 172.217.174.110
Name:   google.com
Address: 2404:6800:4004:80b::200e

The DNS server address is specified as 127.0.0.53. This address is special and goes to see the systemd-resolved settings.

$ sudo cat /etc/resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "resolvectl status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.

nameserver 127.0.0.53
options edns0 trust-ad

In the systemd-resolved setting, the gateway address of the NAT connection destination terminal was set. It seems that it depends on the Internet connection environment of the terminal with VirtualBox, but there is no reason to change it, so leave it as it is this time.

kana@kana-VirtualBox:~$ systemd-resolve --status
Global
       LLMNR setting: no
MulticastDNS setting: no
  DNSOverTLS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
          DNSSEC NTA: 10.in-addr.arpa
                      16.172.in-addr.arpa
                      168.192.in-addr.arpa
                      17.172.in-addr.arpa
                      18.172.in-addr.arpa
                      19.172.in-addr.arpa
                      20.172.in-addr.arpa
                      21.172.in-addr.arpa
                      22.172.in-addr.arpa
                      23.172.in-addr.arpa
                      24.172.in-addr.arpa
                      25.172.in-addr.arpa
                      26.172.in-addr.arpa
                      27.172.in-addr.arpa
                      28.172.in-addr.arpa
                      29.172.in-addr.arpa
                      30.172.in-addr.arpa
                      31.172.in-addr.arpa
                      corp
                      d.f.ip6.arpa
                      home
                      internal
                      intranet
                      lan
                      local
                      private
                      test

Link 3 (enp0s8)
      Current Scopes: none
DefaultRoute setting: no
       LLMNR setting: yes
MulticastDNS setting: no
  DNSOverTLS setting: no
      DNSSEC setting: no
    DNSSEC supported: no

Link 2 (enp0s3)
      Current Scopes: DNS
DefaultRoute setting: yes
       LLMNR setting: yes
MulticastDNS setting: no
  DNSOverTLS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
  Current DNS Server: 192.168.11.1
         DNS Servers: 192.168.11.1
          DNS Domain: ~.

X-Window display size

The default 800x600 is hard to see, so set it to the right size. image.png

Software update

On the console side of VirtualNBox, a notification that ubuntu software update is possible was displayed, so update it just in case. If you want to display it manually, select `Software Update from the menu at the bottom left.

image.png

It takes a long time to apply depending on the environment, so it is good to do it in some time. Estimate 30 minutes to 1 hour. After updating, open Software Update and the following dialog box will be displayed.

image.png

Introduced openssh-server

The ubuntu package management command is apt, and it is installed as follows.

$ sudo apt-get install openssh-server

After installing the package, let's check the service startup status.

$ sudo systemctl status sshd
● ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2020-12-26 10:48:19 JST; 8h ago
       Docs: man:sshd(8)
             man:sshd_config(5)
    Process: 634 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
   Main PID: 644 (sshd)
      Tasks: 1 (limit: 3829)
     Memory: 4.6M
     CGroup: /system.slice/ssh.service
             mq644 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups

Summary

Since it is the minimum setting, I hope that you can set it according to the application from here onwards. I hope it will be helpful for beginners.

Thank you for reading.

Recommended Posts

ubuntu 20.04 + VirtalBox installation procedure summary
ubuntu20.04 + Geth installation procedure
Pylearn 2 installation procedure
PostgreSQL 10.0 installation procedure
blockdiag installation procedure
Linux mint installation procedure
AWS CLI installation procedure
django-debug-toolbar installation procedure memo
Anaconda3 environment installation procedure
Scrapy environment installation procedure
MongoDB installation (Ubuntu 18 LTS)
Offline installation procedure for openpyxl
Python CMS Mezzanine installation procedure
CentOS 8 installation procedure (latest version)
Docker Easy Installation Procedure (CentOS)
Python 3.6 installation procedure [for Windows]
Personal Ubuntu & WSL2 setup summary
OpenCV installation procedure on Raspberry Pi
PySpark 1.5.2 + Elasticsearch 2.1.0 Installation procedure and execution
Teamviewer for Linux installation procedure (CentOS)
Natural language processing analyzer installation summary