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

by Vivek Gite [Last updated: November 19, 2008]

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@10.10.20.5:3128/'

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@10.10.1.55:3128/'
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 10.10.1.53 -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 10.10.1.53 -P 3128 -D 5999 cvsup1.FreeBSD.org 5999
Once connected, open supfile:
# vi /path/to/supfile
And set default host to *default host=127.0.0.1:
*default host=localhost
OR
*default host=127.0.0.1
Save and close the file. After starting prtunnel like this, you could then point supfile to 127.0.0.1, and prtunnel will attempt to connect you to cvsup1.FreeBSD.org via the HTTP proxy server on a system named "10.10.1.53" with given username and password. Now run csup, enter:
# csup /path/to/supfile

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 0 comments… add one now }

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Tagged as: , , , , , , , ,

Previous post: Exim Remove All messages From the Mail Queue

Next post: VSFTPD: Force Upload Only No Downloads