What are the first commands I run after installing FreeBSD? Or How to patch FreeBSD? Or How to install ports on FreeBSD?
Ok, so you just installed FreeBSD, an maybe you are not familiar with it, so you think, “What now?”.
Well, think about what you do when you install any platform. You do three things:
- Apply patches/updates.
- Install software
- Post-installation configuration of system and software
For example, when you install a new windows operating system, it is common to go to Windows Update and update your server. Then you install software such as microsoft office, etc… The same for servers. You update the server, then maybe you add your server software. Then you configure it some more.
The order may vary for every install or you may even do this three step process multiple times.
Just because you are on FreeBSD does not mean the same three step process doesn’t apply. This three item process is operating system independent. It is the first thing I do on FreeBSD as well.
So here are the first commands that I run after logging into a new FreeBSD install.
Same commands in a nice script/code box you can use to copy and paste.
freebsd-update fetch freebsd-update install portsnap fetch portsnap extract
Let me explain what each command does:
freebsd-update fetch– This download patches that have been released for the version of FreeBSD you have installed. It does not install the patches.
freebsd-update install– This command installs the patches that were previously download.
portsnap fetch– This download a compressed version of the
Portsmeans applications that have been ported or developed to compile and run on FreeBSD. So the ports tree is basically a database of available software that can be install on FreeBSD.
portsnap extract– This extracts the compressed version of the ports tree.
So with these four commands you have your system updated/patched. You also have all the software that is available ready to be installed.
I am not sure why i didn’t know this before, but you can combine each pair of commands into one command:
freebsd-update fetch install portsnap fetch extract
Stay tuned for my article on searching the ports tree.
As you can read in the comments, it is good to know that you only have to “extract” the ports tree once and for every subsequent update to the ports tree, you should only run it with the “update” command as shown.
portsnap fetch update