[LINUX] Ubuntu 18.04 LTS installation method (compatible with external HDD / SSD / USB memory)

In this article, we will explain the procedure to ** install Ubuntu 18.04 on an external device ** under the environment where Windows 10 is originally installed on the internal HDD / SSD. 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>

The detailed procedure is described below.

First, insert the ** (4) backup external device ** into your PC. Next, click the Start button, enter ** "Control Panel" **, and click ** "Control Panel" ** in the search results. 1.png

** Click "Backup and Restore (Windows 7)" **. 2.png

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

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 device. 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.

Then, as usual, ** start Windows 10 **. Access the following site and download ** "ubuntu-18.04.x-desktop-amd64.iso" **. http://releases.ubuntu.com/18.04/ 1.png

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/ 44.png

After downloading, execute ** "rufus-x.x.exe" **. 46.png

** Insert the USB memory ** of what you need to prepare (2) into your PC. Set the following ** "device" ** to the USB memory ** of ** (2). 2.png 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 **. 3.png

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

** Click "Yes" **. 5.png

If you agree with this, click ** "OK" **. 7.png

While copying the ISO file, it looks like the following. 8.png

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

(2) Ubuntu installation

Live USB boot

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

** 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. 11.png

Enter "disks" in the search word and click ** "Disks" **. 12.png

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 device (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). 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> 13.png

If you delete the partition allocation, it will be as follows. 14.png

Installation settings

Now, start the installation. ** Execute "Install Ubuntu 18.04.x LTS" **. 15.png

・ Language setting

Select ** "Japanese" ** and click ** "Continue" **. 16.png

・ Keyboard layout settings

Leave this as it is and click ** "Continue" **. 17.png

・ Internet connection settings

If you can connect to the Internet, connect it. 18.png

· 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" **. 19.png

-Installation type setting

For the installation type, click ** "Other" **. ** Note: Choosing the top two will be troublesome later. ** </ font> 20.png

-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> 21.png

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. 22.png

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

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. 24.png

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

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. 26.png

Set ** "Device to install bootloader" ** to the location of ** (3) device "EFI system partition" ** ("/ dev / sdc1" in the example). Normally, I would like the boot loader to be installed in this partition, but if not, please perform post-processing after installation. (I will describe it later.) 27.png

** 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 **. 28.png

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

・ Time zone setting

If you live in Japan, enter ** "Tokyo" ** and click ** "Continue" **. 30.png

・ Account settings

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

What to do during installation

When the screen below appears, the Ubuntu installation will start. 32.png

・ 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" **. 33.png

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

-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. Perhaps the bootloader is installed on the ** "EFI system partition" ** of the device where 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 **. 35.png

If the "EFI system partition" of the device in (3) is mounted, it is not necessary, but if not, post-processing is required. 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" **. 36.png

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

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.) 37.png

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

Package update

Open a terminal with "Ctrl" + "Alt" + "T" and execute the following command. ** Update the package list ** with "update" **, and ** update the package version ** based on the package list with ** "upgrade" **.

$ 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. 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). First, open the terminal with "Ctrl" + "Alt" + "T".

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

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

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-get 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-get install -y boot-repair && (boot-repair &)

When the installation is complete, click ** "Recommended Repair" ** below. 39.png

When the following screens appear, click ** "Yes" **. 40.png 41.png

When the following screen appears, the installation is complete. </ font> 42.png

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>

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.

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 ** "cmd" **. When ** "Command Prompt" ** appears in the search results, ** right-click ** and click ** "Run as administrator" **. 10.png

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. When executing ** "sel vol" **, enter the number ** of the part where ** Info is the system **.

c:\>diskpart
DISKPART> list disk

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

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

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

Z:\EFI>

This is the end of post-processing after installation.

in conclusion

This completes the installation procedure and post-processing.

If you have a GPU, you can learn Deep Learning as well. The following is an article for building a Deep Learning environment. If you have completed the installation procedure in this article and would like to build a Deep Learning environment, please refer to it!

** ・ Ubuntu18.04 Deep Learning environment construction starting from zero ** https://qiita.com/koba-jon/items/a7c5239fb5c05172c1b3

Also, if there are any points that should be improved, please comment.

Let's have a good development life!

Reference URL

https://linuxfan.info/ubuntu-18-04-install-guide https://linuxfan.info/make-linux-install-usb-on-windows https://kledgeb.blogspot.com/2013/12/ubuntu-boot-repair-19-boot-repair.html https://bi.biopapyrus.jp/os/win/dualboot-fix-bootmenu.html