How To Install motion on Ubuntu 22.04

In this tutorial we learn how to install motion on Ubuntu 22.04. motion is V4L capture program supporting motion detection

Introduction

In this tutorial we learn how to install motion on Ubuntu 22.04.

What is motion

motion is:

Motion is a program that monitors the video signal from one or more cameras and is able to detect if a significant part of the picture has changed. Or in other words, it can detect motion.

Motion is a command line based tool. It has no graphical user interface. Everything is setup either via the command line or via configuration files.

The output from motion can be: - jpg/ppm image files - mpeg/mp4/swf/flv/mov/ogg video sequences

Also, motion has its own minimalistic web server. Thus, you can access the webcam output from motion via a browser.

There are three methods to install motion on Ubuntu 22.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 motion Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install motion

Install motion Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install motion

Install motion 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 motion using aptitude by running the following command:

sudo aptitude -y install motion

How To Uninstall motion on Ubuntu 22.04

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

sudo apt-get remove motion

Uninstall motion And Its Dependencies

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

sudo apt-get -y autoremove motion

Remove motion Configurations and Data

To remove motion configuration and data from Ubuntu 22.04 we can use the following command:

sudo apt-get -y purge motion

Remove motion configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge motion

References

Summary

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