HostOnNet Blog

FreeBSD – A revisit after 10 years

Looking for Linux Server Admin or WordPress Expert? We can help.

During 2004-2006 we used FreeBSD on all our servers for security reason. They worked properly in most party. During that time Cpanel control panel did supported FreeBSD. Later Cpanel stopped supporting FreeBSD, we switched to Linux.

Since i am running Linux on my desktop, there is no reason to look back to FreeBSD. Today i decided to try FreeBSD. I almost forget most of the FreeBSD commands, i need a quick refresher.

Lets find out what version of FreeBSD we are running.

root@boby:~ # uname -a
FreeBSD boby 11.0-RELEASE-p2 FreeBSD 11.0-RELEASE-p2 #0: Mon Oct 24 06:55:27 UTC 2016     [email protected]:/usr/obj/usr/src/sys/GENERIC  amd64
root@boby:~ # 

Installing Software

Software is installed with pkg or ports. As far as i remember, pkg use binary package like yum, apt, dnf etc.. ports compile software from source. I remember installing Apache, PHP from ports, that take like 15 to 20 minutes, then break for some reason… splitting out all PHP code to your web site visitors. Hope all of this works good now.

Installing Software with pkg

Lets install nmap with pkg

root@boby:~ # pkg install nmap
Updating FreeBSD repository catalogue...
Fetching meta.txz: 100%    944 B   0.9kB/s    00:01    
Fetching packagesite.txz: 100%    6 MiB   1.2MB/s    00:05    
Processing entries: 100%
FreeBSD repository update completed. 25746 packages processed.
The following 2 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	nmap: 7.40
	pcre: 8.39_1

Number of packages to be installed: 2

The process will require 28 MiB more space.
6 MiB to be downloaded.

Proceed with this action? [y/N]: y
Fetching nmap-7.40.txz: 100%    5 MiB   1.1MB/s    00:05    
Fetching pcre-8.39_1.txz: 100%    1 MiB 569.7kB/s    00:02    
Checking integrity... done (0 conflicting)
[1/2] Installing pcre-8.39_1...
[1/2] Extracting pcre-8.39_1: 100%
[2/2] Installing nmap-7.40...
[2/2] Extracting nmap-7.40: 100%
root@boby:~ # 

Searching for Available Software Packages

To search for available software, use command pkg search SOFTWARE-NAME

Lets search for PHP 7.0

pkg search php7

Upgrading All Installed software

This is like apt/yum, almost exact commands.

pkg update
pkg upgrade

update will update software index from repository. pkg upgrade downloads and install latest software.

root@boby:~ # pkg update
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
root@boby:~ #

Lets do a pkg upgrade

root@boby:~ # pkg upgrade
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
Checking for upgrades (3 candidates): 100%
Processing candidates (3 candidates): 100%
The following 2 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
	curl: 7.52.1_1 -> 7.53.0
	ca_root_nss: 3.28.1 -> 3.29.3

Number of packages to be upgraded: 2

1 MiB to be downloaded.

Proceed with this action? [y/N]: y
Fetching curl-7.53.0.txz: 100%    1 MiB 276.2kB/s    00:04    
Fetching ca_root_nss-3.29.3.txz: 100%  335 KiB 342.9kB/s    00:01    
Checking integrity... done (0 conflicting)
[1/2] Upgrading ca_root_nss from 3.28.1 to 3.29.3...
[1/2] Extracting ca_root_nss-3.29.3: 100%
[2/2] Upgrading curl from 7.52.1_1 to 7.53.0...
[2/2] Extracting curl-7.53.0: 100%
Message from ca_root_nss-3.29.3:
********************************* WARNING *********************************

FreeBSD does not, and can not warrant that the certification authorities
whose certificates are included in this package have in any way been
audited for trustworthiness or RFC 3647 compliance.

Assessment and verification of trust is the complete responsibility of the
system administrator.

*********************************** NOTE **********************************

This package installs symlinks to support root certificates discovery by
default for software that uses OpenSSL.

This enables SSL Certificate Verification by client software without manual
intervention.

If you prefer to do this manually, replace the following symlinks with
either an empty file or your site-local certificate bundle.

  * /etc/ssl/cert.pem
  * /usr/local/etc/ssl/cert.pem
  * /usr/local/openssl/cert.pem

***************************************************************************
root@boby:~ # 

Software upgrade is done, we get a NOTE from FreeBSD after upgrade.

Getting pkg help

You can get help with command pkg help

root@boby:~ # pkg help
Usage: pkg [-v] [-d] [-l] [-N] [-j |-c |-r ] [-C ] [-R ] [-o var=value] [-4|-6]  []
Global options supported:
	-d             Increment debug level
	-j             Execute pkg(8) inside a jail(8)
	-r             Execute pkg(8) using relocating installation to 
	-c             Execute pkg(8) inside a chroot(8)
	-C             Use the specified configuration file
	-R             Directory to search for individual repository configurations
	-l             List available commands and exit
	-v             Display pkg(8) version
	-N             Test if pkg(8) is activated and avoid auto-activation
	-o             Override configuration option from the command line
	-4             Only use IPv4
	-6             Only use IPv6

Commands supported:
	add            Compatibility interface to install a package
	alias          List the command line aliases
	annotate       Add, modify or delete tag-value style annotations on packages
	audit          Reports vulnerable packages
	autoremove     Removes orphan packages
	backup         Backs-up and restores the local package database
	check          Checks for missing dependencies and database consistency
	clean          Cleans old packages from the cache
	config         Display the value of the configuration options
	convert        Convert database from/to pkgng
	create         Creates software package distributions
	delete         Deletes packages from the database and the system
	fetch          Fetches packages from a remote repository
	help           Displays help information
	info           Displays information about installed packages
	install        Installs packages from remote package repositories and local archives
	lock           Locks package against modifications or deletion
	plugins        Manages plugins and displays information about plugins
	query          Queries information about installed packages
	register       Registers a package into the local database
	remove         Deletes packages from the database and the system
	repo           Creates a package repository catalogue
	rquery         Queries information in repository catalogues
	search         Performs a search of package repository catalogues
	set            Modifies information about packages in the local database
	ssh            Package server (to be used via ssh)
	shell          Opens a debug shell
	shlib          Displays which packages link against a specific shared library
	stats          Displays package database statistics
	unlock         Unlocks a package, allowing modification or deletion
	update         Updates package repository catalogues
	updating       Displays UPDATING information for a package
	upgrade        Performs upgrades of packaged software distributions
	version        Displays the versions of installed packages
	which          Displays which package installed a specific file

Commands provided by plugins:

For more information on the different commands see 'pkg help '.
root@boby:~ # 

List All Installed Software versions

Use pkg version command to use all installed software and its version

root@boby:~ # pkg version
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
ca_root_nss-3.29.3                 =
curl-7.53.0                        =
dmidecode-3.0                      =
e2fsprogs-1.43.4                   =
gettext-runtime-0.19.8.1_1         =
gpart-0.1h_2                       =
indexinfo-0.2.6                    =
jq-1.5                             =
libffi-3.2.1                       =
libiconv-1.14_10                   =
libnghttp2-1.18.0                  =
libxml2-2.9.4                      =
nmap-7.40                          =
oniguruma5-5.9.6_1                 =
pcre-8.39_1                        =
php70-7.0.16                       =
pkg-1.9.4_1                        =
py27-Babel-2.3.4                   =
py27-Jinja2-2.8                    =
py27-MarkupSafe-0.23               =
py27-boto-2.45.0                   =
py27-cheetah-2.4.4_1               =
py27-cloud-init-0.7.6              =
py27-configobj-5.0.6_1             =
py27-jsonpatch-1.9                 =
py27-jsonpointer-1.9               =
py27-markdown-2.6.5                =
py27-oauth-1.0.1_2                 =
py27-prettytable-0.7.2_2           =
py27-pytz-2016.10,1                =
py27-requests-2.11.1               =
py27-serial-3.2.1                  =
py27-setuptools27-32.1.0           =
py27-six-1.10.0                    =
py27-yaml-3.11_2                   =
python27-2.7.13_1                  =
readline-6.3.8                     =
rsync-3.1.2_6                      =
sudo-1.8.19p2                      =
vim-lite-8.0.0134_1                =
root@boby:~ # 

Continued at FreeBSD – A revisit after 10 years (part 2)

Posted in FreeBSD

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.