Create the working environment for the course.
You need to set up two things to get through the course:
There are several possibilities for that:
You can use IFA's server LIFA (lifa.phys.au.dk). I have asked IT-support to create for each of you an account on LIFA. With LIFA you get both a POSIX system and the place on the internet. You only need an internet connection and a terminal emulator with ssh capabilities to log in to LIFA. There is a terminal emulator for Windows—PuTTY—which should do just fine. MacOSX (and other *BSDs) and Linux-based systems all have built-in terminal emulators (well, Android needs an extra app).
Possible pitfalls: you need an internet connection to work on LIFA; you need VPN connection if you are outside of the university; LIFA has not been updated for about a decade (but is still ok).
Install Ubuntu Desktop (or your other favourite POSIX system) on your own laptop. You can do it either directly or in a virtual box.
MacOSX (Darwin) is mostly POSIX compatible. If you install Homebrew package management system, you should be able to get all the necessary utilities.
There is a POSIX environment for Microsoft-Windows called Cygwin. Some students managed to successfully make it through the course using this enviroment.
LIFA itself. LIFA runs Apache web-server which serves files from the user's public_html directory.
Your favourite filesharing service (GoogleDrive, DropBox, CloudMe, ownCloud, Github, ...).
Set up your POSIX system and filesharing.
If you plan to work on your own box:
If you plan to work on LIFA, then
You should have received an email from NFIT to your university account with instructions how to get your LIFA account: so, get your LIFA account.
On Linux or Mac: run your terminal emulator and type in the terminal window
ssh your_username@lifa.phys.au.dk
where instead of "your_username" you have to type your actual LIFA
username. It might ask you whether you trust lifa – answer "yes"
without quotes. Then it will ask you for your password – type in
your LOFA password. If everything goes right, you are logged in on lifa.
On windows run PuTTY and specify "lifa.phys.au.dk" without quotes as the destination. Then login with your LIFA username and password. It might ask you whether you trust lifa – answer yes.
When you are done, issue the command
exit
Prepare the directory for the exercises
If you are working on your own box, create a directory, say ~/numeric, where you will
be doing exercises and find out how you will be uploading your exercises
to your filesharing server.
If you are working on LIFA, do
Create the directory for the exercises using the mkdir command:
mkdir -p ~/public_html/numeric
where ~/ is the abbreviation for you home
directory.
Now the URL http://www.phys.au.dk/~your_username
points to your ~/public_html/ directory, while
http://www.phys.au.dk/~your_username/numeric points to your
~/public_html/numeric directory which should then be the
place for your exercises.
Change the permissions to allow the others see
your ~/public_html directory,
chmod -R go+xr ~/public_html
You might need to issue this command again after you have created some
new files.
If you do not wish the others to see a certain file, for example
my_secret_file, do
chmod go-r my_secret_file
If you are working on your own box, but use LIFA as fileserver you can copy files and directories between your POSIX box and lifa in several ways:
For example (presuming that you are able to ssh onto lifa, since scp
uses the same protocol as ssh), if your username on lifa is "pks07",
and you want to copy the folder "myFolder" on your box into your
"~/public_html/numeric" directory on lifa, you can use the following
command:
scp -r myFolder pks07@lifa.phys.au.dk:/usr/users/pks07/public_html/numeric/
It will ask you for lifa's password (or not if your ssh goes via RSA keys). It may take some seconds to establish ssh connection into lifa, but it works in the end (for me in any case).
You probably have to delete any lines with "biff" and/or "date" or other talkative commands from you "~/.login" and/or "~/.cshrc" and/or "~/.profile" files because of issuses with talkative shell profiles.
You first have to install sshfs it with the command
sudo apt-get install sshfs
Now you can mount your filesystem on lifa as a directory on your own
box. You mount sshfs onto an empty directory on your box, for example,
"~/lifa" (where "~/" is a short-hand notation for your home-directory).
If you don't have such an empty directory, you have to create it with
the command mkdir ~/lifa.
You mount your lifa's filesystem onto the empty "~/lifa" directory with
the command (if your username is pks07)
Now the "~/lifa" directory is directly connected to your
home-directory on lifa. You can copy or move files there or back in the
usual way.
sshfs pks07@lifa.phys.au.dk:/usr/users/pks07 ~/lifa
Having done your copying/moving you unmount the filesystem with the
command
fusermount -u ~/lifa
It is of advantage to create the file "~/.ssh/config" with the content
ServerAliveInterval 10
Try it out
Create a "test" sub-directory in your numeric directory:
mkdir -p ~/public_html/numeric/test
cd ~/public_html/numeric/test
~/numeric):
mkdir -p ~/numeric/test
cd ~/numeric/test
Pick your favourite text editor. If you don't have one, try nano –
it is very simple. You only need to remember that, for example,
^X in the menu list at the bottom of the window means
pressing the Ctrl-key (usually bottom left) and the x-key (often between
z and c) together (Ctrl-key first).
A very popular GUI text editor is gedit but you need a computer with an X-window system installed to run it (linux-based systems, like Ubuntu, usually have it installed by default). For example, you can boot the computers in the computer room off an Ubuntu Live CD or USB and work from that. In order to use X-window programs you have to login with "-X" option,
ssh -X user@host
create a file named hello.c with the content
#include <stdio.h>
int main(void)
{
printf("hello\n");
return 0;
}
cc hello.c -o hello
or using make utility
make hello
./hello
the word "hello" must appear on the screen if everything goes right.
http://www.phys.au.dk/~your_username/numeric/test.
If you work with your own filesharing service, synchronise the direcory
with your fileserver and check that you can see it in a browser.