A memo that installed Ubuntu 20.4 on HP Z2 Mini G4 and created a deep learning environment with Python Docker

I got the HP Z2 Mini G4, so a memo when I set it up

Machine: HP Z2 Mini G4 Workstation CPU: Intel(R) Xeon(R) E-2224G CPU @ 3.50GHz RAM: 32GB GPU: NVIDIA Quadro P600 GPU: Intel® HD Graphics P630 (with built-in CPU) OS is:

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"

OS installation

After all, I installed the latest version of Ubuntu 20.04.1 LTS. Next, I installed openssh-server and openssh-client. You can't install it unless you upgrade it before this installation, I always think that you have the latest version.

$ sudo apt update
$ sudu apt upgrade -y
$ sudo install openssh-server
$ sudo install openssh-client
$ sudo systemctl enable sshd
$ sudo systemctl start sshd

From here on, work with ssh from your Mac.

NVIDIA Driver install https://github.com/NVIDIA/nvidia-docker

Recommended Driver Confirmation

$ ubuntu-drivers devices
== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd00001CBCsv0000103Csd00008458bc03sc00i00
vendor   : NVIDIA Corporation
model    : GP107GLM [Quadro P600 Mobile]
driver   : nvidia-driver-435 - distro non-free
driver   : nvidia-driver-440 - distro non-free recommended
driver   : nvidia-driver-390 - distro non-free
driver   : nvidia-driver-440-server - distro non-free
driver   : nvidia-driver-418-server - distro non-free
driver   : xserver-xorg-video-nouveau - distro free builtin

Recommended Driver install This will select the CPU built-in orientation

sudo ubuntu-drivers autoinstall

Specified installation sudo apt install driver name

These days it's just a convenient way to install cuda

  1. sudo apt install nvidia-driver-440 installation
  2. nvidia-smi confirmation
  3. sudo reboot reboot
 $ sudo apt install nvidia-driver-440

$ nvidia-smi 
Sat Aug 29 16:47:10 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.100      Driver Version: 440.100      CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Quadro P600         Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   54C    P0    N/A /  N/A |      0MiB /  4032MiB |      2%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

$ sudo reboot

Docker install & nvidia docke install This is something that has become very easy these days. See the https://github.com/NVIDIA/nvidia-docker page. The installation conditions are

The procedure is: Install Docker 19.3, then install nvidia-docker-toolkit

A. Docker installation
  1. Remove docker old version
  2. Install curl
  3. Add repository
  4. Add docker GPG key
  5. docker installation
  6. Install docker-compose
  7. Add execute permission for docker-compose install directory
B. nvidia-container-toolkit installation
  1. Add nvidia docker repository
  2. Installation
docker install official page
# uninstall old version
$  sudo apt-get remove docker docker-engine docker.io containerd runc

# install use repository
$ sudo apt-get update
$ sudo apt install curl

$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common

# Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

# Verify
$ sudo apt-key fingerprint 0EBFCD88

$ sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
$ docker --version
Docker version 19.03.12, build 48a66213fe


# docker Compose install
# Run this command to download the current stable release of Docker Compose:
#Download the current stable release of Docker Compose by running the following command:
$ sudo curl -L "https://github.com/docker/compose/releases/download/1.26.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

#Give execute right
$ sudo chmod +x /usr/local/bin/docker-compose
$ docker-compose --version
docker-compose version 1.26.2, build eefe0d31

nvidia-docker installation

# Add the package repositories
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list

sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
sudo systemctl restart docker

# test
$ sudo docker run --gpus all nvidia/cuda:10.0-base nvidia-smi

# docker run --gpus all -it --rm -v local_dir:container_dir nvcr.io/nvidia/pytorch:xx.xx-py3
$  docker run --gpus all -it --rm -v local_dir:container_dir nvcr.io/nvidia/pytorch:20.08-py3

nvidia-docker confirmation

$ nvidia-container-cli info
NVRM version:   440.100
CUDA version:   10.2

Device Index:   0
Device Minor:   0
Model:          Quadro P600
Brand:          Quadro
GPU UUID:       GPU-55463dd1-1880-c457-390a-29cd30b1fc80
Bus Location:   00000000:01:00.0
Architecture:   6.1

Install Python & jupyter

For Python, 3.8.3 was included, but pip was not included, so install pip3. I tried to put jupyter with pip, but it is useless, so install it with apt

$ python3 --version
Python 3.8.2

$ sudo apt install python3-pip

$ pip3 --version
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

$ pip3 list
Package                 Version
apturl                  0.5.2
bcrypt                  3.1.7
blinker                 1.4
...
wheel                   0.34.2
xkit                    0.0.0

# jupyter install

$ sudo apt  install jupyter-core
$ sudo apt install jupyter-notebook
$ sudo apt install ipython3

jupyter remote publishing settings

Get password hash value
~$ ipython3 
Python 3.8.2 (default, Jul 16 2020, 14:00:26) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.13.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from notebook.auth import passwd                                        

In [2]: passwd()                                                                
Enter password: 
Verify password: 
Out[2]: 'sha1:<Hash value>'

In [3]: exit                                              

I haven't tried it, but I always did it after installing ipython, but it seems that jupyter can also do it. According to the manual, https://jupyter-notebook.readthedocs.io/en/stable/public_server.html Read Running a notebook server

Create configuration file
$ mkdir ~/.jupyter
$ vi ~/.jupyter/jupyter_notebook_config.py

c = get_config()
c.IPKernelApp.pylab = 'inline'
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 9999 
c.NotebookApp.password = u'sha1:<Hash value>'

c.NotebookApp.ip = is a subnet mask specification c.NotebookApp.port = Access port c.NotebookApp.password = Please enter the issued password hash

You can now access it from your browser with Server_address: 9999


Note: sudo apt-get purge nvidia- *

Recommended Posts

A memo that installed Ubuntu 20.4 on HP Z2 Mini G4 and created a deep learning environment with Python Docker
Building a Deep Learning environment (Ubuntu 20.04 LTS)
[Memo] Create a CentOS 8 environment easily with Docker
Environment construction command memo with Docker on AWS
Prepare a scraping environment with Docker and Java
Install Ubuntu 20.04 in virtual box on windows10 and build a development environment using docker
How to quit Docker for Mac and build a Docker development environment with Ubuntu + Vagrant
Compiled kotlin with cli with docker and created an environment that can be executed with java
[Note] Build a Python3 environment with Docker in EC2
Comfortable Docker environment created with WSL2 CentOS7 and Docker Desktop
A memo that handles a class created independently with ArrayList
Creating a lightweight Java environment that runs on Docker
Build a Node-RED environment with Docker to move and understand
Prepare a transcendentally simple PHP & Apache environment on Mac with Docker
Building a haskell environment with Docker + VS Code on Windows 10 Home
[Rails] A memo that created an advanced search form with ransack
Create a development environment for Ruby 3.0.0 and Rails 6.1.0 on Ubuntu 20.04.1 LTS
I tried to make a machine learning application with Dash (+ Docker) part1 ~ Environment construction and operation check ~
Build a web application development environment that uses Java, MySQL, and Redis with Docker CE for Windows