setfattr: command not found – Install setfattr CentOS

How to Install setfattr command on Linux CentOS 7, Redhat 7, cPanel Server

Follow the below steps to install setfattr command on CentOS 7 / RHEL 7 server.


[root@server /]# setfattr
bash: setfattr: command not found


I got the above error on my CentOS 7 server. On Redhat and CentOS servers, setfattr command is provided by attr package.

1. Log into your Server via SSH as ‘root’ user

2. Check whether attr package is installed or not

Type the below command to check whether ‘attr’ package is installed on your server:

# rpm -qa | grep attr

root@server [/]# rpm -qa | grep attr
root@server [/]#

‘attr’ package is not installed on the above server and that is the reason why ‘setfattr’ command shows error.

Install ‘attr’ package using yum.

root@server [/]# yum install attr
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base:
* extras:
* updates:
Resolving Dependencies
–> Running transaction check
—> Package attr.x86_64 0:2.4.46-12.el7 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

Package Arch Version Repository Size
attr x86_64 2.4.46-12.el7 base 66 k

Transaction Summary
Install 1 Package

Total download size: 66 k
Installed size: 169 k
Is this ok [y/d/N]: y
Downloading packages:
attr-2.4.46-12.el7.x86_64.rpm | 66 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : attr-2.4.46-12.el7.x86_64 1/1
Verifying : attr-2.4.46-12.el7.x86_64 1/1

attr.x86_64 0:2.4.46-12.el7

root@server [/]#


root@server [/]# setfattr –version
setfattr 2.4.46

setfattr v2.4.46 (attr) is installed on the above Server.

How to download and install attr rpm on CentOS 7 / RHEL 7 server

1. First you must ssh to your server as ‘root’ user

2. Download attr package from CentOS website using wget command


3. Install attr package using either yum command or rpm command

# yum install attr-2.4.46-13.el7.x86_64.rpm

When you run the above command, yum will install attr package and the required dependency.

To install the package using rpm command:

# rpm -ivh attr-2.4.46-13.el7.x86_64.rpm

If you are using rpm command, you must first install the dependencies and then install attr package.

No need to install the below dependencies, if it is already installed on your server

Required dependencies are given below:

libattr = 2.4.46-13.el7
rpmlib(CompressedFileNames) – 3.0.4-1
rpmlib(FileDigests) – 4.6.0-1
rpmlib(PayloadFilesHavePrefix) – 4.0-1
rpmlib(PayloadIsXz) – 5.2-1