Installation Instructions

Introduction

I have a Lenovo Legion Y520 Windows 10 laptop with Ubuntu 20.04 installed on a Samsung portable SSD T5 disk. I start my machine from this disk.

All installation instructions in this course are based on Ubuntu 20.04.

Install Julia

Julia is a language that is fast, dynamic, easy to use, and open source.

Prerequisites
  • Your computer OS is Ubuntu 20.04 64 bit.
StepActionComment
1Download JuliaClick on the link and find the row Generic Linux Binaries for x86. Click on 64-bit. Download the file eg. julia-1.5.3-linux-x86_64.tar.gz
2Ctrl+Alt-TOpen a terminal window.
2$ mkdir juliaCreate a folder
3$ cd juliaEnter folder
4$ mv ~/Downloads/julia-1.5.3-linux-x86_64.tar.gz .Move the downloaded file to folder julia.
5$ tar -zxvf julia-1.5.3-linux-x86_64.tar.gzExtract the file.
6$ cd julia/julia/julia-1.5.3/bin/
7$ ./juliaStart Julia.
8julia> Ctrl-DClose Julia.
9cd ../..
10$ sudo ln -s /home/rob/julia/julia-1.5.3/bin/julia /usr/local/bin/juliaCreate a symbolic link.
11$ juliaStart Julia.
12Ctrl-DClose Julia.
Info

You can remove the symbolic link with: sudo rm /usr/local/bin/julia.

Install Git

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Prerequisites
StepActionComment
1sudo apt install git
2git config –global user.email "<your email address>"
3git config –global user.name "<your first and last name>"E.g. "Rob Bontekoe"
4git config –global github.user "<yout git hub name>"E.g. "rbontekoe"
5cat .gitconfigShow your git data.

Install Julia for VSCode

Juno will not be further expanded with new features. It looks like VSCode is going to be the future development platform for Julia. Watch the video JuliaCon 2020 | (Juno 1.0) VSCode for Julia 1.0 | Sebastian P., Shuhei K., David A..

Prerequisites
  • Your computer OS is Ubuntu 20.04 64 bit.
  • You have installed Julia 1.5+.
  • You have installed Git.

In this activity, you will:

  1. Install VSCode.
  2. Install the Julia Extension.
  3. Optional, Show Inline Results.

Step 1: Install VSCode.

The installation of VSCode runs most smoothly if you install Julia and Git first.

StepActionComment
1Go to the VSCode site
2Click on: DownloadSelect the Download button.
3Right of .deb, select: 64 bitClick on the 64 bit button.
4Select: SaveSelect the Download folder and click on Save.
5Go to your Download folder
6Type: sudo apt install ./<downloaded .deb file>E.g. sudo apt install ./code1.50.0-1602051089amd64.deb. VSCode will be installed.
7cd ~Go to your home folder.
8Type: code .VSCode is started.
Step 2: Install the Julia Extension.

You won't be able to work with Julia until you install the plugin.

StepActionComment
1Ctrl+Shift-XOpen the Extensions pane. You can also hover over the most left icon column to find the option.
2At the top of the pane, in the field Search Extensions in Marketplace type: juliaFind the Julia extension: Jul1a, Julia Language Support.
3Click on: InstallInstall the Julia extension.
4Clear the field Search Extensions in MarketplaceErease julia.
Step 3 (optional): Show Inline Results.

One of the great things about Juno is that you could see the result of a statement on the same line when you executed the code in a file step by step using Shift-<Enter>. This feature is now also available in the Julia extension. However, you step by step through your code in VSCode with Alt-<Enter>.

StepActionComment
1Ctrl+Shift-XOpen the Extensions pane. You can also hover over the most left icon column to find the option.
2Type: juliaType julia in the Search Extensions in Marketplace field when the extension is not visible.
3Click on the: Sprocket symbolThe Install button has been replaced by the sprocket symbol. It opens the menu of the julia extension.
4Select: Extension Settings
5Click in the adjacent pane on the tab: UserThe tab User is the default selected tab!
6Search for the option: julia > Execution: ResultType
7Choose: inlineThe default is REPL, which meanns that the results are printed in the terminal.

Links:

Install IJulia

IJulia is a browser back-end for the Jupyter interactive notebook environment.

Prerequisites
  • Julia 1.0+ has been installed.
StepActionComment
1juliaStart Julia.
2]Activate package manager.
3add IJuliaInstall package.
4BackSpaceBack to the julia prompt.
5using IJuliaLoad package.
6notebook(detached=true, dir=".")Start IJulia.
Only the first time you get the next question:

install Jupyter via Conda, y/n? [y]:

Type: y <Enter>

Your browser window opens.
StepActionComment
7Select: New > Julia 1.5.0-rc2Create a new Julia notebook.
8Type: 1 + 2Enter a formula in a cell.
9Shift-EnterExecute formula. The result 3 will be shown.

Install Docker

Docker is an open container platform for developing, shipping, and running applications.

Prerequisites
  • Your computer OS is Ubuntu 20.04 or higher.

See also: How To Install Docker On Ubuntu

StepActionComment
1sudo apt-get updateUpdate Software Repositories.
2sudo apt-get remove docker docker-engine docker.ioUninstall Old Versions of Docker
3sudo apt install docker.ioInstall Docker
4sudo systemctl start docker
5sudo systemctl enable docker
6sudo docker versionCheck Docker Version

Install NVidia Driver

See: How to install the NVIDIA drivers on Ubuntu 20.04 Focal Fossa Linux

StepActionComment
1$ ubuntu-drivers devicesCheck drivers
== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd00001C8Dsv000017AAsd000039D1bc03sc02i00
vendor   : NVIDIA Corporation
model    : GP107M [GeForce GTX 1050 Mobile]
driver   : nvidia-driver-390 - distro non-free
driver   : nvidia-driver-450-server - distro non-free
driver   : nvidia-driver-435 - distro non-free
driver   : nvidia-driver-418-server - distro non-free
driver   : nvidia-driver-440-server - distro non-free
driver   : nvidia-driver-450 - distro non-free recommended
driver   : xserver-xorg-video-nouveau - distro free builtin
StepActionComment
2$ sudo ubuntu-drivers autoinstallInstall recommended driver.
3$ sudo reboot

Install CUDA for Docker Containers

See: NIVIDIA User guide

Prerequisites
StepActionComment
1Run the following code below:Enable GPU support for Docker.
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo tee /etc/systemd/system/docker.service.d/override.conf <<EOF
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd --host=fd:// --add-runtime=nvidia=/usr/bin/nvidia-container-runtime
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
StepActionComment
2sudo docker start test_sshdStart the container.
2ssh rob@172.17.0.2Enter the container.
3juliaStart Julia.
4using PkgStart package manager
5Pkg.add(["BenchmarkTools", "CUDA", "Flux"]))Load CUDA, etc.
6<Backspace>Return to Jullia.
7using CUDA; has_cuda()Test whether CUDA is enabled.

TODO: It didn't work for me. Troubleshoot!

  • https://github.com/JuliaGPU/docker

Important Docker Commands

CommandComment
sudo docker imagesDisplay all Docker Images.
sudo docker psDisplay all running containers.
sudo docker ps - aDisplay all containers.
sudo docker start <name or id>E.g docker start test_sshd.
sudo docker exec -it <name or id> <command>E.g docker exec -it test_sshd bash.
sudo docker exec -it <name or id> <command>E.g docker exec -it test_sshd julia.
Ctrl-DExit the container
sudo docker stop <name or id>E.g docker stop test_sshd.
sudo docker rm -f <name or id>Delete a container.
sudo docker rmi <image id>Delete an image.

Install Ubuntu on Samsung T5 and Lemovo Legion Y520 with Windows 10

The steps I have done.

StepAction/ResponseComment
1Download ISO-image from Ubuntu 18.04. website
2Copy with Rufus to USB-stick
3Start machine and press F2Change the Bios Lenovo
Under Boot tab:
Fast Boot disabled
Under Security tab:
Secureboot disabled
See:
https://github.com/kfechter/LegionY530Ubuntu/blob/master/Sections/InstallUbuntu.md
StepAction/ResponseComment
4Start Y520 with Windows 10 and press F12
5Choose UbuntuRestart via USB.
6After restart choose for install Ubuntu on 500GB portable disk
7sudo apt update
8sudo do-release-upgrade -dUpgrade to Ubuntu 20.04.

To be reconsidered, I am not sure to deliver on-line courses this way.

Dockerfile

Prerequisites
  • Your computer OS is Ubuntu 20.04.
  • You have installed Dockerversion version 0.18.0 or higher.

If you have installed Docker, you can create a Docker Image from a Dockerfile. From an image you can create Docker containers.

FROM "jupyter/minimal-notebook"

USER root

ENV JULIA_VERSION=1.1.0

RUN mkdir /opt/julia-${JULIA_VERSION} && \
    cd /tmp && \
    wget -q https://julialang-s3.julialang.org/bin/linux/x64/`echo ${JULIA_VERSION} | cut -d. -f 1,2`/julia-${JULIA_VERSION}-linux-x86_64.tar.gz && \
    tar xzf julia-${JULIA_VERSION}-linux-x86_64.tar.gz -C /opt/julia-${JULIA_VERSION} --strip-components=1 && \
    rm /tmp/julia-${JULIA_VERSION}-linux-x86_64.tar.gz

RUN ln -fs /opt/julia-*/bin/julia /usr/local/bin/julia

USER $NB_UID

# Add packages and precompile

RUN julia -e 'import Pkg; Pkg.update()' && \
    julia -e 'import Pkg; Pkg.add("Plots"); using Plots' && \
    # julia -e 'import Pkg; Pkg.add("PlotlyJS"); using PlotlyJS' && \
    julia -e 'import Pkg; Pkg.add("Distributions"); using Distributions' && \
    julia -e 'import Pkg; Pkg.add("Optim"); using Optim' && \
    julia -e 'import Pkg; Pkg.add("StatsPlots"); using StatsPlots' && \
    julia -e 'import Pkg; Pkg.add("IJulia"); using IJulia' && \
    fix-permissions /home/$NB_USER

Install IJulia

Prerequisites
  • Your computer OS is Ubuntu 20.04.
  • You have installed Dockerversion version 0.18.0 or higher.
Note

The instruction are based on Ubuntu 18.04. We use the command line in a terminal window.

First check whether Docker is installed on your system, by typing docker --version. If the command docker is not recognized, install Docker.

StepActionComment
1Open a terminal window on Ubuntu$ is the prompt of your OS.
2$ mkdir workCreate the folder work. Optionally, create sub-directories with the names of your students.
3$ mkdir juliaCreate another directory `julia'.
4$ cd juliaGoto the directory julia.
5Copy the code of the section Dockerfile to the clipboard
6$ nano DockerfileOpen the text editor nano.
7Ctrl-Shift-VPaste the text on the clipboard into the text editor.
8Ctrl-OSave the Dockerfile.
9Ctrl-XExit nano
10$ lslist the content of the directory julia.
11$ cat DockerfileDisplay the content of the Dockerfile.
12$ docker build -t julia-image .Create a Docker IJulia image. The name of the image is julia-image.
13$ docker run -v ~/work:/home/jovjan/work -p 8888:8888 --name julia julia-imageCreate a Docker container, and the IJulia Notebook server starts.
14Ctrl-CStop the server.

Using IJulia

Instructor

StepAction/ResponseComment
1$ docker start juliaStart the IJulia.
2$ docker exec -it julia bashStart the Docker client.
3jovyan@40f8c3bcf0c1:~$ jupyter notebook listDisplay the token.
jovyan@40f8c3bcf0c1:~$ jupyter notebook list Currently running servers: http://0.0.0.0:8888/?token=f394613a12c103a2de92e70aa34715b2183d58e3d5580a2e :: /home/jovyan
4Select the tokenIn this case: f394613a12c103a2de92e70aa34715b2183d58e3d5580a2e.
5Ctrl-Shift-CCopy the token to the clipboard.
6Store the key somewhere, so you can email it to your students.
7$ Ctrl-DExit Docker client.