{"id":3384,"date":"2019-06-21T18:45:15","date_gmt":"2019-06-21T15:45:15","guid":{"rendered":"https:\/\/kifarunix.com\/?p=3384"},"modified":"2024-03-11T23:06:55","modified_gmt":"2024-03-11T20:06:55","slug":"install-or-uninstall-software-from-freebsd-ports-collection","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-or-uninstall-software-from-freebsd-ports-collection\/","title":{"rendered":"Install or Uninstall Software from FreeBSD Ports Collection"},"content":{"rendered":"\n

In this guide, we are going to learn how to install or uninstall software from FreeBSD Ports Collection. Ports Collection<\/a> is is a set of Makefiles<\/code>, patches, and description files which are used to compile and install an individual application on FreeBSD. An application\/software being compiled is called a port.<\/p>\n\n\n\n

Installing or Uninstalling Software from FreeBSD Ports Collection<\/h2>\n\n\n\n

To install or uninstall a software using Ports collections, you first need to install Ports Collection if at all they were not installed with the OS.<\/p>\n\n\n\n

Install Ports Collection using Portsnap on FreeBSD 12<\/h3>\n\n\n\n

The recommended way of installing Ports Collection on FreeBSD is to use Portsnap. Portsnap is a fast and user-friendly tool for retrieving the Ports Collection. It connects to a FreeBSD site, verifies the secure key, and downloads a new copy of the Ports Collection.<\/p>\n\n\n\n

To begin with, run system update and upgrade<\/p>\n\n\n\n

pkg update<\/code><\/pre>\n\n\n\n
pkg upgrade -f<\/code><\/pre>\n\n\n\n

download a compressed snapshot of the Ports Collection. The snapshot will be stored under \/var\/db\/portsnap<\/strong>.<\/p>\n\n\n\n

portsnap fetch<\/code><\/pre>\n\n\n\n
Looking up portsnap.FreeBSD.org mirrors... 6 mirrors found.\nFetching public key from ec2-ap-southeast-2.portsnap.freebsd.org... done.\nFetching snapshot tag from ec2-ap-southeast-2.portsnap.freebsd.org... done.\nFetching snapshot metadata... done.\nFetching snapshot generated at Fri Jun 21 03:03:21 EAT 2019:\nbe72cc6990cd51c776b41c1a4e848af2b5516e4667ccc8          84 MB  126 kBps 11m20s\nExtracting snapshot... done.\nVerifying snapshot integrity... done.\nFetching snapshot tag from ec2-ap-southeast-2.portsnap.freebsd.org... done.\nFetching snapshot metadata... done.\nUpdating from Fri Jun 21 03:03:21 EAT 2019 to Fri Jun 21 15:32:36 EAT 2019.\nFetching 5 metadata patches... done.\nApplying metadata patches... done.\nFetching 0 metadata files... done.\nFetching 51 patches. \n(51\/51) 100.00%  done.                                 \ndone.\nApplying patches... \ndone.\nFetching 0 new ports or files... done.\n<\/code><\/pre>\n\n\n\n

Once the fetching completes, extract Ports Collection snapshot to \/usr\/ports<\/strong>. This can only be done if the snapshot was being fetched for the first time.<\/p>\n\n\n\n

portsnap extract<\/code><\/pre>\n\n\n\n

If the Ports Collection snapshot has been downloaded before, you can simply update it by running the commands below;<\/p>\n\n\n\n

portsnap fetch\nportsnap update<\/code><\/pre>\n\n\n\n

You can however run this as a single command;<\/p>\n\n\n\n

portsnap fetch update<\/code><\/pre>\n\n\n\n

Installing Software using Ports Collection<\/h3>\n\n\n\n

Before you can compile a software\/application, here in called a port, ensure that you have GNU make (gmake<\/strong>)utility installed. To verify if gmake is installed;<\/p>\n\n\n\n

which gmake\n\/usr\/local\/bin\/gmake<\/code><\/pre>\n\n\n\n

Installing GNU make utility<\/h4>\n\n\n\n

If gmake is not installed, see below on how to install.<\/p>\n\n\n\n

pkg install gmake<\/code><\/pre>\n\n\n\n
Updating FreeBSD repository catalogue...\nFreeBSD repository is up to date.\nAll repositories are up to date.\nThe following 1 package(s) will be affected (of 0 checked):\n\nNew packages to be INSTALLED:\n\tgmake: 4.2.1_3\n\nNumber of packages to be installed: 1\n\nThe process will require 2 MiB more space.\n382 KiB to be downloaded.\n\nProceed with this action? [y\/N]: y\n[1\/1] Fetching gmake-4.2.1_3.txz: 100%  382 KiB 390.7kB\/s    00:01    \nChecking integrity... done (0 conflicting)\n[1\/1] Installing gmake-4.2.1_3...\n[1\/1] Extracting gmake-4.2.1_3: 100%\n<\/code><\/pre>\n\n\n\n

Next, navigate to the specific sub-directory of the software\/port to be installed. For example, in this guide, we are going to demonstrate how to install neofetch, command-line tool for fetching system information.<\/p>\n\n\n\n

cd \/usr\/ports\/sysutils\/neofetch<\/code><\/pre>\n\n\n\n

Next, compile the port or software as shown below;<\/p>\n\n\n\n

make install<\/code><\/pre>\n\n\n\n
===> Building\/installing dialog4ports as it is required for the config dialog\n===>  Cleaning for dialog4ports-0.1.6\n===>  License BSD2CLAUSE accepted by the user\n===>   dialog4ports-0.1.6 depends on file: \/usr\/local\/sbin\/pkg - found\n=> dialog4ports-0.1.6.tar.gz doesn't seem to exist in \/usr\/ports\/distfiles\/.\n=> Attempting to fetch http:\/\/files.etoilebsd.net\/dialog4ports\/dialog4ports-0.1.6.tar.gz\ndialog4ports-0.1.6.tar.gz                               10 kB 5073 kBps    00s\n===> Fetching all distfiles required by dialog4ports-0.1.6 for building\n===>  Extracting for dialog4ports-0.1.6\n=> SHA256 Checksum OK for dialog4ports-0.1.6.tar.gz.\n===>  Patching for dialog4ports-0.1.6\n===>  Configuring for dialog4ports-0.1.6\n===>  Building for dialog4ports-0.1.6\ncc  -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing  -Wall -pedantic -c dialog4ports.c -o dialog4ports.o\ncc  -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing  -Wall -pedantic -c mixedlist.c -o mixedlist.o\ngzip -cn dialog4ports.1 > dialog4ports.1.gz\ncc -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing  -Wall -pedantic dialog4ports.o mixedlist.o -o dialog4ports -lncursesw -lm -ldialog\n===>  Staging for dialog4ports-0.1.6\n===>   Generating temporary packing list\ninstall  -s -m 555 dialog4ports \/usr\/ports\/ports-mgmt\/dialog4ports\/work\/stage\/usr\/local\/bin\ninstall  -m 0644 dialog4ports.1.gz \/usr\/ports\/ports-mgmt\/dialog4ports\/work\/stage\/usr\/local\/man\/man1\n====> Compressing man pages (compress-man)\n===>  Installing for dialog4ports-0.1.6\n===>  Checking if dialog4ports is already installed\n...\n====> Compressing man pages (compress-man)\n===>  Installing for bash-5.0.7\n===>  Checking if bash is already installed\n===>   Registering installation for bash-5.0.7 as automatic\nInstalling bash-5.0.7...\n===>   neofetch-6.0.0 depends on executable: bash - found\n===>   Returning to build of neofetch-6.0.0\n===>   Generating temporary packing list\ninstall  -m 0644 \/usr\/ports\/sysutils\/neofetch\/work\/neofetch-6.0.0\/CHANGELOG.md \/usr\/ports\/sysutils\/neofetch\/work\/stage\/usr\/local\/share\/doc\/neofetch\ninstall  -m 0644 \/usr\/ports\/sysutils\/neofetch\/work\/neofetch-6.0.0\/README.md \/usr\/ports\/sysutils\/neofetch\/work\/stage\/usr\/local\/share\/doc\/neofetch\n====> Compressing man pages (compress-man)\n===>  Installing for neofetch-6.0.0\n===>  Checking if neofetch is already installed\n===>   Registering installation for neofetch-6.0.0\nInstalling neofetch-6.0.0...\n<\/code><\/pre>\n\n\n\n

Neofetch is now installed.<\/p>\n\n\n\n

which neofetch<\/code><\/pre>\n\n\n\n
\/usr\/local\/bin\/neofetch<\/code><\/pre>\n\n\n\n
neofetch<\/code><\/pre>\n\n\n\n
```                        `       root@freebsd12.example.com \n  ` `.....---.......--.```   -\/    -------------------------- \n  +o   .--`         \/y:`      +.   OS: FreeBSD 12.0-RELEASE amd64 \n   yo`:.            :o      `+-    Uptime: 2 hours, 15 mins \n    y\/               -\/`   -o\/     Packages: 134 (pkg) \n   .-                  ::\/sy+:.    Shell: csh tcsh 6.20.00 \n   \/                     `--  \/    Terminal: \/dev\/pts\/0 \n  `:                          :`   CPU: Intel i5-8250U (1) @ 1.800GHz \n  `:                          :`   GPU: VirtualBox Graphics Adapter \n   \/                          \/    Memory: 334MiB \/ 985MiB \n   .-                        -.\n    --                      -.                             \n     `:`                  `:`\n       .--             `--.\n          .---.....----.\n<\/code><\/pre>\n\n\n\n

After the installation, run make clean<\/strong> to remove temporary files that were created during the installation to save space.<\/p>\n\n\n\n

make clean<\/code><\/pre>\n\n\n\n

You can also check how to install MySQL 8 on FreeBSD 12 as another example.<\/p>\n\n\n\n

Install MySQL 8 on FreeBSD 12<\/a><\/p>\n\n\n\n

Uninstalling Software using Ports Collection<\/h3>\n\n\n\n

To uninstall any software or port installed via the Ports Collection on FreeBSD 12, simply navigate to the port subdirectory and run make deinstall<\/strong>. For example, to remove neofetch installed above;<\/p>\n\n\n\n

make deinstall<\/code><\/pre>\n\n\n\n
===>  Deinstalling for neofetch\n===>   Deinstalling neofetch-6.0.0\nUpdating database digests format: 100%\nChecking integrity... done (0 conflicting)\nDeinstallation has been requested for the following 1 packages (of 0 packages in the universe):\n\nInstalled packages to be REMOVED:\n\tneofetch-6.0.0\n\nNumber of packages to be removed: 1\n[1\/1] Deinstalling neofetch-6.0.0...\n[1\/1] Deleting files for neofetch-6.0.0: 100%\n<\/code><\/pre>\n\n\n\n

Well, that is all on installing\/uninstall software from FreeBSD Ports collection.<\/p>\n\n\n\n

Related Tutorials:<\/p>\n\n\n\n

How to Install FreeBSD 12 on VirtualBox<\/a><\/p>\n\n\n\n

Install Apache, MySQL, PHP (FAMP) Stack on FreeBSD 12<\/a><\/p>\n\n\n\n

How to Install phpMyAdmin on FreeBSD 12<\/a><\/p>\n\n\n\n

Install and Configure OpenVPN Server FreeBSD 12<\/a><\/p>\n\n\n\n

Install Nginx, MySQL, PHP (FEMP) Stack on FreeBSD 12<\/a><\/p>\n\n\n\n

Install phpMyAdmin with Nginx on FreeBSD 12<\/a><\/p>\n\n\n\n

Install and Configure Telegraf on FreeBSD 12<\/a><\/p>\n\n\n\n

Install Apache with Self-signed Certificate<\/a> on FreeBSD 12<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"

In this guide, we are going to learn how to install or uninstall software from FreeBSD Ports Collection. Ports Collection is is a set of Makefiles,<\/p>\n","protected":false},"author":2,"featured_media":15070,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[280,121,49,1005],"tags":[278,6212,1003,1002,1001,6213,1004],"class_list":["post-3384","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-freebsd","category-howtos","category-command-cheatsheets","category-package-installation","tag-freebsd-12","tag-install-package-from-freebsd-ports","tag-install-software","tag-port","tag-ports-collection","tag-uninstall-freebsd-ports","tag-uninstall-software","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/3384"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=3384"}],"version-history":[{"count":7,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/3384\/revisions"}],"predecessor-version":[{"id":21162,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/3384\/revisions\/21162"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/15070"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=3384"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=3384"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=3384"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}