FreeBSD 13.2 Ports: Difference between revisions

From CompleteNoobs
Jump to navigation Jump to search
AwesomO (talk | contribs)
Created page with "In FreeBSD, the Ports Collection is a comprehensive framework for installing and managing third-party applications. To install and update the Ports tree, follow these steps: ==Install the Ports tree== If you haven't installed the Ports tree during the FreeBSD installation, you can do it using the '''portsnap''' utility. First, fetch the latest snapshot of the Ports tree: <code>portsnap fetch</code> After fetching the snapshot, extract it to '''/usr/ports''': <code>p..."
 
(No difference)

Latest revision as of 14:55, 5 May 2023

In FreeBSD, the Ports Collection is a comprehensive framework for installing and managing third-party applications. To install and update the Ports tree, follow these steps:

Install the Ports tree

If you haven't installed the Ports tree during the FreeBSD installation, you can do it using the portsnap utility. First, fetch the latest snapshot of the Ports tree:

portsnap fetch

After fetching the snapshot, extract it to /usr/ports:

portsnap extract

  • Note: can also be done on one line: portsnap fetch extract

Update the Ports tree

To update the Ports tree, first fetch the latest updates using portsnap:

portsnap fetch

Then, apply the updates to your local Ports tree:

portsnap update

That's it! Now your Ports tree is up-to-date.

(Optional) Automate Ports tree updates

If you want to automate the process of updating the Ports tree, you can create a simple cron job. First, open the root user's crontab:

crontab -e

Add the following line to update the Ports tree daily at 3:30 AM:

30 3 * * * /usr/sbin/portsnap -I cron update

Save and exit the editor. The Ports tree will now be updated automatically every day at the specified time.

Remember that updating the Ports tree only updates the available ports; it does not update the installed applications themselves. To update your installed applications, you need to use tools like portmaster or portupgrade.

Example - walk through

Install sudo with insults enabled/configured

Why sudo with insults enabled? Because life must be enjoyed!

Navigate to the sudo port directory

First, change your working directory to the sudo port directory in the ports tree:

cd /usr/ports/security/sudo

Enable the INSULTS option

To enable the insults feature in sudo, you'll need to customize the port's options. Run the following command:

make config

This will open a text-based interface showing a list of options for the sudo port. Look for the "INSULTS" option, which should be unchecked by default. Use the arrow keys to highlight "INSULTS" and press the spacebar to enable it (an asterisk (*) will appear next to it). After that, press 'Enter' to save the configuration and exit.

Build and install sudo

Now that you've enabled the INSULTS option, you can build and install the sudo port by running:

make install clean

This command will compile sudo with the specified options and install it on your system. The process may take a few minutes, depending on your system's resources.

Configure sudo

After installing sudo, you need to configure it by editing the sudoers file. To do this safely, use the visudo command, which will open the sudoers file in your default text editor: Warning default $EDITOR will be vi Learn Basic vi first!

visudo

In the sudoers file, look for the line that defines user privilege specifications. It should look like this:

root ALL=(ALL) ALL

To grant your user account sudo privileges, add a new line with your username and the same format, replacing 'username' with your actual username:

username ALL=(ALL) ALL

Save the file and exit the text editor.

Test sudo with insults

To test your newly installed sudo with insults enabled, try running a command that requires root privileges. For example:

sudo ls /root

If you enter an incorrect password, sudo should now respond with a random insult instead of the standard error message.

Congratulations! You've successfully installed sudo with insults enabled from FreeBSD 13.2 ports. Enjoy the amusing responses whenever you mistype your password.


Keep Port Install's Updated