How to instal/setup XMLStarlet in Linux?

Rishi picture Rishi · Mar 17, 2017 · Viewed 10.5k times · Source

I'm fairly new to Linux and shell scripting; and have a requirement to parse and query an xml. I was able to find and use XML starlet for Windows successfully.

However, my goal is to have that run on Linux via a shell script.

Can anyone please share the steps to install and configure XMLStarlet on Linux?

Thanks!

Answer

Ismail picture Ismail · May 9, 2019

For Ubuntu:

sudo apt-get update
sudo apt-get install xmlstarlet

For CentOS: It is present in epel repo, download the repo and enable it

sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Confirm if it is enabled or not

cd /etc/yum.repos.d
grep -re enabled=1

This should show

epel.repo:enabled=1

Then Download xmlstarlet

sudo yum -y install xmlstarlet