Sometimes when you are behind corporate or university network you might
need to setup HTTP/HTTPS proxy settings to access the Internet. Setting up proxy on linux is simple enough, you just need to export environment variables , you can add to your shell configuration file.
But when you’ll try to run your package manager with sudo , these variables will not be passed onto root. This becomes particularly annoying when you have to use AUR repository and it would not build packages in root and when you try to run it with unprivileged user, it fails to download dependencies via pacman. There are two methods to fix this.
Run to following command to edit sudoers file1$ sudo visudo
add the following line1Defaults env_keep += "https_proxy http_proxy"
this way $https_proxy and $http_proxy will be passed onto root by sudo.
Also make sure you have set environment variables for current user. If
not then you can add it by editing .bashrc if you use bash or
~/.config/fish/config.fish if you use fish like me.
You also directly set proxy for pacman by editing /etc/pacman.conf
- open pacman config file by1$ sudo nano nano /etc/pacman.conf
uncomment XferCommand so that it looks like
save it and then open /etc/wgetrc
and uncommand the following lines so that it looks like
This should make pacman run via sudo.
For other applications like firefox you can set proxy directly through
Preferences > Advanced > Network > Settings
and for chrome / chromium you’d need to pass argument to use proxy like
Most of the things which need internet and work over http/https proxy should work now.