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.

ERROR :

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

FIX :

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
base
Loading mirror speeds from cached hostfile
* base: ftp.linux.ncsu.edu
* extras: mirror.ash.fastserv.com
* updates: centos.mirror.nac.net
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
========================================================================================================================================================================
Installing:
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

Installed:
attr.x86_64 0:2.4.46-12.el7

Complete!
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

#wget http://mirror.centos.org/centos/7/os/x86_64/Packages/attr-2.4.46-13.el7.x86_64.rpm

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
libattr.so.1()(64bit)
libattr.so.1(ATTR_1.0)(64bit)
libattr.so.1(ATTR_1.2)(64bit)
libc.so.6()(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3)(64bit)
libc.so.6(GLIBC_2.3.4)(64bit)
libc.so.6(GLIBC_2.4)(64bit)
rpmlib(CompressedFileNames) – 3.0.4-1
rpmlib(FileDigests) – 4.6.0-1
rpmlib(PayloadFilesHavePrefix) – 4.0-1
rtld(GNU_HASH)
rpmlib(PayloadIsXz) – 5.2-1