How to Install locate package in RedHat 6

Posted by Md. Mahidul Hasan on 10:05 PM with No comments

How to Install locate package in RedHat 6

Check whether locate or slocate or mlocate RPM is installed in your machine.
[root@app2 ~]# rpm -qa| grep -i locate

If its not installed then search for the locate package from yum repository.
[root@app2 ~]# yum search locate
=============================== Matched: locate ================================
mlocate.x86_64 : An utility for finding files by name

Now install the locate package. In old version it may be slocate.
[root@app2 ~]# yum install mlocate

[root@app2 ~]# locate testfile
locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory

To resolve the database update issue we need to update database manually. Though cronjob would create it after a restart.
[root@app2 ~]# updatedb

Now you should be able to use locate command in redhat 6.04 or centos 6.04.