Running things on the undergraduate servers

Running things on the undergraduate servers

At the end of every term, the UBC CS helpdesk will purge the undergrad Oracle accounts. If you want to keep your project running, you will need to keep your files and host them on another service after that point.

1 Using Linux

Linux is an operating system that many servers, including the undergraduate machines on which most of you will do your project, run. Note that Linux is an offshot of an older OS called Unix, and sometimes you'll see it referred to as Unix; these instructions should apply regardless of whether you're using Unix or Linux. On Linux, most commands are typed rather than being run through an interface that you click on. These commands are run from an application called a command line interface.

Here is a common list of commands that you may find to be helpful:

The following table summarizes some especially useful commands for managing files:

Command Function
man To get help on other commands.
man -k To get help on commands matching a keyword.
ls To list the contents of the current directory.
ls -F To list the contents of the current directory in terms of files, directories and executable programs.
ls -a To list the contents of the current directory, including hidden files.
ls -l To list the contents of the current directory in details.
pwd To list the pathname of the current directory.
cd To navigate to another directory.
mkdir To make a directory.
rmdir To remove an empty directory.
cp To copy files.
mv To move(rename) files.
rm To remove files.
rm -i To remove files with confirmation.
rm -r To remove a directory. The contents of the directory is also removed.
rm -f To remove files, overidding any confirmation.

You may also find this list of Linux commands or the local software guide to be helpful.

Linux from Windows

To get Linux-like commands on your PC, run "terminal" from the start menu. You can also Download Xmanager (or any other terminal emulator). Note: to follow this link you'll have to follow the instructions to log on. Use the above directions to access the "Xshell" program, which came with the above software. Please make sure that you are accessing the instructions for undergrads, or you will be directed to access the wrong computer.

Note: this is definitely not needed for this class, but you may find it to be fun and/or helpful!

Linux from Mac

Mac has a built in program called Terminal that you can use. It can be found in the Applications → Utilities.

2 Your Project Files

Most of you are developing your project on your own computers (locally) and then running them on the server. Some of you are making webpages using PHP. Some of you are making other applications. These instructions should work regardless of what kind of project you are making.

The first thing to figure out is where does your IDE store the files that you are editing? For most of you, this will probably be on your local machine. I cannot tell you which directory. If you are not sure, you can try using the "ls -l" command in the helpful Linux instructions above to see when the file has changed. If you are creating a webpage, you can also try clicking on it to see if when you load it into your web browser you have the change that you are making.

If your IDE is storing your files on the machine that you are trying to access that isn't changing, you need to figure out where the directory is. Probably the Linux commands above will be enough.

If your IDE is storing your files on your local machine and what you are trying to access that is not changing is on the server, then you need to move the files to the server. Note that if you are following the instructions that we gave you for JavaScript, as it says on that page, the localhost that you are connecting to IS ON THE SERVER. So you will need to move the files over.

I note that one possibility is that you can do a git pull on the server in order to move the files over from your repository. This is honestly the best long term strategy. However, I'm not sure of exactly what the details are to get this set up properly. If someone wants to tell me how to do this, I will happily update the FAQ with other instructions. Assuming that you cannot get this to work, do as instructed below.

3 Logging on to the Server

To log onto the undergrad CS server, open your command line interface and type in the following:ssh (CWL ID)@remote.students.cs.ubc.ca (e.g., ssh r2d2@remote.students.cs.ubc.ca). When prompted for a password, type in your CWL password. Note that when you type in your password, it may look like nothing is being typed in- this is just a security measure so that people don't know how long your password.

4 Setting Up Your Undergrad Account

In either case, if you're running a website or something else, the main thing issue is setting up permissions appropriately. Please see the department's instructions on setting up permissions and related issues. The only difference if you are not running a website is that you do not need to put your files in the public_html directory.

5 Transferring Files From Your Computer to the Server

scp stands for secure copy and is a command that we use when we want to transfer files from our computer to a server (or vice versa). In order to transfer a file, we need to know a few pieces of information first:

  • Where the file we want to transfer is located (you can find this out by clicking on your file, and pressing command+i (for Macs) or right clicking the file and clicking on "Properties"). A window detailing properties of your file will pop up and you can find the location of your file listed under Where. Copy that location down.)
  • The name of our file that we want to transfer
  • Where we want the file to go after we transfer it
  • CWL ID
  1. Launch your command line interface.
  2. Change directories to the folder the HTML files are stored in with the cd command. For example, if the HTML files are located on Desktop, you will want to change directories to Desktop with cd Desktop
  3. Assuming our CWL ID is r2d2, the file we want to transfer is called index.html, and we want to transfer the file to the public_html folder, the scp command would look like the following: scp index.html r2d2@remote.students.cs.ubc.ca:/home/w/r2d2/public_html

If you are running Windows, you may also want to try Xftp software which is free for members of the computer science department.

6 Checking Your Files From a Browser

To check your website, open an Internet Browser (e.g., Chrome, Firefox, etc). In the address bar, type in the following: http://www.students.cs.ubc.ca/~(CWL ID)/(fileName).html. Make sure you replace the parentheses with your own information. For example, if I had the CWL ID username r2d2 and the file I transferred over to the server was called index.html, I would type in the following URL: http://www.students.cs.ubc.ca/~r2d2/index.html

Troubleshooting

If you are having trouble publishing your pages, check the following:

  • More instructions can be found at the local software guide
  • Have you made any typos in the filename(s)? As humans, we would look at "inedx.html" and recognize that the intent was "index.html", but the computer won't!
  • If you're having trouble publishing your images, check to make sure the case is correct in your img tag. For example, if your file was named "me.JPG", the src attribute of your img tag must be exactly "me.JPG". It will not work if you put "me.jpg".
  • Ask someone else to try accessing your files; if they can't access the files, then neither can the web browser. Here are the steps for the other person to take, assuming that your login ID is r2d2:
    1. Have the other person change into your home directory: cd ~r2d2. If this doesn't work, you need to refer to the "Setting Up Your Undergrad Account" section for instructions on how to change folder permissions.
    2. Have the student change into your html directory: cd public_html. If this doesn't work, you need to perform step 2 above to change the permissions on your public_html directory.
    3. Have the student look at the file that you are having trouble with (let's assume it's "index.html"): more index.html. If this doesn't work, you need to perform step 3 above to change the permissions on your index.html file.