$$ \def\E{\mathbb{E}} %expectation \def\P{\mathbb{P}} %prob \def\var{\mathbb{V}} %var \def\T{\mathrm{\scriptscriptstyle T}} %transpose \def\ind{\mathbbm{1}} %indicator \newcommand{\gw}[1]{\color{red}{(#1)}} \newcommand{\norm}[1]{\lVert#1\rVert} \newcommand{\abs}[1]{\lvert#1\rvert} $$

This blog records how I install and configure my Ubuntu 20.04 . All the codes should be run in a terminal.

Contents

Hardware

  • Model: AlienWare R11
  • CPU: Intel Core i7 10700kF
  • GPU: NVIDIA 3060Ti
  • Pre-installed system: Windows 10

Dual boot

There are already lots of blogs on how to install Ubuntu and dual boot with Windows 10. For example,

https://www.linuxtechi.com/dual-boot-ubuntu-20-04-lts-along-with-windows-10/

One more thing on AlienWare, we have to change the SATA operation from RAID to AHCI. Then reboot the Windows with safe mode. The steps are

  1. Run cmd as administrator (not PowerShell, you would have to escape {...})

  2. Copy-paste this command, which will start Windows in Safe Mode the next time you reboot:

    bcdedit /set {current} safeboot minimal
    
  3. Restart the computer and enter UEFI/BIOS setup.

  4. Change the SATA operation mode from RAID to AHCI.

  5. Save changes and exit Setup and Windows will automatically boot to Safe Mode.

  6. Launch cmd again, as in step #1.

  7. Copy-paste this command, which will start Windows in Normal Mode the next time you reboot:

    bcdedit /deletevalue {current} safeboot
    
  8. Reboot and Windows will automatically start with AHCI drivers enabled.

Softwares/packages

Use the following command if installation failed due to dependencies are not installed.

sudo apt -f install
  • git Git: a tool for version control.

    sudo apt install git-all
    
  • Curl: a tool to download or transfer files/data from or to a server using FTP, HTTP, HTTPS, SCP, SFTP, SMB and other supported protocols on Linux or Unix-like system.

    sudo apt install curl
    
  • Terminal multiplexer: byobu

    sudo apt-get install byobu
    
  • bash: zsh and oh-my-zsh for plugins/personalization. Powerful yet elegant.

     sudo apt install zsh
     sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
    

    A lot of articles/configurations available online, e.g. Github.

    My terminal appearance:

    image-20210318185826012

  • Web browser: Chrome. I’d suggest Chrome though Firefox is default in Ubuntu. The reason is that Chrome is supported by Google and has a larger community and tools, such as gmail, google drive.

    1. Integral with Google Drive on Ubuntu 20.04
      • Add online account to GNOME in the setting, but this way doesn’t work well if we have to interact frequently, like read and write file.
      • As an alternative, try google-drive-ocamlfuse. Installation and usage on the homepage are easy to follow.
    2. Chrome plugins
      • Ad block, etc.
      • OneTab for tab management
      • Momentum for customized new tab
      • Tampermonkey for user script
  • Markdown: Typora. Best markdown editor I’ve experienced. Support $\LaTeX$ and exporting to PDF, html, tex, rST, word, etc.

    # or run:
    # sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA300B7755AFCFAE
    wget -qO - https://typora.io/linux/public-key.asc | sudo apt-key add -
    # add Typora's repository
    sudo add-apt-repository 'deb https://typora.io/linux ./'
    sudo apt-get update
    # install typora
    sudo apt-get install typora
    

    If failed due to gpg: invalid key, remove the file in the “/etc/apt/trusted.gpg.d/home:manuelschneid3r.gpg”.

  • Text editor for general use: Sublime text 3.

    wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
    sudo apt-get install apt-transport-https
    sudo add-apt-repository "deb https://download.sublimetext.com/ apt/stable/"
    sudo apt-get update
    sudo apt install sublime-text
    
  • IDE: Jetbrain toolbox and PyCharm. Best for Python and Java.

  • Desktop automation utility: AutoKey.

    Install by package manager or pip.

  • Dictionary: GoldenDict. Support select words from screen. Support search from online source like WiKi and Google.

    sudo apt-get install goldendict
    

    Off-line dictionaries: StarDict

  • PDF reader: Okular. Support annotations like text, highlighter, hand-draw. Support multiple tabs. Support index and search.

    Warning: Try to install from Ubuntu software store, current stable release(20.12.3) on kde channel has some bug.

  • Zoom

    Problem: When use a high solution monitor, need to change the configuration file to match the font size. See here.

Configure GNOME

This somehow quite personal. Anyhow if you want to do so, Tweak is the starting point, and Chrome-gnome plugin helps you manage the extensions.

sudo apt install gnome-tweak-tool
sudo apt install chrome-gnome-shell

Some popular extensions

Also, find themes here.

Configure my Python environment

Intro

I decide not to use Anaconda in this computer, since currently I use Python for research purpose and stick on a fairly stable version, say 3.8 or 3.9. I don’t need many different virtue environments and different versions of packages. Otherwise, it would be a good choice to manage the environments for beginners.

Install Python

sudo apt install python3.8

Packages

Note that pip is not installed by default. So we have to install pip first.

sudo apt install python3-pip

The binary file for pip is pip3, we can set an alias if we will not use Python 2.

alias pip=pip3

The following list is from most frequent/important for me to less frequent. Most of them can be installed by

pip install package_name
  • jupyter Favorite tool for developing. A true notebook.

    1. Installation (for notebook only)

      pip install notebook
      
    2. Extensions, almost necessary for me to use jupyter note book. Provide functions like notifying idle, highlighting, moving chunks, etc.

      pip install jupyter-contrib-nbextensions
      
  • Numpy, fundamental package for scientific computing.

  • Scipy, fundamental package for scientific computing.

  • pandas, data frame manipulation.

  • scikit-learn, machine learning algorithms.

  • pytorch, deep learning package developed by Facebook.

    I installed the GPU version. For your CUDA and CUDNN version, try

    nvidia-smi
    

    Some how nvcc is not installed but nvidia driver and CUDA are already installed in my computer, so I didn’t bother install them this time.

    For pytoch, please refer to its homepage.

  • matplotlib, visualization.

  • seaborn, for better visualization

  • Sphinx, for writing documentations. For usage see my another post here.

  • statsmodels, for statistical analysis.

  • thefuck, a command line tool.

Others

  1. Font

    • Install Font manager

      sudo apt install font-manager
      
    • My favorite font: Monaco. Used for Overleaf as well. Download the font by:

      wget http://www.gringod.com/wp-upload/software/Fonts/Monaco_Linux.ttf
      
  2. Wallpaper

    Unfortunately, haven’t find a good solution for multiple monitors.

  3. Albert

    Doesn’t work very well with Google drive.