Let's configure your machine

Let's venture into the darkness of Ubuntu and set-up your machine, shall-we ?

Every command, unless specified otherwise, is to be run in the Ubuntu terminal.

What you will need

  • A working computer from the last decade, with Linux / Ubuntu (or a potato connected to the Internet (a Minitel won't work)).
  • A Microsoft SQL Server database, with two databases : prod and dev. In the docs, the databases are called store_dev or store_prod. Feel free to use any name you want for as long as you can remember it.
  • A database user, with read-write access to the database. In the docs, the user is called store_user. Once again, name-it as you wish !

Prepare your environement

  1. Install required dependencies
sudo apt -y update && \
    sudo apt -y upgrade && \
    sudo apt -yq install curl \
    software-properties-common \
    unzip \
    zip \
    python3 \
    python3-distutils \
    python3-dev \
    unixodbc-dev \
    openssh-client \
    git 
  1. Install the Microsoft SQL ODBC Driver 2018
if ! [[ "18.04 20.04 22.04 23.04" == *"$(lsb_release -rs)"* ]];
then
    echo "Ubuntu $(lsb_release -rs) is not currently supported.";
    exit;
fi
curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc
curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18
# optional: for bcp and sqlcmd
sudo ACCEPT_EULA=Y apt-get install -y mssql-tools18
echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
source ~/.bashrc
# optional: for unixODBC development headers
sudo apt-get install -y unixodbc-dev
  1. Install a modern Python Package Manager : poetry
curl -sSL https://install.python-poetry.org | python3 -
  1. Add Poetry to your PATH
The next command update the PATH through ~/.profile. Feel free to tailor this command to your own needs.
echo 'export PATH="$HOME/.poetry/bin:$PATH"' >> ~/.profile && \
source ~/.profile

Did I do everything right ?

Test thoose commands in a new Linux terminal (bash), this to make sure your PATH variable has been properly updated.
  • Python
python3 --version  # Should return something like : Python 3.10.0
  • Poetry
poetry --version  # Should return something like : Poetry version 2.1.12
If you got a poetry / python3 command not found, you might want to make sure Python3 AND Poetry are actually in your PATH variable.