<style>
.markdown-body h1:first-of-type {
margin-top: 24px;
}
.markdown-body h1 {
margin-top: 64px;
}
.markdown-body h1 + h2 {
margin-top: 32px;
}
.markdown-body h2 {
margin-top: 48px;
}
.markdown-body h2.topics {
font-size: 1.8em;
border-bottom: none;
}
.markdown-body h2 {
color: #5a57b8;
}
.markdown-body h3 {
color: cornflowerblue;
}
.markdown-body h4 {
color: cornflowerblue;
}
.exercise {
font-size: 150%;
font-weight: bold;
color: rgb(227,112,183);
}
.note {
color: red;
}
.markdown-body em {
color: #e000e0;
}
.markdown-body strong {
color: #e000e0;
font-weight: bold;
}
.markdown-body p a,
.markdown-body td a {
border-bottom: 1px solid;
}
.markdown-body a:hover {
border-bottom: none;
text-decoration: none;
}
</style>
# Installing Linux and Python
## Installing Linux
In ACIT 1515 we will be using Linux, an open-source (free to use, distribute, and modify) operating system that you will encounter in several of your CIT courses. All the assignments, instructions, and examples in this course will assume that you are operating within a Linux environment.
If you are using a Mac for CIT, skip the rest of this guide and install [Homebrew](https://brew.sh/), then run `brew install python` in your Terminal. Note that you will likely need to substitute the `python3` command for any instructions that tell you to enter `python3.13`.
For the majority of you - the Windows users - [WSL](https://learn.microsoft.com/en-us/windows/wsl/) (Windows Subsystem for Linux, version 2) is how we will install and work within a Linux environment, and we can access WSL via the Terminal (or PowerShell) application.
To open the Terminal application on Windows, you can hit the Windows key and search for 'Terminal'. Terminal is a GUI (Graphical User Interface) app that allows us to install WSL, which in turn will allow us to run Ubuntu (one of the many available versions of Linux). All of the Python programs we will write and run will live inside this Ubuntu virtual machine.
Once you have located and opened Terminal, you will be greeted with a screen that is essentially blank, with the exception of some messages and a ==prompt==. The prompt will likely look something like `PS C:\Users\your-name>`, followed by a flashing cursor. The flashing cursor indicates that this is where you can type Windows ==commands== (combinations of words and symbols), like `New-Item ~\test.txt -type file` which creates a file called `test.txt` inside your home folder.
The `C:\Users\your-name` portion of the prompt is a ==path==, your *location* within the Windows operating system. Slashes indicate *folders*, with multiple slashes indicating nested folders. This default path is telling you you are inside a folder named after your user name (e.g. your-name) which is inside a folder named `Users`, which itself is inside of the `C:` drive (your hard drive).
From this Windows prompt we can install WSL. Before beginning, you may need to configure your system to allow WSL - hit the Windows key and search 'features' to find the Control Panel named 'Turn Windows features on or off'. Click 'Turn Windows features on or off' and a small window should appear with several options that can be checked on or off.
Select 'Virtual Machine Platform' and 'Windows Subsystem for Linux' and restart your computer.
Once your computer has restarted, reopen the Terminal and type the command `wsl --update`. Provided no errors are showing in the Terminal you should next be able to enter the command `wsl --install Ubuntu-24.04` to create an Ubuntu virtual machine.
Once that installation completes (make note of any choices you need to make for username and password), you can log into your Ubuntu instance by entering `wsl ~`
You should now see a prompt that is different to the one you saw previously - this is a Linux ==shell== prompt and here you can only enter Linux commands.
```shell
you@machine:~$
```
**Note**: if the path that you see at the end of the prompt starts with `/mnt`, for example:
```shell
you@machine:/mnt/c/Users/you$
```
enter the `cd` command (followed by the enter key) to go to your Linux home folder.
In Linux, if we want to create a file in our home folder the command is `touch ~/test.txt`. Note that Linux paths use forward-slashes to indicate folders, not back-slashes like Windows paths!
In most cases you will only need to know the Linux versions of commands used to perform operations like file creation. Every time you start the Terminal application you can immediately log in to your WSL Ubuntu instance using the `wsl ~` command and refer to the Linux command reference on the Learning Hub under Content > Week 1 if you need to run Python scripts or work with files and folders.
## Installing Python
After logging in to your Ubuntu instance, you will need to install Python. Ubuntu uses APT (Advanced Package Tool) to install tools like Python that are not part of the core operating system. Type the following commands to install Python from your WSL Ubuntu prompt:
```shell
sudo add-apt-repository ppa:deadsnakes/ppa
```
```shell
sudo apt install python3.13-full python3.12-venv
```
Assuming the above commands work (if not please ask your instructor for help), you can then run the following commands to install Pip, a tool similar to APT that is used to install only Python-related tools:
```shell
python3.13 -m ensurepip --upgrade
```
```shell
echo "export PATH=/home/$(whoami)/.local/bin:\$PATH" >> ~/.bashrc
```
Finally, test your installation by running:
```shell
python3.13 --version
```
If all went well, you should see output similar to `Python 3.13.3` in the terminal.