Install Ubuntu22.04 under Windows10 (build dual system) steps + install Nvidia graphics card driver

The Lunix system is commonly used for training neural networks, and Ubuntu22.04 is used here.
Record the Windows10+Ubuntu dual system installation method.

Download Ubuntu22.04

Download link: Ubuntu 22.04.2 LTS
ready image file ubuntu-22.04.2-desktop-amd64.iso

Make an Ubuntu installation disk

Prepare a U disk for making Ubuntu installation disk
Download image burning tool: win32diskimager

Open after installation.
insert image description here


Select the downloaded Ubuntu22.04 image file (file type selection *.*)
insert image description here


Insert the USB flash drive, select the drive letter of the USB flash drive (disk F in the figure), click "Write", select "Continue", and start writing the image file.
insert image description here

Partition the hard drive

General Ubuntu partition planning scheme:

Partition type or mount point General required size
boot area efi (boot type) 500MB
memory swap partition swap 20GB (can be slightly larger than your own physical memory)
Root mount node (for installing system files) ext4/ 20GB
Store personal user data mount nodes ext4/home 10GB or more

Open Windows 10 Disk Management:
insert image description here

Select a partition for the partitioning work required by the Ubuntu system.
I choose the E drive here, you can choose the partition you want to install the Ubuntu system on your own, and format it. Note that it is best to leave more than 50GB empty.
Right-click on "Ubuntu (E:)" and select "Shrink Volume".
insert image description here

Click "Compress" and an unallocated area will be displayed, which is ready to be left for Ubuntu installation.
insert image description here

View disk partition type

We right-click the disk 0 in the above figure, click "Properties", and check the disk partition form.
insert image description here

Common disk partition forms are MBR and GPT.
For GPT, it corresponds to the UEFI Boot mode of the BIOS. For this boot mode, a /efi partition (as shown in the boot area in the above table) needs to be divided.
For MBR, it corresponds to the Legacy Boot mode (traditional mode) of the BIOS. For this type, a /boot partition is required.
You can see that the partition format of our disk is GPT .

install ubuntu

After confirming that the U disk is burnt and the disk partition type (GPT) is confirmed, restart the PC.
Press DEL (the key may be different in different situations) to enter the BIOS interface.
insert image description here

You can see that the default boot mode is UEFI:
insert image description here

We need to change the boot option No. 1 to USB boot:
insert image description here

insert image description here

Finally save and exit BIOS.

After restarting, you will enter the interface about installing Ubuntu (if you have not entered it, you can Baidu to find out how to enter the startup interface for different motherboards), select the first "Try or Install Ubuntu" to enter the Ubuntu installation:
insert image description here

Entered successfully! Select the Chinese language and choose to install Ubuntu
insert image description here


Note that when you reach the "Installation Type" step, you need to select "Other Options":
insert image description here

Select the free partition allocated by compression before, and click the "+" sign below:
insert image description here

① First create a system partition.
Select 500MB for the size, which is used to select "EFI system partition". Click OK and
insert image description here
you will see an additional 500MB partition of efi type above.

②Create a swap space (memory swap partition):
the size is slightly larger than your memory, I choose 20GB for selecting "swap space"
insert image description here

③ Create a root mount node:
set the size (although I wrote 20GB, but it is recommended to give more points such as 100GB, otherwise you may encounter insufficient space when installing CUDA and the like), and select "/" as the mount point
insert image description here

④Create a home mount point:
use the default space for the size, and select "/home" for the mount point
insert image description here


The following partitions are created for Ubuntu, we remember the device name of the efi partition (" /dev/sda3 " in the picture):
insert image description here

Click on the efi partition, and select the device name just now (" /dev/sda3 ") in the device where the bootloader is installed below.
insert image description here

When everything is ready, click "Install Now". Click "Continue".
insert image description here

Once you've set up your name, computer name, username, and password, you're ready to install.
After the installation is complete, you will be prompted to restart.
After restarting, you will be prompted to unplug the installation U disk, press ENTER.


If it returns to Windows 10 after restarting, it means that the priority of the startup option is still Windows. We then restart to enter the BIOS interface, you can set the boot options.
Just set Ubuntu as the priority, save, exit and restart.
My situation is as shown in the figure below (the BIOS program setting method of different motherboards is a little different):
insert image description here


You can see the following startup screen after normal startup:
the first item is Ubuntu (you can also choose Windows)
insert image description here

Then you can enter the Ubuntu system!

About Unable to locate package error

If there is an installation package showing that the package cannot be located,
first open the terminal and enter sudo apt-get updateto see if the package information can be updated.
If not, please refer to this article .

Install graphics driver

After installing the game system, the system seems to not recognize my graphics card (RTX3060), and the graphics display is livmpipe.
At this time, the graphics card driver needs to be installed.
insert image description here

Go to Nidia official website to find the driver:
enter the corresponding information, click Search
insert image description here
and then click Download to start downloading the "run" file.
insert image description here

After the download is complete, right click on the file storage directory and select "Open in Terminal".
Enter sudo bash 驱动文件名, enter the password after confirmation, and enter the installation program. After entering the installation program, it may prompt that the installation cannot be done (You appear to be running an X server...).
insert image description here

At this time, we need to restart the system and install directly using the Ubuntu command line mode. Let's move this run file to the root directory first.


After restarting, on the login interface, press Ctrl+Alt+F2 (or F3~F6) to enter the command line interface.
Manually enter the user name and password to log in the user.
Enter sudo bash 驱动文件名to install.

Select "Continue installation"
insert image description here

Here you will be prompted that the system uses the third-party driver nouveau by default (you can Baidu about nouveau yourself), the installer will ask whether you can create a module file for you to disable nouveau, here select "yes" on the left.
The installer will then exit.
insert image description here


sudo bash 驱动文件名After restarting, we directly log in and return to the graphical interface, and enter the installation program again, it will prompt that the gcc package is not installed.
After exiting, enter sudo apt install build-essentialinstall in the terminal.

Finally, enter again sudo bash 驱动文件名to open the installer to install, and then you can install normally.
As shown: Would you like to run the nvidia-xconfigutility to automatically update your x configuration so that the NVIDIA x driver will be used when you restart x? Any pre-existing x confile will be backed up → Select "yes" if
there is no problem , the installation is complete.


Now the graphics card can be displayed normally!

insert image description here

We nvidia smican display GPU information normally by typing in the terminal!
insert image description here

Ubuntu boot menu set to default Windows boot

We know that you can enter the Windows system in the Ubuntu boot menu, but the default choice is Ubuntu, and it will automatically enter the Ubuntu system after waiting for 10 seconds.
Many people want to change the default selection to Windows, because it is used the most, so that you don’t need to press the arrow keys to select windows every time, and you can directly enter Windows by waiting for 10 seconds or pressing the ENTER key each time.
insert image description here
We open the terminal and enter:

sudo gedit /etc/default/grub

Enter the text editor, find it GRUB_DEFAULT=0, and change 0 to 2 (windows boot manager is the third item in the above figure, so it is "2").
Save and exit.
insert image description here
Finally enter in the terminal:

sudo gupdate-grub

Just restart.

Guess you like

Origin blog.csdn.net/takedachia/article/details/130354110