How To Install ruby-webrick on Ubuntu 22.04

In this tutorial we learn how to install ruby-webrick on Ubuntu 22.04. ruby-webrick is HTTP server toolkit in Ruby

Introduction

In this tutorial we learn how to install ruby-webrick on Ubuntu 22.04.

What is ruby-webrick

ruby-webrick is:

WEBrick is an HTTP server toolkit that can be configured as an HTTPS server, a proxy server, and a virtual-host server.

It used to be provided with the standard library of the Ruby interpreter, and has been available only as a standalone gem since ruby3.0.

There are three methods to install ruby-webrick 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 ruby-webrick Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install ruby-webrick

Install ruby-webrick Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install ruby-webrick

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

sudo aptitude -y install ruby-webrick

How To Uninstall ruby-webrick on Ubuntu 22.04

To uninstall only the ruby-webrick package we can use the following command:

sudo apt-get remove ruby-webrick

Uninstall ruby-webrick And Its Dependencies

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

sudo apt-get -y autoremove ruby-webrick

Remove ruby-webrick Configurations and Data

To remove ruby-webrick configuration and data from Ubuntu 22.04 we can use the following command:

sudo apt-get -y purge ruby-webrick

Remove ruby-webrick configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge ruby-webrick

References

Summary

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