Setting Up For 6.101 on GNU/Linux
Please Log In for full access to the web site.
Note that this link will take you to an external site (https://shimmer.mit.edu) to authenticate, and then you will be redirected back to this page.
Table of Contents
1) Command Line§
Note that the instructions below (and throughout 6.101) will often refer to using your computer's command line to run programs. We don't expect you to be familiar with using the command line before starting 6.101, and we'll try our best to explain exactly what needs to be done. If you are not familiar with the command line, we suggest reading the section of our course readings about some command-line basics before proceeding.
With time, using the command line will start to feel more comfortable. But it
can feel like a lot, especially right away at the start of 6.101! If it feels
overwhelming, please don't fret; we're here to help! If you have questions
about any of the steps described on this page, please feel free to ask for
help, either in person during lab hours or over e-mail at 6.101-help@mit.edu
.
2) Python§
6.101 requires you to access Python for completing the lab assignments, and a local Python installation can also be helpful for following along with live sessions, trying things out on your own, etc.
The lab checkers for this class will use Python version 3.11. It is important that you use Python 3.9 or newer, and we strongly recommend that you install and use Python 3.11 (in part because the error messages from Python 3.11 are much better). You can follow the instructions below (which vary depending on your choice of operating system):
From Package Manager
Most major GNU/Linux distributions will have a recent-enough Python available in their repositories, and so it may be possible to install an appropriate Python version from its package manager. If so, it is fine to install from there. For example:
$ sudo apt install python3.11
On Debian GNU/linux, you can also install IDLE from the idle3
package, e.g.,
$ sudo apt install idle-python3.11
From Source
It is also possible to compile Python from source if you would prefer to install a more recent version of Python. Below is the sequence of commands necessary to compile Python 3.11.1 on Debian GNU/Linux:
$ sudo apt -y build-dep python3
$ sudo apt -y install build-essential libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev tk-dev uuid-dev libffi-dev
$ wget https://www.python.org/ftp/python/3.11.1/Python-3.11.1.tar.xz
$ tar xvf Python-3.11.1.tar.xz
$ cd Python-3.11.1
$ ./configure --enable-optimizations
$ make
$ sudo make altinstall
These commands first install the software necessary to build Python and then
compile and install it. You can test that it worked by running python3
from
a command prompt (note that it should report its version as 3.11.1).
3) Text Editor or IDE§
You will also need a program for editing your Python source files. Depending on where you learned Python and how far along you are, you may or may not already have a preferred text editor (or Integrated Development Environment) for working with Python code. If you already have something you are familiar with, feel free to use that! If not, we recommend using the "IDLE" program (which is included with most Python installations) for editing your files.
4) Pytest§
For all labs, you will also need the
pytest
module installed to run our test
cases. Certain labs may have additional requirements (which will be described
in the writeups for those labs), but for now, pytest
is all we'll need. You
can install pytest
from the command line using a command like the following:
$ pip3 install pytest
(depending on your setup, you may need to type pip
instead of pip3
; or you
may need to include sudo
at the front, i.e. sudo pip3 install pytest
)
After having done so, if you make a small Python file containing only the line
import pytest
, then evaluating that file with Python should work without
error.
You should also be able to run pytest
from the command line; if not, look for
a warning from the pip3 install pytest
command of the following form:
WARNING: The scripts py.test and pytest are installed in '...' which is not on PATH.
In this case, you'll want to add the specified directory to your PATH
environment variable, or use python3 -m pytest
as a workaround.
5) Lab Submission Script§
Throughout 6.101, every time you are ready to submit an assignment to our server to be officially tested and scored, you will run a program from the command line to make that submission.
5.1) Installing the Submission Script§
In order to be able to run the program, we will first need to install it on your machine. You should be able to do so using the following two commands on Debian or Ubuntu (or similar commands on other GNU/Linux distributions):
$ sudo curl -o /usr/local/bin/6.101-submit https://py.mit.edu/_static/spring23/6.101-submit
$ sudo chmod a+rx /usr/local/bin/6.101-submit
You can test whether the installation succeeded by running the following command:
$ 6.101-submit -t
If everything is working, that command should have produced some output,
ultimately ending with the message: "labs@py.mit.edu: Permission denied
(publickey).
" If you see that message, the script was installed successfully!
Note: if you get an error something like "ssh: command not found
" then you
might need to install an ssh client:
$ sudo apt install -y openssh-client
5.2) Configuring SSH Keys§
The "permission denied" message from the previous step happened because, as of right now, we do not know how to tell that it is you who is running the submission script. In order to be able to tell who you are, we will need one or more "SSH public keys" from you (one for each machine you plan to submit from).
Depending on your previous experience, you may already have one or more SSH keys installed on your machine. You can test for their presence by running the following command:
$ cat ~/.ssh/*.pub
If that command produced any output (typically a line starting with ssh-
),
you already have an SSH key on your machine! In that case, copy-and-paste the
output into this form in order to let us know about this SSH
key.
If the command above did not produce any output, that's OK, too; it just means that we'll need to take a few steps to set up a new SSH key. You can do that by running the following command:
$ ssh-keygen -t ed25519
That command should ask you several questions. If you do not have a reason to change your answers to those questions, it should be fine to accept the default values for each (by hitting "Enter" at each question without typing anything). If you do choose a password here, be sure to remember it, as you will need to enter it every time you submit an assignment to the 6.101 server!
Once you have generated a key, rerun the command above (cat ~/.ssh/*.pub
) and
copy/paste the output into this form.
5.3) Testing§
Once we have your SSH public keys, running the following command should produce slightly different results from before:
$ 6.101-submit -t
Now it should report back your username, as well as your role within 6.101. If you see your username there, you should be all set!