I recently setup a new FreeBSD 6.2 server, only to find the following:
server# cd /usr/ports
/usr/ports: No such file or directory.
I panicked a little bit, as I’ve not setup a freeBSD server in a while, so I tried to recall what I did last time.
I remembered that all I did last time was use “cvsup”, however…
cvsup: Command not found.
Here’s the deal… apparently the “cvsup” command is no longer used, and instead we’ve now got “csup“, which apparently is a rewrite of cvsup in C. This can be quite confusion if you were not aware of the change (like myself).
Now we know this we can log in as the “root” user, and setup the ports:
First of all, copy the example “ports-supfile” (needed for csup) to your root directory.
server# cp /usr/share/examples/cvsup/ports-supfile /root/ports-supfile
Now we run the csup command:
server# csup /root/ports-supfile
Name lookup failure for “CHANGE_THIS.FreeBSD.org”: hostname nor servname provided, or not known
Obviously there’s a problem. We need to edit the “ports-supfile” and change the host, or do we…?
Usage: csup [options] supfile
-1 Don’t retry automatically on failure (same as “-r 0”)
-4 Force usage of IPv4 addresses
-6 Force usage of IPv6 addresses
-A addr Bind local socket to a specific address
-b base Override supfile’s “base” directory
-c collDir Subdirectory of “base” for collections (default “sup”)
-d delLimit Allow at most “delLimit” file deletions (default unlimited)
-h host Override supfile’s “host” name
-i pattern Include only files/directories matching pattern.
May be repeated for an OR operation. Default is
to include each entire collection.
-k Keep bad temporary files when fixups are required
-l lockfile Lock file during update; fail if already locked
-L n Verbosity level (0..2, default 1)
-p port Alternate server port (default 5999)
-r n Maximum retries on transient errors (default unlimited)
-s Don’t stat client files; trust the checkouts file
-v Print version and exit
-z Enable compression for all collections
-Z Disable compression for all collections
We can use the -h option of csup to supply a host override, we now just need to find a cvsup host to use. Select one that is closest to your server, for example, my server is in the UK, so I would use “cvsup.uk.FreeBSD.org”. You could also use fastest_cvsup, to find the fastest one for you.
Now we issue the command again, but now with the -h option:
server# csup -h cvsup.uk.FreeBSD.org /root/ports-supfile
And with any luck, providing your server has an internet connection the process should begin.
Note: I hate using the “vi” editor and since this system hasn’t got ports yet, I can’t install my preferred editor “nano”, once I have nano installed via ports, I would edit the ports-supfile with the selected cvsup hostname, meaning I do not have to supply one in the future when I come to update the ports.
Hope this helps somebody!