Saturday, August 7, 2010

Debian: How to apt-pinning

I am currently using debian testing but in some cases I needed to install newer versions of some packages which were only available in unstable (e.g. nvidia's driver). Therefore, I had to set up apt-pinning.

First of all you need to add the unstable repos in the /etc/apt/sources.list

deb http://ftp.debian.org/debian/ unstable main contrib non-free

Then edit /etc/apt/apt.conf and add the following line:

APT::Default-Release "testing";

Edit the /etc/apt/preferences file and add:

Package: *
Pin: release a=testing
Pin-Priority: 700

Package: *
Pin: release a=unstable
Pin-Priority: 500

For more info about the preferences take a look at apt_preferences man page.

Finally, run apt-get update

You can now install packages from unstable using the -t unstable option. For example,

apt-get install -t unstable iceweasel

You must be very careful while doing this and watch out for the dependencies that may be installed in order to avoid breaking packages already installed from testing. It may be useful to run apt-get install -t unstable -s iceweasel which just simulates the installation of the package without affecting the system to review any dependencies and upgrades.


Debian: How to mount a windows samba share

A couple of days ago I was trying to use file space that my university provides on my laptop running debian linux. This guide does not only apply for the so-called "H: drive" of Imperial College but for all windows shares.

First of all, you need to install the following packages: smb-client and smbfs. Create a directory in your home directory that will be used for mounting the samba share. (mkdir ~/samba)

Then edit the /etc/fstab file by adding a row like this:

serverURL mountPoint smbfs username=XXXX,user,noauto 0 0

The username=XXXX part is for logging in to the remote sever. If no login is requred then it can be ommited. The user option allows for mounting the directoy without root privileges and noauto specifies that it won't be mounted automatically during startup.
The line should look like this:

//server/myDirectory/ /home/antonis/samba smbfs username=XXX,user,noauto 0 0

Then you can mount the directory using mount ~/samba. If a password is required you will prompted to type it. Once done unmount it by: umount ~/samba

Note: to access you Imperial H drive you should use the VPN service.