String the apt-get commands with && instead of ;

Also `cd /tmp` before removing the temp directory that we would still
be in.