Many new FreeBSD users face the problem when /usr/ports directory is missing just after OS installation is finished. Here are three ways from FreeBSD Handbook to obtain ports collection.

1. CVSup

Make sure /usr/ports is empty before you run CVSup for the first time! If you already have the Ports Collection present, obtained from another source, CVSup will not prune removed patch files.

  1. Install the net/cvsup-without-gui package:
    # pkg_add -r cvsup-without-gui

    After this package will be downloaded and installed.

  2. Run cvsup:
    # cvsup -L 2 -h cvsup.FreeBSD.org /usr/share/examples/cvsup/ports-supfile

    cvsup is usually located at /usr/local/bin directory. Change cvsup.FreeBSD.org to a CVSup server near you. See CVSup Mirrors for a complete listing of mirror sites.

     

  3. Running the cvsup command later will download and apply all the recent changes to your Ports Collection, except actually rebuilding the ports for your own system.

2. Portsnap

Portsnap is an alternative system for distributing the Ports Collection. It was first included in FreeBSD 6.0. On older systems, you can install it from ports-mgmt/portsnap package:

# pkg_add -r portsnap
  1. Since FreeBSD 6.1-RELEASE and with recent versions of the Portsnap port or package, you can safely skip this step. The /usr/ports will be created automatically at first use of the portsnap command. With previous versions of Portsnap, you will have to create an empty directory /usr/ports if it does not exists:
    # mkdir /usr/ports
  2. Download a compressed snapshot of the Ports Collection into /var/db/portsnap. You can disconnect from the Internet after this step, if you wish.
    # portsnap fetch
  3. If you are running Portsnap for the first time, extract the snapshot into /usr/ports:
    # portsnap extract

    If you already have a populated /usr/ports and you are just updating, run the following command instead:

    # portsnap update

3. Sysinstall

This method involves using sysinstall to install the Ports Collection from the installation media. Note that the old copy of Ports Collection from the date of the release will be installed. If you have Internet access, you should always use one of the methods mentioned above.

  1. As root, run sysinstall (/stand/sysinstall in FreeBSD versions older than 5.2) as shown below:
    # sysinstall
  2. Scroll down and select Configure, press Enter.
  3. Scroll down and select Distributions, press Enter.
  4. Scroll down to ports, press Space.
  5. Scroll up to Exit, press Enter.
  6. Select your desired installation media, such as CDROM, FTP, and so on.
  7. Scroll up to Exit and press Enter.
  8. Press X to exit sysinstall.

 

8 Comments

 

  1. October 8, 2007  10:16 pm by STEREO Reply

    Nice to get a freeBSD tip from a linux guy.

    I thought of giving up a semi-needed app installation for today after seeing absence of ports tree (wasn't really motivated to look in the handbook), but here - 'portsnap fetch' is about finishing its job while I'm typing this...

  2. October 9, 2007  8:20 am by artiomix Reply

    It's very nice to meet here fellow countryman, Sasha :)

  3. May 1, 2010  1:02 pm by Monty Rabelo Reply

    Fantastic. What a terrific website! I appreciate the time you have taken to post. Continue the excellent work.

  4. January 22, 2011  12:35 pm by Philadelphia auto insurance Reply

    I cant believe some of the places I have been taken to by stumblupon (just now this site) I was trying to pass a couple of dull hours away, when stumbleupon landed me here. What a tremendous site you have Im so delighted to have discovered it I have just spent the last twenty mins going through some of your articles, and have also bookmarked some of them. I will defiantly be back to learn a bit more when i have abit more time.

  5. April 21, 2011  12:59 pm by Music,Guitar,Ibanez,Fender,ESP,Songs,Lyric Reply

    I am so happy to read this. This is the kind of info that needs to be given and not the accidental misinformation that's at the other blogs. Appreciate your sharing this best doc.

  6. April 23, 2011  12:28 pm by Arnoldo Smetana Reply

    Wonderful post. I like how you bring in your own writing natural talent! Continue great work.

  7. May 18, 2011  9:36 pm by Dona Thomson Reply

    Korg PX5D Pandora Guitar and Bass Multi Effects Processor, A compact processor for guitar and bass, USB Interface capability, Famous Korg ‘REMS’ modeling technology. 180 variations of classic and cutting-edge guitar amps, bass amps, cabinets, classic and new effects.

  8. Pingback : Honoray cadets-Honor Respect Dedication

Leave a reply

 

Your email address will not be published.