ssh root@IP_Address -p Port_number<\/code><\/pre>\n\n\n\nIf you cannot log in as root, remember to replace \u201croot\u201d with a user that has sudo privileges. Additionally, replace the \u201cIP_Address\u201d and \u201cPort_Number\u201d with your server\u2019s respective IP address and SSH port.<\/p>\n\n\n\n
Once logged in, update the package repository files on the system with the command:<\/p>\n\n\n\n
# apt update<\/code><\/pre>\n\n\n\n<\/span>Step 2. Install Python Packages and Create a Virtual Environment <\/span><\/h2>\n\n\n\nDebian 12 comes with Python version 3.11 installed by default – you can check this with the command:<\/p>\n\n\n\n
# python --version\nPython 3.11.2<\/code><\/pre>\n\n\n\nNow you can install the required packages python3-pip and python3-venv with the command:<\/p>\n\n\n\n
# apt install python3-venv python3-pip<\/code><\/pre>\n\n\n\nYou can install Flask globally with the command pip3 install flask, but it’s recommended to create a virtual environment and install the Flask application there.<\/p>\n\n\n\n
Let’s create a new user and install the Flask application in a new virtual environment:<\/p>\n\n\n\n
# adduser john<\/code><\/pre>\n\n\n\nNow, you can log in as the user john with the above command. After logging in, create the directories flaskapp\/templates:<\/p>\n\n\n\n
# su - john\n$ mkdir -p flaskapp\/templates<\/code><\/pre>\n\n\n\n