pkg command is used to install software in FreeBSD.
To update package repo, run
pkg update -f
Example
root@ok-vm:~ # pkg update -f Updating FreeBSD repository catalogue... pkg: Repository FreeBSD has a wrong packagesite, need to re-create database Fetching meta.txz: 100% 940 B 0.9kB/s 00:01 Fetching packagesite.txz: 100% 6 MiB 878.0kB/s 00:07 Processing entries: 100% FreeBSD repository update completed. 28776 packages processed. All repositories are up to date. root@ok-vm:~ #
To install postfix mail server, run
pkg install postfix
To auto start postfix, you need to run
sysrc postfix_enable="YES"
You can also add postfix_enable=”YES” to /etc/rc.conf manually.
root@ok-vm:~ # cat /etc/rc.conf hostname="ok-vm" ifconfig_hn0="DHCP" ifconfig_hn0_ipv6="inet6 accept_rtadv" sshd_enable="YES" # Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable dumpdev="AUTO" waagent_enable="YES" root@ok-vm:~ # sysrc postfix_enable="YES" postfix_enable: -> YES root@ok-vm:~ # cat /etc/rc.conf hostname="ok-vm" ifconfig_hn0="DHCP" ifconfig_hn0_ipv6="inet6 accept_rtadv" sshd_enable="YES" # Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable dumpdev="AUTO" waagent_enable="YES" postfix_enable="YES" root@ok-vm:~ #
Finding Software
To find package that provides a software, you can run
pkg search -o SOFTWARE_NAME
Example
root@ok-vm:~ # pkg search -o nginx www/nginx Robust and small WWW server www/nginx-devel Robust and small WWW server www/nginx-full Robust and small WWW server (full package) www/nginx-lite Robust and small WWW server (lite package) www/nginx-naxsi Robust and small WWW server (plus NAXSI) www/p5-Nginx-ReadBody Nginx embeded perl module to read and evaluate a request body www/p5-Nginx-Simple Perl 5 module for easy to use interface for Nginx Perl Module www/p5-Test-Nginx Testing modules for Nginx C module development root@ok-vm:~ #
Delete a software
pkg delete PACKAGE_NAME
Upgrade all installed software
pkg upgrade
Leave a Reply