Packages and Ports management
Remarks#
Tips:
- Remember to always check the
/usr/ports/UPDATINGfile before upgrading. There might be some significant changes in programs you use or in their configuration which will break your current setup.
Getting Ports tree
Portsnap
portsnap fetch
portsnap extractupdating ports tree with portsnap
portsnap updateschedule cron job for daily updates
0 3 * * * root /usr/sbin/portsnap cronSVN
head
cd /usr/ports
svnlite checkout https://svnweb.freebsd.org/ports/head .quaterly
FreeBSD Ports team freeze ports tree every 3 months. To get this ports tree you can use ports branches:
cd /usr/ports
svnlite checkout https://svnweb.freebsd.org/ports/branches/2016Q4 .Tarball (http or ftp)
cd /usr/ports
fetch https://ftp.freebsd.org/pub/FreeBSD/releases/amd64/11.0-RELEASE/ports.txz
tar xJvf ports.txzGit
git clone https://github.com/freebsd/freebsd-portsSearching software
keyword search
cd /usr/ports
make search key=apachename search
cd /usr/ports
make search name=apache24Using fresports
Official FreeBSD ports website (https://freshports.org/) give you a nice way to find ports and all information concerning it.
Building and installing software
If you have found your software in the ports tree, now its the time to build it.
Simple build and install with manual configuration
cd /usr/ports/www/apache24
make
make installSimple build and install with automatic configuration
cd /usr/ports/www/apache24
make BATCH=yes
make installConfiguring software sources
If you want custom configuration from ports, you can configure it before building it make config. All ports configuration are stored in /var/db/ports/${CATEGORY_NAME}/options as makefile.
Configuring www/apache24
cd /usr/ports/www/apache24
make config
make
make installThis configuration will be saved in /var/db/ports/www_apache24/options.
Packaging
Manual packaging
You can make your own package based on ports.
cd /usr/ports/www/apache24
make package BATCH=yesThis command will store your package in /usr/ports/packages/All.
Using poudriere
poudriere is currently the official package builder for FreeBSD.
Installing poudriere
pkg install poudriere
# or
cd /usr/ports/ports-mgmt/poudriere
make
make installConfiguring poudriere
poudriere configuration is stored in /usr/local/etc/poudriere.conf and /usr/local/etc/poudriere.d
Deploying poudriere jail
poudriere jail -c -j myjailUpdating poudriere jail
poudriere jail -u -j myjailDeploying poudriere ports tree
poudriere ports -c -p myportsUpdating poudriere ports tree
poudriere ports -u -p myportsBulk build
poudriere bulk -j myjail -p myports www/apache24