mlocate - A locate/updatedb that re-uses the existing database for efficiency ChangeLog

HOWTO


# mlocate 0.25
# ============
# mlocate is another locate/updatedb, like GNU findutils' ones, and slocate.
# My understanding of the three is this:
# - GNU findutils is the standard one.  updatedb creates a database of
#   all files on the system.  locate finds any matching files in the
#   database.
# - slocate's updatedb creates a database of all files on the system too,
#   but with permissions.  It's locate does not display results for files
#   that a user does not have access to.
# - mlocate's updatedb merges the existing database together with changes,
#   speeding up the daily run of updatedb significantly.  locate can work
#   as slocate's does.

# Get it
cd
test -f installed/mlocate-0.25.tar.xz &&
mv -f installed/mlocate-0.25.tar.xz .
test ! -f mlocate-0.25.tar.xz &&
wget --no-check-certificate \
https://fedorahosted.org/releases/m/l/mlocate/mlocate-0.25.tar.xz

# Extract the tarball
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "mlocate-*" -exec rm -r {} \;
tar xJvf ~/mlocate-0.25.tar.xz
cd mlocate-0.25
test $UID = 0 && chown -R root:root .

# Cnfigure and build it
./configure --prefix=/usr --sysconf=/etc --localstatedir=/var/lib \
--mandir=/usr/man --disable-nls
make

# Become root to install it
su

# If you also have GNU findutils' updatedb/locate installed, remove them
( cd /usr/bin ; rm -f locate updatedb )
( cd /usr/man/man1 ; rm -f locate.1 updatedb.1 updatedb.1.gz )
rm -f /etc/cron.daily/locate /usr/man/man5/locatedb.5 /usr/var/locatedb \
/var/man/cat1/updatedb.1.bz2

# Add a 'mlocate' group
getent group | egrep -q "^mlocate:" || groupadd mlocate

# Add your non-root account to the mlocate group
usermod -G mlocate $(logname)

# Install it
make install

# See these man pages: locate, updatedb, mlocate.db, updatedb.conf

# You can create an /etc/updatedb.conf like so, or pass these options using
# commandline options (see the man page)
cat <<EOF > /etc/updatedb.conf
PRUNEFS="devpts NFS nfs afs proc smbfs autofs iso9660 udf tmpfs cifs"
PRUNEPATHS="/dev /proc /sys /tmp /usr/tmp /var/tmp /afs /net /media /mnt"
EOF
chmod 644 /etc/updatedb.conf

# Set it to run from cron every day
cat <<EOF > /etc/cron.daily/mlocate
#!/bin/sh
ionice -c 3 nice -n 19 /usr/bin/updatedb
EOF
chmod 700 /etc/cron.daily/mlocate

# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .

# Become yourself again
exit

# Keep the tarball for later
cd
mkdir -p -m 0700 installed
rm -f installed/mlocate-0.25.tar.*
mv -f mlocate-0.25.tar.xz installed/


# If you ever want to uninstall mlocate, this should do it:
cd
su
test -d src/mlocate-* && ( cd src/mlocate-* ; make uninstall )
( cd /usr/bin ; rm -f locate updatedb )
( /usr/man/man5 ; rm -f mlocate.db.5 updatedb.conf.5 )
rm -f /usr/man/man1/locate.1 /usr/man/man8/updatedb.8
test -d /var/lib/mlocate && rm -r /var/lib/mlocate
exit
find ~/src -maxdepth 1 -type d -name "mlocate-*" -exec rm -r {} \;
rm -f ~/installed/mlocate-*.tar.*

List of HOWTOs

Web page itself last updated: 2023-12-20 8:06pm (EST -0500)
HOWTO last updated: 2012-05-14 9:17am
Copyright © 2001-2024 Jason Englander. All Rights reserved.
[HTML5]