# using pkg behind proxy



## andrewm659 (Jun 30, 2016)

How can I set this up so that I can do `sudo pkg install packagename` as a normal user.

In RHEL I would put an entry in the /etc/yum.conf for the proxy.


----------



## ShelLuser (Jun 30, 2016)

What kind of proxy are we talking about? A lot of proxies will easily work when the systems default route has been pointed to said proxy.


----------



## andrewm659 (Jun 30, 2016)

Most likely a squid proxy.


----------



## SirDice (Jun 30, 2016)

pkg(8) uses fetch(3):

```
HTTP_PROXY          URL of the proxy to use for HTTP requests.  The docu-
                         ment part is ignored.  Only HTTP proxies are sup-
                         ported for HTTP requests.  If no port number is spec-
                         ified, the default is 3128.

                         Note that this proxy will also be used for FTP docu-
                         ments, unless the FTP_PROXY variable is set.

     http_proxy          Same as HTTP_PROXY, for compatibility.
```

Also read pkg.conf(5):

```
pkg_env: {
               http_proxy: "http://myproxy:3128",
           }
```


----------



## SirDice (Jun 30, 2016)

ShelLuser said:


> A lot of proxies will easily work when the systems default route has been pointed to said proxy.


So-called "transparent" proxies, yes. But most proxies I've come across aren't transparent.


----------

