[PYTHON] Prepare an Ubuntu 20.04 system

I have been using Ubuntu (18.04) as my main PC since 2018. Since the new LTS 20.04 was released this year, I'm waiting for the initial bug fix and installing 20.04.1 from scratch () and using it. This is the initial setting and installation procedure for your PC. For your information

Note: Touchpad and TrackPoint no longer work on linux kernel, "uname = Linux 5.4.0-47-generic x86_64", so currently use "uname = Linux 5.4.0-42-generic x86_64" ing.

Installed PC information:

Item Value
dmi.bios.date 07/08/2020
dmi.bios.version N2EET49W (1.31 )
dmi.board.vendor LENOVO
dmi.product.family ThinkPad X1 Extreme
dmi.product.name 20MFCTO1WW

Prepare USB

https://ubuntu.com/tutorials/create-a-usb-stick-on-ubuntu#1-overview

You can create a bootable USB by inserting a USB drive on Ubuntu (18.04 or 20.04) with the disk app and restoring the downloaded image.

OS installation wizard procedure

--Select Japanese --Select the minimum installation

I tried it once without selecting the minimum installation, but I got a message that Japanese input support was incomplete at startup. It doesn't seem to be the case for a minimal installation.

--Select to use the required driver / external driver --Select the partition to install and select Delete / Install All

Prepare a development environment

Install the snap (Ubuntu Software) app

Prepare a public key and register with GITHUB

https://docs.github.com/ja/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

Install library

Make it possible to build for development (including being able to build python).

sudo apt update
sudo apt install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl git

Install terminal tools

htop/tmux

sudo apt install htop tmux

awscli v2

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

Install python (pyenv)

pyenv is a tool that provides an environment where you can switch between Python versions using multiple versions of Python.

  1. pyenv installation:

    curl https://pyenv.run | bash
    

After installation, add the displayed text to ~ / .bashrc

```
export PATH="/home/shane/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
```

Reflect in open terminals:     source ~/.bashrc

  1. Install each version of python with pyenv

    # list available versions with command:
    # pyenv install --list
    # (2020-9-8 now)
    pyenv install 3.7.9
    # upgrade pip/install pipenv
    pyenv global 3.7.9
    python -m pip install pip -U
    python -m pip install pipenv
    
    pyenv install 3.8.5
    pyenv global 3.8.5
    python -m pip install pip -U
    python -m pip install pipenv    
    
  2. Set up global python:

    pyenv global 3.8.5
    

Other python tools

Include commonly used tools in global python (jupyterlab, pre-commit)

python -m pip install jupyterlab

#I'm wondering if it's needed here, but it's working

--Code check tool before GIT commit at development Set script to execute

python -m pip install pre-commit

Note: If you use pre-commit, run pre-commit install from within pipenv / virtualenv

Install the app

Docker

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04

install docker

sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common

Added GPG key for Docker repository (returns ʻOK`):

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Add Docker repository

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"

Install Docker:

sudo apt update
sudo apt install docker-ce

Make sure Docker is installed and running:

# docker.service is"active (running)"Should be
sudo systemctl status docker
Allow sudo to run as if it weren't needed

Add your user to the docker user group so you don't have to type sudo when using the docker command

sudo usermod -aG docker ${USER}

After adding, please restart your PC.

There is a method without rebooting, but sometimes it doesn't work

After rebooting, you can check if the user is joining docker with the following command:

id -nG

Check if docker is working properly with the following command:

docker run hello-world

Install docker-compose

When this command is executed, it will be placed under / usr / local / bin.

sudo curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Add execute permission

sudo chmod +x /usr/local/bin/docker-compose

Verification:

docker-compose --version

Slack

As of August 2020, the SLACK app (snap) in the ubuntu repository doesn't seem to be able to type Japanese, so download and install .deb from the SLACK site.

  1. Download from SLACK

  2. Install slack-desktop-*. Deb

    sudo dpkg -i ~/download/slack-desktop-*.deb
    

System setting

Shortcut key setting to open ubuntu file tool with "WIN-E"

VPN settings

...TBC

Recommended Posts

Prepare an Ubuntu 20.04 system
Prepare Python development environment on Ubuntu
Creating an Ubuntu 18.04 + MAAS2.4 environment starting from 0