<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Batkhuu</title>
    <description>The latest articles on DEV Community by Batkhuu (@bybatkhuu).</description>
    <link>https://dev.to/bybatkhuu</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F418548%2F83f2834c-d833-45f1-a2e6-9640338d451b.jpeg</url>
      <title>DEV Community: Batkhuu</title>
      <link>https://dev.to/bybatkhuu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bybatkhuu"/>
    <language>en</language>
    <item>
      <title>Install Docker and Docker Compose on Linux</title>
      <dc:creator>Batkhuu</dc:creator>
      <pubDate>Thu, 07 Apr 2022 08:38:05 +0000</pubDate>
      <link>https://dev.to/bybatkhuu/install-docker-and-docker-compose-on-linux-27m7</link>
      <guid>https://dev.to/bybatkhuu/install-docker-and-docker-compose-on-linux-27m7</guid>
      <description>&lt;h2&gt;
  
  
  Official pages
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Install Docker Engine on Ubuntu: &lt;a href="https://docs.docker.com/engine/install/ubuntu/#installation-methods"&gt;https://docs.docker.com/engine/install/ubuntu/#installation-methods&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Docker install script for most Linux distros: &lt;a href="https://github.com/docker/docker-install"&gt;https://github.com/docker/docker-install&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;NVIDIA Docker installation guide for most Linux distros: &lt;a href="https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#setting-up-nvidia-container-toolkit"&gt;https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#setting-up-nvidia-container-toolkit&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Post-installation steps for Linux: &lt;a href="https://docs.docker.com/engine/install/linux-postinstall"&gt;https://docs.docker.com/engine/install/linux-postinstall&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Install Docker Compose: &lt;a href="https://docs.docker.com/compose/install/#install-compose"&gt;https://docs.docker.com/compose/install/#install-compose&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Docker Compose github releases: &lt;a href="https://github.com/docker/compose/releases"&gt;https://github.com/docker/compose/releases&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Compose V2: &lt;a href="https://docs.docker.com/compose/cli-command/#install-on-linux"&gt;https://docs.docker.com/compose/cli-command/#install-on-linux&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  1. Install Docker
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1.1. Install Docker with the script
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Download docker installer script:&lt;/span&gt;
curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://get.docker.com &lt;span class="nt"&gt;-o&lt;/span&gt; get-docker.sh
&lt;span class="c"&gt;# Install docker by 'get-docker.sh' script:&lt;/span&gt;
&lt;span class="nv"&gt;DRY_RUN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 &lt;span class="nb"&gt;sudo &lt;/span&gt;sh get-docker.sh

&lt;span class="c"&gt;# Remove downloaded script:&lt;/span&gt;
&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-vrf&lt;/span&gt; get-docker.sh

&lt;span class="c"&gt;# To avoid using 'sudo' for docker commands:&lt;/span&gt;
&lt;span class="c"&gt;# Create a new 'docker' group:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;groupadd docker
&lt;span class="c"&gt;# Add current user to the 'docker' group:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;usermod &lt;span class="nt"&gt;-aG&lt;/span&gt; docker &lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;whoami&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;# Apply new group changes to the new shell session:&lt;/span&gt;
newgrp docker
&lt;span class="c"&gt;# Or reboot the system to apply docker group changes:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;shutdown &lt;span class="nt"&gt;-r&lt;/span&gt; now

&lt;span class="c"&gt;# Configure docker to start on reboot:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl &lt;span class="nb"&gt;enable &lt;/span&gt;docker.service
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl &lt;span class="nb"&gt;enable &lt;/span&gt;containerd.service

&lt;span class="c"&gt;# Check docker is installed and running:&lt;/span&gt;
docker &lt;span class="nt"&gt;-v&lt;/span&gt;
docker info
docker images
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  1.2. [Only for GPU] Install NVIDIA Docker
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Skip this step, if you don't have NVIDIA GPU!&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;[REQUIRED]&lt;/strong&gt; Install NVIDIA GPU driver: &lt;a href="https://github.com/bybatkhuu/wiki/blob/main/posts/manuals/installs/nvidia-driver-linux.md"&gt;https://github.com/bybatkhuu/wiki/blob/main/posts/manuals/installs/nvidia-driver-linux.md&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;For Ubuntu/Debian-based Linux distros:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;## [IMPORTANT] Only for Ubuntu/Debian-based linux&lt;/span&gt;
&lt;span class="c"&gt;# Download the nvidia-docker GPG key and setup the stable repository:&lt;/span&gt;
&lt;span class="nv"&gt;distribution&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt; /etc/os-release&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$ID$VERSION_ID&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
   &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; curl &lt;span class="nt"&gt;-s&lt;/span&gt; &lt;span class="nt"&gt;-L&lt;/span&gt; https://nvidia.github.io/nvidia-docker/gpgkey | &lt;span class="nb"&gt;sudo &lt;/span&gt;apt-key add - &lt;span class="se"&gt;\&lt;/span&gt;
   &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; curl &lt;span class="nt"&gt;-s&lt;/span&gt; &lt;span class="nt"&gt;-L&lt;/span&gt; https://nvidia.github.io/nvidia-docker/&lt;span class="nv"&gt;$distribution&lt;/span&gt;/nvidia-docker.list | &lt;span class="nb"&gt;sudo tee&lt;/span&gt; /etc/apt/sources.list.d/nvidia-docker.list

&lt;span class="c"&gt;# Update repository list:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get update
&lt;span class="c"&gt;# Install nvidia-docker2:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; nvidia-docker2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Edit the &lt;code&gt;/etc/docker/daemon.json&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;nano /etc/docker/daemon.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and add the following &lt;code&gt;default-runtime&lt;/code&gt; into the &lt;code&gt;/etc/docker/daemon.json&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"default-runtime"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"nvidia"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"default-runtime"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"nvidia"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"runtimes"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"nvidia"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"path"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"nvidia-container-runtime"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"runtimeArgs"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;save changes and exit from the file editor.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Restart docker service:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl daemon-reload
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl restart docker.service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. [RECOMMENDED] Limit docker log file max size and max rotation
&lt;/h3&gt;

&lt;p&gt;Edit the &lt;code&gt;/etc/docker/daemon.json&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;nano /etc/docker/daemon.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and add the following &lt;code&gt;log-opts&lt;/code&gt; into the &lt;code&gt;/etc/docker/daemon.json&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"log-opts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"max-size"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"10m"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"max-file"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"10"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;save changes and exit from the file editor.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Restart docker service:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl restart docker.service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Install Docker Compose V2
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;## Download docker-compose binary release:&lt;/span&gt;
&lt;span class="c"&gt;# [RECOMMENDED] Compose v2.2.3 (Linux) release:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;curl &lt;span class="nt"&gt;-L&lt;/span&gt; &lt;span class="s2"&gt;"https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;uname&lt;/span&gt; &lt;span class="nt"&gt;-m&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; /usr/local/bin/docker-compose
&lt;span class="c"&gt;# [For old version] Compose v1.29.2 (Linux) release:&lt;/span&gt;
&lt;span class="c"&gt;# sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose&lt;/span&gt;
&lt;span class="c"&gt;# [Only for experimental] Latest version release:&lt;/span&gt;
&lt;span class="c"&gt;# sudo curl -L $(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep browser_download_url | grep linux-$(uname -m)\" | cut -d '"' -f 4) -o /usr/local/bin/docker-compose&lt;/span&gt;

&lt;span class="c"&gt;# Apply executable permission to the docker-compose binary:&lt;/span&gt;
&lt;span class="nb"&gt;sudo chmod&lt;/span&gt; +x /usr/local/bin/docker-compose

&lt;span class="c"&gt;# Create a symbolic link to '/usr/bin':&lt;/span&gt;
&lt;span class="nb"&gt;sudo ln&lt;/span&gt; &lt;span class="nt"&gt;-s&lt;/span&gt; /usr/local/bin/docker-compose /usr/bin/docker-compose

&lt;span class="c"&gt;# Check docker-compose version:&lt;/span&gt;
docker-compose &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;👍 ✨&lt;/p&gt;

&lt;h2&gt;
  
  
  INSTALLATION COMPLETE
&lt;/h2&gt;




&lt;h2&gt;
  
  
  [OPTIONAL] Change the docker data directory to the external storage
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Stop the docker service:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl stop docker.service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Edit the &lt;code&gt;/etc/docker/daemon.json&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;nano /etc/docker/daemon.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and add the following &lt;code&gt;data-root&lt;/code&gt; into the &lt;code&gt;/etc/docker/daemon.json&lt;/code&gt; file (don't forget to change &lt;strong&gt;[NEW_STORAGE_PATH]&lt;/strong&gt; to your new directory):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"data-root"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"[NEW_STORAGE_PATH]/docker/data-root"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"data-root"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/mnt/ssd/1/docker/data-root"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;save changes and exit from the file editor.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Copy the current docker data directory to the new directory:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;rsync &lt;span class="nt"&gt;-a&lt;/span&gt; /var/lib/docker/ &lt;span class="o"&gt;[&lt;/span&gt;NEW_STORAGE_PATH]/docker/data-root
&lt;span class="c"&gt;# For example:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;rsync &lt;span class="nt"&gt;-a&lt;/span&gt; /var/lib/docker/ /mnt/ssd/1/docker/data-root

&lt;span class="c"&gt;# Rename the old docker data directory as a backup:&lt;/span&gt;
&lt;span class="nb"&gt;sudo mv&lt;/span&gt; /var/lib/docker /var/lib/docker.old

&lt;span class="c"&gt;# Start docker service:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl start docker.service

&lt;span class="c"&gt;# Test docker is working properly:&lt;/span&gt;
docker &lt;span class="nt"&gt;-v&lt;/span&gt;
docker info
docker images
docker ps &lt;span class="nt"&gt;-a&lt;/span&gt;

&lt;span class="c"&gt;# Remove the old backup docker data directory:&lt;/span&gt;
&lt;span class="nb"&gt;sudo rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; /var/lib/docker.old
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  [OPTIONAL] Install command auto-completion for docker-compose
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Download docker-compose auto-completion script into '/etc/bash_completion.d/':&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;curl &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-L&lt;/span&gt; https://raw.githubusercontent.com/docker/compose/1.29.2/contrib/completion/bash/docker-compose &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-o&lt;/span&gt; /etc/bash_completion.d/docker-compose

&lt;span class="c"&gt;# Reload current bash shell session:&lt;/span&gt;
&lt;span class="nb"&gt;source&lt;/span&gt; ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Docker supported platforms (OS): &lt;a href="https://docs.docker.com/engine/install"&gt;https://docs.docker.com/engine/install&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Install NVIDIA GPU driver: &lt;a href="https://github.com/bybatkhuu/wiki/blob/main/posts/manuals/installs/nvidia-driver-linux.md"&gt;https://github.com/bybatkhuu/wiki/blob/main/posts/manuals/installs/nvidia-driver-linux.md&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Change docker data root directory: &lt;a href="https://tienbm90.medium.com/how-to-change-docker-root-data-directory-89a39be1a70b"&gt;https://tienbm90.medium.com/how-to-change-docker-root-data-directory-89a39be1a70b&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>docker</category>
      <category>compose</category>
      <category>nvidiadocker</category>
      <category>linux</category>
    </item>
    <item>
      <title>Install PM2 (Process Manager 2)</title>
      <dc:creator>Batkhuu</dc:creator>
      <pubDate>Thu, 07 Apr 2022 08:29:16 +0000</pubDate>
      <link>https://dev.to/bybatkhuu/install-pm2-process-manager-2-4pdn</link>
      <guid>https://dev.to/bybatkhuu/install-pm2-process-manager-2-4pdn</guid>
      <description>&lt;h2&gt;
  
  
  PM2 (Process Manager 2)
&lt;/h2&gt;

&lt;p&gt;Process manager tool based on Node.js.&lt;br&gt;
It's a tool that allows you to manage your applications (Node.js/python/binary/shell script/etc...).&lt;/p&gt;

&lt;h3&gt;
  
  
  Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Start/stop/restart applications on demand&lt;/li&gt;
&lt;li&gt;Easy to manage multiple processes&lt;/li&gt;
&lt;li&gt;Run applications in the background&lt;/li&gt;
&lt;li&gt;Monitor logs and resources usage&lt;/li&gt;
&lt;li&gt;Restart applications on source code changes or failure&lt;/li&gt;
&lt;li&gt;Startup on system reboot (service)&lt;/li&gt;
&lt;li&gt;Environment based configuration&lt;/li&gt;
&lt;li&gt;PM2 Plus - Advanced features (Web interface, cluster mode, etc...)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Official pages
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;PM2: &lt;a href="https://pm2.keymetrics.io"&gt;https://pm2.keymetrics.io&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Quick start guide: &lt;a href="https://pm2.keymetrics.io/docs/usage/quick-start"&gt;https://pm2.keymetrics.io/docs/usage/quick-start&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Single page guide: &lt;a href="https://pm2.keymetrics.io/docs/usage/pm2-doc-single-page"&gt;https://pm2.keymetrics.io/docs/usage/pm2-doc-single-page&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;PM2 npm: &lt;a href="https://www.npmjs.com/package/pm2"&gt;https://www.npmjs.com/package/pm2&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;PM2 logrotate: &lt;a href="https://www.npmjs.com/package/pm2-logrotate"&gt;https://www.npmjs.com/package/pm2-logrotate&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Node.js&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;[RECOMMENDED] NVM&lt;/strong&gt;: &lt;a href="https://github.com/bybatkhuu/wiki/blob/main/posts/manuals/installs/nvm.md"&gt;https://github.com/bybatkhuu/wiki/blob/main/posts/manuals/installs/nvm.md&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install PM2 through NPM:&lt;/span&gt;
npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; pm2

&lt;span class="c"&gt;# Install pm2-logrotate to rotate logs for PM2:&lt;/span&gt;
pm2 &lt;span class="nb"&gt;install &lt;/span&gt;pm2-logrotate

&lt;span class="c"&gt;# Check PM2 is running and check the version:&lt;/span&gt;
pm2 ping
pm2 &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;👍 ✨&lt;/p&gt;

&lt;h2&gt;
  
  
  INSTALLATION COMPLETE
&lt;/h2&gt;




&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;### Run application:&lt;/span&gt;

&lt;span class="c"&gt;## Start node.js application in the background:&lt;/span&gt;
pm2 start app.js

&lt;span class="c"&gt;## Start shell script app with naming "script-app":&lt;/span&gt;
pm2 start script.sh &lt;span class="nt"&gt;-n&lt;/span&gt; script-app

&lt;span class="c"&gt;## Start the python application and watch for changes:&lt;/span&gt;
pm2 start python-app.py &lt;span class="nt"&gt;--watch&lt;/span&gt;

&lt;span class="c"&gt;## Start binary file with arguments (--port 8080):&lt;/span&gt;
pm2 start binary-file &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="nt"&gt;--port&lt;/span&gt; 8080

&lt;span class="c"&gt;## Use ecosystem configuration file:&lt;/span&gt;
&lt;span class="c"&gt;# Generate a simple ecosystem.config.js file:&lt;/span&gt;
pm2 init simple
&lt;span class="c"&gt;# Update the ecosystem.config.js file according to your needs:&lt;/span&gt;
vi ecosystem.config.js
&lt;span class="c"&gt;# Start ecosystem.config.js:&lt;/span&gt;
pm2 start ecosystem.config.js

&lt;span class="c"&gt;## Or use JSON file and start in the foreground:&lt;/span&gt;
pm2 start pm2-process.json &lt;span class="nt"&gt;--no-daemon&lt;/span&gt;

&lt;span class="c"&gt;## Or use YAML file and specify log file path:&lt;/span&gt;
pm2 start pm2-process.yml &lt;span class="nt"&gt;--log&lt;/span&gt; /path/to/logs


&lt;span class="c"&gt;### Check logs:&lt;/span&gt;
pm2 logs app-name &lt;span class="nt"&gt;--lines&lt;/span&gt; 50


&lt;span class="c"&gt;### Restart application:&lt;/span&gt;
pm2 restart app-name


&lt;span class="c"&gt;### Shows a list of applications registered into PM2:&lt;/span&gt;
pm2 list


&lt;span class="c"&gt;### Monitor applications:&lt;/span&gt;
pm2 monit


&lt;span class="c"&gt;### Stop and delete the application:&lt;/span&gt;
pm2 stop app-name
pm2 del app-name


&lt;span class="c"&gt;### Generate ecosystem.config.js file:&lt;/span&gt;
pm2 ecosystem


&lt;span class="c"&gt;## Startup application on system reboot:&lt;/span&gt;
pm2 startup
&lt;span class="c"&gt;#--------------------------------------------------------------------------------&lt;/span&gt;
&lt;span class="c"&gt;## Run according to shown command!&lt;/span&gt;
&lt;span class="c"&gt;# For example:&lt;/span&gt;
&lt;span class="c"&gt;# [PM2] You have to run this command as root. Execute the following command:&lt;/span&gt;
&lt;span class="c"&gt;#      $ sudo su -c "env PATH=$PATH:/home/user/.nvm/versions/node/v12.20.1/bin pm2 startup &amp;lt;distribution&amp;gt; -u &amp;lt;user&amp;gt; --hp &amp;lt;home-path&amp;gt;"&lt;/span&gt;
&lt;span class="c"&gt;#--------------------------------------------------------------------------------&lt;/span&gt;
pm2 save


&lt;span class="c"&gt;### Help:&lt;/span&gt;
pm2 &lt;span class="nt"&gt;--help&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  PM2 plus
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;PM2 plus overview: &lt;a href="https://pm2.io/docs/plus/overview"&gt;https://pm2.io/docs/plus/overview&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Ecosystem file: &lt;a href="https://pm2.keymetrics.io/docs/usage/application-declaration"&gt;https://pm2.keymetrics.io/docs/usage/application-declaration&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Startup script: &lt;a href="https://pm2.keymetrics.io/docs/usage/startup"&gt;https://pm2.keymetrics.io/docs/usage/startup&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Logs: &lt;a href="https://pm2.keymetrics.io/docs/usage/log-management"&gt;https://pm2.keymetrics.io/docs/usage/log-management&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Monitoring: &lt;a href="https://pm2.keymetrics.io/docs/usage/monitoring"&gt;https://pm2.keymetrics.io/docs/usage/monitoring&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Custom metrics: &lt;a href="https://pm2.keymetrics.io/docs/usage/process-metrics"&gt;https://pm2.keymetrics.io/docs/usage/process-metrics&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Cluster mode: &lt;a href="https://pm2.keymetrics.io/docs/usage/cluster-mode"&gt;https://pm2.keymetrics.io/docs/usage/cluster-mode&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Automate your python script with PM2: &lt;a href="https://towardsdatascience.com/automate-your-python-script-with-pm2-463238ea0b65"&gt;https://towardsdatascience.com/automate-your-python-script-with-pm2-463238ea0b65&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>pm2</category>
      <category>processmanager</category>
      <category>monitoring</category>
      <category>crossplatform</category>
    </item>
    <item>
      <title>Install Miniconda (Conda) and Python</title>
      <dc:creator>Batkhuu</dc:creator>
      <pubDate>Thu, 07 Apr 2022 08:29:09 +0000</pubDate>
      <link>https://dev.to/bybatkhuu/install-miniconda-conda-and-python-50o6</link>
      <guid>https://dev.to/bybatkhuu/install-miniconda-conda-and-python-50o6</guid>
      <description>&lt;h2&gt;
  
  
  Miniconda (Conda)
&lt;/h2&gt;

&lt;p&gt;The clean and light version of the anaconda.&lt;/p&gt;

&lt;h3&gt;
  
  
  Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Cross-platform&lt;/li&gt;
&lt;li&gt;Python&lt;/li&gt;
&lt;li&gt;Conda&lt;/li&gt;
&lt;li&gt;Miniforge&lt;/li&gt;
&lt;li&gt;Multiple environments&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Official pages
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Miniconda: &lt;a href="https://docs.conda.io/en/latest/miniconda.html"&gt;https://docs.conda.io/en/latest/miniconda.html&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Install on Linux: &lt;a href="https://conda.io/projects/conda/en/latest/user-guide/install/linux.html"&gt;https://conda.io/projects/conda/en/latest/user-guide/install/linux.html&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Miniforge: &lt;a href="https://github.com/conda-forge/miniforge"&gt;https://github.com/conda-forge/miniforge&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Install on &lt;strong&gt;Linux&lt;/strong&gt;, &lt;strong&gt;macOS&lt;/strong&gt;, or &lt;strong&gt;Windows&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Download and install &lt;strong&gt;Miniconda (v3)&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;For &lt;strong&gt;Windows&lt;/strong&gt;: &lt;a href="https://docs.conda.io/en/latest/miniconda.html"&gt;https://docs.conda.io/en/latest/miniconda.html&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;For &lt;strong&gt;Linux&lt;/strong&gt; or &lt;strong&gt;macOS&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;## Recommended path to install Miniconda:&lt;/span&gt;
&lt;span class="c"&gt;# For example: ${HOME}/workspaces/runtimes/miniconda3&lt;/span&gt;

&lt;span class="c"&gt;## Linux (x86_64):&lt;/span&gt;
wget https://repo.anaconda.com/miniconda/Miniconda3-py38_4.11.0-Linux-x86_64.sh
bash Miniconda3-py38_4.11.0-Linux-x86_64.sh

&lt;span class="c"&gt;## Linux (aarch64):&lt;/span&gt;
wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-aarch64.sh
bash Miniforge3-Linux-aarch64.sh

&lt;span class="c"&gt;## macOS (Intel):&lt;/span&gt;
wget https://repo.anaconda.com/miniconda/Miniconda3-py38_4.11.0-MacOSX-x86_64.sh
bash Miniconda3-py38_4.11.0-MacOSX-x86_64.sh

&lt;span class="c"&gt;## macOS (Apple M1):&lt;/span&gt;
wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh
bash Miniforge3-MacOSX-arm64.sh


&lt;span class="c"&gt;# Remove downloaded file:&lt;/span&gt;
&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-vrf&lt;/span&gt; Mini&lt;span class="k"&gt;*&lt;/span&gt;.sh

&lt;span class="c"&gt;# For bash:&lt;/span&gt;
&lt;span class="c"&gt;# Load .bashrc file to init conda into current bash session:&lt;/span&gt;
&lt;span class="nb"&gt;source&lt;/span&gt; ~/.bashrc

&lt;span class="c"&gt;# For zsh:&lt;/span&gt;
&lt;span class="c"&gt;# Load .zshrc file to init conda into current zsh session:&lt;/span&gt;
&lt;span class="nb"&gt;source&lt;/span&gt; ~/.zshrc


&lt;span class="c"&gt;# Clean conda caches:&lt;/span&gt;
conda clean &lt;span class="nt"&gt;-y&lt;/span&gt; &lt;span class="nt"&gt;-av&lt;/span&gt;

&lt;span class="c"&gt;# Update conda to the latest version:&lt;/span&gt;
conda update &lt;span class="nt"&gt;-y&lt;/span&gt; conda

&lt;span class="c"&gt;# Check installed conda version:&lt;/span&gt;
conda &lt;span class="nt"&gt;-V&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Install &lt;strong&gt;Python&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Create a new conda environment with python and pip:&lt;/span&gt;
conda create &lt;span class="nt"&gt;-y&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; py38 &lt;span class="nv"&gt;python&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;3.8.12 pip

&lt;span class="c"&gt;# Set default conda environment to .bashrc:&lt;/span&gt;
&lt;span class="c"&gt;## Linux:&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"conda activate py38"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; ~/.bashrc

&lt;span class="c"&gt;## macOS:&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"conda activate py38"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; ~/.zshrc

&lt;span class="c"&gt;# Activate new conda environment:&lt;/span&gt;
conda activate py38

&lt;span class="c"&gt;# Upgrade pip to the latest version:&lt;/span&gt;
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-U&lt;/span&gt; pip
pip &lt;span class="nb"&gt;install &lt;/span&gt;pytest

&lt;span class="c"&gt;# Clean pip caches:&lt;/span&gt;
pip cache purge

&lt;span class="c"&gt;# Clean conda caches:&lt;/span&gt;
conda clean &lt;span class="nt"&gt;-y&lt;/span&gt; &lt;span class="nt"&gt;-av&lt;/span&gt;

&lt;span class="c"&gt;# Check installed python and pip version:&lt;/span&gt;
python &lt;span class="nt"&gt;-V&lt;/span&gt;
pip &lt;span class="nt"&gt;-V&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;👍 ✨&lt;/p&gt;

&lt;h2&gt;
  
  
  INSTALLATION COMPLETE
&lt;/h2&gt;




&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;## Viewing a list of the packages in a conda environment:&lt;/span&gt;
conda list

&lt;span class="c"&gt;# Or list packages of other conda environment:&lt;/span&gt;
conda list &lt;span class="nt"&gt;-n&lt;/span&gt; py38


&lt;span class="c"&gt;## Viewing a list of conda environments:&lt;/span&gt;
conda &lt;span class="nb"&gt;env &lt;/span&gt;list


&lt;span class="c"&gt;## Creating environment variables associated with Conda environments:&lt;/span&gt;
conda &lt;span class="nb"&gt;env &lt;/span&gt;config vars &lt;span class="nb"&gt;set &lt;/span&gt;&lt;span class="nv"&gt;PYTHONPATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;PWD&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;PYTHONPATH&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;


&lt;span class="c"&gt;## Exporting conda environment to environment.yml file:&lt;/span&gt;
conda &lt;span class="nb"&gt;env export&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; environment.yml


&lt;span class="c"&gt;## Creating conda environment from environment.yml file:&lt;/span&gt;
conda &lt;span class="nb"&gt;env &lt;/span&gt;create &lt;span class="nt"&gt;-f&lt;/span&gt; environment.yml


&lt;span class="c"&gt;## Cloning a conda environment:&lt;/span&gt;
conda create &lt;span class="nt"&gt;-y&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; py38_clone &lt;span class="nt"&gt;--clone&lt;/span&gt; py38


&lt;span class="c"&gt;## Removing conda environment:&lt;/span&gt;
conda remove &lt;span class="nt"&gt;-y&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; py38 &lt;span class="nt"&gt;--all&lt;/span&gt;


&lt;span class="c"&gt;## Conda help:&lt;/span&gt;
conda &lt;span class="nt"&gt;-h&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Miniconda installation: &lt;a href="https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html"&gt;https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Managing conda environments: &lt;a href="https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html"&gt;https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>miniconda</category>
      <category>conda</category>
      <category>python</category>
      <category>crossplatform</category>
    </item>
    <item>
      <title>Install NVM (Node Version Manager) and Node.js</title>
      <dc:creator>Batkhuu</dc:creator>
      <pubDate>Thu, 07 Apr 2022 08:27:46 +0000</pubDate>
      <link>https://dev.to/bybatkhuu/install-nvm-node-version-manager-and-nodejs-42h3</link>
      <guid>https://dev.to/bybatkhuu/install-nvm-node-version-manager-and-nodejs-42h3</guid>
      <description>&lt;h2&gt;
  
  
  NVM (Node Version Manager)
&lt;/h2&gt;

&lt;p&gt;NVM is a tool for managing multiple versions of Node.js.&lt;/p&gt;

&lt;h3&gt;
  
  
  Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Cross-platform&lt;/li&gt;
&lt;li&gt;Node.js&lt;/li&gt;
&lt;li&gt;Manager for multiple versions of Node.js, npm, and yarn&lt;/li&gt;
&lt;li&gt;Multiple Node.js environments&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Official pages
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;NVM: &lt;a href="https://github.com/nvm-sh/nvm"&gt;https://github.com/nvm-sh/nvm&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;NVM for Windows: &lt;a href="https://github.com/coreybutler/nvm-windows"&gt;https://github.com/coreybutler/nvm-windows&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Install on &lt;strong&gt;Linux&lt;/strong&gt; or &lt;strong&gt;macOS&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Download and install &lt;strong&gt;NVM (v0.39.1)&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;## Recommended path to install NVM:&lt;/span&gt;
&lt;span class="c"&gt;# Set and export `NVM_DIR` environment variable. For example:&lt;/span&gt;
&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-vp&lt;/span&gt; ~/workspaces/runtimes/.nvm
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;NVM_DIR&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;HOME&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/workspaces/runtimes/.nvm"&lt;/span&gt;

&lt;span class="c"&gt;# Install NVM:&lt;/span&gt;
wget &lt;span class="nt"&gt;-qO-&lt;/span&gt; https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash


&lt;span class="c"&gt;## For bash:&lt;/span&gt;
&lt;span class="c"&gt;# Load .bashrc file to init NVM into current bash session:&lt;/span&gt;
&lt;span class="nb"&gt;source&lt;/span&gt; ~/.bashrc

&lt;span class="c"&gt;## For zsh:&lt;/span&gt;
&lt;span class="c"&gt;# Load .zshrc file to init NVM into current zsh session:&lt;/span&gt;
&lt;span class="nb"&gt;source&lt;/span&gt; ~/.zshrc


&lt;span class="c"&gt;# Check installed NVM version:&lt;/span&gt;
nvm &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Install &lt;strong&gt;Node.js&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install Node.js, update NPM to latest, and set default Node.js:&lt;/span&gt;
nvm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--latest-npm&lt;/span&gt; &lt;span class="nt"&gt;--alias&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;default 16.14.2
&lt;span class="c"&gt;# Set to use default Node.js:&lt;/span&gt;
nvm use default

&lt;span class="c"&gt;# Clean NVM caches:&lt;/span&gt;
nvm cache clear

&lt;span class="c"&gt;# Check installed Node.js and NPM version:&lt;/span&gt;
node &lt;span class="nt"&gt;-v&lt;/span&gt;
npm &lt;span class="nt"&gt;-v&lt;/span&gt;

&lt;span class="c"&gt;# Install essential extra packages:&lt;/span&gt;
npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; pm2 newman jshint
pm2 &lt;span class="nb"&gt;install &lt;/span&gt;pm2-logrotate

&lt;span class="c"&gt;# Clean NPM caches:&lt;/span&gt;
npm cache clean &lt;span class="nt"&gt;--force&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;👍 ✨&lt;/p&gt;

&lt;h2&gt;
  
  
  INSTALLATION COMPLETE (&lt;strong&gt;Linux&lt;/strong&gt;, &lt;strong&gt;macOS&lt;/strong&gt;)
&lt;/h2&gt;




&lt;h2&gt;
  
  
  Install on &lt;strong&gt;Windows&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Download and install &lt;strong&gt;NVM-Windows (v1.1.9)&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Downloads: &lt;a href="https://github.com/coreybutler/nvm-windows/releases"&gt;https://github.com/coreybutler/nvm-windows/releases&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Install &lt;strong&gt;Node.js&lt;/strong&gt; (&lt;strong&gt;Windows&lt;/strong&gt;)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;nvm&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;install&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;16.14.2&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;nvm&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;use&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;16.14.2&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;👍 ✨&lt;/p&gt;

&lt;h2&gt;
  
  
  INSTALLATION COMPLETE (&lt;strong&gt;Windows&lt;/strong&gt;)
&lt;/h2&gt;




&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# NVM help:&lt;/span&gt;
nvm &lt;span class="nt"&gt;-h&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Install NVM on Ubuntu 18.04: &lt;a href="https://nbanzyme.medium.com/easy-way-to-install-nvm-on-ubuntu-18-04-2cfb19ee5391"&gt;https://nbanzyme.medium.com/easy-way-to-install-nvm-on-ubuntu-18-04-2cfb19ee5391&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Install NVM macOS: &lt;a href="https://nodesource.com/blog/installing-node-js-tutorial-using-nvm-on-mac-os-x-and-ubuntu/"&gt;https://nodesource.com/blog/installing-node-js-tutorial-using-nvm-on-mac-os-x-and-ubuntu/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>nvm</category>
      <category>node</category>
      <category>javascript</category>
      <category>crossplatform</category>
    </item>
    <item>
      <title>Install NVIDIA CUDA on Linux</title>
      <dc:creator>Batkhuu</dc:creator>
      <pubDate>Thu, 07 Apr 2022 08:27:45 +0000</pubDate>
      <link>https://dev.to/bybatkhuu/install-nvidia-cuda-on-linux-1040</link>
      <guid>https://dev.to/bybatkhuu/install-nvidia-cuda-on-linux-1040</guid>
      <description>&lt;h2&gt;
  
  
  Official pages
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;CUDA: &lt;a href="https://developer.nvidia.com/cuda-toolkit"&gt;https://developer.nvidia.com/cuda-toolkit&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;CUDA archive: &lt;a href="https://developer.nvidia.com/cuda-toolkit-archive"&gt;https://developer.nvidia.com/cuda-toolkit-archive&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Install CUDA: &lt;a href="https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#runfile"&gt;https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#runfile&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;cuDNN: &lt;a href="https://developer.nvidia.com/cudnn"&gt;https://developer.nvidia.com/cudnn&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Install cuDNN: &lt;a href="https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html#installlinux-tar"&gt;https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html#installlinux-tar&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;TensorRT: &lt;a href="https://developer.nvidia.com/tensorrt-getting-started"&gt;https://developer.nvidia.com/tensorrt-getting-started&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Install TensorRT: &lt;a href="https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html#installing-tar"&gt;https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html#installing-tar&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Check current Linux system specification
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Check NVIDIA GPU exists:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;## Use lshw:&lt;/span&gt;
lshw &lt;span class="nt"&gt;-C&lt;/span&gt; display

&lt;span class="c"&gt;# Only for Ubuntu/Debian:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get update &lt;span class="nt"&gt;--fix-missing&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; Acquire::CompressionTypes::Order::&lt;span class="o"&gt;=&lt;/span&gt;gz
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; pciutils mesa-utils
&lt;span class="c"&gt;# Or use lspci:&lt;/span&gt;
lspci | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; vga &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; lspci | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; nvidia
&lt;span class="c"&gt;# Or use glxinfo:&lt;/span&gt;
glxinfo | egrep &lt;span class="s2"&gt;"OpenGL vendor|OpenGL renderer"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Check linux OS information:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;## Check linux OS version and distro:&lt;/span&gt;
&lt;span class="nb"&gt;uname&lt;/span&gt; &lt;span class="nt"&gt;-a&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cat&lt;/span&gt; /etc/&lt;span class="k"&gt;*&lt;/span&gt;release

&lt;span class="c"&gt;## Check kernel version:&lt;/span&gt;
&lt;span class="nb"&gt;uname&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt;
&lt;span class="c"&gt;# Or:&lt;/span&gt;
hostnamectl

&lt;span class="c"&gt;## Check GCC and make compiler version:&lt;/span&gt;
gcc &lt;span class="nt"&gt;--version&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; make &lt;span class="nt"&gt;-v&lt;/span&gt;

&lt;span class="c"&gt;## Check glibc version:&lt;/span&gt;
ldd &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Check CUDA version compatibility
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;[IMPORTANT]&lt;/strong&gt; Search and check the &lt;strong&gt;latest stable NVIDIA driver version&lt;/strong&gt; for &lt;strong&gt;your GPU model(s)&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;NVIDIA driver downloads: &lt;a href="https://www.nvidia.com/Download/Find.aspx?lang=en-us"&gt;https://www.nvidia.com/Download/Find.aspx?lang=en-us&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;[IMPORTANT]&lt;/strong&gt; Check the &lt;strong&gt;compatibility&lt;/strong&gt; of the &lt;strong&gt;NVIDIA driver version&lt;/strong&gt; with &lt;strong&gt;CUDA versions&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;CUDA release note: &lt;a href="https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html"&gt;https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;CUDA compatibility PDF: &lt;a href="https://docs.nvidia.com/pdf/CUDA_Compatibility.pdf"&gt;https://docs.nvidia.com/pdf/CUDA_Compatibility.pdf&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;CUDA compatibility: &lt;a href="https://docs.nvidia.com/deploy/cuda-compatibility/#minor-version-compatibility"&gt;https://docs.nvidia.com/deploy/cuda-compatibility/#minor-version-compatibility&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;[IMPORTANT]&lt;/strong&gt; Check &lt;strong&gt;system requirements&lt;/strong&gt; for &lt;strong&gt;CUDA versions&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;CUDA latest version: &lt;a href="https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#system-requirements"&gt;https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#system-requirements&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;CUDA older versions archive: &lt;a href="https://developer.nvidia.com/cuda-toolkit-archive"&gt;https://developer.nvidia.com/cuda-toolkit-archive&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;[RECOMMENDED]&lt;/strong&gt; Check the &lt;strong&gt;compute capability&lt;/strong&gt; of &lt;strong&gt;your GPU model(s)&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;GPU compute capability: &lt;a href="https://developer.nvidia.com/cuda-gpus"&gt;https://developer.nvidia.com/cuda-gpus&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;CUDA Wikipedia: &lt;a href="https://en.wikipedia.org/wiki/CUDA"&gt;https://en.wikipedia.org/wiki/CUDA&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;[RECOMMENDED]&lt;/strong&gt; Check the &lt;strong&gt;cuDNN version&lt;/strong&gt; with &lt;strong&gt;compute capability&lt;/strong&gt; of &lt;strong&gt;your GPU model(s)&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;cuDNN support matrix: &lt;a href="https://docs.nvidia.com/deeplearning/cudnn/support-matrix/index.html"&gt;https://docs.nvidia.com/deeplearning/cudnn/support-matrix/index.html&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;[OPTIONAL]&lt;/em&gt; Check the &lt;strong&gt;compatibility&lt;/strong&gt; of &lt;strong&gt;TensorRT versions&lt;/strong&gt; with &lt;strong&gt;CUDA versions&lt;/strong&gt; and &lt;strong&gt;cuDNN versions&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;TensorRT latest version: &lt;a href="https://docs.nvidia.com/deeplearning/tensorrt/support-matrix/index.html"&gt;https://docs.nvidia.com/deeplearning/tensorrt/support-matrix/index.html&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;TensorRT older versions archives: &lt;a href="https://docs.nvidia.com/deeplearning/tensorrt/archives/index.html"&gt;https://docs.nvidia.com/deeplearning/tensorrt/archives/index.html&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;[RECOMMENDED]&lt;/strong&gt; Check compatible &lt;strong&gt;CUDA versions&lt;/strong&gt; for required &lt;strong&gt;machine learning/deep learning frameworks/libraries&lt;/strong&gt; you want to use:

&lt;ul&gt;
&lt;li&gt;Tensorflow-gpu: &lt;a href="https://www.tensorflow.org/install/source#gpu"&gt;https://www.tensorflow.org/install/source#gpu&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Pytorch: &lt;a href="https://pytorch.org/get-started/previous-versions"&gt;https://pytorch.org/get-started/previous-versions&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Etc...&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Install NVIDIA GPU driver
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;[REQUIRED]&lt;/strong&gt; Install NVIDIA GPU Driver: &lt;a href="https://github.com/bybatkhuu/wiki/blob/main/posts/manuals/installs/nvidia-driver-linux.md"&gt;https://github.com/bybatkhuu/wiki/blob/main/posts/manuals/installs/nvidia-driver-linux.md&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Install CUDA toolkit
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Download CUDA
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;IMPORTANT!&lt;/strong&gt; &lt;strong&gt;Download and use the .RUN file!&lt;/strong&gt; It can &lt;strong&gt;prevent installing incompatible NVIDIA drivers&lt;/strong&gt; and &lt;strong&gt;prevent overwriting&lt;/strong&gt; the previous &lt;strong&gt;/usr/local/cuda&lt;/strong&gt; (if you installed another CUDA already) symbolic link.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IMPORTANT!&lt;/strong&gt; &lt;strong&gt;Don't download or use the .DEB file!&lt;/strong&gt; It will &lt;strong&gt;overwrite the current default CUDA (if you installed it already) directory (/usr/local/cuda)&lt;/strong&gt; and also it will &lt;strong&gt;overwrite the already installed latest compatible NVIDIA driver version&lt;/strong&gt; into the &lt;strong&gt;old or incompatible driver&lt;/strong&gt;. Moreover, if you &lt;strong&gt;want to use a different version of CUDA, never install CUDA.DEB file!&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Search and download the required version of CUDA (&lt;strong&gt;cuda_***_linux.run&lt;/strong&gt;) installer file from this link: &lt;a href="https://developer.nvidia.com/cuda-toolkit-archive"&gt;https://developer.nvidia.com/cuda-toolkit-archive&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;If you're using a command-line interface, just copy the download link from the NVIDIA website and use wget to download. For example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt; ~/Downloads
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/Downloads
&lt;span class="c"&gt;# 1. (Skip this, if you've already downloaded) Download CUDA .run installer file by wget:&lt;/span&gt;
wget https://developer.download.nvidia.com/compute/cuda/[CUDA_VERSION]/local_installers/cuda_[CUDA_VERSION]_[DRIVER_VERSION]_linux.run
&lt;span class="c"&gt;# For example:&lt;/span&gt;
wget https://developer.download.nvidia.com/compute/cuda/11.0.3/local_installers/cuda_11.0.3_450.51.06_linux.run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Install CUDA.run file
&lt;/h3&gt;

&lt;p&gt;When installing CUDA.run, follow the below steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Type '&lt;strong&gt;accept&lt;/strong&gt;' and &lt;strong&gt;ENTER&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IMPORTANT!&lt;/strong&gt; Uncheck and disable NVIDIA driver installation to prevent overwriting already installed latest compatible version of NVIDIA driver into an old or incompatible driver.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IMPORTANT!&lt;/strong&gt; Uncheck and disable CUDA symbolic link installation to prevent overwriting the current default CUDA (if you installed it already) directory (/usr/local/cuda).&lt;/li&gt;
&lt;li&gt;Choose install and press it!
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Change directory to cuda_***.run file downloaded directory. For example:&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/Downloads

&lt;span class="c"&gt;# 2. IMPORTANT! Install cuda_***.run file:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;sh cuda_[CUDA_VERSION]_[DRIVER_VERSION]_linux.run
&lt;span class="c"&gt;# For example:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;sh cuda_11.0.3_450.51.06_linux.run

&lt;span class="c"&gt;# 3. Remove downloaded file:&lt;/span&gt;
&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-vrf&lt;/span&gt; cuda_[CUDA_VERSION]_[DRIVER_VERSION]_linux.run
&lt;span class="c"&gt;# For example:&lt;/span&gt;
&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-vrf&lt;/span&gt; cuda_11.0.3_450.51.06_linux.run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Post-installation
&lt;/h2&gt;

&lt;p&gt;Edit the &lt;code&gt;~/.bashrc&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 4. Add CUDA environment variables to current user .bashrc file:&lt;/span&gt;
&lt;span class="c"&gt;# (It loads environment variables, whenever current user opens a new bash session/new terminal)&lt;/span&gt;
nano ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and add the following lines into the &lt;code&gt;~/.bashrc&lt;/code&gt; file (don't forget to change &lt;strong&gt;[CUDA_VERSION]&lt;/strong&gt; into the installed version):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;## CUDA ##&lt;/span&gt;
&lt;span class="c"&gt;# Change to installed CUDA version:&lt;/span&gt;
&lt;span class="c"&gt;# export CUDA_VERSION=[CUDA_VERSION]&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;CUDA_VERSION&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;11.0
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;CUDA_HOME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"/usr/local/cuda-&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;CUDA_VERSION&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;CUDA_PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;CUDA_HOME&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;CUDA_PATH&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/bin:&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;LIBRARY_PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;CUDA_PATH&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/lib64:&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;LIBRARY_PATH&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;LD_LIBRARY_PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;CUDA_PATH&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/lib64:&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;LD_LIBRARY_PATH&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;LD_LIBRARY_PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;CUDA_PATH&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/extras/CUPTI/lib64:&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;LD_LIBRARY_PATH&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;NVCC&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;CUDA_PATH&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/bin/nvcc"&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;CFLAGS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"-I&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;CUDA_PATH&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/include &lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;CFLAGS&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;save changes and exit from the file editor.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 5. Load .bashrc file to init environment variables into the current bash session:&lt;/span&gt;
&lt;span class="nb"&gt;source&lt;/span&gt; ~/.bashrc

&lt;span class="c"&gt;# 6. Check CUDA compiler version:&lt;/span&gt;
nvcc &lt;span class="nt"&gt;-V&lt;/span&gt;
&lt;span class="c"&gt;# Or:&lt;/span&gt;
&lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;CUDA_PATH&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;/version.txt
&lt;span class="c"&gt;# Or:&lt;/span&gt;
&lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;CUDA_PATH&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;/version.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  [RECOMMENDED] Install cuDNN (For Deep Learning)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Download cuDNN
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;IMPORTANT!&lt;/strong&gt; &lt;strong&gt;Download and use .TGZ or .TAR.XZ file!&lt;/strong&gt; You can install cuDNN into a custom directory, which means you can control which version of cuDNN you want to use and where to install it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IMPORTANT!&lt;/strong&gt; &lt;strong&gt;Don't download and use .DEB file!&lt;/strong&gt; It will overwrite the cuDNN library into the current default CUDA directory (/usr/local/cuda).&lt;/li&gt;
&lt;li&gt;Download cuDNN &lt;strong&gt;.TGZ&lt;/strong&gt; or &lt;strong&gt;.TAR.XZ&lt;/strong&gt; file from this link: &lt;a href="https://developer.nvidia.com/rdp/cudnn-download"&gt;https://developer.nvidia.com/rdp/cudnn-download&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Install cuDNN .tgz or .tar.xz package files
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Change directory to cudnn_***.tgz or .tar.xz file downloaded directory. For example:&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/Downloads

&lt;span class="c"&gt;## Extract cuDNN .tgz or .tar.xz package file:&lt;/span&gt;
&lt;span class="c"&gt;# New versions:&lt;/span&gt;
&lt;span class="nb"&gt;tar&lt;/span&gt; &lt;span class="nt"&gt;-xf&lt;/span&gt; cudnn-linux-x86_64-[CUDNN_VERSION]_cuda[CUDA_VERSION]-archive.tar.xz
&lt;span class="c"&gt;# For example:&lt;/span&gt;
&lt;span class="nb"&gt;tar&lt;/span&gt; &lt;span class="nt"&gt;-xf&lt;/span&gt; cudnn-linux-x86_64-8.3.1.22_cuda11.5-archive.tar.xz

&lt;span class="c"&gt;# Or older versions:&lt;/span&gt;
&lt;span class="nb"&gt;tar&lt;/span&gt; &lt;span class="nt"&gt;-xzf&lt;/span&gt; cudnn-[CUDA_VERSION]-linux-x64-v[CUDNN_VERSION].tgz
&lt;span class="c"&gt;# For example:&lt;/span&gt;
&lt;span class="nb"&gt;tar&lt;/span&gt; &lt;span class="nt"&gt;-xzf&lt;/span&gt; cudnn-11.0-linux-x64-v8.0.5.39.tgz


&lt;span class="c"&gt;# Copy extracted files into specific CUDA directory:&lt;/span&gt;
&lt;span class="nb"&gt;sudo cp&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt; cud&lt;span class="k"&gt;*&lt;/span&gt;/include/cudnn&lt;span class="k"&gt;*&lt;/span&gt;.h /usr/local/cuda-&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;CUDA_VERSION&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;/include
&lt;span class="nb"&gt;sudo cp&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt; cud&lt;span class="k"&gt;*&lt;/span&gt;/lib&lt;span class="k"&gt;*&lt;/span&gt;/libcudnn&lt;span class="k"&gt;*&lt;/span&gt; /usr/local/cuda-&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;CUDA_VERSION&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;/lib64

&lt;span class="c"&gt;# Add read permissions to extracted files:&lt;/span&gt;
&lt;span class="nb"&gt;sudo chmod &lt;/span&gt;a+r /usr/local/cuda-&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;CUDA_VERSION&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;/include/cudnn&lt;span class="k"&gt;*&lt;/span&gt;.h /usr/local/cuda-&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;CUDA_VERSION&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;/lib64/libcudnn&lt;span class="k"&gt;*&lt;/span&gt;

&lt;span class="c"&gt;# Remove downloaded files:&lt;/span&gt;
&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; cud&lt;span class="k"&gt;*&lt;/span&gt;

&lt;span class="c"&gt;# Check installed cuDNN version:&lt;/span&gt;
&lt;span class="nb"&gt;cat&lt;/span&gt; /usr/local/cuda-&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;CUDA_VERSION&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;/include/cudnn.h | &lt;span class="nb"&gt;grep &lt;/span&gt;CUDNN_MAJOR &lt;span class="nt"&gt;-A&lt;/span&gt; 2
&lt;span class="c"&gt;# Or:&lt;/span&gt;
&lt;span class="nb"&gt;cat&lt;/span&gt; /usr/local/cuda-&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;CUDA_VERSION&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;/include/cudnn_version.h | &lt;span class="nb"&gt;grep &lt;/span&gt;CUDNN_MAJOR &lt;span class="nt"&gt;-A&lt;/span&gt; 2

&lt;span class="c"&gt;# cuDNN installation complete!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  [OPTIONAL] Install TensorRT
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Download TensorRT
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;IMPORTANT!&lt;/strong&gt; &lt;strong&gt;Download and use the .TAR.GZ file!&lt;/strong&gt; You can install TensorRT into a custom directory, which means you can control which version of TensorRT you want to use and where to install it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IMPORTANT!&lt;/strong&gt; &lt;strong&gt;Don't download and use .DEB file!&lt;/strong&gt; You can't control TensorRT libraries.&lt;/li&gt;
&lt;li&gt;Download the cuDNN &lt;strong&gt;.TAR.GZ&lt;/strong&gt; file from this link: &lt;a href="https://developer.nvidia.com/nvidia-tensorrt-download"&gt;https://developer.nvidia.com/nvidia-tensorrt-download&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Install TensorRT .tar.gz package files
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Change directory to TensorRT-***.tar.gz file downloaded directory. For example:&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/Downloads

&lt;span class="c"&gt;# Extract TensorRT .tar.gz package file:&lt;/span&gt;
&lt;span class="nb"&gt;tar&lt;/span&gt; &lt;span class="nt"&gt;-xzf&lt;/span&gt; TensorRT-[TENSORRT_VERSION].[OS_DISTRO].x86_64-gnu.cuda-[CUDA_VERSION].cudnn[CUDNN_VERSION].tar.gz
&lt;span class="c"&gt;# For example:&lt;/span&gt;
&lt;span class="nb"&gt;tar&lt;/span&gt; &lt;span class="nt"&gt;-xzf&lt;/span&gt; TensorRT-7.2.0.14.Ubuntu-18.04.x86_64-gnu.cuda-11.0.cudnn8.0.tar.gz

&lt;span class="c"&gt;# Create TensorRT base directory:&lt;/span&gt;
&lt;span class="nb"&gt;sudo mkdir&lt;/span&gt; &lt;span class="nt"&gt;-vp&lt;/span&gt; /opt/tensorrt

&lt;span class="c"&gt;# Copy extracted files into TensorRT directory:&lt;/span&gt;
&lt;span class="nb"&gt;sudo mv&lt;/span&gt; &lt;span class="nt"&gt;-vf&lt;/span&gt; TensorRT-[TENSORRT_VERSION] /opt/tensorrt/TensorRT-[TENSORRT_VERSION]
&lt;span class="c"&gt;# For example:&lt;/span&gt;
&lt;span class="nb"&gt;sudo mv&lt;/span&gt; &lt;span class="nt"&gt;-vf&lt;/span&gt; TensorRT-7.2.0.14 /opt/tensorrt/TensorRT-7.2.0.14

&lt;span class="c"&gt;# Remove downloaded file:&lt;/span&gt;
&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-vrf&lt;/span&gt; TensorRT-[TENSORRT_VERSION].[OS_DISTRO].x86_64-gnu.cuda-[CUDA_VERSION].cudnn[CUDNN_VERSION].tar.gz
&lt;span class="c"&gt;# For example:&lt;/span&gt;
&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-vrf&lt;/span&gt; TensorRT-7.2.0.14.Ubuntu-18.04.x86_64-gnu.cuda-11.0.cudnn8.0.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Edit the &lt;code&gt;~/.bashrc&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Add TensorRT environment variables into current user .bashrc file:&lt;/span&gt;
&lt;span class="c"&gt;# (It loads environment variables, whenever current user opens a new bash session/new terminal)&lt;/span&gt;
nano ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and add the following lines into the &lt;code&gt;~/.bashrc&lt;/code&gt; file (don't forget to change &lt;strong&gt;[TENSORRT_VERSION]&lt;/strong&gt; into the installed version):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;## TensorRT ##&lt;/span&gt;
&lt;span class="c"&gt;# Change to your installed TensorRT version:&lt;/span&gt;
&lt;span class="c"&gt;# export TENSORRT_VERSION=[TENSORRT_VERSION]&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;TENSORRT_VERSION&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;7.2.0.14
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;TENSORRT_PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"/opt/tensorrt/TensorRT-&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;TENSORRT_VERSION&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;TENSORRT_VERSION&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/bin:&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;LD_LIBRARY_PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;TENSORRT_PATH&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/lib:&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;LD_LIBRARY_PATH&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;save changes and exit from the file editor.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Load .bashrc file to init environment variables into current bash session:&lt;/span&gt;
&lt;span class="nb"&gt;source&lt;/span&gt; ~/.bashrc

&lt;span class="c"&gt;# (Only for Python) Install TensorRT python packages:&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;TENSORRT_PATH&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;/python
pip &lt;span class="nb"&gt;install &lt;/span&gt;tensorrt-[TENSORRT_VERSION]-cp[PYTHON_VERSION]-none-linux_x86_64.whl
&lt;span class="c"&gt;# For example:&lt;/span&gt;
pip &lt;span class="nb"&gt;install &lt;/span&gt;tensorrt-7.2.0.14-cp38-none-linux_x86_64.whl

&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;TENSORRT_PATH&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;/uff
pip &lt;span class="nb"&gt;install &lt;/span&gt;uff-&lt;span class="k"&gt;*&lt;/span&gt;&lt;span class="nt"&gt;-py2&lt;/span&gt;.py3-none-any.whl

&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;TENSORRT_PATH&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;/graphsurgeon
pip &lt;span class="nb"&gt;install &lt;/span&gt;graphsurgeon-&lt;span class="k"&gt;*&lt;/span&gt;&lt;span class="nt"&gt;-py2&lt;/span&gt;.py3-none-any.whl

&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;TENSORRT_PATH&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;/onnx_graphsurgeon
pip &lt;span class="nb"&gt;install &lt;/span&gt;onnx_graphsurgeon-&lt;span class="k"&gt;*&lt;/span&gt;&lt;span class="nt"&gt;-py2&lt;/span&gt;.py3-none-any.whl

&lt;span class="c"&gt;# TensorRT installation complete!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Test CUDA
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install sample source codes to test CUDA:&lt;/span&gt;
cuda-install-samples-[CUDA_VERSION].sh ~
&lt;span class="c"&gt;# For example:&lt;/span&gt;
cuda-install-samples-11.0.sh ~

&lt;span class="c"&gt;# Change directory to CUDA sample source codes installed directory:&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/NVIDIA_CUDA-[CUDA_VERSION]_Samples
&lt;span class="c"&gt;# For example:&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/NVIDIA_CUDA-11.0_Samples

&lt;span class="c"&gt;# Build sample source codes:&lt;/span&gt;
make clean &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; make &lt;span class="nt"&gt;-j8&lt;/span&gt;

&lt;span class="c"&gt;# Change directory to built binary directory:&lt;/span&gt;
&lt;span class="nb"&gt;cd &lt;/span&gt;bin/x86_64/linux/release

&lt;span class="c"&gt;# Run CUDA test binaries:&lt;/span&gt;
./deviceQuery
./bandwidthTest

&lt;span class="nb"&gt;cd&lt;/span&gt; ~
&lt;span class="c"&gt;# Remove sample source codes:&lt;/span&gt;
&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; ~/NVIDIA_CUDA-[CUDA_VERSION]_Samples
&lt;span class="c"&gt;# For example:&lt;/span&gt;
&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; ~/NVIDIA_CUDA-11.0_Samples
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;👍 ✨&lt;/p&gt;

&lt;h2&gt;
  
  
  INSTALLATION COMPLETE
&lt;/h2&gt;

</description>
      <category>cuda</category>
      <category>deeplearning</category>
      <category>gpu</category>
      <category>linux</category>
    </item>
    <item>
      <title>Install NVIDIA GPU driver on Linux (Ubuntu/Debian)</title>
      <dc:creator>Batkhuu</dc:creator>
      <pubDate>Thu, 07 Apr 2022 08:23:31 +0000</pubDate>
      <link>https://dev.to/bybatkhuu/install-nvidia-gpu-driver-on-linux-ubuntudebian-4ei6</link>
      <guid>https://dev.to/bybatkhuu/install-nvidia-gpu-driver-on-linux-ubuntudebian-4ei6</guid>
      <description>&lt;h2&gt;
  
  
  Official pages
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;NVIDIA driver downloads: &lt;a href="https://www.nvidia.com/Download/Find.aspx?lang=en-us"&gt;https://www.nvidia.com/Download/Find.aspx?lang=en-us&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;NVIDIA driver installation: &lt;a href="https://docs.nvidia.com/datacenter/tesla/tesla-installation-notes/index.html#runfile"&gt;https://docs.nvidia.com/datacenter/tesla/tesla-installation-notes/index.html#runfile&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;NVIDIA driver configuration instructions: &lt;a href="https://download.nvidia.com/XFree86/Linux-x86_64/510.47.03/README/installdriver.html"&gt;https://download.nvidia.com/XFree86/Linux-x86_64/510.47.03/README/installdriver.html&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;NVIDIA persistence: &lt;a href="https://docs.nvidia.com/deploy/driver-persistence/index.html#persistence-daemon"&gt;https://docs.nvidia.com/deploy/driver-persistence/index.html#persistence-daemon&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;NVIDIA persistenced github: &lt;a href="https://github.com/NVIDIA/nvidia-persistenced"&gt;https://github.com/NVIDIA/nvidia-persistenced&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Install NVIDIA GPU driver
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Disable automatic updates on Ubuntu/Debian
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 1. Disable auto-update and auto-upgrade:&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'APT::Periodic::Update-Package-Lists "0";'&lt;/span&gt; | &lt;span class="nb"&gt;sudo tee&lt;/span&gt; /etc/apt/apt.conf.d/20auto-upgrades
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'APT::Periodic::Unattended-Upgrade "0";'&lt;/span&gt; | &lt;span class="nb"&gt;sudo tee&lt;/span&gt; &lt;span class="nt"&gt;-a&lt;/span&gt; /etc/apt/apt.conf.d/20auto-upgrades
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Disable open-source nouveau driver
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 2. Write blacklist options for the nouveau driver (disable):&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"blacklist nouveau"&lt;/span&gt; | &lt;span class="nb"&gt;sudo tee&lt;/span&gt; &lt;span class="nt"&gt;-a&lt;/span&gt; /etc/modprobe.d/blacklist-nouveau.conf
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"options nouveau modeset=0"&lt;/span&gt; | &lt;span class="nb"&gt;sudo tee&lt;/span&gt; &lt;span class="nt"&gt;-a&lt;/span&gt; /etc/modprobe.d/blacklist-nouveau.conf

&lt;span class="c"&gt;# 3. Update kernel initramfs for blacklist (modprobe.d) options:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;update-initramfs &lt;span class="nt"&gt;-u&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Install essential packages
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 4. Clean apt package manager lists and caches:&lt;/span&gt;
&lt;span class="nb"&gt;sudo rm&lt;/span&gt; &lt;span class="nt"&gt;-vrf&lt;/span&gt; /var/lib/apt/lists/&lt;span class="k"&gt;*&lt;/span&gt; /var/cache/apt/archives/&lt;span class="k"&gt;*&lt;/span&gt; /tmp/&lt;span class="k"&gt;*&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get clean &lt;span class="nt"&gt;-y&lt;/span&gt;

&lt;span class="c"&gt;# 5. Updating, indexing, and caching apt package manager app lists:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get update &lt;span class="nt"&gt;--fix-missing&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; Acquire::CompressionTypes::Order::&lt;span class="o"&gt;=&lt;/span&gt;gz

&lt;span class="c"&gt;# 6. Upgrade and reinstall OS base packages:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get upgrade &lt;span class="nt"&gt;-y&lt;/span&gt;

&lt;span class="c"&gt;# 7. Remove old or unnecessary leftover packages:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get autoremove &lt;span class="nt"&gt;-y&lt;/span&gt;

&lt;span class="c"&gt;# 8. IMPORTANT! Install dkms and base packages:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; build-essential pkg-config libglvnd-dev mesa-utils wget dkms
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Download the appropriate Linux driver for the current NVIDIA GPU model
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Search and download the latest verified stable NVIDIA GPU driver (&lt;strong&gt;NVIDIA-Linux-x86_64-***.run&lt;/strong&gt;) installer file from this link: &lt;strong&gt;&lt;a href="https://www.nvidia.com/Download/Find.aspx?lang=en-us"&gt;https://www.nvidia.com/Download/Find.aspx?lang=en-us&lt;/a&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IMPORTANT!&lt;/strong&gt; &lt;strong&gt;Download and use the .RUN file!&lt;/strong&gt; It can install the NVIDIA driver with the &lt;strong&gt;DKMS module&lt;/strong&gt;, which is really important!&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IMPORTANT!&lt;/strong&gt; &lt;strong&gt;Don't download or use the .DEB file!&lt;/strong&gt; It will &lt;strong&gt;BREAK&lt;/strong&gt; the kernel eventually, especially when the kernel header/version/module is upgraded, which is so &lt;strong&gt;FRUSTRATING!&lt;/strong&gt; Therefore, sometimes conflict with other application &lt;strong&gt;dependencies&lt;/strong&gt; (dependency hell)...&lt;/li&gt;
&lt;li&gt;If you're using a command-line interface, just copy the download link and use wget to download. For example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt; ~/Downloads
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/Downloads

&lt;span class="c"&gt;# 9. (Skip this, if you've already downloaded) Download appropriate Linux driver for current NVIDIA GPU model&lt;/span&gt;
wget https://us.download.nvidia.com/[GPU_MODEL_TYPE_URL]/NVIDIA-Linux-x86_64-[DRIVER_VERSION].run
&lt;span class="c"&gt;# For example:&lt;/span&gt;
wget https://us.download.nvidia.com/XFree86/Linux-x86_64/510.54/NVIDIA-Linux-x86_64-510.54.run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Preparation steps before installing NVIDIA GPU driver
&lt;/h3&gt;

&lt;h4&gt;
  
  
  [IMPORTANT] Change GUI environment to console environment
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Skip this step to 11, if you're not using a GUI environment and already using a console environment or SSH&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TIP:&lt;/strong&gt; From here you're going to enter the console environment, so you need to write down these below commands on some text file to read from command-line or note on somewhere!&lt;/li&gt;
&lt;li&gt;You can change the GUI environment to a virtual console environment by pressing these keyboard buttons: &lt;strong&gt;Ctrl + Alt + F1/F3&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Or by entering the Linux command:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 10. IMPORTANT! Entering into virtual console environment:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;chvt 1
&lt;span class="c"&gt;# Or:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;chvt 3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Enter username and password to log in to a console environment&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Stop GUI processes to prepare the installation of the NVIDIA GPU driver
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 11. Stop GUI service (lightdm/gdm/gdm3/kdm/slim/etc..):&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;service lightdm stop
&lt;span class="c"&gt;# Or:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;service gdm stop
&lt;span class="c"&gt;# Or:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;service gdm3 stop

&lt;span class="c"&gt;# 12. Initialize and refresh console environment without X11 (GUI) processes:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;init 3

&lt;span class="c"&gt;# Change directory to NVIDIA-Linux-x86_64-***.run driver downloaded directory. For example:&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/Downloads

&lt;span class="c"&gt;# 13. Change permission of NVIDIA-Linux-x86_64-***.run driver installer file to executable:&lt;/span&gt;
&lt;span class="nb"&gt;chmod&lt;/span&gt; +x ./NVIDIA-Linux-x86_64-[DRIVER_VERSION].run
&lt;span class="c"&gt;# For example:&lt;/span&gt;
&lt;span class="nb"&gt;chmod&lt;/span&gt; +x ./NVIDIA-Linux-x86_64-510.54.run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Install NVIDIA driver.run file
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;IMPORTANT!&lt;/strong&gt; (&lt;strong&gt;--dkms&lt;/strong&gt;) Register Nvidia driver to the DKMS for future kernel upgrade.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IMPORTANT!&lt;/strong&gt; (&lt;strong&gt;--no-x-check&lt;/strong&gt;) Disable the X11 config checker to prevent triggering X11 (GUI) processes while installing the driver.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IMPORTANT!&lt;/strong&gt; (&lt;strong&gt;--no-cc-version-check&lt;/strong&gt;) Disable the C/C++ version checker to prevent install error occurs when the DKMS C/C++ version is not matching with the current installed C/C++ version!
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 14. IMPORTANT! Install nvidia driver with appropriate arguments:&lt;/span&gt;
&lt;span class="nb"&gt;sudo&lt;/span&gt; ./NVIDIA-Linux-x86_64-[DRIVER_VERSION].run &lt;span class="nt"&gt;--no-x-check&lt;/span&gt; &lt;span class="nt"&gt;--no-cc-version-check&lt;/span&gt; &lt;span class="nt"&gt;--dkms&lt;/span&gt;
&lt;span class="c"&gt;# For example:&lt;/span&gt;
&lt;span class="nb"&gt;sudo&lt;/span&gt; ./NVIDIA-Linux-x86_64-510.54.run &lt;span class="nt"&gt;--no-x-check&lt;/span&gt; &lt;span class="nt"&gt;--no-cc-version-check&lt;/span&gt; &lt;span class="nt"&gt;--dkms&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Select 'Continue installation' on the warning message.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IMPORTANT!&lt;/strong&gt; Select '&lt;strong&gt;Yes&lt;/strong&gt;' for the register of the DKMS kernel module.&lt;/li&gt;
&lt;li&gt;Select '&lt;strong&gt;No&lt;/strong&gt;' for 32-bit compatibility installation OR select '&lt;strong&gt;OK&lt;/strong&gt;' when a 32-bit compatibility error appears.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IMPORTANT!&lt;/strong&gt; Select '&lt;strong&gt;No&lt;/strong&gt;' when it asks to automatically update your X configuration file.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 15. Remove downloaded file:&lt;/span&gt;
&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-vf&lt;/span&gt; ./NVIDIA-Linux-x86_64-[DRIVER_VERSION].run
&lt;span class="c"&gt;# For example:&lt;/span&gt;
&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-vf&lt;/span&gt; ./NVIDIA-Linux-x86_64-510.54.run

&lt;span class="c"&gt;# 16. Reboot system:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;shutdown &lt;span class="nt"&gt;-r&lt;/span&gt; now

&lt;span class="c"&gt;# 17. Check nvidia driver is installed:&lt;/span&gt;
nvidia-smi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Post-installation
&lt;/h2&gt;

&lt;h3&gt;
  
  
  [Only for ML/DL server] Setup nvidia-persistence mode daemon
&lt;/h3&gt;

&lt;p&gt;Not recommended: GPU that is used by X11/Wayland processes (for GUI rendering).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install git to clone:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; ssh git

&lt;span class="c"&gt;# Download nvidia-persistenced source code from github:&lt;/span&gt;
git clone https://github.com/NVIDIA/nvidia-persistenced.git

&lt;span class="c"&gt;# Install nvidia-persistenced service daemon:&lt;/span&gt;
&lt;span class="nb"&gt;cd &lt;/span&gt;nvidia-persistenced/init
&lt;span class="nb"&gt;sudo&lt;/span&gt; ./install.sh

&lt;span class="c"&gt;# Remove downloaded files:&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ../.. &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; nvidia-persistenced

&lt;span class="c"&gt;# Check nvidia-persistence mode is ON:&lt;/span&gt;
nvidia-smi
&lt;span class="c"&gt;# Or check nvidia-persistenced.service is running:&lt;/span&gt;
systemctl status nvidia-persistenced.service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;👍 ✨&lt;/p&gt;

&lt;h2&gt;
  
  
  INSTALLATION COMPLETE
&lt;/h2&gt;




&lt;h2&gt;
  
  
  [OPTIONAL] Install the NVIDIA GPU monitoring tool
&lt;/h2&gt;

&lt;h3&gt;
  
  
  🌟📡 nvitop
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install python3 and pip3 packages:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; python3 python3-pip

&lt;span class="c"&gt;# Install nvitop into system python3 packages:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;pip3 &lt;span class="nb"&gt;install &lt;/span&gt;nvitop

&lt;span class="c"&gt;# Check nvitop:&lt;/span&gt;
nvitop &lt;span class="nt"&gt;-m&lt;/span&gt; full
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;a href="https://pypi.org/project/nvitop"&gt;https://pypi.org/project/nvitop&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/XuehaiPan/nvitop"&gt;https://github.com/XuehaiPan/nvitop&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  📊 nvtop
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install cmake, ncurses and git:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; cmake libncurses5-dev libncursesw5-dev

&lt;span class="c"&gt;# Download nvtop source code from github:&lt;/span&gt;
git clone https://github.com/Syllo/nvtop.git
&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-vp&lt;/span&gt; nvtop/build &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;nvtop/build

cmake ..
&lt;span class="c"&gt;# If it errors with "Could NOT find NVML (missing: NVML_INCLUDE_DIRS)"&lt;/span&gt;
&lt;span class="c"&gt;# try the following command instead, otherwise skip to the build with make:&lt;/span&gt;
&lt;span class="c"&gt;#cmake .. -DNVML_RETRIEVE_HEADER_ONLINE=True&lt;/span&gt;

make
&lt;span class="nb"&gt;sudo &lt;/span&gt;make &lt;span class="nb"&gt;install&lt;/span&gt;

&lt;span class="c"&gt;# Remove downloaded files:&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ../.. &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; nvtop

&lt;span class="c"&gt;# Check nvtop:&lt;/span&gt;
nvtop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/Syllo/nvtop"&gt;https://github.com/Syllo/nvtop&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Re-install or upgrade the NVIDIA driver to the latest version
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Remove DKMS NVIDIA modules
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Skip this step, if you didn't install the NVIDIA driver with DKMS.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Check current dkms nvidia modules, versions, and kernels:&lt;/span&gt;
&lt;span class="c"&gt;# [TIP]: Use module versions to remove.&lt;/span&gt;
dkms status | &lt;span class="nb"&gt;grep &lt;/span&gt;nvidia

&lt;span class="c"&gt;# Remove old dkms nvidia module/version:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;dkms remove nvidia/[DRIVER_VERSION] &lt;span class="nt"&gt;--all&lt;/span&gt;
&lt;span class="c"&gt;# For example:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;dkms remove nvidia/510.54 &lt;span class="nt"&gt;--all&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Disable the nvidia-persistenced service daemon
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Skip this step, if you didn't setup the nvidia-persistenced daemon.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Stop and disable nvidia-persistenced service daemon:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl stop nvidia-persistenced.service
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl disable nvidia-persistenced.service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Uninstall all nvidia-* packages
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get remove &lt;span class="nt"&gt;--purge&lt;/span&gt; &lt;span class="s1"&gt;'^nvidia-.*'&lt;/span&gt;
&lt;span class="c"&gt;# Or:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;nvidia-uninstall

&lt;span class="c"&gt;# Reboot system:&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;shutdown &lt;span class="nt"&gt;-r&lt;/span&gt; now
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Install the latest NVIDIA driver version
&lt;/h3&gt;

&lt;p&gt;Install NVIDIA driver again (start from the beginning): #install-nvidia-gpu-driver&lt;/p&gt;

</description>
      <category>nvidia</category>
      <category>gpu</category>
      <category>driver</category>
      <category>linux</category>
    </item>
  </channel>
</rss>
