Smartmontools installation instructions
=======================================

$Id: INSTALL,v 1.37 2004/03/02 18:19:55 shattered Exp $

Please also see the smartmontools home page:
http://smartmontools.sourceforge.net/

Table of contents:

[1] Kernel requirements
[2] Installing from CVS
[3] Installing from source tarball
[4] Guidelines for different Linux distributions
[5] Guidelines for FreeBSD
[6] Guidelines for NetBSD
[7] Guidelines for Solaris
[8] Guidelines for Windows
[9] Comments
[10] Detailed description of ./configure options

[1] Kernel requirements
=======================

    A) Linux

    Any recent Linux distribution should support smartmontools.  Note
    that smartmontools requires Linux kernel 2.2.14 or greater in
    order to run at all.  But to give the ATA RETURN SMART STATUS
    command, the kernel needs to support the HDIO_DRIVE_TASK ioctl().
    Any 2.4 series kernel should provide this support.  Some of the
    2.2.20 and later kernels also provide this support if they're
    properly patched and configured.  Please see FAQ section of the
    URL above.

    If you are using 3ware controllers, for full functionality you
    must either use version 1.02.00.037 or greater of the 3w-xxxx
    driver, or patch earlier 3ware 3w-xxxx drivers.  See:
	http://smartmontools.sourceforge.net/3w-xxxx.txt
    for the patch.  The version 1.02.00.037 3w-xxxx.c driver was
    incorporated into kernel 2.4.23-bk2 on 3 December 2003 and into
    kernel 2.6.0-test5-bk11 on 23 September 2003.

    B) FreeBSD

    For FreeBSD support, a 5-current kernel that includes ATAng is
    required in order to support ATA drives.  Even current versions of
    ATAng will not support 100% operation, as the SMART status can not
    be reliably retrieved.  There is patch pending approval of the
    ATAng driver maintainer that will address this issue.
    
    C) Solaris
    
    The SCSI code has been tested on a variety of Solaris 8 and 9
    systems.  ATA/IDE code works only on SPARC platform.  All tested
    kernels worked correctly.

    D) NetBSD

    The code was tested on a 1.6ZG (i.e., 1.6-current) system. It should
    also function under 1.6.1 and later releases (unverified).  Currently
    it doesn't support ATA devices on 3ware RAID controllers.

[2] Installing from CVS
=======================
    Get the sources from the CVS repository:
    cvs -d :pserver:anonymous@cvs.smartmontools.sourceforge.net:/cvsroot/smartmontools login
    cvs -d :pserver:anonymous@cvs.smartmontools.sourceforge.net:/cvsroot/smartmontools co sm5
    (when prompted for a password, just press Enter)

    Then type:
    ./autogen.sh
    and continue with step [3] below, skipping the "unpack the tarball" step.

    Further details of using CVS can be found at the URL above.

    The autogen.sh command is ONLY required when installing from
    CVS. You need GNU Autoconf (version 2.50 or greater), GNU Automake
    (version 1.6 or greater) and their dependencies installed in order
    to run it.  You can get these here:
    http://www.gnu.org/directory/GNU/autoconf.html
    http://www.gnu.org/directory/GNU/automake.html

[3] Installing from the source tarball
======================================

    If you are NOT installing from CVS, then unpack the tarball: 
    tar zxvf smartmontools-5.VERSION.tar.gz

    Then:
    ./configure
    make
    make install (you may need to be root to do this)

    As shown (with no options to ./configure) this defaults to the
    following set of installation directories:   
    --prefix=/usr
    --sbindir=/usr/sbin
    --sysconfdir=/etc
    --mandir=/usr/share/man
    --with-docdir=/usr/share/doc/smartmontools-VERSION
    --with-initscriptdir=/etc/rc.d/init.d
    --disable-sample

    These will overwrite existing "distribution" installations for Red
    Hat, Slackware, and some other Linux distributions.

    For different installation locations or distributions, simply add
    arguments to ./configure as shown in [4] below.

    If you wish to alter the default C compiler flags, set an
    environment variable CFLAGS='your options' before doing
    ./configure, or else do:
    make CFLAGS='your options'

[4] Guidelines for different Linux distributions
================================================

Note: Please send corrections/additions to:
smartmontools-support@lists.sourceforge.net

Debian:
  ./configure --prefix=/usr/local

Filesystem Hierarchy Standard (FHS):
  ./configure --sbindir=/usr/local/sbin                               \
              --sysconfdir=/usr/local/etc                             \
              --mandir=/usr/local/man                                 \
              --with-initscriptdir=/usr/local/etc/rc.d/init.d         \
              --with-docdir=/usr/local/share/doc/smartmontools-VERSION

Red Hat:
  ./configure
  OR EQUIVALENTLY
  ./configure --sbindir=/usr/sbin                               \
	      --sysconfdir=/etc                                 \
	      --mandir=/usr/share/man                           \
	      --with-initscriptdir=/etc/rc.d/init.d             \
	      --with-docdir=/usr/share/doc/smartmontools-VERSION

Slackware:
  If you don't want to overwrite any "distribution" package, use:
  ./configure --prefix=/usr/local

  Otherwise use:
  ./configure --sbindir=/usr/sbin                               \
              --sysconfdir=/etc                                 \
              --mandir=/usr/share/man                           \
              --with-initscriptdir=/etc/rc.d                    \
              --with-docdir=/usr/share/doc/smartmontools-VERSION

  And
  removepkg smartmontools smartsuite (only root can do this)
  before make install

  The init script works on Slackware. You just have to add an entry like
  the following in /etc/rc.d/rc.M or /etc/rc.d/rc.local:

  if [ -x /etc/rc.d/smartd ]; then
    . /etc/rc.d/smartd start
  fi

  To disable it:
  chmod 644 /etc/rc.d/smartd

  For a list of options:
  /etc/rc.d/smartd

SuSE:
  ./configure --sbindir=/usr/sbin                                        \
              --sysconfdir=/etc                                          \
              --mandir=/usr/share/man                                    \
              --with-initscriptdir=/etc/init.d                           \
              --with-docdir=/usr/share/doc/packages/smartmontools-VERSION

[5] Guidelines for FreeBSD
==========================
  To match the way it will installed when it becomes available as a PORT, use
  the following:

  ./configure --prefix=/usr/local                                      \
              --with-initscriptdir=/usr/local/etc/rc.d/                \
              --with-docdir=/usr/local/share/doc/smartmontools-VERSION \
	      --enable-sample

  Also, it is important that you use GNU make (gmake from /usr/ports/devel/gmake)
  to build smartmontools, as the default FreeBSD make doesn't know how to build
  the man pages.

  NOTE: --enable-sample will cause the smartd.conf and smartd RC files to
  be installed with the string '.sample' append to the name, so you will end
  up with the following:
	/usr/local/etc/smartd.conf.sample
	/usr/local/etc/rc.d/smartd.sample

[6] Guidelines for NetBSD
=========================
  ./configure --prefix=/usr/pkg                                       \
	      --with-docdir=/usr/pkg/share/doc/smartmontools

[7] Guidelines for Solaris
==========================

    smartmontools has been partially but not completely ported to
    Solaris.  It includes complete SCSI support but no ATA or 3ware
    support.  It can be compiled with either cc or gcc. To compile
    with gcc:

    ./configure [args]
    make

    To compile with Sun cc:

    setenv CC cc  [csh syntax], or
    CC=cc         [sh syntax]
    ./configure [args]
    make

    The correct arguments [args] to configure are:
     --sbindir=/usr/sbin                                \
     --sysconfdir=/etc                                  \
     --mandir=/usr/share/man                            \
     --with-docdir=/usr/share/doc/smartmontools-VERSION \
     --with-initscriptdir=/etc/init.d

    To start the script automatically on bootup, create hardlinks that
    indicate when to start/stop in:
		    /etc/rc[S0123].d/
    pointing to /etc/rc.d/smartd. Create:
	    K<knum>smartd in rcS.d, rc0.d, rc1.d, rc2.d
	    S<snum>smartd in rc3.d
    where <knum> is related to <snum> such that the higher snum is the
    lower knum must be.

[8] Guidelines for Windows
==========================
Cygwin:
  ./configure --mandir=/usr/share/man				\
	      --with-docdir=/usr/share/doc/smartmontools-VERSION

[9] Comments
============

To compile from another directory, you can replace the step
  ./configure [options]
by the following:
  mkdir objdir
  cd objdir
  ../configure [options]

To install to another destination (used mainly by package maintainers,
or to examine the package contents without risk of modifying any
system files) you can replace the step:
  make install
with:
  make DESTDIR=/home/myself/smartmontools-package install

Use a full path. Paths like ~/smartmontools-package may not work.

After installing smartmontools, you can read the man pages, and try
out the commands:
   
man smartd.conf
man smartctl
man smartd

/usr/sbin/smartctl -s on -o on -S on /dev/hda (only root can do this)
/usr/sbin/smartctl -a /dev/hda (only root can do this)

Note that the default location for the manual pages are
/usr/share/man/man5 and /usr/share/man/man8.  If "man" doesn't find
them, you may need to add /usr/share/man to your MANPATH environment
variable.

Source and binary RPM packages are available at
http://sourceforge.net/project/showfiles.php?group_id=64297

Refer to http://smartmontools.sourceforge.net/index.html#howtodownload
for any additional download and installation instructions.

The following files are installed if ./configure has no options:

/usr/sbin/smartd				[Executable daemon]
/usr/sbin/smartctl	 			[Executable command-line utility]
/etc/smartd.conf                                [Configuration file for smartd daemon]
/etc/rc.d/init.d/smartd	 			[Init/Startup script for smartd]
/usr/share/man/man5/smartd.conf.5		[Manual page]
/usr/share/man/man8/smartctl.8			[Manual page]
/usr/share/man/man8/smartd.8			[Manual page]
/usr/share/doc/smartmontools-5.X/AUTHORS	[Information about the authors and developers]
/usr/share/doc/smartmontools-5.X/CHANGELOG	[A log of changes. Also see CVS]
/usr/share/doc/smartmontools-5.X/COPYING	[GNU General Public License Version 2]
/usr/share/doc/smartmontools-5.X/INSTALL	[Installation instructions: what you're reading!]
/usr/share/doc/smartmontools-5.X/NEWS		[Significant bugs discovered in old versions]
/usr/share/doc/smartmontools-5.X/README		[Overview]
/usr/share/doc/smartmontools-5.X/TODO		[Things that need to be done/fixed]
/usr/share/doc/smartmontools-5.X/WARNINGS	[Systems where lockups or other serious problems were reported]
/usr/share/doc/smartmontools-5.X/smartd.conf	[Example configuration file for smartd]
/usr/share/doc/smartmontools-5.X/examplescripts	[Executable scripts for -M exec of smartd.conf (4 files)]


[10] Detailed description of arguments to configure command
===========================================================

When you type:
./configure [options]
there are six particularly important variables that affect where the
smartmontools software is installed.  The variables are listed here,
with their default values in square brackets, and the quantities that
they affect described following that.  This is a very wide table: please read
it in a wide window.

OPTIONS              DEFAULT                                      AFFECTS
-------              -------                                      -------
--prefix             [NO VALUE]                                   Please see below
--sbindir            /usr/sbin                                    Directory for smartd/smartctl executables;
                                                                  Contents of smartd/smartctl man pages
--mandir             /usr/share/man                               Directory for smartctl/smartd/smartd.conf man pages
--sysconfdir         /etc                                         Directory for smartd.conf;
                                                                  Contents of smartd executable;
                                                                  Contents of smartd/smartd.conf man pages;
                                                                  Directory for rc.d/init.d/smartd init script
--with-initscriptdir  ${sysconfdir}/init.d/rc.d                   Location of init scripts       
--with-docdir	      $(prefix)/usr/share/doc/smartmontools-5.X   Location of the documentation
--enable-sample	      --disable-sample				  Adds the string '.sample' to the names of the smartd.conf file and the smartd RC file



If you set --prefix and NONE of the other four variables, for example:
./configure --prefix=/home/joe
then the DEFAULT paths will ALL have prefix appended to them.

For example, if you set --prefix=/home/joe and none of the other four
variables then the different directories that are used would be:
--sbindir             /home/joe/usr/sbin
--mandir              /home/joe/usr/share/man
--sysconfdir          /home/joe/etc
--with-initscriptdir  /home/joe/etc/init.d/rc.d
--with-docdir	      /home/joe/usr/share/doc/smartmontools-5.X

This is useful for test installs in a harmless subdirectory somewhere.

Here are the four possible cases for the four variables above:

Case 1:
--prefix not set
--variable not set
===> VARIABLE gets default value above

Case 2:
--prefix set
--variable not set
===> VARIABLE gets PREFIX/ prepended to default value above

Case 3:
--prefix not set
--variable set
===> VARIABLE gets value that is set

Case 4:
--prefix is set
--variable is set
===> PREFIX is IGNORED, VARIABLE gets value that is set


For Filesystem Hierarchy Standard (FHS) installation locations
described in http://www.pathname.com/fhs/ please use:
--prefix=/usr/local


Here are the differences with and without --enable-sample, assuming
no other options specified (see above for details)

Case 1:
--enable-sample provided
==> Files installed are:
	/etc/smartd.conf.sample
	/etc/rc.d/init.d/smartd.sample

Case 2:
--disable-sample provided or parameter left out
==> Files installed are:
	/etc/smartd.conf
	/etc/rc.d/init.d/smartd



Additional information about using configure can be found here:
http://www.gnu.org/manual/autoconf-2.57/html_mono/autoconf.html#SEC139
