How To Install ruby-httpclient on Ubuntu 18.04

In this tutorial we learn how to install ruby-httpclient on Ubuntu 18.04. ruby-httpclient is HTTP client library for ruby

Introduction

In this tutorial we learn how to install ruby-httpclient on Ubuntu 18.04.

What is ruby-httpclient

ruby-httpclient is:

httpclient gives something like the functionality of libwww-perl (LWP) in Ruby.

Features: * methods like GET/HEAD/POST/* via HTTP/1.1. * HTTPS(SSL), Cookies, proxy, authentication(Digest, NTLM, Basic), etc. * asynchronous HTTP request, streaming HTTP request. * by contrast with net/http in standard distribution; o Cookies support o MT-safe o streaming POST (POST with File/IO) o Digest auth o Negotiate/NTLM auth for WWW-Authenticate (requires net/htlm module) o NTLM auth for WWW-Authenticate/Proxy-Authenticate (requires win32/sspi module) o extensible with filter interface o you don’t have to care HTTP/1.1 persistent connection (httpclient cares instead of you).

There are three methods to install ruby-httpclient on Ubuntu 18.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-httpclient 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-httpclient using apt-get by running the following command:

sudo apt-get -y install ruby-httpclient

Install ruby-httpclient Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install ruby-httpclient

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

sudo aptitude -y install ruby-httpclient

How To Uninstall ruby-httpclient on Ubuntu 18.04

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

sudo apt-get remove ruby-httpclient

Uninstall ruby-httpclient And Its Dependencies

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

sudo apt-get -y autoremove ruby-httpclient

Remove ruby-httpclient Configurations and Data

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

sudo apt-get -y purge ruby-httpclient

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

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

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

References

Summary

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