The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]

Things look quiet here. But I've been doing a lot of blogging at dan.langille.org because I prefer WordPress now. Not all my posts there are FreeBSD related. I am in the midst of migrating The FreeBSD Diary over to WordPress (and you can read about that here). Once the migration is completed, I'll move the FreeBSD posts into the new FreeBSD Diary website.

Installing a port without installing the ports 14 January 2000
Need more help on this topic? Click here
This article has 1 comment
Show me similar articles
Let'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 situation
Someone 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 tarball
The 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
total 7
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:

cd /usr/ports/net/bind8
make clean
cd ..
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 did
They 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 tarball
Here'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.
Password:
230-Welcome to wcarchive - home FTP site for Walnut Creek CDROM.
230-There are currently 4915 users out of 5000 possible.
230-
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)
ftp> exit

A short hand version of this is:

fetch ftp://ftp.freebsd.org/pub/FreeBSD/ports/ports/net/bind8.tar

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/.
mkdir /usr/ports
mkdir /usr/ports/net
mv bind8.tar.gz /usr/ports/net
cd /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 port
Now that you have the tarball and unzipped it. go into the directory and make it.
cd /usr/ports/net/bind8
make
OH OH!  we forgot something
If 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
Mk/
Mk/bsd.port.mk
Mk/bsd.port.post.mk
Mk/bsd.port.pre.mk
Mk/bsd.port.subdir.mk
Then try the make again
If 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.


Share
Need more help on this topic? Click here
This article has 1 comment
Show me similar articles