Installing a port without installing the portsLet’s say you suddenly discover that you need to upgrade a port, but you don’t have the port skeletons installed. What are you going to do? This article talks about how we managed to do that.
If you want to update a port collection, try reading Updating the ports collection.
The situationSomeone wanted to upgrade their version of bind8 but they didn’t have the port skeletons installed and time was important. I’ve found it takes up to an hour to install the port skeletons. My first option was to upgrade using cvsup, but he didn’t have that installed either. So we went for another option.
I suggest you read http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html
Getting the tarballThe first thing you need for any port is the tarball for that port. This tarball contains the basic things required to build a port. Here is a short example of what is needed:
[root@fred:/usr/ports/net/bind8] # ls -l
drwxr-xr-x 2 root wheel 512 Dec 24 18:26 CVS
-rw-r--r-- 1 root wheel 1047 Nov 15 14:03 Makefile
-rw-r--r-- 1 root wheel 710 May 18 1999 README.html
drwxr-xr-x 3 root wheel 512 Dec 24 18:26 files
drwxr-xr-x 3 root wheel 512 Dec 24 18:26 patches
drwxr-xr-x 3 root wheel 512 Dec 24 18:26 pkg
Here is what I did to give him the tarball:
tar cfz bind8.tar.gz bind8/
mv bind8.tar.gz /var/ftp/pub
I did the make clean so I wasn’t sending them the .obj files and the binaries. Then I used tar to create a taball and moved that to my ftp directory. This allowed the person to grab the tarball from my box.
What they didThey grabbed the tarball from my box by doing this:
$ fetch ftp://ftp.myftpserver.org/pub/bind8.tar.gz
Receiving bind8.tar.gz (3616 bytes): 100%
3616 bytes transfered in 0.7 seconds (5.00 Kbytes/s)
The better way to get the tarballHere’s a better way to get the tarball if you can’t get it from someone else. And I’d recommand this method rather than the above unless you trust the person in question.
$ ftp ftp.freebsd.org
Connected to wcarchive.cdrom.com.
220 wcarchive.cdrom.com FTP server ready.
Name (ftp.freebsd.org:dan): ftp
331 Guest login ok, send your email address as password.
230-Welcome to wcarchive - home FTP site for Walnut Creek CDROM.
230-There are currently 4915 users out of 5000 possible.
230 Guest login ok, access restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd /pub/FreeBSD/ports/ports/net
250 CWD command successful.
ftp> get bind8.tar
local: bind8.tar remote: bind8.tar
200 PORT command successful.
150 Opening BINARY mode data connection for 'bind8.tar'.
226 Transfer complete.
14336 bytes received in 0.30 seconds (46.39 KB/s)
A short hand version of this is:
Note that the above will not work on all FTP servers. But it does work on ftp.freebsd.org.
What about this tarball?You could use this tarball anywhere, but I suggest you stick with the port convention and put it under the /usr/ports tree. In this example, the tarball would go into /usr/ports/net/.
mv bind8.tar.gz /usr/ports/net
tar xvf bind8.tar.gz
Originally, I had the options in the tar command as "xvfz". But that won’t work as Mark Ma pointed out. Thanks. The "z" option is for compression. But the above tarballs are not compressed.
Make the portNow that you have the tarball and unzipped it. go into the directory and make it.
OH OH! we forgot somethingIf you get this message when doing the make:
"/usr/share/mk/bsd.port.mk", line 2: Could not find /usr/ports/Mk/bsd.port.mk
make: fatal errors encountered -- cannot continue
Do this (if you are behind a firewall, you may need to do a "fetch -P" instead of just "fetch"):
# cd /usr/ports
# fetch ftp://ftp.freebsd.org/pub/FreeBSD/ports/ports/Mk.tar
fetch: pub/FreeBSD/ports/ports/Mk.tar: cannot get remote modification time
Receiving Mk.tar: 95 Kbytes
97280 bytes transfered in 16.5 seconds (5.76 Kbytes/s)
# tar xvf Mk.tar
Then try the make againIf you try the make again, and find you can’t fetch the files, it may be because of your firewall. See make – and how to use it behind a firewall.
But that should allow you to build that port you wanted so badly.