Skip to content

Latest commit

 

History

History
174 lines (117 loc) · 4.89 KB

File metadata and controls

174 lines (117 loc) · 4.89 KB

Linux (or WSL) setup environment for development

This guide is under construction

TODO:

  • Add comments about proxy?

This is how I set up a fresh linux installation to start working in machine learning and programming.

It is also useful for WSL (Windows Subsystem for Linux) and I will add comments for it as well.

I keep this tutorial handy in case I do a clean OS install or if I need to check some of my initial settings.

WSL installation guide

If you're using WSL, first read the guide I wrote for Windows

Remember that to run docker in WSL, it has to be installed in Windows using Docker Desktop.

Terminal

Refer to my section in Suggested Tools and Setup: GNU Terminal for Linux

Basic Settings

References:

Setup root password:

# @ shell(linux)

sudo passwd root
  • Set up the screen lock command so you can do it every time you stand up (Super+L or Ctrl+Alt+L)
  • Set up your WiFi connection.
  • For ease of use, make hidden files and file extensions visible.

Hidden files visibility: I can't work without seeing hidden files, so in Ubuntu we can do CTRL+H and the hidden files will appear.

To set it as the default follow this guide

Install basic build software

In order for most anything else to install properly, we need these first:

# @ shell(debian-based)

sudo apt-get update
sudo apt-get install \
    build-essential \
    curl \
    libbz2-dev \
    libffi-dev \
    liblzma-dev \
    libncursesw5-dev \
    libreadline-dev \
    libsqlite3-dev \
    libssl-dev \
    libxml2-dev \
    libxmlsec1-dev \
    llvm \
    make \
    tk-dev \
    wget \
    xz-utils \
    zlib1g-dev

Now I just started using an Arch-based distro so don't quote me on this but these should be the equivalents:

# shell(arch-based)

sudo pacman -Syy
sudo pacman -S \
    base-devel \
    curl \
    libffi \
    llvm \
    make \
    wget

Without these, there can sometimes be errors. I include this list here because a lot of the time I would install this and forget, and then struggle with errors when starting from a new machine, or a Docker image.

Install Japanese and Chinese keyboards

# fish (arch)
sudo pacman -S \
    fcitx5 \
    fcitx5-qt \
    fcitx5-rime \
    fcitx5-gtk \
    fcitx5-configtool \
    fcitx5-chinese-addons \
    fcitx5-mozc \
    fcitx5-table-other \
    fcitx5-table-extra \
    noto-fonts \
    noto-fonts-extra \
    noto-fonts-cjk \
    asian-fonts
    
set -gx GTK_IM_MODULE fcitx
set -gx QT_IM_MODULE fcitx
set -gx XMODIFIERS @im=fcitx

Then re-login

Add Input methods:

  • Keyboard - English (US) - English (US, intl. AltGr Unicode combining)
  • Mozc
    • This is Japanese input
  • Pinyin
    • This is Chinese input

Setup git

Follow the Git Setup and Customization for more details.

Install Docker Engine for Linux

Docker allows us to run server apps that share an internal environment separate from the OS.

Follow the official guide for docker

For Ubuntu, specifically, there's this guide.

Reboot after installing.

Install Python

Follow my Python setup guide

CUDA and GPU settings

For a linux system to use an nvidia GPU for calculations instead of the CPU, we need to install CUDA, and for neural networks specifically, cuDNN is also needed.

  1. NVIDIA drivers installation guide
  2. CUDA Installation guide
  3. cuDNN installation guide

If you already have nvidia or cuda tools installed and want to upgrade, you can use these commands before installing the new software:

apt remove --purge cuda*
apt remove --purge nvidia*
apt remove --purge libcuda*

Be prepared to run your server in console only mode, since you'll be altering the graphics drivers during this process.

However I personally prefer to use the nvidia/cuda docker images

For specific examples where I used CUDA compatible images, see my CUDA python dockerfiles document


That is all for now. This is my initial setup for the lab environment under a proxy. If I have any projects that need further tinkering, that goes on another repository / tutorial.