Thuta Learning
Raspberry Pi
IntermediateHardwareBeginner

Installing Software with apt

Raspberry PiLesson 12

What you'll walk away with

  • Understand Installing Software with apt without any of the intimidation
  • Be able to run the hardware wiring/code yourself
  • Apply this concept right away in a real project

Let's think about it this way for a moment

Since Raspberry Pi OS is Debian-based, the apt package manager works exactly the way you learned it in the Linux tutorial — sudo apt update (refresh the package list), sudo apt install <package> (install), sudo apt remove <package> (uninstall). To install a Python library (aside from gpiozero) you can also use pip (the Python package manager) — it's worth knowing the difference between apt (system-wide packages) and pip (Python-specific packages).

Let's connect it to a real scenario

For a web server project, installing nginx is as simple as typing sudo apt install nginx (following the same pattern as the Linux tutorial's Docker/Web chapter). To install a Python library (say, requests or flask), run pip install requests flask — using a virtual environment (python3 -m venv) lets you isolate each project's dependencies and avoid conflicts.

Let's look at it together

bash
# System package (apt)
sudo apt update
sudo apt install nginx

# Python package (pip)
pip install requests flask

# Virtual environment (recommended for projects)
python3 -m venv myproject-env
source myproject-env/bin/activate
pip install flask
You should see
After installing nginx, running sudo systemctl status nginx should show it as 'active (running)'.

5-minute try-it

Create a Python virtual environment and try installing the flask library (on a Pi if you have one, or on the Linux tutorial's VM/WSL).

A quick word of caution

Just like the package management lesson in the Linux tutorial warned, running sudo apt upgrade on a production Pi (a home server that's running 24/7) without testing it first can shift dependency versions out from under you.

Easy traps

  • Mixing up apt and pip, then not being able to find a Python-specific library via apt install
  • Running pip install system-wide instead of inside a virtual environment, causing dependency conflicts across many projects

Now try it yourself

Create a Python virtual environment and try installing the flask library (on a Pi if you have one, or on the Linux tutorial's VM/WSL).

You'll know it worked when: After installing nginx, running sudo systemctl status nginx should show it as 'active (running)'.

Updated on

Progress is saved only in this browser on this device. It isn't synced to other devices.

Report a problem with this lessonOpens your email app with this lesson's address filled in — nothing is sent until you send it.

Installing Software with apt | Thuta Learning