Solution:
[root@ip-xxx ~]# which locate /usr/bin/which: no locate in (/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
Use yum to install mlocate package
[root@ip-xxx ~]# yum install mlocate -y Loaded plugins: amazon-id, rhui-lb, search-disabled-repos cloudera-manager | 951 B 00:00:00 mysql-connectors-community | 2.6 kB 00:00:00 mysql-tools-community | 2.6 kB 00:00:00 mysql56-community | 2.6 kB 00:00:00 rhui-REGION-client-config-server-7 | 2.1 kB 00:00:00 rhui-REGION-rhel-server-releases | 2.0 kB 00:00:00 rhui-REGION-rhel-server-rh-common | 2.1 kB 00:00:00 Resolving Dependencies --> Running transaction check ---> Package mlocate.x86_64 0:0.26-8.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================================= Package Arch Version Repository Size ============================================================================================================================================================================================= Installing: mlocate x86_64 0.26-8.el7 rhui-REGION-rhel-server-releases 113 k Transaction Summary ============================================================================================================================================================================================= Install 1 Package Total download size: 113 k Installed size: 379 k Downloading packages: mlocate-0.26-8.el7.x86_64.rpm | 113 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : mlocate-0.26-8.el7.x86_64 1/1 Verifying : mlocate-0.26-8.el7.x86_64 1/1 Installed: mlocate.x86_64 0:0.26-8.el7 Complete!
Update the locate repository
[root@ip-xxx ~]# updatedb