Skip to content

How to Install jq(JSON processor) on Linux

How to Install jq(JSON processor) on Linux
Share

Reading Time: 3 minutes

In this tutorial, we will guide you on How to Install jq(JSON processor) on Linux. To install JQ you should have ssh access to the server and sudo or root privilege. Without JQ it is difficult to get one or more values only from jSON files hence We recommend you to get familiar with JQ tools, Once you go through this article you should be able to install JQ and process or read some data.

What is JSON

JSON stands for Javascript object notation. This is used to store data in the format of keys and values.

What is JQ

JQ stands for JSON processor. We can use JQ to process output and query desired results.

How to Install jq(JSON processor) on Linux

We will show you how to install JQ on Redhat and Centos-based systems however you can read more tutorials for Linux here

Install epel-release :
You need to first install epel-release as JQ is part of this.

# yum install epel-release -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.sonic.net
 * extras: mirrors.sonic.net
 * updates: ziply.mm.fcix.net
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-11 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================================================================================================
 Package                                                 Arch                                              Version                                          Repository                                         Size
====================================================================================================================================================================================================================
Installing:
 epel-release                                            noarch                                            7-11                                             extras                                             15 k

Transaction Summary
====================================================================================================================================================================================================================
Install  1 Package

Total download size: 15 k
Installed size: 24 k
Downloading packages:
epel-release-7-11.noarch.rpm                                                                                                                                                                 |  15 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : epel-release-7-11.noarch                                                                                                                                                                         1/1
  Verifying  : epel-release-7-11.noarch                                                                                                                                                                         1/1

Installed:
  epel-release.noarch 0:7-11

Complete!

Install JQ (JSON Processor)

How to Install jq(JSON processor) on Linux

yum install jq -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                                                                                                                                                         |  23 kB  00:00:00
 * base: mirrors.sonic.net
 * epel: mirror.fcix.net
 * extras: mirrors.sonic.net
 * updates: ziply.mm.fcix.net
epel                                                                                                                                                                                         | 4.7 kB  00:00:00
(1/3): epel/x86_64/group_gz                                                                                                                                                                  |  99 kB  00:00:00
(2/3): epel/x86_64/updateinfo                                                                                                                                                                | 1.0 MB  00:00:00
(3/3): epel/x86_64/primary_db                                                                                                                                                                | 7.0 MB  00:00:00
Resolving Dependencies
--> Running transaction check
---> Package jq.x86_64 0:1.6-2.el7 will be installed
--> Processing Dependency: libonig.so.5()(64bit) for package: jq-1.6-2.el7.x86_64
--> Running transaction check
---> Package oniguruma.x86_64 0:6.8.2-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================================================================================================
 Package                                             Arch                                             Version                                                  Repository                                      Size
====================================================================================================================================================================================================================
Installing:
 jq                                                  x86_64                                           1.6-2.el7                                                epel                                           167 k
Installing for dependencies:
 oniguruma                                           x86_64                                           6.8.2-2.el7                                              epel                                           181 k

Transaction Summary
====================================================================================================================================================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 348 k
Installed size: 1.0 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/epel/packages/jq-1.6-2.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Public key for jq-1.6-2.el7.x86_64.rpm is not installed
(1/2): jq-1.6-2.el7.x86_64.rpm                                                                                                                                                               | 167 kB  00:00:00
(2/2): oniguruma-6.8.2-2.el7.x86_64.rpm                                                                                                                                                      | 181 kB  00:00:00
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                               967 kB/s | 348 kB  00:00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Importing GPG key 0x352C64E5:
 Userid     : "Fedora EPEL (7) <epel@fedoraproject.org>"
 Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
 Package    : epel-release-7-11.noarch (@extras)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : oniguruma-6.8.2-2.el7.x86_64                                                                                                                                                                     1/2
  Installing : jq-1.6-2.el7.x86_64                                                                                                                                                                              2/2
  Verifying  : oniguruma-6.8.2-2.el7.x86_64                                                                                                                                                                     1/2
  Verifying  : jq-1.6-2.el7.x86_64                                                                                                                                                                              2/2

Installed:
  jq.x86_64 0:1.6-2.el7

Dependency Installed:
  oniguruma.x86_64 0:6.8.2-2.el7

Complete!

Validate JQ
You can validate JQ by using below mentioned command.

$ sudo rpm -qa |grep

Check JQ Version
To check the installed jq version you need to use jq -Version command as shown below.

$ jq -Version

Remove jq(JSON Processor)

Once you are done with jq utility you can uninstall this tool by using yum remove jq -y command 
$ sudo yum remove jq -y

Remove EPEL Repository

You can even remove the EPEL repository by using yum remove epel-release -y command if not required anymore.

$ yum remove epel-release -y

Conclusion

My tutorials are also available on Quora, Please follow me. We hope you are able to install JQ successfully. If you have any query on How to Install jq(JSON processor) on Linux , Please do write to us.


Share

Leave a Reply

Your email address will not be published. Required fields are marked *