# HOWTO: Install PC-BSD PBIs on FreeBSD



## nickednamed (Oct 16, 2012)

This "HOWTO" hopes to explain and demonstrate how to make basic use of PC-BSD's ports-mgmt/pbi-manager to *install, update and delete* PC-BSD PBI style packages on FreeBSD. I may update this later to include changing the default repository and creating your own PBI files, if I ever do that myself.

*Contents*

*1. Introduction*
-   a. What is a PBI?
-   b. Why would I want to use PBIs?
-   c. What is ports-mgmt/pbi-manager?
*2. Installation*
-   a. From ports or packages
-   b. Setup and configuration
*3. How to use ports-mgmt/pbi-manager*
-   a. Find / check a repository
-   b. Find an application to install
-   c. Install your chosen application
-   d. Upgrade application(s)
-   e. Remove application(s)

*1. Introduction*

*A. What is a PBI?*
A PBI is an application packaging format first implemented on PC-BSD as part of its package management system, both of which are now available on FreeBSD via the ports-mgmt/pbi-manager application.

*B. Why would I want to use PBIs instead of regular FreeBSD ports/packages?*

Of course, to really learn FreeBSD I wholeheartedly recommend the ports system both for the knowledge and skills it provides and also for fine-grain control over your applications. However, I think that PBIs do in fact serve a very useful purpose on FreeBSD.

PBIs are self-contained application packages containing all the files and libraries needed to run that application. The purpose of this is to separate the base system from the applications it runs as much as possible in order to protect the system from such problems as: broken ports and packages; broken, missing and/or incompatible libraries; botched un/installations; tricky updates and so-called "dependency hell". 

I personally use it for testing and running large, rarely needed, complicated graphical applications which require a large number of dependencies, toolkits and libraries, such as editors/libreoffice and deskutils/calibre. In this way, I can avoid lengthy, complicated and problematic install/update/deletion procedures and keep my base system as clean and unchanged as possible.


*C. What is ports-mgmt/pbi-manager?*
PBI Manager is a suite of command line utilities which can be used to find, install, remove, create, update and generally manage PBIs and their repositories. PBI manager features the following tools (but not only) which I hope to explain in this HowTo: pbid, pbi_add, pbi_browser, pbi_delete, pbi_info, pbi_update. For a full list see PC-BSD PBI Manager page


*2. Installation*

*A. Install ports-mgmt/pbi-manager via the ports system:*
`# cd /usr/ports/ports-mgmt/pbi-manager`
`# make install clean`

Or install via packages:
`# pkg_add -r pbi-manager`


*B. Configuration*
In order to use ports-mgmt/pbi-manger you should have the PBI daemon running:
`# /usr/local/etc/rc.d/pbid start`

To have the PBI daemon run on system startup add the PBI daemon to /etc/rc.conf:
`# echo 'pbid_enable="YES"' >> /etc/rc.conf`

If the pbid daemon is running, the repository's index and meta files will be automatically fetched and made ready for browsing.


*3. How to use ports-mgmt/pbi-manager*

*A. Find / check the official PC-BSD repository using pbi_listrepo:*
`# pbi_listrepo` This should give you:

```
[ID]  [Description]
-----------------------------------------------------
001 Official PC-BSD Repository
```


*B. Find an application to install by name using pbi_browser:*
`# pbi_browser -s APPLICATION_NAME`.

For example `# pbi_browser -s libreoffice` gives the output: 
	
	



```
Using RepoID: 001
Searching for: libreoffice
------------------------------------
Application: LibreOffice
Version: 3.5.6
Created: 20120907 220121
RootInstall: NO
Arch: i386
Author: The Document Foundation
URL: http://www.libreoffice.org/
License: GPL
Type: Graphical
Keywords: Office,Word,Excel,SpreadSheet,Access,PowerPoint
Icon: /var/db/pbi/repo-icons/dd3920955c2fcf9bcc66b20dc0d89354-LibreOffice.png
Description: LibreOffice is the free power-packed Open Source personal productivity suite
for Windows, Macintosh and Linux, that gives you six feature-rich applications for all
your document production and data processing needs: Writer, Calc, Impress, Draw, Math and Base.

To install this PBI:
# pbi_add --rArch i386 --repo 001 -r LibreOffice
```

Or alternatively use the following options:
`# pbi_browser -c CATEGORY` to list all applications listed in a specified category.

`# pbi_browser --listcats` to list all available categories in your chosen repository.

`# pbi_browser --viewall` to list all PBIs in a given repository.

These options can be rather slow and cumbersome as they produce very many lines of text, however in this case, /usr/bin/grep is your friend 


*C. Install your chosen PBI using [pbi_add[/file]:*
`# pbi_add -r PACKAGE_NAME`

Your systems architecture should be chosen automatically, and the PBI daemon should cycle through your listed repositories until the application you have specified is found. You could however, specify the architecture and the repository to be used with the --rArch and --repo options respectively:
`# pbi_add --rArch i386 --repo 001 -r LibreOffice`


*D. Upgrade PBIs using pbi_update:*
Check a specified PBI for updates: `# pbi_update -c PBI_NAME`

Check all PBIs for updates: `# pbi_update --check-all`

Update a specified PBI: `# pbi_update PBI_NAME`

Update all PBIs: `# pbi_update --update-all`

You can also use the --enable-auto and --disable-auto options to enable or disable automatic updates of a specified PBI.


*E. Remove a PBI using pbi_delete:*
In order to remove a PBI from your system, the full name and version of the PBI should be given. An easy way to find this is to use pbi_info:
`% pbi_info`. This will give you an output like:
	
	



```
libreoffice-3.5.6-i386
```
Then you can run the uninstall command:
`# pbi_delete libreoffice-3.5.6-i386`


References:
PC-BSD PBI Manager page


----------

