Connect a ubuntu linux vm to an microsoft NTLMv2 proxy

In order to connect a ubuntu linux vm to a microsoft proxy server, several steps are involved to produce a working connection.

Several ubuntu versions (maybe a new version can do this automatically) are not able to connect to such a proxy without further tweaking.

The software which is needed to perform the NTLM authentication is named Cntlm.
It can be found here:
http://sourceforge.net/projects/cntlm/files/cntlm/cntlm%200.92.3/cntlm-…

Download the latest version, untar and compile it using the default settings:
./configure --prefix=/url/local
make && make install

After the installation was finished, try to execute it and check if it was built successfully.
Then, execute the following command:
cntlm -u user@DOMAIN -M http://microsoft.com proxy.domain.com:8080

You will be asked for the password and if the command performs successfully, a authentication mechanism und a password hash will be displayed.

Edit the file /etc/cntlm.conf and change the following values:
Username your_username
Domain your_domain
Workstation name_of_the_host_workstation

Proxy proxy.domain.com:8080

The Password and second Proxy entry should be commented out.
Change/add the following values in the file below:
Auth NTLMv2
PassNTLMv2 your_password_hash

Save the file and start the cntlm command as root. The program will listen to port 3128 by default.

Change the Ubuntu Settings:
System->Preferences->Network Proxy
to use a manual proxy configuration and use 127.0.0.1 with port 3128 as proxy for all connections. The user/password should be empty, since the cntlm does the authentication. Apply the settings system-wide and you can now use apt, wget and other programs requiring internet connection.