Difference between revisions of "Computer lab introduction"

From MolEvol
Jump to: navigation, search
(SSH on Windows)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
''"On the other side of the screen, it all looks so easy."'' (TRON, 1982)
 
''"On the other side of the screen, it all looks so easy."'' (TRON, 1982)
 
[https://molevol.mbl.edu/images/1/1b/Computer_Lab_intro.pdf Slides here]
 
  
 
==Goals==
 
==Goals==
Line 73: Line 71:
 
<br>
 
<br>
 
First we want to log on to the class servers.<br>
 
First we want to log on to the class servers.<br>
In the following command replace username and servername with the user and server name on your piece of paper:<br>
+
In the following command replace username and server name with the user and server name on your piece of paper:<br>
'''Note: the class serverse are without the hyphen. So class-02 is actually class02'''
+
 
 
<pre style="font-size: 1.25em">
 
<pre style="font-size: 1.25em">
 
ssh username@servername
 
ssh username@servername
 
</pre>
 
</pre>
 +
'''Note: the class server names are without the hyphen. So class-02 is actually class02'''<br>
  
 
For example if my username is  jbloggs and my server name is class04 I type:<br>
 
For example if my username is  jbloggs and my server name is class04 I type:<br>
Line 97: Line 96:
 
jbloggs@class02.jbpc-np.mbl.edu
 
jbloggs@class02.jbpc-np.mbl.edu
 
</pre>
 
</pre>
'''Note: the class serverse are without the hyphen. So class-02 is actually class02
+
'''Note: the class server names are without the hyphen. So class-02 is actually class02'''<br>
'''
+
 
 
Enter a name for this configuration (e.g. MolEvol) where it says "Saved Sessions" and click Save
 
Enter a name for this configuration (e.g. MolEvol) where it says "Saved Sessions" and click Save
 
Now you can access the cluster by clicking on that saved session.
 
Now you can access the cluster by clicking on that saved session.
Line 111: Line 110:
  
 
=== Everyone ===
 
=== Everyone ===
You should have a black screen asking for your password, which is on the back of your card under your username. Type it in. You will not see the letters you are typing.
+
You should have a black screen asking for your password, which is on the piece of paper. Type it in. You will not see the letters you are typing.
  
 
==== Changing your password ====
 
==== Changing your password ====
Line 150: Line 149:
 
Where the url is the website address of the file you wish to download. For example
 
Where the url is the website address of the file you wish to download. For example
 
<pre style="font-size: 1.25em">
 
<pre style="font-size: 1.25em">
wget http://phylo.bio.ku.edu/slides/GarliDemo/molevol2016.txt
+
wget https://github.com/wrightaprilm/Paleantology/blob/master/Talks/Molevol2017/molevol2017.txt
 
</pre>
 
</pre>
 
Will download the file molevol2016.txt to the directory you are in.
 
Will download the file molevol2016.txt to the directory you are in.
Line 163: Line 162:
 
'''Ask a person next to you their name, and find and read their fact!'''
 
'''Ask a person next to you their name, and find and read their fact!'''
  
 
==Loading pre-installed programs==
 
Many of the programs that you will need for the course are already installed on the class servers. These need to be specifically loaded in for them to work.<br>
 
For example on the command line type
 
<pre style="font-size: 1.25em">
 
garli
 
</pre>
 
You should get an error message saying: '''-bash: garli: command not found'''<br>
 
Now type
 
<pre style="font-size: 1.25em">
 
module load bioware
 
</pre>
 
This should load all the preinstalled programs so that you can access them. Now type garli again and you should see some information on Garli options ending with:<br>
 
'''ERROR: could not open file "garli.conf".'''<br>
 
Showing that garli is now available for use.<br>
 
If needed, programs can all be unloaded by typing '''module unload bioware'''<br>
 
Note: these commands won't work on your local computer, only when you are logged in to the class servers.
 
  
 
==Setting up Cyberduck==
 
==Setting up Cyberduck==
Line 229: Line 211:
 
In order to get files from your computer to the server open a terminal window and navigate to the folder on your computer using the commands like cd. Once in the folder containing the file you want to upload you type
 
In order to get files from your computer to the server open a terminal window and navigate to the folder on your computer using the commands like cd. Once in the folder containing the file you want to upload you type
 
<pre style="font-size: 1.25em">
 
<pre style="font-size: 1.25em">
scp filename username@classServername:~
+
scp filename username@classServername.jbpc-np.mbl.edu:~
 
</pre>
 
</pre>
 
e.g.
 
e.g.
Line 236: Line 218:
 
To get files from your computer to the cluster:
 
To get files from your computer to the cluster:
  
     scp text.txt emctavish@class01:/class/emctavish
+
     scp text.txt cmeehan@class01.jbpc-np.mbl.edu:/class/emctavish
  
 
To get files from the cluster to your computer:
 
To get files from the cluster to your computer:
  
     scp emctavish@class01:/class/emctavish/testfile.txt .
+
     scp cmeehan@class01.jbpc-np.mbl.edu:/class/emctavish/testfile.txt .
 
 
==Accessing the cluster from outside MBL==
 
 
 
Follow the same instructions from above except:
 
replace the server address (@class07) with '''@class.mbl.edu''' and the once on the cluster use '''ssh class07''' (or whatever your appropriate node is), and run your analyses there.
 
 
 
From cyberduck, follow the instructions as above using '''@class.mbl.edu'''. All your files on the cluster will be synced to there.
 
 
 
It will be available until Sept 15, but go easy on it next week because the STAMPs course will be using it.
 
  
 
==Useful links==
 
==Useful links==

Latest revision as of 11:21, 20 July 2017

"On the other side of the screen, it all looks so easy." (TRON, 1982)

Goals

By the end of this introduction, you should be able to:

  • Log in to the class cluster.
  • Navigate and understand the directory structure.
  • Create and edit files and directories on the cluster.
  • Move files to the cluster.

Ask for help if any of these things aren't working by the end!

Slack group

Slack is a messaging/discussion program that allows for large groups to interact as needed.
There is a slack group set up for people to ask questions if needed, and to have discussions.
The slack team is molevol17
If you can't join through the app/website, you can click on this link

WiFi Login

To log on to the MBL wireless choose the MBL-REGISTER from the wireless list. Your username is your initials followed by the 5 digit number on the side of your identification card. Your password is the same. E.g. if your name is Jane Bloggs and the your card has the number 12345 on the side then your login details are:

username: jb12345
password: jb12345

Some people have been having trouble, if it isn't working find or email Conor cmeehan@itg.be or any TA, or ask on the Slack group.

Downloads

Please download and install the following programs:

After you have installed Notepad++, open it. Go to Settings, Preferences, New Document, and set the line endings to Unix.

If you have time at the end of this lab, please use it to download the software listed here: Divergence time software

Remote computer access software

We will use Secure Shell (SSH) and sFTP to connect to the servers. The servers are powerful computers where we can run the programs much faster than would be possible on your laptop. In order to access these you need to log in to your assigned server


SSH

SSH stands for "Secure Shell." These are programs that provide a Unix shell so that one can enter commands and log onto other computers (i.e., those on the server where we will be doing our analyses).

You must be on the MBL register internet or this will not work

SSH on Linux and Mac Os X

First, open a terminal window:

  • Linux: Konsole (KDE), gnome-terminal (GNOME)
  • Mac: Terminal (in /Applications/Utilities)


First we want to log on to the class servers.
In the following command replace username and server name with the user and server name on your piece of paper:

ssh username@servername

Note: the class server names are without the hyphen. So class-02 is actually class02

For example if my username is jbloggs and my server name is class04 I type:

   ssh jbloggs@class04.jbpc-np.mbl.edu

It will then ask for your password which is on the back of your card under your username

SSH on Windows

On windows you can use git for windows or PuTTY for accessing the class servers.
If using git for windows, follow the Linux/Mac approach above.
To set up SSH on PuTTY Enter your username and servername in the "Host Name or IP Address" field You can find your username and servername on the piece of paper:

username@servername

For example if my username is jbloggs and my server name is class02 I type:

jbloggs@class02.jbpc-np.mbl.edu

Note: the class server names are without the hyphen. So class-02 is actually class02

Enter a name for this configuration (e.g. MolEvol) where it says "Saved Sessions" and click Save Now you can access the cluster by clicking on that saved session.

PuTTy copy paste tip: PuTTy FAQ

Copy and paste works similarly to the X Window System. You use the left mouse button to select text in the PuTTY window. The act of selection automatically copies the text to the clipboard: there is no need to press Ctrl-Ins or Ctrl-C or anything else. In fact, pressing Ctrl-C will send a Ctrl-C character to the other end of your connection (just like it does the rest of the time), which may have unpleasant effects. The only thing you need to do, to copy text to the clipboard, is to select it.

To paste the clipboard contents into a PuTTY window, by default you click the right mouse button. If you have a three-button mouse and are used to X applications, you can configure pasting to be done by the middle button instead, but this is not the default because most Windows users don't have a middle button at all.

You can also paste by pressing Shift-Ins.

Everyone

You should have a black screen asking for your password, which is on the piece of paper. Type it in. You will not see the letters you are typing.

Changing your password

The first thing to do once you have successfully logged on to a server is to change your password. This is done by typing:

passwd

This will prompt you to enter a new password so do so and press the enter key. Next you re-enter the new password and again press enter. It may then ask you for your LDAP password and you should type in your original password given on the back of your card.
Once you have done this every time you ssh in to the server you will use the new password created.

Basic Syntax

Unix commands follow the general format of:

command -options target

Not all commands need options (sometimes called flags, and generally preceded by a single or double hyphen ("-" or "--")) or targets, but others require them.

  • For example:
    • cd homedirectory uses the command "cd" (change directory) and the target "homedirectory" to move from the current directory into the subdirectory called "homedirectory"
    • ls -l homedirectory uses the command "ls" (list), the option "-l" for long-list, and the target "homedirectory" to list the contents of homedirectory in the "long list" format, which provides more thorough descriptions than does the regular "ls".

Notes on syntax for directory structure

  • Two dots (..) indicates the parent directory of the present working directory. So, for example, "cd .. will move you back one directory.
  • One dot (.) indicates the present working directory. So, for example, "cd ." will keep you where you are. There are times where the single dot can be more useful than this...
  • The tilde (~) refers to your home directory. On the class machines your home directory is /class/yourusername. You'll also have a unique home directory on your laptop, etc. The tilde is very helpful if you get lost while using the terminal -- just type "cd ~" and you'll be back in your homedirectory.
  • A forward slash (/) by itself or at the start of a path refers to the root of the filing system -- the folder that contains all other folders.
  • NOTE: do not make changes on the class server in the root folder or any shared folders. All your work is to be done in your home directory or a subdirectory.

Intro-to-Unix tutorial

Please go to the UNIX tutorial and go through the step by step guide there.

Downloading files

In order to get a file from an online source you can use wget. Type:

wget <URL>

Where the url is the website address of the file you wish to download. For example

wget https://github.com/wrightaprilm/Paleantology/blob/master/Talks/Molevol2017/molevol2017.txt

Will download the file molevol2016.txt to the directory you are in. Note: If you are on OSX and trying to do this locally to your machine, this won't work. Curl is an alternative for doing this. See if you can figure out using google how curl works. Wget will still work on the class servers, regardless of your operating system.

Copy this file to a file named <yourname.txt> (remember! No spaces!)

Edit the statement in the file using nano, to a fact about yourself.

Copy it to the /class/shared/facts directory.

Ask a person next to you their name, and find and read their fact!


Setting up Cyberduck

Creating a bookmark

When you open Cyberduck a screen should appear that has some default connections bookmarked such as Google Docs and Amazon.
Click the '+' button at the BOTTOM LEFT to create a new bookmark (NOT the one with the globe at the top). Here we will put the details of our cluster login and save it so that each time we open Cyberduck we don't have to re-enter the details. Click the dropdown menu that says FTP (file Transfer Protocol) and select SFTP.
Create a nickname for this bookmark. For example mine is called 'MBL cluster'.
In 'server' write the class number of the server you were given. For example, I am emctavish@class04 so I put class04 in here.
In the username box place the username you were given. This is likely your first initial and your last name. For example mine is emctavish.
Once all these details are entered close that screen. (e.g. on a mac click the red circle or on windows click the X).
A new bookmark should have appeared named whatever you set as the nickname. Double click on this.
Cyberduck should ask you for the password. Type in the password you changed it to earlier. There should be a button asking for you to 'add to your keychain' or something similar. Make sure this box is ticked. Once done, click to connect.
This may connect you directly to the cluster. If not double click on the bookmark again.
You now should see your home directory on the cluster. You should see the file "yourname.txt" that we created earlier.

Navigating the cluster on Cyberduck and transferring files

Navigating through the class cluster in cyberduck is easy.
Double click on a folder to open that folder.
Above the window that lists files there should be your path. For example when I login my path shows '/class/emctavish'. This tells me where I am on the cluster right now. If you click this dropdown menu you can see each folder you are in. For example when I click on the dropdown I have a line that says /class/emctavish, one that says /class and one that just says /. Clicking on any of these will allow you to navigate to that folder. If you get lost in folders you can click this dropdown and select /class/username (where username is your own username) and this will bring you to your home directory.
An alternative way to go to a specific folder is click the 'Go' menu at the top of Cyberduck and click 'Go to folder'. Here you can write the full path and go to a specific folder. For example, if you are logged in to the cluster through a terminal/putty you can type 'pwd' and then copy that path into the 'go to folder' box and now Cyberduck will be in the same folder as your terminal window.

There are two ways to download files from the class cluster to your computer.
1.If you double click on a file name, this file will be automatically downloaded to your default download folder. A transfer window should open up when you double click on a file. At the bottom there will be a line that starts 'local file'. This is the location of that downloaded file on your own computer
2. An easier way to get files both to and from the class cluster through Cyberduck is through drag and drop. If you have an open finder window (mac) or explorer window (windows) you can click and drag a file from the Cyberduck window to the finder/explorer window directly. You also can do this in the reverse (drag a file from finder/explorer to Cyberduck) to place a file on the cluster in that folder.

Using Cyberduck for remote editing

Instead of using nano or similar to edit files on the class cluster you can use a GUI text editor like TextWrangler through Cyberduck.
In cyberduck click 'File'->'Preferences' on a Mac or 'Edit'->'Preferences' on Windows.
Click the 'Editor' button.
There should be a dropdown menu where you can select a text editor. Select TextWrangler on a Mac, Notepad++ on Windows.
Close this window.
Now when you single click on a file in Cyberduck, a 'Edit' button with the icon for the editor you selected should appear in the top right corner. Click this button to open that file in the editor. Now you can edit the file on the cluster without downloading to your local computer. When you save this file it will be automatically updated on the class cluster.

Short Cyber Duck Exercise

The easiest way to transfer files using CyberDuck is with drag-and-drop. Try to drag a file from your desktop (or another folder of your choosing) from the CyberDuck window. This method allows you to choose unique destinations for each file you transfer.

In CyberDuck, double click example.txt your 'myfolder' on the cluster. To where does this file download? CyberDuck also allows for more permanent modification to how files are downloaded, you can set automatic download locations. If you want to change this, under Edit -> Preferences -> Transfers, you can edit this.

Lastly: Right clicking (Ctrl click on a Mac) will allow you to select Download to or Download As. This will allow you to choose a location, and if you choose, a new file name for the file.

These methods will all work to get files from the cluster to your computer, and each have their own benefits. Generally, you will be fine using any of them throughout the course.

Make a folder on your computer to hold all of your lab materials from this course!

SCP is a good alternative to Cyberduck for linux and Mac's

There are two places you may need to get files on to the class server from: your own computer or an online source
In order to get files from your computer to the server open a terminal window and navigate to the folder on your computer using the commands like cd. Once in the folder containing the file you want to upload you type

scp filename username@classServername.jbpc-np.mbl.edu:~

e.g. just like cp, the format is scp <from> <to>

To get files from your computer to the cluster:

   scp text.txt cmeehan@class01.jbpc-np.mbl.edu:/class/emctavish

To get files from the cluster to your computer:

   scp cmeehan@class01.jbpc-np.mbl.edu:/class/emctavish/testfile.txt .

Useful links

The following table contains a list of commands that will allow us to navigate through the directory structure. The entries are linked to their Wikipedia pages, which contain very useful examples.

Some basic commands
Linux/Mac Description Syntax (Linux/Mac)
pwd print working directory pwd
ls list directory contents ls
history display command history history
cd change directory cd directory_name
mkdir make directory mkdir directory_name
cp copy files cp original_filename copied_filename
mv move files (the same as rename files) mv original_filename moved_filename
clear clear the screen clear
exit quit command line exit
' ' Ctrl-E Go to the end of line
' ' Ctrl-A Go to the beginning of line

=