Coming from my Linux background, I expected that after installing FreeBSD and choosing my geographical location – and, most importantly, choosing a local FTP mirror for the bootonly install CD –, somehow the system would "guess" that I'd want to keep the same location when doing further package installs - with pkg_add for instance. Unfortunately, pkg_add goes to the default ftp://ftp.freebsd.org package location and it can take a long time to install a package with lots of dependencies.
After fiddling around I found out there's an environment variable called PACKAGESITE that instructs pkg_add to go to a "package site" designated by the user.
The thing one needs to remember regarding PACKAGESITE is that it needs to containt the full URL to the "Latest/" directory on that FTP mirror.
First of all you will need the list of FreeBSD mirrors. Just pick up your mirror and then proceed to...
Exporting the variable. This depends of course on the shell you're using.
* If using the default csh shell, you will need to setenv:
setenv PACKAGESITE "ftp://ftp1.ro.freebsd.org/pub/FreeBSD/ports/packages/Latest/"
(for instance – just remember not to limit yourself to "ftp://ftpwhatever.country.freebsd.org" because it won't be enough; you need to enter the full path, up to "Latest/", and to also include the trailing slash!)
You obviously don't want to setenv every time you install a package, so you'll need to enter that line in your /root/.cshrc file:
echo 'setenv PACKAGESITE "ftp://ftp1.ro.freebsd.org/pub/FreeBSD/ports/packages/Latest/"' >> /root/.cshrc
* If you're using bash, you'll need to export the variable:
export PACKAGESITE="ftp://ftp1.ro.freebsd.org/pub/FreeBSD/ports/packages/Latest/"
Of course you don't want to do this every time you install a package, therefore you'll need to add this line in your /root/.bash_profile file:
echo 'export PACKAGESITE="ftp://ftp1.ro.freebsd.org/pub/FreeBSD/ports/packages/Latest/"' >> /root/.bash_profile
0 comments:
Post a Comment