The Configuration Process for a New Ubuntu Machine

January 6, 2019 - 5 minute read - Category: Tech

Some Chinese Specific Configurations

  1. Setup some VPN software

  2. Change the apt-get source to Ali source (阿里源): Ref.

  3. Change the pip and conda source to Tsinghua source (清华源): Ref.

     conda config --add channels
     conda config --add channels
     conda config --set show_channel_urls yes
     conda config --add channels
     # msys2
     conda config --add channels
     # bioconda
     conda config --add channels
     # menpo
     conda config --add channels
     # pytorch
     conda config --add channels
  4. Configure git download via VPN

I. Hardware Configurations

  1. Configure the wifi adapter:
    • If you want to use PCIe or USB wifi adapter, please check whether they have drivers in the linux system. I am using TP-Link AC1300 PCIe Wireless Wifi PCIe Card.
    • You can refer to this page, which provides an excellent introduction to how to configure adapter drivers. The PCIe card mentioned above is correspond to 14e4:4360 type in the post, where you can use sudo apt install bcmwl-kernel-source to install the driver.
    • You can connect your phone to the computer using a USB caple and enable its hotspot functionality. Then your computer can connect to the network via your phont’s hotspot.
  2. Configure Nvidia Driver
    • **The video cable must be plugged into the slots on video cards rather than those on motherboards. **
    • Install the CUDA Toolkit according to this page (Remember to check cuda version on the tutorial page):
      • You should choose the appropriate CUDA version according to your demand. (For example, till now (Jan 2019), most TensorFlow versions only support CUDA 9.0 but not 10.0.)
      • You can choose to install the required Nvidia driver during this process.
      • There maybe some problems herein. I find the following two links very useful to solve the problems.
      • Don’t forget the change add the cuda path to the PATH variable.

      • If you encounter the purple-screen problem:
        • Firstly Check the video cable slots problem indicated above.
        • Next, you can check the BIOS settings. Disable the ` UEFI Secure Boot`.
        • There are other possible causes and solutions. Please try to google Ubuntu purple screen Nvidia and find different approaches. This is the hardest part, and it usually takes tons of time to debug. Don’t frustrate and cheer up!
    • Download cuDNN Runtime Library for your OS on this page and check the corresponding tutorial. (You may set up a new account to download it. )
      • Run sudo dpkg -i /path/to/deb/file and sudo apt-get install -f to install the deb file.
      • Why running the sudo apt-get install -f command? Ref
  3. Setup SSH
    1. Install OpenSSH Service

       sudo apt-get install openssh-server
       sudo service ssh status


    2. Copy the ssh key to the server

       cat ~/.ssh/ | ssh [email protected]_host "mkdir -p ~/.ssh && touch ~/.ssh/authorized_keys && chmod -R go= ~/.ssh && cat >> ~/.ssh/authorized_keys"


    3. Change the SSH connection to only allow ssh-keys

      • You need to explicitly set PasswordAuthentication no in /etc/ssh/sshd_config to allow only Public Key Authentication.
      • And restart the sshd service using service ssh restart (pre systemd migration) or systemctl restart sshd.service.
      • Ref
    4. *Resolving the EDAS problems:

      When encounter the EDAS problems like: ECDSA host key for has changed and you have requested strict checking. You can Remove the cached key for on the local machine:

       ssh-keygen -R


  4. Setup zsh and plugins (include install git)

    • Refer to this page for the installation process:
      apt-get install zsh
      apt-get install git-core
      wget -O - | zsh
      chsh -s `which zsh`
      sudo shutdown -r 0
    • Use echo $0 to check if zsh installation is successful. Ref

    • Install zsh plug-ins and change zsh themes. Ref. Use nano ~/.zshrc to edit the zsh configuration file. Change the property of ZSH_THEME and plugins:

    • *Change the iterm2 color schema according to this page.
  5. For Windows and Ubuntu dual boot machines, if you cannot boot Ubuntu,
    • Check your BIOS configuration and disable secure boot.
    • If secure boot is disabled and you still cannot boot the system, it is possibly due to something wrong with the GRUB.
    • You can use a ubuntu installation disk with boot-repair to resolve the issue, ref to and .

II. Python Environment Configurations

  1. Install Anaconda:
    • For Chinese users, they can download Anaconda via Tsinghua source with higher speed.
    • sudo bash ./
    • Remember to allow anaconda to initialize the .bashrc file and copy the settings to .zshrc file.
  2. Some tricky issues about Anaconda:
    • The last version of Anaconda with python 3.6 is 5.2.0, which you can find from here. Newer versions of anaconda are using Python 3.7 by default.
    • And if you want to avoid automatically upgrade the conda version, you can turn to this page. The so-called conda pin operation is useful.
  3. Install the TensorFlow or PyTorch GPU version based on the instructions on their websites.
    • conda install pytorch torchvision cuda100 -c pytorch
    • Tensorflow Installation. Generally use pip instal tensorflow-gpu
    • Verify the tensorflow installation:
       import tensorflow as tf
       hello = tf.constant("hello TensorFlow!")


III. Useful Ubuntu Softwares

  1. htop: An enhanced processor monitor
  2. screen: As described here, screen is a terminal multiplexer, which allows a user to access multiple separate terminal sessions inside a single terminal window or remote terminal session.
  3. An interesting bash-based weather forcast app by igor_chubin. You can use it via curl<cityname>.