When you are behind a proxy server on your ubuntu machine you have to edit (or create) your apt.conf to define the proxy settings:
Create (or edit) an apt.conf file at /etc/apt/apt.conf
Add the following line to this file:
If you have any special characters in your password you have to use the URL encoding syntax. For example a ! translates to %21.
The next time you use apt-get the proxy settings will be used.