locate可以列出所有的相关文件名,但是由于最小化安装Centos6.4操作系统,系统默认是没有安装slocate的。
直接上代码:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
[root@WWW tmp]# yum install locate Loaded plugins: fastestmirror Determining fastest mirrors * base: mirrors.163.com * extras: mirrors.163.com * updates: mirrors.163.com base | 3.7 kB 00:00 extras | 3.4 kB 00:00 updates | 3.4 kB 00:00 updates/primary_db | 2.4 MB 00:00 Setting up Install Process No package locate available. Error: Nothing to do [root@ns2 tmp]# yum install slocate Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.163.com * extras: mirrors.163.com * updates: mirrors.163.com Setting up Install Process No package slocate available. Error: Nothing to do [root@ns2 tmp]# yum install *locate* Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.163.com * extras: mirrors.163.com * updates: mirrors.163.com Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package mlocate.i686 0:0.22.2-4.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================= Package Arch Version Repository Size ============================================================================================================================= Installing: mlocate i686 0.22.2-4.el6 base 85 k Transaction Summary ============================================================================================================================= Install 1 Package(s) Total download size: 85 k Installed size: 273 k Is this ok [y/N]: y |
到此安装完成,但是有一个问题:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 |
[root@WWW tmp]# ls - l `locate crontab` locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory ls: cannot access -: No such file or directory ls: cannot access l: No such file or directory [root@WWW tmp]# updatedb updatedb: can not find group `slocate' [root@WWW tmp]# groupadd slocate [root@WWW tmp]# updatedb [root@WWW tmp]# ll /var/lib/mlocate/mlocate.db -rw-r----- 1 root slocate 2329705 Apr 18 16:22 /var/lib/mlocate/mlocate.db [root@WWW tmp]# ls -l `locate crontab` -rw------- 1 root root 541 Nov 23 20:42 /etc/anacrontab -rw-r--r--. 1 root root 457 Sep 27 2011 /etc/crontab -rwsr-xr-x 1 root root 46780 Nov 23 20:42 /usr/bin/crontab |
申明:本文由BYRD原创(基于Centos6.4 X64),未经许可禁止转载!SourceByrd's Weblog-https://note.t4x.org/error/db-no-such-file-or-directory/ SourceByrd's Weblog-https://note.t4x.org/error/db-no-such-file-or-directory/
申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!