Create the working environment for the course.
You need to set up two things to get through the course:
There are (at least) two possibilities for that:
Get yourself an account on IFA's server, LIFA (lifa.phys.au.dk). This way 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. MacOS and other *BSDs and Linux-based systems all have built-in terminal emulators.
You have to contact AU IT, ST (bygning 1521, lok. 310) and ask them to create an account for you on IFA's server, lifa.phys.au.dk, for the course Numeriske Metoder. Allegedly they are not very helpful there but they should do their job.
Install Ubuntu Desktop (or your other favourite POSIX system) on your own laptop (either directly or in a virtual box) for doing the exercises; and use one of the available filesharing services (LIFA, DropBox, GoogleDrive, CloudMe, ...) to upload your solutions.
Mac OSX (Darwin) is mostly POSIX compatible: if you install Homebrew package management system, you should be able to get all the necessary utilities.
Set up your POSIX system and filesharing.
If you plan to work on your own box then
If you plan to work on LIFA, then
Get yourself an account on "lifa.phys.au.dk", the IFA server.
If you have an NFIT account with the corresponding email address like "pks07@phys.au.dk" then you might already have an account on lifa with the username "pks07" and the corresponding NFIT password.Otherwise go to NFIT (or whatever it is called now) help-desk (1521-310) and get yourself an account on "lifa.phys.au.dk" (for Numerical Methods course).
Log in to you lifa account.
From the wired network at IFA (nfit.au.dk and phys.au.dk) and from "eduroam" wireless at IFA you log in to lifa with your NFIT username and your NFIT password.
From the outside world you login with a pair of RSA keys: a public key and a private key. They both are small pieces of ascii text. The private key should be kept on your private computer from which you login to lifa; the public key has to be added to your "authorized_keys" on lifa (as described below).
Another possibility to login from the outside world is VPN into the IFA's network. I do not do it, but some students used it with success.
If you are inside IFA—for example, your box is connected to IFA's wired network—login on lifa with your NFIT username and NFIT password using secure shell:
ssh your_username@lifa.phys.au.dk
where instead of "your_username" you have to type your actual NFIT
username. It might ask you whether you trust lifa – answer "yes"
without quotes. Then it will ask you for your password – type in
your NFIT 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 NFIT username and password. It might ask you whether you trust lifa – answer yes.
If you are outside IFA, you have to set up a pair of RSA keys – a private key and a public key. The public key has to be added to your authorized keys on lifa and the private key has to be kept privately on your private computer you will be loggin in from.
If you have already set up the keys, go to the next item.
Otherwise, the official instructions (also for PuTTY) are here in English and here in Danish. If you can't read them, here are the unofficial instructions for a Linux system:
If you don't have a suitable pair of personal RSA keys, create them with ssh-keygen command on a linux system (you can also do it on lifa itself by loggin in from within IFA with your NFIT username and password as described above) by issuing the following commands at the terminal
cd
ssh-keygen -t rsa
It will ask you for a passphrase which you have to make up and
remember – there is no way to restore the passphrase if you forget
it. The passphrase belongs to the key and has nothing to do with your
NFIT password. Do not use a blank passphrase!
If everything goes right, a private key, called "id_rsa", and a public key, called "id_rsa.pub" are generated in your .ssh directory.
The private key has to be kept in the .ssh directory of the computer you want to login from. The public key—which is simply a long line of ascii characters—has to be added to the file ".ssh/authorized_keys" on your lifa account.
If you have generated the keys on lifa itself and assuming you are connected to lifa from your private Linux box to be used to login from outside, do
cd ~/.ssh
cat id_rsa.pub >> authorized_keys
This will add the public key to the authorized keys on lifa. Now logout
from lifa with the exit command and copy the private key to
your private computer using the secure copy command (you probably need
to delete the lines with "biff" and/or "date" commands from you "~/.login"
and/or "~/.cshrc" and/or "~/.profile" files if it is there, because of
issuses
with talkative shell profiles)
scp your_username@lifa:/usr/users/your_username/.ssh/id_rsa ~/.ssh/
You can now login on lifa from outside IFA.
If you have generated the keys in the .ssh directory of your private Linux system, the private key is already where it has to be, and you only need to add the public key (the content of the "id_rsa.pub" file) to your "~/.ssh/authorized_keys" file on lifa. Copy the public key to a USB-drive or send it to yourself by email (it is public, so no security risk here).
Using a computer with a terminal emulator from IFA (for example, your own box inside IFA):
cd
cd .ssh
nano authorized_keys
Using a computer with X-windows system inside IFA. You can get one by booting an Ubuntu live USB or live CD on one of the public computers. Or, connect your Ubuntu box to the wired network at IFA.
-X option -- you need that to run Firefox on lifa:
ssh -X your_username@lifa
firefox --no-remote &
In this Firefox, go to your email, get your attachment, and save it in
your Desktop directory (or any other directory at your wish
-- the important thing is to remember the name of the directory).
cd
cd .ssh
cat ~/Desktop/id_rsa.pub >> authorized_keys
If you saved the file in another directory, you have to use the name of
that directory, of course.
After the public key had been added to authorized keys on lifa, all computers with the corresponding private key in the .ssh directory can ssh into lifa as
ssh your_username@lifa.phys.au.dk
It will ask you for the pasphrase of the public key.
Once you have logged in on lifa try
ssh your_username@molveno
Molveno is the dedicated server for numerical methods. Your home
directory is the same as on lifa.
Molveno should have more recent software as compared to lifa and I can install extra software on molveno should you need some.
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
Please use gedit on lifa only, molveno is a very old and underpowered box.
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. Otherwise synchronise the direcory with your fileserver and
check that you can see it in a browser.