Creating and setting up your cloud machine

Sign up for digitalocean. The promo code we give you provides a $50 credit, that will easily cover all your bootcamp needs, and will have plenty left over for your personal adventures. However, you still need to enter a credit card to activate the account.

Create a droplet by entering a name for your machine. Call your machine whatever you fancy. We will use this for McNulty, so [yourname]-mcnulty (like irmak-mcnulty) is pretty straightforward, but go crazy.

Choose the machine size as the smallest: $5/mo, you can leave the rest of the defaults alone. Region and Available Settings are fine as they are, and the default Ubuntu installation is great. Click "Create Droplet" and you will get an email with your root password.

Open a terminal and connect to your machine by typing ssh root@xxx.xxx.xx.xxx (replace the x'es with the ip address of your digitalocean machine). The first time you connect, it will ask you to change your password (asking the old password twice and then asking you to write a new one twice).

Setting up your machine

Great! Now let's start installing things.

We already have python installed (you can check that by typing python, hitting enter, and noticing that you are now at a python command line. Type import pickle. See how nothing happened? That means it's working. Use ctrl-d to get out of there.

since we're on the subject of importing packages on a brand new installation of python, you can see all of the modules that come with python in this documetation index.

Installing things

apt-get is a handy package management tool. The Ubuntu guide mentions that it is "a powerful command line tool that" performs several functions, but most people just use apt-get for its one to two main uses, most notably apt-get install.

I'll also mention the related and handy apt search command, which I use when I pretty much know the name of the thing I want, but I'm not sure I have it exactly right.

pip

Let's try that out now. We know we'll want pip to help us install all our python packages. Is it just apt-get install pip? I never remember.

Before you apt search, update your libraries (the things apt search is going to search) by typing apt-get update.

When that finishes, try apt search pip.

Holy moly that's a lot of pip returns. Scroll up to the "p's" and see if you can find the winner.

Install pip by typing [spoiler alert] apt-get install python-pip. Accept the myriad suggestions it makes, and hit enter to watch it go. It will take a medium amount of time for this to finish up.

fun fact: we'd usually be typing sudo apt-get install [whatever], but this time we didn't use sudo! that's because when we created our servers, we start out as root. It is wise to create a user and not go around being root all day, because that is a bad idea in general. We'll make a user in just a bit. Here are some handy instructions for this and other server setup tasks.

scipy stack

now that we're on Ubuntu instead of OS X, we can install our stack of usual tools with this line: sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose

git

We'll also be interacting with repositories from our server, so let's apt-get install git. I won't make you search that one because there are way too many packages that have 'git' in the name. So I'll save you the trouble -- it's just called 'git'.

then,

git config --global user.email [your@email.address]
git config --global user.name [your username]

adduser

Let's go ahead and make a user account for ourself at this point. Choose a name for yourself and add a user acount with the intuitive command: adduser [username].

Pick a password, re-enter it, and then feel free to hit enter through all of the other questions.

Make yourself special by granting yourself root privileges: type visudo, this will open up nano (a text editor) to edit the sudoers file. Find the line that says root ALL=(ALL:ALL) ALL. Give yourself a line beneath that which says [username] ALL=(ALL:ALL) ALL. Save by hitting Ctrl-o and then Enter when asked for the file name. Exit nano with Ctrl-x.

fun fact: did you know that when you see a yes/no prompt in this format [Y]/n, that you can simply hit enter and it will assume you mean the default (capital and bracketed) option? You'd be surprised how many people I've caught carefully typing a capital Y. It's a lot.

Now stop being root and start being you using su [yourname]. su stands for switch user. Now type cd and enter to get into your home directory.

create an alias to make it easier to log in to your cloud machine. On your local laptop (you can open up a new terminal for this), in your home directory (cd ~ or just cd), go to your hidden .ssh directory (view hidden directories by adding the flag -a to your ls command). Create a file called config. You can create a file by just opening it in an editor (like nano) and saving it. Put the following information in it:

Host mcnulty
     HostName  xxx.xxx.xxx.xxx
     User bo
 

Here, replace the xxx.xxx.xxx.xxx with the cloud machine's ip, replace mcnulty with whatever nickname you want to give the machine, and replace bo with the username you created on the machine. Now you can quickly log in by doing:

ssh mcnulty

mysql

install mysql: sudo apt-get install mysql-server and give yourself a root password. The Mysql server root password is different from the system root password, and you'll have to remember it, so keep that in mind when choosing one.

Done? Move on to getting mysql setup on your cloud server.