How to reinstall Ubuntu from scratch



Turn on workstations

Both Dell and Lenovo are slow to launch the system, though Lenovo is slightly better. Dell does not want to restart the machine when internal components are still lightly charged. Even if you press the power button, the machine automatically turns off after 10 seconds. In this case, we should unplug the workstation, wait for a while, and press the power button again. If the problem is getting worse, then there can be other reasons.

Workstation boot options

Dell

Lenovo

One should release ESC when "enter BIOS" message disappeared.

Choose Ubuntu or Debian?

Choose the Linux distro to install

Create Live USB from installer image

Download the ISO image, and convert to a bootable image in a USB stick. Do not just copy and paste ISO. Mac OSX cannot recognize the contents of a bootable image (Live USB) after successful conversion.
Some instructions are found in English and Japanese.


Boot from live USB

Ubuntu (safe graphics)

After the installation, you should restart the workstation. However, the graphics driver is not installed yet. You still need to enter GRUM mode manually.

Log in by Text console or GUI

When you accidentally entered log in screen (before creating any user accounts), you can return to TTY (text console) by typing Ctrl+Alt+F2. You can return to GUI by typing Ctrl+Alt+F1. The 'F-number' key may change depending on your system.

Boot Ubuntu with low-res graphics

When you boot the machine, you should enter the GRUB mode by pushing(?) shifting ESC (Lenovo) or SHIFT (Dell). From GRUB, you edit the boot option by typing 'e' at 'Ubuntu', and add 'nomodeset' after 'quiet splash' as follows,

linux /boot/vmlinuz-... root=... ro quiet splash nomodeset $vt_handoff

Sometimes you have to scroll down the window to find this code; see Dell's page

Here 'nomodeset' means that Ubuntu kernels does not load the video drivers, and uses BIOS mode until the X driver is loaded. In other words, if the correct video drivers are installed, one can see the boot sequence and login screen at high resolution.

Install graphics driver

After booting Ubuntu, the workstation should be connected to the internet.
Click "software update" in "setting”. It takes some time. We cannot execute multiple installation processes at the same time, because some files are locked.

Now we configure the setting of "apt" for China; this process may not be needed, but it could save time to download. Go to Tsinghua mirror and rewrite the file

/etc/apt/sources.list

Probably you need to get the latest version of certificates from Ubuntu page. If you use Ubuntu20.04, download

ca-certificates_20211016~20.04.1_all.deb

Execute,

sudo apt update
sudo apt upgrade
sudo apt install build-essential

Now we can install the graphics driver. Open
Software & Updates > Settings > Additional Drivers >
NVIDIA Corporation: GP107GL [Quadro P1000] > Using NVIDIA driver meta-package from nvidia-driver-550 (proprietary,tested) and click install (or Apply Changes). The precise numner '550' may change. It is not needed to change the `nomodeset' boot options.

If WiFi is not recognized, probably the USB dongle is broken; see Troubleshooting One can also try

sudo apt install net-tools
ifconfig

Install USB Wifi dongle

When you set up the workstation from scratch, it is better to use the USB Wifi dongle compatible with the latest version of Ubuntu. However, if you want to try a faster Wifi dongle, you can try TP-Link Archer T2U Nano.

As of 2022, the Linux kernel version of Ubuntu 20.04 is 5.14, which one can check by

uname -a

The driver of TP-Link Archer T2U Nano is called RTL8812AU. Unfortunately, this driver is only compatibel with Linux kernel version ≤ 5.8. However, the driver RTL8821AU is compatible with later versions of the Linux kernel. You can still install this driver. See AskUbuntu and GitHub repos for the details of installation.

Add language inputs

Go to Setting > Region and Language > Manage Installed Languages > Install language packs (JP, CN)

Here you can logout and logon. Then reopen the same window, Add Input Sources

Note that pure “Japanese” or “Chinese” are just keyboard layouts. They are not useful for typing Japanese or Chinese languages.


Install softwares

General warning

When you install something, please watch the log. Some components may not be installed due to temporary internet connection problems. Always collect the missing files.
Often you need to edit .profile, .bashrc or .bash_profile for setup. An easy way is to open Text Editor, right-click to show hidden files. The hidden files can be shown or hidden also by CTRL+h.

Install pyenv-virtualenv

An easy way is use Homebrew for Linux, rather than the “install pyenv in Ubuntu” procedures, because there are many pitfalls.

sudo apt install git
sudo apt install curl
brew install pyenv
brew install pyenv-virtualenv
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

and logoff and logon again; see also instructions, though virtualenvwrapper is not always necessary.

Once pyenv-virtualenv is installed, follow my webpage to install the right version of python (and pip). For example,

!python3 -m pip install qiskit
!python3 -m pip install qiskit-ignis
!python3 -m pip install qiskit-experiment
!python3 -m pip install matplotlib
!python3 -m pip install pylatexenc

Install Mathematica

We should fill in System Transfer Form from Wolfram’s page. If it is declined, contact Wolfram. Usually Wolfram does not change the number of controlling kernels from 12 to 48, so you always need to warn them explicitly every time.

You go to Wolfram User Portal, download the driver for Linux. You may not be able to download Mathematica and Documentation at the same time. In this case, you should download two files,

Without documentation, it takes a long time to open a help page when the internet connection is slow.

Install LaTeX

Some python program uses LaTeX, which should be installed on the system. If we install TeX Live and Texmaker, we should execute

sudo apt-get install texlive-full
sudo apt-get install -y texmaker

Install SageMath

The Ubuntu package manager (apt or apt-get) gives you only SageMath v9. In order to install SageMath v10, you need to install from the source code or change OS to e.g. ArchLinux.

The source code of the latest version of SageMath is available from GitHub. The instruction to install from source code is available here. The official website recommends that you have to install Fortran compiler, Python, and other related packages. You should also see README in GitHub. Note that the information in this page is not updated. Also, GitHub README is slighly different from Installation Guide in PDF.

After downloading the source code (e.g. sagemath-master-branch), you rename the folder as "sage", and execute make+configure.

cd sage
make configure
./configure

Check the output of the configure, as it will suggest extra packages to be installed; sometimes the compiler does not recognize already-installed packages. After install, try

make reconfigure

Also check the number of CPU's by

nproc

Assuming that you have 96 CPU's, you can execute

MAKE="make -j96" make

It will take a long time (~24h) to build the package from scratch. If the installation process may stop indefinitely; for example, if it fails to download a package several times, then it stops. In that case, you should interrupt the process by Ctrl+C, investigate log, and try repeating the installation step several times.

make clean
make reconfigure
MAKE="make -j96" make

People say that make can resume installation from the interruption point. However, it is also possible that the installation persistently fails due to corrupt packages. One can try another clean install, but some package conflicts may crush the ssytem, and one needs to reinstall OS (x_x).

Convert Markdown to HTML

Open a md file using VS code, right-click the editor, select Markdown PDF Export (html).


created 2022/Jul last updated 2024/Oct