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

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Leave a Reply

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

Previous Post

How to Make Website WCAG Compliant?

Next Post

Link download Kali Linux 2020.1 (ISO + Torrent)

Related Posts