[LINUX] Ubuntu 20.04 LTS installation method (for external drive)

As of April 23, 2020, the official version of Ubuntu 20.04, the long-term support version following Ubuntu 18.04, has finally been released! </ font> In this article, we will explain the procedure to ** install Ubuntu 20.04 on an external drive ** under the environment where Windows 10 is originally installed on the internal HDD / SSD.

device1.jpg

This is effective when it is difficult to temporarily remove the internal HDD / SSD, such as a notebook PC. If it can be taken out temporarily, take it out at the time of installation.

Introduction

What to prepare

(1) ** PC (with built-in HDD / SSD with Windows 10 installed) ** </ font> (2) ** USB memory (4GB or more) ** </ font> → This will be Live USB (Ubuntu installer) (3) ** External HDD / SSD / USB memory (64GB or more) ** </ font> → Ubuntu is installed here (4) External HDD / SSD / USB memory / SD card, etc. (capacity optional) → For backup

(1)-(3) → Required, (4) → Optional

Precautions for installation

If you make a mistake when installing Ubuntu, ** Windows 10 data may be lost ** </ font>. Please do not make a mistake in each step. (Be especially careful where it is written in ** red ** </ font>.) It is recommended to make a backup on another device just in case.

** Also, we have confirmed that Ubuntu does not start on the following PCs. ** </ font> ・ Microsoft Surface

(0) Backup

If the data of Windows 10 is erased once when installing Ubuntu, it is difficult to recover the data. It's a good idea to back up your data to prevent this from happening. ** Especially if you are installing Ubuntu for the first time, it is highly recommended to back up your data. ** </ font>

device2.jpg

The detailed procedure is described below.

First, insert the ** (4) backup external device ** into your PC. Then click the Start button, type ** "Control Panel" **, and click ** "Control Panel" ** in the search results. windows0.jpg

** Click "Backup and Restore (Windows 7)" **. windows1.jpg

Although it says "Windows 7", there is no problem because it can be used for "Windows 10".

Select the device ** (4) as the backup destination device **, and click ** "Backup Now" **. windows2.jpg

This completes the data backup.

(1) Creating a live USB (installer)

To start Ubuntu on your PC, you need to have Ubuntu installed on your external drive. Also, in order to install Ubuntu, a dedicated installer is required.

This time, we will create a live USB (Ubuntu installer) by downloading the ISO file and writing it to a USB memory.

device3.jpg

Then, as usual, ** start Windows 10 **. Access the following site and click ** "64-bit PC (AMD64) desktop image" ** in the ** "Desktop image" ** column to download the ISO file. http://releases.ubuntu.com/20.04/ windows3.jpg

Here, use the dedicated software to write the downloaded ISO file to the USB memory. Access the following site and download ** "Rufus" **. https://rufus.ie/ windows4.jpg

After downloading, execute ** "rufus-x.x.exe" **. windows5.jpg

** Insert the USB memory ** of what you need to prepare (2) into your PC. Set the following ** "device" ** to the USB memory ** of ** (2). windows6.jpg If you use live USB, all the data saved in the USB memory will be erased. If you have data, move it to another device.

Click ** "Select" ** and ** select the downloaded ISO file **. windows7.jpg

** Confirm that the input is correct ** </ font> When you are done, click ** "Start" **. windows8.jpg

** Click "Yes" **. windows9.jpg

** Check "Burn in ISO image mode" ** and click ** "OK" **. windows10.jpg

If you agree with this, click ** "OK" **. windows11.jpg

While copying the ISO file, it looks like the following. windows12.jpg

When the status becomes ** "Ready" **, writing of the ISO file is complete. ** Click "Close" ** to finish. windows13.jpg

(2) Ubuntu installation

Live USB boot

Then, start the Ubuntu installer created earlier by one of the following methods.

device4.jpg

** 1. Select "Start Button"-> "Shutdown Button"-> "Shift" + "Restart"-> "Use Device"-> Live USB ** ** 2. "Start Button"-> "Shutdown Button"-> "Shift" + "Reboot"-> "Troubleshooting"-> "Advanced Options"-> "UEFI Firmware Settings"-> "Reboot"-> UEFI or BIOS boot → Select Live USB (or sort boot order) ** ** 3. Shutdown-> touch power button-> press "F2" repeatedly-> boot UEFI or BIOS-> select live USB (or sort boot order) **

If you want to start by method 2 or 3, the following site will be helpful. https://freesoft.tvbok.com/tips/peripherals/bios_boot_fn-key_list.html https://www.pc-master.jp/mainte/k-jyuni.html

Device confirmation / initialization

Start the Ubuntu installer, and when the following screen appears, click ** "Application Button" ** at the bottom left. ubuntu1.jpg

Enter "disks" in the search word and click ** "Disks" **. ubuntu2.jpg

Then, the devices currently recognized by the PC will be displayed.

Then, please insert ** HDD / SSD / USB memory ** of what you need to prepare (3) into your PC. ** Here, the device newly added in the left column is the external drive of (3). ** </ font> ** Select the newly added device and make a note of the characters written to the right of "Device". ** </ font>

In my case, the first from the top is the device on which Windows 10 is installed (/ dev / sda), the second is the live USB (/ dev / sdb) of (2), and the third is the device of (3) (/). It was dev / sdc).

device5.jpg

If a partition is assigned to the device in (3), click the "-" button there to delete it. ** Note: Please check if the device to be deleted is correct before executing. ** </ font> ubuntu3.jpg

If you delete the partition allocation, it will be as follows. ubuntu4.jpg

Installation settings

device6.jpg

Now, start the installation. ** Execute "Install Ubuntu 20.04 LTS" **. ubuntu5.jpg

・ Language setting

Select ** "Japanese" ** and click ** "Continue" **. ubuntu6.jpg

・ Keyboard layout settings

Leave this as it is and click ** "Continue" **. ubuntu7.jpg

・ Internet connection settings

If you can connect to the Internet, connect it. ubuntu8.jpg

· Updates and other software settings

We will leave the update options to you. Basically, there is no problem if you set as follows. After setting, click ** "Continue" **. ubuntu9.jpg

-Installation type setting

For the installation type, click ** "Other" **. ** Note: If you select the above two, Windows 10 data may be deleted. ** </ font> ubuntu10.jpg

-Partition setting

** Select ** "Free Space" ** just below the device name ** ("/ dev / sdc" in the example) that you noted earlier, and click ** "+" ** I will. ** Note: The recognition method differs depending on the PC, so the example and device are not necessarily the same. ** </ font> ubuntu11.jpg

Select ** "EFI System Partition" **, set the size to ** "512MB" **, and then click ** "OK" ** as shown below. The EFI system partition is the place where the boot loader for booting the OS is managed. ubuntu12.jpg

Select ** "Free Space" ** under the same device name as before, and click ** "+" **. ubuntu13.jpg

Select ** "Swap area" **, set the size to ** "8000MB" **, and then click ** "OK" ** as shown below. The swap area is a place to temporarily evacuate data when the capacity of the main memory (RAM) is about to overflow. Even if the main memory (RAM) is only 4GB, if the swap area is 8GB, it can be used as if the main memory is 12GB. ubuntu14.jpg

Select ** "Free Space" ** under the same device name as before, and click ** "+" **. ubuntu15.jpg

Select ** "ext4 Journaling File System" **, assign mount points ** "/" **, ** all remaining sizes **, and then select ** "OK" ** as shown below. Click. The files that make up Ubuntu are installed in this partition. The location of the data saved after installation basically corresponds to this partition. ubuntu16.jpg

Set ** "Device to install bootloader" ** to the location of ** (3) device ** ("/ dev / sdc" in the example). Normally, I would like the boot loader to be installed on this device, but if not, please perform post-processing after installation. (I will describe it later.) (It seems that such a problem occurs when the installed device is not "/ dev / sda".) ubuntu17.jpg

** Make sure that the format of the "ext4 journaling file system" ("/ dev / sdc3" in the example) of the device in (3) is checked **, and click ** Install **. ubuntu18.jpg

** Note: Check again whether the device in (3) is selected. ** </ font> After confirming that the device in (3) is selected, click ** "Continue" **. ubuntu19.jpg

・ Time zone setting

If you live in Japan, enter ** "Tokyo" ** and click ** "Continue" **. ubuntu20.jpg

・ Account settings

After setting the name and password, click ** "Continue" **. Remember this password as you will need it to log in to Ubuntu. ubuntu21.jpg

What to do during installation

When the screen below appears, the Ubuntu installation will start. ubuntu22.jpg

・ Prevention of automatic shutdown

If you leave your PC unattended during installation, make the following settings. First, click the application button, enter "settings" in the search word, and click ** "Settings" **. ubuntu23.jpg

Select ** "Power" ** and set as follows. This will prevent the screen from dimming and shutting down during installation. ubuntu24.jpg

-Confirm the installation destination of the boot loader

Open ** "Disks" ** from the application button. Here, if the ** "EFI system partition" ** of the device (3) is not mounted (the triangle mark is not attached), the boot loader is not installed on this device.

ubuntu25.jpg

Perhaps the bootloader is installed on the ** "EFI system partition" ** of the device on which Windows 10 is installed. In other words, when you start Ubuntu, you need not only the device ** (3) but also two devices with Windows 10 installed **.

Here are some examples of successful boot loader installation (which can be started on other PCs) and examples of failures (which cannot be started on other PCs). boot_loader1.jpg boot_loader2.jpg

If the "EFI system partition" of the device in (3) is mounted (in the case of success), it is not necessary, but if not (in the case of failure), post-processing is required. I will. Post-processing is described at the end of this article (4).

-Confirmation of installation completion

If the following window is displayed, the installation is complete. ** Click "Restart Now" **. ubuntu26.jpg

Reboot and log in. At this point, you can remove the live USB from your PC. If Windows 10 has started, start Ubuntu in the device (3) in the same way as when starting live USB.

(3) Setup after installation

Once started, click the ** Application Button ** at the bottom left. setup1.jpg

Then type ** "settings" ** and click ** "settings" **. setup2.jpg

When the screen is displayed, click as follows to prevent automatic shutdown. setup3.jpg

Next, after logging in to Ubuntu and waiting for a while, the following screen will appear. Click ** "Install Now" **. (If it does not appear, please ignore it.) setup4.jpg

When the installation is complete, the following screen will appear. Click ** "Restart Now" **. setup5.jpg

Enable Japanese input

Click ** "ja" ** at the top right of the screen, and then click ** "Japanese (Mozc)" **. By doing this, you will be able to enter hiragana. setup6.jpg

Home directory language "Japanese → English" setting

First, open the terminal with ** "Ctrl" + "Alt" + "T" **.

Enter the following command (character string after "$") (select a range and drag and drop, or copy and execute "Ctrl" + "Shift" + "V") and press the enter key to execute. ..

$ LANG=C xdg-user-dirs-gtk-update

Next, check ** "Dont's ask me this again" ** and click ** "Update Names" **.

setup7.jpg

Caps Lock key settings

You can change the ** "Caps Lock" key to the "Ctrl" key ** by executing the following command.

$ gsettings set org.gnome.desktop.input-sources xkb-options "['ctrl:nocaps']"

Install Google Chrome

Install ** "Google Chrome" ** by executing the following command. If you are prompted to enter the password, enter the password set during installation and press the enter key.

$ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
$ sudo dpkg -i google-chrome-stable_current_amd64.deb
$ rm google-chrome-stable_current_amd64.deb

Install Vim

By executing the following command, ** "vim" **, which is a high-performance text editor, will be installed.

$ sudo apt install vim

Install language support

Ubuntu20.04 does not have language support installed from the beginning. If you have it installed, it is convenient because you can make detailed settings for Japanese character input.

Click the application button to display the search screen, enter ** "language" **, and click ** "language support" **.

setup8.jpg

When the following screen is displayed, click ** "Install" ** to install language support.

setup9.jpg

If you ** restart ** your PC and follow the steps below, a new ** "tool" ** will be added, and you will be able to make detailed settings for Japanese input (Mozc, etc.).

setup10.jpg

Package update

By executing the following command, ** "update" ** will update the ** package list **, and ** "upgrade" ** will update the package version ** based on the package list ** To do. It's a good idea to run it on a regular basis right after you start Ubuntu.

$ sudo apt update
$ sudo apt upgrade

(4) Post-processing after installation

If the boot loader is not installed in the "EFI system partition" of the device in (3), execute the following post-processing. ** If you do not perform post-processing, you will not be able to start it on a PC that is not used for installation. ** </ font>

device7.jpg

In other words, by this process, you can start Ubuntu on another PC as long as you have the device (3). ** * If "BitLocker" appears when Windows 10 starts, we have confirmed that it will be restored by this post-processing. ** </ font>

Reinstall boot loader

Reinstall the boot loader in the "EFI system partition" of the device in (3). device8.jpg

** Open a terminal with "Ctrl" + "Alt" + "T" ** and execute the following command. A confirmation screen will be displayed when you add the PPA, so press the ** Enter key **.

$ sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt update

 Simple tool to repair frequent boot problems.

Website: https://sourceforge.net/p/boot-repair/home
 More information: https://launchpad.net/~yannubuntu/+archive/ubuntu/boot-repair
 Press [ENTER] to continue. You can cancel the addition with Ctrl-c.

After the update is complete, execute the following command to install "Boot Repair".

$ sudo apt install -y boot-repair && (boot-repair &)

When the installation is complete, click ** "Recommended Repair" ** below. boot_repair1.jpg

When the following screens appear, click ** "Yes" **. boot_repair2.jpg boot_repair3.jpg boot_repair4.jpg

When the following screen appears, the installation is complete. </ font> boot_repair5.jpg

The boot loader has been installed in the "EFI system partition" of the device in (3). ** In other words, at this point, basically any PC can start Ubuntu with the device (3). ** </ font>

device9.jpg

Remove old bootloader

I was able to install a new boot loader on the device in (3). However, Windows 10 still has the old Ubuntu bootloader. Therefore, ** delete the old Ubuntu boot loader ** included in the Windows 10 device.

device10.jpg

Then, ** remove the device (3) from the PC and start Windows 10 **. When the "grub" screen appears, execute "exit".

When the Windows 10 screen comes up, click the ** Start button ** and enter ** "Command Prompt" **. When ** "Command Prompt" ** appears in the search results, ** right-click ** and click ** "Run as administrator" **. windows14.jpg

When the command prompt starts up, execute the following command.

C:\WINDOWS\system32>cd c:\
c:\>bcdedit /enum firmware

 Firmware application (101fffff
--------------------------------
identifier              {d626dc8a-3f6d-11ea-ab4f-806e6f6e6963}
device                  partition=\Device\HarddiskVolume1
path                    \EFI\UBUNTU\SHIMX64.EFI
description             ubuntu

Here, pay attention to the firmware whose ** description is "ubuntu" **, apply the characters written on the right side of ** identifier to the following "identifier", and execute the ** command.

c:\>bcdedit /delete "identifier"

 ~~~~~ Example ~~~~~
c:\>bcdedit /delete {d626dc8a-3f6d-11ea-ab4f-806e6f6e6963}
 You have successfully completed this operation.
~~~~~~~~~~~

Execute the following command again to confirm that the firmware whose ** description is "ubuntu" ** has been deleted.

c:\>bcdedit /enum firmware

Then run ** "diskpart" ** to mount the EFI system partition on the device where Windows 10 is installed.

c:\>diskpart
DISKPART> list disk

 Disk State Size Free Dyna GPT
 ### Mick
  ------------  -------------  -------  -------  ---  ---
 Disk 0 Online 476 GB 0 B *

When executing ** "sel disk" **, enter the ** Windows 10 disk number **.

DISKPART> sel disk 0

 Disk 0 has been selected.
DISKPART> list vol

  Volume ###  Ltr Label        Fs    Type        Size     Status     Info
  ----------  --- -----------  ----  ----------  -------  ---------  --------
 Volume 0 C Windows NTFS Partition 475 GB Normal boot
 Volume 1 Windows RE NTFS Partition 990 MB Normal
 Volume 2 SYSTEM FAT32 Partition 260 MB Normal system

When executing ** "sel vol" **, enter the number ** of the part where ** Info is the system **.

DISKPART> sel vol 2

 Volume 2 has been selected.
DISKPART> assign letter=Z

 DiskPart has successfully assigned a drive letter or mount point.
DISKPART> exit

Finally, execute the following commands in order to ** completely remove the old Ubuntu bootloader **.

c:\>cd /d Z:
Z:\>dir
 The volume label for drive Z is SYSTEM
 Volume serial number is EC96-1E84

 Z: \ directory

2020/01/25  11:02    <DIR>          EFI
2019/04/23  14:20    <DIR>          boot-repair
 0 files 0 bytes
 Two directories 232,128,512 bytes of free space
Z:\>cd EFI
Z:\EFI>dir
 The volume label for drive Z is SYSTEM
 Volume serial number is EC96-1E84

 Z: \ EFI directory

2018/11/12  13:38    <DIR>          .
2018/11/12  13:38    <DIR>          ..
2018/11/12  13:38    <DIR>          Microsoft
2019/05/06  17:20    <DIR>          Boot
2020/01/25  11:08    <DIR>          ubuntu
 0 files 0 bytes
 5 directories 232,128,512 bytes of free space
Z:\EFI>rmdir /S ubuntu
 ubuntu, are you sure (Y / N)? Y

This is the end of post-processing after installation.

in conclusion

This completes the installation procedure and post-processing. Now you can basically start Ubuntu on any PC as long as you have a device with Ubuntu installed.

Ubuntu is an OS that is very suitable for development, so if you use it well, you will be able to develop it.

For other post-installation setups, the following site was detailed and easy to understand. ・ 11 things to do after installing Ubuntu 20.04 LTS

Let's have a fun development life!

Reference URL

https://qiita.com/koba-jon/items/240e6b9a9bee6a0b28cc