I can't add PPA repository behind the proxy

Solution 1:

Workaround if apt-get still works behind the proxy

  • add sources manually to /etc/apt/sources.list
  • add gpg key

Adding sources manually

I think on launchpad.net every ppa still contains a small description how to add sources manually. The launchpad site for your mentioned ppa ppa:nilarimogard/webupd8 is https://launchpad.net/~nilarimogard/+archive/webupd8. If you scroll down you see an expandable label Technical details about this PPA. If you expand it you find the description how to add sources manually. Add the following lines to mentioned /etc/apt/sources.list

deb http://ppa.launchpad.net/nilarimogard/webupd8/ubuntu quantal main 
deb-src http://ppa.launchpad.net/nilarimogard/webupd8/ubuntu quantal main 

Of course you have to adjust quantal to whatever version you are currently using.

Adding the Signing Key

The description also contains a signing key. This is important, so that your system can always verify that you actually access a trustworthy ppa-address. In case of your ppa that is 1024R/4C9D234C(can also be found under Technical details about this PPA), where the number behind the slash is important. You can add the fingerprint via the apt-key program. Typically you would perform the following command

 sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 4C9D234C

Adding if apt-key doesn't work through proxy

Since you already had problems with the add-apt-repository program this might not work either. So instead you can download and add the 1024 Bit key manually. If wget works you can do that in one step.

wget "http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0x531EE72F4C9D234C" -O out && sudo apt-key add out && rm out

Otherwise safe "http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0x531EE72F4C9D234C" in e.g. /path/key and use sudo apt-key add /path/key to add it.

Close with the usual

Afterwards you have to update the repository information apt-get update and then you should be able to download the packages.

Resources

My personal favorite on how to use the packaging mechanism (sadly in German): http://wiki.ubuntuusers.de/Paketquellen_freischalten/PPA

The launchpad version also mentions all the important points: https://help.launchpad.net/Packaging/PPA/InstallingSoftware

Since it is untypical to use apt-key in the described way I only found the information in the man pages, man apt-key.

Related answer that pretty much describes the standard way to install ppa's manually: https://askubuntu.com/a/38029/128349

Solution 2:

Actually it seems to be much easier than the answer posted previously. You just need "sudo" to know that you are behind a proxy and it will work effortlessly. To do this, you need to export your proxy for http and https the way you usually do:

export http_proxy=http://username:password@host:port/
export https_proxy=https://username:password@host:port/

and then add Defaults env_keep="https_proxy" to then end of /etc/sudoers file. After this you should be able to add the ppa using the command:

sudo add-apt-repository ppa:the_ppa_you_want_to_add

or use

sudo -E add-apt-repository ppa:the_ppa_you_want_to_add

if you don't want to modify /etc/sudoers file. The -E option exports environment variables to the sudo user.

I have given a detailed description about this here on my blog.

Solution 3:

Make sure apt proxy is set like below

sudo vi /etc/apt/apt.conf

add following proxy settings and save the file

Acquire::http::proxy "http ://proxy.company.com:port/";
Acquire::https::proxy "https ://proxy.company.com:port/";
Acquire::ftp::proxy "ftp://proxy.company.com:port/";

in addition export following in Terminal before you run the command

export http_proxy=http ://proxy.company.com:port/
export https_proxy=https ://proxy.company.com:port/

This should work.