If at any point you get stuck during this initial setup or throughout the semester, please don’t hesitate to email the course staff at 15-131-staff at cs dot cmu dot edu.
SSH is a program that lets you log in to a server and run commands on it. At CMU, you’ll use SSH extensively in most of your CS classes. SSH is also a very important tool for working in industry and knowing how to use it will be essential throughout your career. (Even in academia, SSH is a very important tool.)
Throughout the rest of the semester we’ll teach you about how to use it and why you want to, but for now we’ll just focus on getting it set up so that you can start using it right away.
The exact instructions on how to set up SSH vary based on what operating system you’re using, so choose the relevant section and proceed from there.
Congratulations! Your OS has a built-in terminal (Terminal.app), so you don’t
need to download anything. You might consider looking at one of the other
terminals for OS X like iTerm2 if you want cooler features like better
color support, easier theming, vertical splits, advanced tmux
integration, and
more.
Sshing is simple; run the following command, replacing ANDREWID
with your
Andrew ID:
ssh ANDREWID@unix.andrew.cmu.edu
When you enter this, you will be prompted for a password–it’s the same password you use to log onto WebISO.
To facilitate quick sshing, you should edit the ssh config file. Use the following command to do that (you don’t need to understand this command yet–we’ll cover it later in the semester). Copy and paste the command into your terminal and hit enter.
mkdir -p ~/.ssh; touch ~/.ssh/config; nano ~/.ssh/config
Add the following (replacing ANDREWID
with your Andrew ID) to this file, save
the file, and exit nano. (Some notes: The ^
character is used to represent
the “control” key, so ^O
means “hold control and press the O key”, and nano
uses “WriteOut” to mean “save”. Nano will ask you to confirm the filename you
want to save. Just hit enter to confirm it.)
Host andrew
Hostname unix.andrew.cmu.edu
User ANDREWID
GSSAPIAuthentication yes
GSSAPIDelegateCredentials yes
Normally, without the above incantation, you would need to type ssh
ANDREWID@unix.andrew.cmu.edu
to ssh, but now you can just type ssh andrew
and the rest will be auto-detected. If you prefer a different name than
andrew
, you can change that line (Host andrew
) in the ssh config file.
First, you should choose a terminal. Your distro almost certainly has one already, but if you don’t the default one you can download another. Some popular terminals are
Once you’ve done that, follow the instructions in the Mac section.
We recommend that you use MobaXterm for SSH. For detailed installation and setup instructions, see this blog post.
If you’re already somewhat familiar with Linux, however, we strongly recommend that you follow the Linux initial setup instructions.
A shell is a program that lets you enter in text commands to a computer and get output from those commands. Shells are essential for using SSH and very useful for programming. We’ll be doing all of our work in this class within a shell, so it’s important that we use the right one!
The default shell on Andrew Linux systems, csh
, is lacking in many ways. For
that reason, we’ll be switching you over to a shell called bash. (If you have
strong preferences about your shell, you’re welcome to use another shell as long
as it’s not csh.)
In order to switch your shell over, follow these instructions:
chsh
at the prompt (type it and hit enter)./bin/bash
and hit enter.The default settings for bash (the shell you switched to) and other programs you’re likely to use during the semester are rather minimal, so we’ve written some configuration files that will give you nicer defaults. Of course, if you want to change these settings to better fit your preferences you can do so.
SSH in to andrew
.
First, we’ll get a few basic files. Copy the following commands into your terminal, hitting enter after each one.
curl https://raw.githubusercontent.com/cmugpi/dotfiles/master/bash_login > ~/.bash_login
curl https://raw.githubusercontent.com/cmugpi/dotfiles/master/bashrc > ~/.bashrc
curl https://raw.githubusercontent.com/cmugpi/dotfiles/master/bashrc_gpi > ~/.bashrc_gpi
curl https://raw.githubusercontent.com/cmugpi/dotfiles/master/vimrc > ~/.vimrc
git clone https://github.com/gmarik/Vundle.vim ~/.vim/bundle/Vundle.vim
vim +PluginInstall +qall
Then, disconnect from Andrew (remember, ^D
) and log in again. When you’ve logged
in, type echo $GPI_PATH
and hit enter. If you see a file path, then everything
went correctly! (If you see nothing, something went wrong. Try logging out and
back in, and if that doesn’t fix it, make a post on Piazza or email us.)
We’ll be using the lern2unix website as a backend to submit and download problems, so you’ll need a lern2unix account which you should sign up for before our first lecture.
Copyright © 2014, Great Practical Ideas in Computer Science.