Linux module
Lesson 12
Installing software safely
Use apt or Homebrew. Do not pipe random scripts into sudo.
beginner25 minRun on your machine
What you will be able to do
- Update and install a package with apt (Ubuntu/WSL) or brew (macOS)
- Run tree on the linux-lab folder
- Explain why curl | sudo bash is unsafe
Why this matters for DE and AI
You will install Python versions, Java for Spark, command-line tools, CUDA toolkits. The safe pattern is a package manager from the OS or a vendor you chose. The unsafe pattern is a blog post that says “run this curl into sudo bash.”
Concepts
Ubuntu / WSL / Debian
sudo apt update
sudo apt install tree
update refreshes the list of packages. install downloads tree. You need the password from Getting Started.
macOS (Homebrew)
If brew is not installed, use the official Homebrew instructions from https://brew.sh and read them. After Homebrew exists:
brew install tree
What tree does: prints a directory as a tree. Nice for checking lab layout. Optional extra later: jq for JSON.
If you cannot install software (locked-down work laptop), skip the install and read the rest. You can ls -R instead of tree.
Practice on your machine
Ubuntu, WSL, or Debian
sudo apt update
sudo apt install --yes tree
tree --version
tree ~/dcubes/linux-lab
macOS with Homebrew
brew install tree
tree --version
tree ~/dcubes/linux-lab
What you should see: tree prints data, logs, scripts, and files under them.
If tree is already installed, apt or brew will say so. That is success.
Confirm the program’s location:
which tree
Common mistakes
- Forgetting
sudoon apt. The error will mention permission. That is expected for system-wide installs. - Installing the first result on a random site. Prefer
apt,brew, or a language-specific tool (later:pipinside a virtualenv). - Assuming macOS has
apt. It does not.
Next
SSH as a mental model — how you will reach cloud VMs and GPU boxes.