Update FreeBSD Using Proxy Server (csup / portsnap proxy update)

Question: How do I upgrade my FreeBSD server and ports tree using our proxy server, which requires username and password based authentication?


Answer: You have various choice under FreeBSD.

Use http_proxy shell variable

Linux / UNIX has environment variable called http_proxy. It allows you to connect text based session / application via the proxy server (bash compatible shell export syntax):
export http_proxy='http://user:password@server.ip.address:port/'
export http_proxy='http://vivek:myPassword@'

Now, you can run portsnap ports update utility or csup command easily:
# portsnap fetch update
# csup /path/to/supfile

prtunnel tunnels

If above method failed use prtunnel to set tunnels. It is a TCP connection through to a remote server using an HTTP or SOCKS5 proxy. It is useful if you are behind a proxy and want to use a program that doesn’t have native proxy support.

Install prtunnel tunnel proxy software

First, get access via proxy, enter:
# export http_proxy='http://user:password@'
Type the following command to install :
# cd /usr/ports/net/prtunnel
# make install clean

How do I use prtunnel?

Type the command as follows:
# prtunnel --password-prompt -t http -H -P 3128 -D 5999 cvsup1.FreeBSD.org 5999
It will prompt for proxy username and password. If you do not wish, prompt try as follows:
# prtunnel -u 'username' -p 'myPassword' -t http -H -P 3128 -D 5999 cvsup1.FreeBSD.org 5999
Once connected, open supfile:
# vi /path/to/supfile
And set default host to *default host=
*default host=localhost
*default host=
Save and close the file. After starting prtunnel like this, you could then point supfile to, and prtunnel will attempt to connect you to cvsup1.FreeBSD.org via the HTTP proxy server on a system named “” with given username and password. Now run csup, enter:
# csup /path/to/supfile

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

1 comment… add one
  • Olaf Mar 24, 2010 @ 12:22

    I do not think that csup honors these proxy variables. :-(

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.