|
| 1 | ++++ |
| 2 | +title = "Part 0: Setting Up Your Environment" |
| 3 | +date = 2025-11-06 |
| 4 | +weight = 0 |
| 5 | +description = "Get your Linux command-line environment ready for the workshop" |
| 6 | + |
| 7 | +[taxonomies] |
| 8 | +tags = ["linux", "workshop", "tutorial", "setup", "wsl"] |
| 9 | + |
| 10 | +[extra] |
| 11 | +series = "Linux Command-Line Tutorial" |
| 12 | +series_part = 0 |
| 13 | +toc = true |
| 14 | +quick_navigation_buttons = true |
| 15 | +giscus = true |
| 16 | ++++ |
| 17 | + |
| 18 | +Before we dive into the workshop, let's get your environment set up! This guide will walk you through installing everything you need, regardless of your operating system. |
| 19 | + |
| 20 | +## Windows Users: Installing WSL (Windows Subsystem for Linux) |
| 21 | + |
| 22 | +WSL lets you run a full Linux environment directly on Windows. It's the best way to learn Linux commands on a Windows machine. |
| 23 | + |
| 24 | +### Prerequisites |
| 25 | + |
| 26 | +- Windows 10 version 2004+ or Windows 11 |
| 27 | +- Administrator access |
| 28 | + |
| 29 | +### Step 1: Enable WSL |
| 30 | + |
| 31 | +{{ admonition(type="info", text="WSL Ubuntu can be installed via the Microsoft store as well, but installing it via powershell is recommended.") }} |
| 32 | + |
| 33 | +Open **PowerShell** as Administrator (Right-click Start → Windows PowerShell (Admin)) and run: |
| 34 | + |
| 35 | +```powershell |
| 36 | +wsl --install ubuntu |
| 37 | +``` |
| 38 | + |
| 39 | +This command will: |
| 40 | + |
| 41 | +- Enable WSL |
| 42 | +- Install the Ubuntu distribution |
| 43 | +- Set up the Linux kernel |
| 44 | + |
| 45 | +**Restart your computer** when prompted. |
| 46 | + |
| 47 | +### Step 2: Set Up Ubuntu |
| 48 | + |
| 49 | +After restart, search for and launch ubuntu through windows search. It will ask you to create a new user: |
| 50 | + |
| 51 | +```bash |
| 52 | +Enter new UNIX username: yourusername |
| 53 | +New password: ******** |
| 54 | +Retype new password: ******** |
| 55 | +``` |
| 56 | + |
| 57 | +**Important**: |
| 58 | + |
| 59 | +- Choose a simple username (lowercase, no spaces) |
| 60 | +- Remember your password! You'll need it for `sudo` commands |
| 61 | +- The password won't show while typing (that's normal!) |
| 62 | + |
| 63 | +### Step 3: Update Your System |
| 64 | + |
| 65 | +Once Ubuntu is set up, run these commands: |
| 66 | + |
| 67 | +```bash |
| 68 | +sudo apt update |
| 69 | +sudo apt upgrade -y |
| 70 | +``` |
| 71 | + |
| 72 | +This updates all packages to their latest versions. |
| 73 | + |
| 74 | +### Step 4: Verify Installation |
| 75 | + |
| 76 | +Let's install `neofetch` to test everything: |
| 77 | + |
| 78 | +```bash |
| 79 | +sudo apt install neofetch -y |
| 80 | +neofetch |
| 81 | +``` |
| 82 | + |
| 83 | +You should see a beautiful display of your system information! 🎉 |
| 84 | + |
| 85 | +### Accessing WSL |
| 86 | + |
| 87 | +You can open WSL in several ways: |
| 88 | + |
| 89 | +1. Search for "Ubuntu" in the Start menu |
| 90 | +2. Open Windows Terminal and select Ubuntu |
| 91 | +3. Type `wsl` in PowerShell or Command Prompt |
| 92 | + |
| 93 | +### WSL Tips |
| 94 | + |
| 95 | +**Access Windows files**: Your Windows drives are mounted at `/mnt/`: |
| 96 | + |
| 97 | +```bash |
| 98 | +cd /mnt/c/Users/YourName/Desktop |
| 99 | +``` |
| 100 | + |
| 101 | +**Access WSL files from Windows**: Type `\\wsl$` in File Explorer |
| 102 | + |
| 103 | +**Copy/Paste**: |
| 104 | + |
| 105 | +- Right-click to paste in terminal |
| 106 | +- Or: Ctrl+Shift+C to copy, Ctrl+Shift+V to paste |
| 107 | + |
| 108 | +--- |
| 109 | + |
| 110 | +## macOS Users: Installing Homebrew |
| 111 | + |
| 112 | +macOS comes with a Unix-based terminal, so you're already halfway there! We'll install Homebrew, the package manager for macOS. |
| 113 | + |
| 114 | +### Step 1: Install [Homebrew](https://brew.sh/) |
| 115 | + |
| 116 | +Open **Terminal** (⌘+Space, type "Terminal") and run: |
| 117 | + |
| 118 | +```bash |
| 119 | +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" |
| 120 | +``` |
| 121 | + |
| 122 | +Follow the on-screen instructions. When complete, run: |
| 123 | + |
| 124 | +```bash |
| 125 | +echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile |
| 126 | +eval "$(/opt/homebrew/bin/brew shellenv)" |
| 127 | +``` |
| 128 | + |
| 129 | +### Step 2: Verify Installation |
| 130 | + |
| 131 | +```bash |
| 132 | +brew --version |
| 133 | +``` |
| 134 | + |
| 135 | +You should see the Homebrew version number. |
| 136 | + |
| 137 | +### Step 3: Test with neofetch |
| 138 | + |
| 139 | +```bash |
| 140 | +brew install neofetch |
| 141 | +neofetch |
| 142 | +``` |
| 143 | + |
| 144 | +You should see your Mac system info! |
| 145 | + |
| 146 | +### macOS Tips |
| 147 | + |
| 148 | +**Your shell**: macOS Catalina+ uses `zsh` by default (which is great! We'll customize it later) |
| 149 | + |
| 150 | +**Access your files**: Your home folder is at `~/` or `/Users/YourName/` |
| 151 | + |
| 152 | +--- |
| 153 | + |
| 154 | +## Linux Users: Package Managers |
| 155 | + |
| 156 | +If you're already on Linux, you're all set! Here are the common package managers for popular distributions: |
| 157 | + |
| 158 | +### Debian/Ubuntu/Linux Mint |
| 159 | + |
| 160 | +```bash |
| 161 | +sudo apt update |
| 162 | +sudo apt install package-name |
| 163 | +``` |
| 164 | + |
| 165 | +### Fedora/RHEL/CentOS |
| 166 | + |
| 167 | +```bash |
| 168 | +sudo dnf install package-name |
| 169 | +# Or on older versions: |
| 170 | +sudo yum install package-name |
| 171 | +``` |
| 172 | + |
| 173 | +### Arch Linux/Manjaro |
| 174 | + |
| 175 | +```bash |
| 176 | +sudo pacman -S package-name |
| 177 | +``` |
| 178 | + |
| 179 | +### openSUSE |
| 180 | + |
| 181 | +```bash |
| 182 | +sudo zypper install package-name |
| 183 | +``` |
| 184 | + |
| 185 | +### Alpine Linux |
| 186 | + |
| 187 | +```bash |
| 188 | +sudo apk add package-name |
| 189 | +``` |
| 190 | + |
| 191 | +### Check Your Package Manager |
| 192 | + |
| 193 | +Not sure which one you have? Try: |
| 194 | + |
| 195 | +```bash |
| 196 | +# Check if apt exists |
| 197 | +which apt |
| 198 | + |
| 199 | +# Check if dnf exists |
| 200 | +which dnf |
| 201 | + |
| 202 | +# Check if pacman exists |
| 203 | +which pacman |
| 204 | +``` |
| 205 | + |
| 206 | +### Verify Installation |
| 207 | + |
| 208 | +Install neofetch to test: |
| 209 | + |
| 210 | +```bash |
| 211 | +# Debian/Ubuntu |
| 212 | +sudo apt install neofetch |
| 213 | + |
| 214 | +# Fedora |
| 215 | +sudo dnf install neofetch |
| 216 | + |
| 217 | +# Arch |
| 218 | +sudo pacman -S neofetch |
| 219 | + |
| 220 | +# Then run it: |
| 221 | +neofetch |
| 222 | +``` |
| 223 | + |
| 224 | +--- |
| 225 | + |
| 226 | +## Testing Your Environment |
| 227 | + |
| 228 | +Let's make sure everything works! Run these commands: |
| 229 | + |
| 230 | +```bash |
| 231 | +# Check your shell |
| 232 | +echo $SHELL |
| 233 | + |
| 234 | +# Check your home directory |
| 235 | +cd ~ |
| 236 | +pwd |
| 237 | + |
| 238 | +# List files |
| 239 | +ls -la |
| 240 | + |
| 241 | +# Create a test file |
| 242 | +echo "Hello, Linux!" > test.txt |
| 243 | +cat test.txt |
| 244 | +rm test.txt |
| 245 | + |
| 246 | +# Check for basic tools |
| 247 | +which git |
| 248 | +which curl |
| 249 | +which vim |
| 250 | +``` |
| 251 | + |
| 252 | +If all these commands work, you're ready to go! 🚀 |
| 253 | + |
| 254 | +--- |
| 255 | + |
| 256 | +## Troubleshooting |
| 257 | + |
| 258 | +### WSL Issues |
| 259 | + |
| 260 | +**"WSL command not found"**: |
| 261 | + |
| 262 | +- Make sure you're running Windows 10 2004+ or Windows 11 |
| 263 | +- Run Windows Update |
| 264 | + |
| 265 | +**"This operation requires elevation"**: |
| 266 | + |
| 267 | +- You need to run PowerShell as Administrator |
| 268 | + |
| 269 | +**Ubuntu doesn't launch after restart**: |
| 270 | + |
| 271 | +- Search for "Ubuntu" in Start menu manually |
| 272 | +- Or run `wsl` in PowerShell |
| 273 | + |
| 274 | +### Homebrew Issues |
| 275 | + |
| 276 | +**"Command not found" after installing**: |
| 277 | + |
| 278 | +- Make sure you ran the [`echo`](#step-1-install-homebrew) command to add Homebrew to your PATH |
| 279 | +- Close and reopen Terminal |
| 280 | + |
| 281 | +**"Permission denied"**: |
| 282 | + |
| 283 | +- Don't use `sudo` with Homebrew commands |
| 284 | +- Homebrew should be installed for your user, not root |
| 285 | + |
| 286 | +### Linux Issues |
| 287 | + |
| 288 | +**"E: Could not get lock"**: |
| 289 | + |
| 290 | +- Another package manager is running |
| 291 | +- Wait a moment or restart your system |
| 292 | + |
| 293 | +**"Permission denied"**: |
| 294 | + |
| 295 | +- Remember to use `sudo` for system-wide installations |
| 296 | + |
| 297 | +--- |
| 298 | + |
| 299 | +## What's Next? |
| 300 | + |
| 301 | +Now that your environment is set up, you're ready to start learning! |
| 302 | + |
| 303 | +**Your checklist**: |
| 304 | + |
| 305 | +- [X] Terminal/WSL installed |
| 306 | +- [X] Package manager working (apt/brew/etc.) |
| 307 | +- [X] `neofetch` showing system info |
| 308 | +- [X] Basic commands tested |
| 309 | + |
| 310 | +**Ready to begin?** Let's dive into the actual command-line skills! |
| 311 | + |
| 312 | +--- |
| 313 | + |
| 314 | +## Next Part |
| 315 | + |
| 316 | +**Start learning:** [Part 1: Getting Started - Your First Commands](/blog/linux-tutorial/01-getting-started) |
| 317 | + |
| 318 | +## Series Index |
| 319 | + |
| 320 | +**Back to Workshop:** [Linux Command-Line Tutorial](/blog/linux-tutorial) |
| 321 | + |
| 322 | +--- |
| 323 | + |
| 324 | +## Quick Reference |
| 325 | + |
| 326 | +```bash |
| 327 | +# WSL (Windows) |
| 328 | +wsl --install # Install WSL |
| 329 | +sudo apt update # Update packages |
| 330 | +sudo apt install neofetch # Install a package |
| 331 | + |
| 332 | +# macOS |
| 333 | +brew install neofetch # Install a package |
| 334 | +brew update # Update Homebrew |
| 335 | + |
| 336 | +# Linux (Debian/Ubuntu) |
| 337 | +sudo apt install neofetch # Install a package |
| 338 | +sudo apt update # Update package list |
| 339 | +``` |
| 340 | + |
| 341 | +**Having issues?** Drop a comment below or check the [WSL documentation](https://docs.microsoft.com/en-us/windows/wsl/) / [Homebrew documentation](https://docs.brew.sh/). |
0 commit comments