How To Install usbmount on Ubuntu 20.04

In this tutorial we learn how to install usbmount on Ubuntu 20.04. usbmount is automatically mount and unmount USB mass storage devices

Introduction

In this tutorial we learn how to install usbmount on Ubuntu 20.04.

What is usbmount

usbmount is:

This package automatically mounts USB mass storage devices (typically USB pens) when they are plugged in, and unmounts them when they are removed. The mountpoints (/media/usb[0-7] by default), filesystem types to consider, and mount options are configurable. When multiple devices are plugged in, the first available mountpoint is automatically selected. If the device provides a model name, a symbolic link /var/run/usbmount/MODELNAME pointing to the mountpoint is automatically created.

The script that does the mounting is called by the udev daemon. Therefore, USBmount requires a 2.6 (or newer) Linux kernel.

Firewire devices are also supported by USBmount.

USBmount is intended as a lightweight solution which is independent of a desktop environment. Users which would like an icon to appear when an USB device is plugged in should use the pmount and hal packages instead.

There are three methods to install usbmount on Ubuntu 20.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install usbmount Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install usbmount using apt-get by running the following command:

sudo apt-get -y install usbmount

Install usbmount Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install usbmount using apt by running the following command:

sudo apt -y install usbmount

Install usbmount Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install usbmount using aptitude by running the following command:

sudo aptitude -y install usbmount

How To Uninstall usbmount on Ubuntu 20.04

To uninstall only the usbmount package we can use the following command:

sudo apt-get remove usbmount

Uninstall usbmount And Its Dependencies

To uninstall usbmount and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:

sudo apt-get -y autoremove usbmount

Remove usbmount Configurations and Data

To remove usbmount configuration and data from Ubuntu 20.04 we can use the following command:

sudo apt-get -y purge usbmount

Remove usbmount configuration, data, and all of its dependencies

We can use the following command to remove usbmount configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge usbmount

References

Summary

In this tutorial we learn how to install usbmount package on Ubuntu 20.04 using different package management tools: apt, apt-get and aptitude.