Comment

A big note on port vs package versions and switching your PACKAGESITE environment

I had FreeBSD 8.2-RELEASE installed. In this case, the ports tree seemed to be the latest stuff, example it had nmap 5.61.t2 while my installed package (not port) was nmap 5.50. When I run pkg_search nmap I see nmap 5.61.t2, if I run pkg_add -r nmap It was already at version 5.50. When I try updating with portupgrade -aPP nmap it cannot find nmap-5.50 on the FTP site. This is because it is looking for ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.2-RELEASE/All/ which only has nmap 5.50 on it. So it seems that ports follow the 8-STABLE versions while your pkg_add is stuck back at 8.2-RELEASE. I think thats a bit strange, because pkg_version -v compares your packages to the port tree, so it says nmap is out of date, but the package is up to date with 5.50 but there is a new port, a bit confusing here.

Sooo, it seems it would be better to upgrade the entire system to user 8-STABLE. Unfortunately its not very easy to get off the -RELEASE version, you cannot simply use the freebsd-update command, that is only for -RELEASE versions (so freebsd-update -r 8-STABLE does NOT work). You have to to a bit of work, basically track a development branch, see http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/current-stable.html and http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html

You may want to try simply enabling pkg_add and portupgrade -aPP to use ftp packages from 8-STALBE by setting your PACKAGESITE environment variable to the proper ftp url. Edit your /root/.cshrc file and adding setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8-stable/Latest/ remember to adjust that i386 to your CPU architecture. Also edit in your users ~/.bash_profile (I like bash for users) by adding PACKAGESITE=ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8-stable/Latest/.

Many FreeBSD'ers say its simply better to install most of your applications with ports, and only use packages for the really big apps like KDE or OpenOffice... I may tend to agree. I don't really like compiling for hours when doing a software update, but you get newer packages.

Fixme
Add how to install info and man pages http://www.cyberciti.biz/tips/howto-install-man-info-pages-and-other-package-set.html

In fact, when doing a fresh install of FreeBSD, its really best to use sysinstall to simply select these distribution sets: base, kernels, info, man, src, ports or simply select "Standard" and "Developer" as the main installation (instead of minimal or custom...)

Info Summary[-][--][++]

FreeBSD is an advanced operating system for modern server, desktop, and embedded computer platforms.[1] This is only a brief crash course or introduction to a few of the import tasks in FreeBSD, mostly installing ports/packages, upgrading the system and navigating the file system.

FreeBSD maintains an incredible wealth of documentation on their website, see their Handbook for information. A great intro to FreeBSD can be found http://www.freebsd.org/doc/en/articles/linux-users/article.html

Exclamation3
Please note that I come mostly from Linux, so I tend to setup FreeBSD in a manner that is similar to my Linux environment (ie, bash vs csh...).

Each command in this topic starts with a # if it is meant to be run as the root user, or a $ (or no sign) if it is meant to be run as the regular user (your main user account)

Install Installation[-][--][++]

I won't go into much detail about installing FreeBSD, most of that can be obtained in their handbook. This topic assumes you have already downloaded a version of FreeBSD and installed it on your computer.

Though for this topic I am going to assume you did a 'Minimal' installation, no xorg or development tools, just plain minimal.

Config Initial Setup[-][--][++]

I tend to start off each post installation setup the same, configuring users, installing bash, installing ports, updating the system... This initial setup is very basic and does not take up too much disk space (minimal dependencies).

  1. Just after a minimal installation, reboot (of course) and login as root
  2. If you did not create an initial user (besides root) during the initial install, create one now
    1. # adduser and follow the basic user setup instructions. You should set your self in the wheel group and use any shell for now[2]
  3. Install a few basic packages with # pkg_add -r pkg_search portupgrade bash sudo nano
    Exclamation4
    If you get pkg_add errors about cannot find file on FTP site, you may have to change the PACKAGESITE environment variable. If your installing FreeBSD 8.2 or 8.x you probably want to run this command # setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8-stable/Latest/ Now run pkg_add -r... again [3]
  4. Now I like to set my main user account to use bash (Linux fan) (but not the root account, leave that at csh, see why), login as each user you want as bash (to logout of a user, type exit) and run chsh and set the shell to /usr/local/bin/bash
    Exclamation4
    The chsh command takes you to a text editor called vi, to edit the shell line, navigate to it with your arrow keys, go over to the first part of /bin/sh and press the DEL key until you are left with Shell:, then press i and insert /usr/local/bin/bash, to save press ESC, then type :wq and hit enter.

    1. Since my main user is in the wheel group, I like to allow all wheel group users to execute root commands using sudo, so add the wheel group to the /usr/local/etc/sudoers file by editing the file as root # vi /usr/local/etc/sudoers, a few pages down find the line # %wheel ALL=(ALL) NOPASSWD: ALL and remove the # pound sign (on that line, just hit the DEL key), now save by pressing ESC, then :wq
    2. Install the ports tree with # portsnap fetch then run # portsnap extract
    3. Update your system with # freebsd-update fetch then run # freebsd-update install

Download Software and Updates[-][--][++]

If you read the handbook you know that FreeBSD can install additional applications using the applications source code (ports), or by precompiled binary packages (packages). I find that there are usually more applications available in the ports collection than as packages, so I run a mix of both.

Installing and Updating Ports[-][--][++]

Remember ports are different than packages. When installing a port you download the apps source code, compile the source code, then install it. Ports take much longer to install than packages, and depending on the package, could take several hours/days to compile Smile

  1. Update your ports tree before installing any packages that day with portsnap fetch update
  2. Search for a port cd /usr/ports then make search name="fire*" or name search key="fire*"
    1. When you find the port you want in the search list, notice the name is actually a folder path, ex Port: www/firefox36
  3. Install port Method 1 (prefered)
    1. portinstall firefox36
  4. Install port Method 2
    1. Navigate to the desired ports directory cd /usr/ports/www/firefox36 then run sudo make install clean
  5. Find outdated ports (needs upgraded) pkg_version -v
  6. Upgrading all outdated ports sudo portupgrade -aP (note, this will try to upgrade the app via the package method first, if there is no package, it will use a port.)

Installing and Updating Packages[-][--][++]

  1. Search for a package pkg_search xxx
  2. Install package pkg_add -r xxx

Upgrading the Distro[-][--][++]

https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/updating-upgrading-freebsdupdate.html

Security Patches
Patches keep you on same 12.0 version but the p10 may change to p13 in uname -a. You can do this often as this is simply a patch upgrade.

freebsd-update fetch
freebsd-update install
reboot

Major and Minor Point Releases
A minor will upgrade from 12.0 to 12.1 for example. A Major will upgrade from 12.x to 13.x. Both can be accomplished here.
Example below upgrade from existing 12.0 to 12.1

freebsd-update -r 12.1-RELEASE upgrade
freebsd-update install
reboot
freebsd-update install
pkg-static upgrade -f
portmaster -afd
freebsd-update install
reboot

  1. Update all security patches for your current release sudo freebsd-update fetch then sudo freebsd-update install.
  2. Update Major and Minor base system release:
    1. sudo portsnap fetch update - Update ports tree
    2. sudo freebsd-update fetch
    3. sudo freebsd-update install
    4. sudo freebsd-update -r 8.X-RELEASE upgrade
    5. sudo freebsd-update install
    6. Reboot computer
    7. sudo freebsd-update install
    8. sudo portupgrade -aP - Upgrade all your ports
    9. sudo freebsd-update install - Final wrap up, possibly reboot after