Start here: set up your practice machine
Everything in these Docs is learned by typing it, so before chapter 1 you need a Linux terminal and the core tools on your own computer. It takes about an hour, it's free, and you only do it once. If you already have a working terminal with Git, Python and Docker, skip to the checklist near the end.
What you're setting up
- A Linux shell (bash), where you'll type almost every command in these Docs.
- Git, to save and share your work (the Git topic).
- Python 3, for scripting and automation (the Python topic).
- Docker, to build and run containers (the Docker topic, and everything after it).
- A code editor. VS Code is free and works the same on every system.
Later topics add a few more tools (kubectl and kind for Kubernetes, the AWS CLI for Cloud); their chapters show how to install them when you get there.
Windows: WSL 2 gives you real Linux
WSL (Windows Subsystem for Linux) runs a real Ubuntu next to Windows, with no separate virtual machine to manage. Open PowerShell as Administrator and run:
PS> wsl --install # installs WSL 2 and Ubuntu, then asks you to restart
PS> wsl -l -v # after the restart: check it
NAME STATE VERSION
* Ubuntu Running 2
After the restart, Ubuntu opens and asks you to create a username and password. That's your Linux user, separate from your Windows account. The password is what sudo asks for later, and nothing appears on screen while you type it; that's normal.
Two habits save a lot of pain:
- Keep your projects inside Linux, in your home folder (
~/projects), not under/mnt/c/.... Files across that border are much slower and their permissions behave strangely. - Use Windows Terminal (from the Microsoft Store) to open Ubuntu tabs. To see your Linux files in Explorer, run
explorer.exe .from any folder.
macOS: Terminal and Homebrew
macOS is Unix underneath, so the built-in Terminal app already gives you a shell (zsh by default; the commands in these Docs work the same unless a chapter says otherwise). Install the developer tools, then Homebrew, the package manager most Mac developers use. Run the one-line installer shown on brew.sh, then:
$ xcode-select --install # compilers and git
$ brew install git python
One thing to know: macOS ships the BSD versions of some classic tools (sed, date, grep), which have slightly different options from the GNU versions on Linux servers. If a command from these Docs behaves oddly on a Mac, that's usually why; practising on a Linux VM or cloud server removes the difference.
Linux, or a small cloud server
On Ubuntu or Debian you already have the shell. Install the basics with the package manager (Linux chapter 4 explains how it works):
$ sudo apt update
$ sudo apt install -y git python3 python3-venv python3-pip curl
Another option is a small cloud server: the Cloud topic shows how to start one on the free tier, and Linux chapter 6 shows how to connect to it over SSH.
Git: install it and introduce yourself
Git stamps every commit with a name and email, so set them once:
$ git --version
$ git config --global user.name "Your Name"
$ git config --global user.email "[email protected]"
$ git config --global init.defaultBranch main
GitHub no longer accepts account passwords for Git, so give it an SSH key instead. Create one, then paste the public half into GitHub under Settings, then SSH and GPG keys, then New SSH key:
$ ssh-keygen -t ed25519 -C "[email protected]" # press Enter to accept the default file
$ cat ~/.ssh/id_ed25519.pub # copy this line into GitHub
$ ssh -T [email protected] # test it
Hi yourname! You've successfully authenticated, but GitHub does not provide shell access.
The file without .pub is your private key. It never leaves your machine and never goes into a repository.
Python
$ python3 --version # 3.10 or newer is fine
$ python3 -m venv .venv && source .venv/bin/activate
(.venv) $ python --version
If venv complains it isn't available on Ubuntu, install python3-venv (above). Python chapter 7 explains what a virtual environment is and why every project gets its own.
Docker
On Windows and Mac, install Docker Desktop from docker.com. On Windows, keep "Use the WSL 2 based engine" switched on, and under Settings, Resources, WSL Integration, enable your Ubuntu, so the docker command works inside Ubuntu. On Linux, install Docker Engine by following the page for your distribution on docs.docker.com, then let your user run it without sudo:
$ sudo usermod -aG docker $USER # then log out and back in
$ docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
Being in the docker group is equal to having root on that machine, which is fine on your own laptop but worth remembering on shared servers.
An editor: VS Code
Install VS Code from code.visualstudio.com. On Windows, add the WSL extension, then open projects from the Ubuntu terminal with code .: the editor runs on Windows but works directly on your Linux files and uses the Linux terminal. The Python, Docker and YAML extensions are worth adding too; they catch typos in Dockerfiles and YAML before you run anything.
The checklist
Run these in your terminal. Every line should print a version, not an error:
$ bash --version | head -1
$ git --version
$ python3 --version
$ docker --version
$ docker compose version
$ code --version # optional
How to use these Docs
- Go through the topics in order: Linux, Python, Networking, Git, Docker, Kubernetes, Cloud, then DevOps. Each one assumes the ones before it.
- Type every command yourself, don't copy and paste. Change things, break them on purpose, and read the errors; that's where most of the learning happens.
- After a chapter, watch the "Go deeper" part of its video, then take that video's test. When a topic is done, try its Challenges.
- Finish with the capstone at the end of the DevOps topic, which builds and ships one app using everything.
Common setup problems
wsl --installsays virtualization isn't enabled: turn on Intel VT-x or AMD-V (sometimes called SVM) in your computer's BIOS/UEFI settings, then try again.permission denied while trying to connect to the Docker daemon socket: either Docker isn't running (start Docker Desktop), or you were added to thedockergroup but haven't logged out and back in yet.python: command not found: usepython3. Inside an activated virtual environment, plainpythonworks.- Git asks for a password when you push: the remote uses HTTPS. Switch it to SSH with
git remote set-url origin [email protected]:you/repo.git. dockerworks in PowerShell but not in Ubuntu: WSL Integration for Ubuntu is switched off in Docker Desktop's settings.