Article directory
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.
Select the downloaded Ubuntu22.04 image file (file type selection *.*
)
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.
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:
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".
Click "Compress" and an unallocated area will be displayed, which is ready to be left for Ubuntu installation.
View disk partition type
We right-click the disk 0 in the above figure, click "Properties", and check the disk partition form.
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.
You can see that the default boot mode is UEFI:
We need to change the boot option No. 1 to USB boot:
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:
Entered successfully! Select the Chinese language and choose to install Ubuntu
Note that when you reach the "Installation Type" step, you need to select "Other Options":
Select the free partition allocated by compression before, and click the "+" sign below:
① First create a system partition.
Select 500MB for the size, which is used to select "EFI system partition". Click OK and
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"
③ 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
④Create a home mount point:
use the default space for the size, and select "/home" for the mount point
The following partitions are created for Ubuntu, we remember the device name of the efi partition (" /dev/sda3 " in the picture):
Click on the efi partition, and select the device name just now (" /dev/sda3 ") in the device where the bootloader is installed below.
When everything is ready, click "Install Now". Click "Continue".
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):
You can see the following startup screen after normal startup:
the first item is Ubuntu (you can also choose Windows)
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 update
to 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.
Go to Nidia official website to find the driver:
enter the corresponding information, click Search
and then click Download to start downloading the "run" file.
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...).
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"
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.
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-essential
install 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!
We nvidia smi
can display GPU information normally by typing in the terminal!
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.
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.
Finally enter in the terminal:
sudo gupdate-grub
Just restart.