[2021] Reinstall ubuntu16.04 system

March 3, 2021 19:47

I caused the ubuntu16.04 system to crash due to various reasons, and now I need to reinstall the system, so I recorded this trip to reinstall ubuntu.

Reason: ubuntu16.04-a problem with the system program was detected

Always log in to the user interface, log in and then flash out, and log in continuously.

Ubuntu system-Ubuntu16.04 can not enter the interface (login interface loop, password is correct)

Check the tutorial, practice operation:, and then the operation can't come out. Consider reinstalling the system.

Main reference https://blog.csdn.net/Spacegene/article/details/86659349

Then took a look at https://blog.csdn.net/d993809188/article/details/100997941

One, uninstall the Ubuntu system

1. Delete the original Ubuntu system partition

View the disk:

Partition

Keyboard input [win] + [R], input [diskpart]. In the diskpart interface, enter [list disk] to query the current disk information

Enter [select disk 0]. Then check all partition information under Disk 0 [list partition].

It can be seen that partition 1 is the windows system partition, and partitions 2-4 are the Ubuntu system partitions (type = unknown). Here we only delete the Ubuntu system partition. Select partition 2 [select partition 2] and delete the partition [delete partition override]. After deleting, you can find an extra 7G unallocated space in the disk manager. Similarly, delete partitions 2-4 in turn

 

2. Delete Ubuntu startup items under UEFI system

2.1 Delete Ubuntu boot entry

First download EasyUEFI, the official download address is: https://www.easyuefi.com/index-us.html , (the download address I found: https://www.easyuefi.com/index-cn.html ) download the official The free trial version is sufficient, and the download address of the cracked version is: http://www.downza.cn/soft/212250.html .

After the download is complete, double-click the executable file to install, and then open EasyUEFI, as shown in the following figure:

Select [Manage EFI boot options] to enter the following interface. Select each ubuntu boot item in turn, and click the button in the red box to delete the ubuntu boot item.

 

2.2 Delete the Ubuntu boot entry in the Win10 EFI boot partition

If after the first step is over, you can directly boot and press ESC or F12 to enter the boot option menu and you will find that there are still Ubuntu boot items, as shown in the following figure:

This is because after installing Ubuntu, Ubuntu's boot information is also written in the EFI boot partition of win10. If you don't delete it, there will be many Ubuntu startup items when you install Ubuntu in the future.

Because there is no drive letter under win10, we cannot access the EFI boot partition of win10. Therefore, here we still use diskpart to operate, first enter disk 0 to assign a drive letter to the EFI partition. The operation is as follows:

1. Enter [Win]+[R], enter [diskpart] to open diskpart;

2. Enter [list disk] to display the disk list

3. Enter [select disk 1], select disk 1, which is the disk where the win10 system is located;

4. Enter [list partition] to view the partition list of Disk 1;

5. Enter [select partition 1] and select the partition where the wind10 boot entry is located (that is, the partition with type=system, and the capacity is generally smaller than 100M);

6. Assign a drive letter to the partition where the win10 EFI boot entry is located, enter [assign letter = p], where p is the drive letter name, letters A~Z should be all, be careful not to repeat the existing drive letter name;

 

At this point, if you look at the win10 disk, you will find that there is an extra P drive, which is the win10 boot entry partition we just allocated, as shown in the following figure:

 

Due to insufficient permissions, the drive letter cannot be opened directly at this time. Here first open Notepad with administrator privileges

 

Then access the P drive through the [File]-[Open] in the upper left corner of the Notepad menu bar, you will find an EFI folder in the P drive, open the EFI folder, and find the following directories (the computer may be slightly different different):

 

Just delete the ubuntu folder here.

At this point, go back to diskpart to delete the drive letter P just assigned, and enter [remove letter = p], as shown below:

 

March 4, 2021 15:21

Two, install ubuntu16.04 system

Reference tutorial https://www.cnblogs.com/masbay/p/10844857.html

There should be another step to make a system disk, but since I installed it before and there is an available system disk, I skipped this step [making a system disk] process. If necessary, I can search for related tutorials on the Internet.

0. Create a blank partition under windows

Right-click "This Computer", click "Manage", click "Disk Management" to allocate space for ubuntu

I have a dual hard disk here, I allocate 600G of space from the E disk of disk 0 to the ubuntu system,

ps: I am going to put the boot items of ubuntu directly in the e disk, and no longer use a separate partition as a boot item.

1. Insert the system disk, restart the computer, and boot into the bios. Different computers have different ways to enter the bios. The way to enter the BIOS here is [Savior's Blade 7000P]: press ESC and F12 keys continuously at the same time when starting up (because the specific time Which of these two, I am not sure, anyway, enter the BIOS system) as shown in the figure.

2. Then in the bios interface-in the [Security] page, turn off [secure boot]

3. Save and exit, the computer will restart, according to your computer, press the corresponding key to enter the boot manager, find the USB startup item, and press Enter to enter.

4. Then you will enter this interface, select Install Ubuntu, and press Enter to confirm

5. After entering, select simplified Chinese

6. Wireless selection [I don't want to connect to wifi wireless network]

7. Only select [Install third-party software for graphics or wireless hardware, MP3 and other media], do not select the first one, it is very slow to download and update while installing, click "Continue"

8. Select [Other options], because manual partitioning is required

9. Then enter the ubuntu system partition, where the window may be too large due to the too small resolution, and the screen cannot fit, you can hold down [ALT+F7] to drag the window with the mouse.

Now you can see the space we allocated to ubuntu under win10, which is the free partition in the figure. 644245MB is about 600G of space.
Add: There are some other free partitions that are very small and only 1MB in size, we ignore it. It may be missed when partitioning.

10. Then perform manual partitioning, click the free drive letter, and click "+" to partition, as follows:

1] swap:
Chinese is "swap space", serving as ubuntu's virtual memory, the general size is about 2 times the computer's physical memory, it can be divided into 16G, logical partition, space starting position, used for "swap" or "Exchange Space"

2]/:
This is the root directory of ubuntu, which is used to install the system and software. It is equivalent to the C drive of windows. We divide it into 100G, the main partition, and the starting position of the space. It is used for the "ext4 log file system" and hangs. The loading point is "/" (adjust according to your disk space, it can be larger, after all, ubuntu installation software is installed in the root directory by default)

3] /home: It is
equivalent to other disks in windows, and the rest (about 500G) is allocated to it, the logical partition, the starting position of the space, used for "ext4 journal file system", the mount point is "/home" "

11. The following step is very important : at the bottom of the partition interface, select the location to install the startup item,

Here we do not partition the boot items of ubuntu separately, and install the boot items of Ubuntu directly in the root directory. You can see that my Ubuntu system partitions are all in [/dev/sda2, 3, 4], so we choose the root directory [/dev/sda] as the location of the installation startup items. Then click [Install Now].

12. It is not important to set the region, set it as you need, or you can continue directly without affecting

13. Then there is the keyboard layout, the default is Chinese. Here is limited by the resolution, the above [Chinese] is not displayed, you can see the [Chinese] option by moving the window with ALT+F7.

14. The next step is to set up the user here, just enter it yourself, such as English letters, try to be as simple as possible, and the password is also simple.
The computer name must be reset, the simpler the better, because this string of computer names is in front of the command line of the terminal.

I forgot to change the computer name here, and the front of the command line is a long string every time, so I need to reset the computer name. The specific method can be seen in the following tutorial How to modify the computer name in Ubuntu

15. After the above settings are completed correctly, you can install Ubuntu. This time, my installation was very fast, and it was completed in 11 minutes.

16. After the installation is complete, you will be reminded to restart. At this time, first unplug the U disk, and then click "Restart now", if it freezes, it will be forced to shut down and restart.

17. If the situation shown in the figure below appears, you can unplug the U disk and press the enter key. If there is no response, simply power off and restart.

18. If you encounter GRUB errors when restarting and booting up, you can directly exit and press Enter.

19. After restarting, enter the Ubuntu system. At this point, all the Ubuntu system installations are over.

20. Then perform operations on the Ubuntu system:
{ Replace the apt source, that is, replace the Tsinghua/Ali source; install the nvidia driver; install CUDA and cudnn; install anaconda and pycharm. }



Three, configure the Ubuntu system

1. Ubuntu 16.04 replaces domestic sources

Refer to ubuntu16.04 and 18.04 to replace the domestic source input command, but the source link is changed;

Refer to Ubuntu16.04 to replace the Alibaba source link obtained in the domestic source .

1.1. Back up the original source file source.list

Open the terminal on the desktop and execute the command: sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

1.2. Modify the source file sources.list

(1) The terminal executes the command: sudo chmod 777 /etc/apt/sources.list to    change the file permissions to make it editable;

(2) Execute the command: sudo gedit /etc/apt/sources.list to     open the file for editing;

(3) Delete the original file content, copy the following and save;

deb http://mirrors.aliyun.com/ubuntu/ xenial main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main

deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb -src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe

deb http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb http://mirrors.aliyun.com/ubuntu/ xenial -security universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial -security universe

1.3. Update source

The desktop terminal executes the command: sudo apt update to update the software list, and change the source to complete.

2. Install nvidia graphics driver

For details on installing the graphics card driver, see my other blog post: "Installing the graphics card driver on Ubuntu16.04 ; [2021 latest] Installing the graphics card driver on Ubuntu16.04 (installation successful!)

3. Install CUDA8.0

https://blog.csdn.net/LemonShy2019/article/details/114582152?spm=1001.2014.3001.5501

4. Replace pip source

https://blog.csdn.net/qq_29935433/article/details/105991490

https://blog.csdn.net/qq_42351063/article/details/102798505

https://blog.csdn.net/luhuaxiang/article/details/90754795

Guess you like

Origin blog.csdn.net/LemonShy2019/article/details/114949447