Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > 37e222326095a93978d54b1564dd9954 > files > 103

apcupsd-3.10.5-1mdk.ppc.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
        <TITLE>Installing Apcupsd</TITLE>
   <meta name="Author" content="Kern Sibbald">
                <link rel=stylesheet href="apcupsd-styles.css" type="text/css">
</head>
<BODY>
<H1>Building and Installing Apcupsd</H1>
<P>The installation can be made several different ways
depending on what system you are running. The basic
procedure involves getting a source distribution, running
the configuration, rebuilding, and installing. For
RedHat systems, <b>apcupsd</b> is available in binary RPM
format as well as source RPM format. Please see 
<a href="install.html#RedHatRPM" name="RedHat RPM Installation">RedHat RPM Installation</a> below
for more details of the RPM installation. For Microsoft Windows
systems, there are two forms of binary install (tar file,
and setup.exe). Please see <a href="install.html#Win32" name="Win32 Installation">Win32 Installation</a> 
below for more details of the
Windows install.
<p>
The basic installation from a tar source file is rather simple: 
</P>
<OL>
        <LI style="margin-bottom: 0.1in">Detar the source code.</li>
        <LI style="margin-bottom: 0.1in"><B>cd</B> to the directory containing the source code.</li>
        <LI style="margin-bottom: 0.1in">./configure (with appropriate options as described below)</li>
        <LI style="margin-bottom: 0.1in">make</li>
                <li style="margin-bottom: 0.1in">su (i.e. become root)</li>
                <li style="margin-bottom: 0.1in">Stop any running apcupsd<br>
                                                 &lt;system-dependent-path&gt;/apcupsd stop</li>
        <li style="margin-bottom: 0.1in">uninstall any old <b>apcupsd</b><br>
                                                 This is important since the default install locations
                                                                                 may have changed.</li>
        <LI style="margin-bottom: 0.1in">make install</li>
                <LI style="margin-bottom: 0.1in">edit your /etc/apcupsd/apcupsd.conf file if necessary</li>
                <LI style="margin-bottom: 0.1in">ensure that your halt script is properly updated</li>
                <li style="margin-bottom: 0.1in">Start the new <b>apcupsd</b> with:<br>
                &lt;system-dependent-path&gt;/apcupsd start</li>
                <LI style="margin-bottom: 0.1in">IMPORTANT! Test the installation as outlined in the
                   <a href="testing.html">Testing Chapter</a> of this document.</li>
</OL>
<P>If all goes well, the <B>./configure</B> will correctly determine
which operating system you are running and configure the source code
appropriately. <B>configure</B> currently recognizes the systems
listed below in the <a href="install.html#OS_Specifics"> Operating System Specifics</a> 
section of this chapter and adapts the configuration
appropriately. Check that the configuration report printed at the end
of the ./configure process corresponds to your choice of directories,
options, and that it has correctly detected your operating system. If not,
redo the ./configure with the appropriate options until your configuration 
is correct.
<p>Please note that a number of the <b>./configure</b> options preset
<b>apcupsd.conf</b> directive values in an attempt to automatically
adapt <b>apcupsd</b> as best possible to your system. You can change
the values in <b>apcupsd.conf</b> at a later time without redoing the configuration
process by simply editing the <b>apcupsd.conf</b> file.</p>
For systems other than those mentioned above, you may need to do some tweaking. 
</P>
<P>In general, you will probably want to supply a more complicated
<B>configure</B> statement to ensure that the modules you want are
built and that everything is placed into the correct directories. 
<p>On RedHat, I use the following:
<pre>
CFLAGS="-g -Wall" LDFLAGS="-g -Wall" ./configure \
  --prefix=/usr \
  --sbindir=/sbin \
  --with-cgi-bin=/home/www/sibbald/new/cgi-bin \
  --enable-cgi \
  --with-css-dir=/home/www/sibbald/new/docs/css \
  --with-log-dir=/etc/apcupsd \
  --enable-pthreads \
  --enable-powerflute
</pre>
<h2>Default Options</h2>
<P>By default, make install will install the executable files in
<B>/sbin</B>, the manuals in <B>/usr/man</B>, and
the configuration and script files in <b>/etc/apcupsd</b>. In addition,
if your system is recognized, certain files such as the startup script
and the system halt script will be placed in appropriate system
directories (usually subdirectories of <b>/etc/rc.d</b>).

<h2><a name="CheckInstall"></a>Checking the Installation</h2>
There are a number of things that you can do to check if the installation (make install)
went well.  The fist is to check where the system has installed <b>apcupsd</b> using
<b>which</b> and <b>whereis</b>. On my
RedHat 6.1 system, I get the following (lines preceded with a $ indicate
what I typed):
<p class="tty">$ which apcupsd<br>
/sbin/apcupsd</p>
and
<p class="tty">$ whereis apcupsd<br>
apcupsd: /sbin/apcupsd /etc/apcupsd /etc/apcupsd.conf /etc/apcupsd.status 
/usr/man/man8/apcupsd.8.gz /usr/man/man8/apcupsd.8</p>
If you find an <b>apcupsd</b> in /usr/sbin, /usr/local/sbin, /usr/lib, or
another such directory, it is probably a piece of an old version of 
<b>apcupsd</b> that you can delete.  If you are in doubt, delete it,
then rerun the <b>make install</b> to ensure that you haven't deleted
anything needed by the new <b>apcupsd</b>. Please note that the
files specified above assume the default installation locations.
<h2>Final Installation Check</h2>
As a final check that the <b>make install</b> went well, you should
check your halt script (in /etc/rc.d on SuSE systems, and in /etc/rc.d/init.d
on RedHat systems) to see that the appropriate lines have been inserted
in the correct place. Modification of the halt script is important so that
at the end of the shutdown procedure, <b>apcupsd</b> will be called again
to command the UPS to turn off the power. This should only be done in
a power failure situation as indicated by the presence of the /etc/powerfail
file, and is necessary if you want your machine to automatically be
restarted when the power returns. On a RedHat system, the lines
containing the <b># ***apcupsd***</b>
should be inserted just before the final halt command:

<pre>
# Remount read only anything that's left mounted.
#echo &quot;Remounting remaining filesystems (if any) readonly&quot;
mount | awk '/ext2/ { print $3 }' | while read line; do
    mount -n -o ro,remount $line
done

# See if this is a powerfail situation.                               # ***apcupsd***
if [ -f /etc/apcupsd/powerfail ]; then                                # ***apcupsd***
   echo                                                               # ***apcupsd***
   echo &quot;APCUPSD will now power off the UPS&quot;                          # ***apcupsd***
   echo                                                               # ***apcupsd***
   /etc/apcupsd/apccontrol killpower                                  # ***apcupsd***
   echo                                                               # ***apcupsd***
   echo &quot;Please ensure that the UPS has powered off before rebooting&quot; # ***apcupsd***
   echo &quot;Otherwise, the UPS may cut the power during the reboot!!!&quot;   # ***apcupsd***
   echo                                                               # ***apcupsd***
fi                                                                    # ***apcupsd***

# Now halt or reboot.
echo &quot;$message&quot;
if [ -f /fastboot ]; then
 echo &quot;On the next boot fsck will be skipped.&quot;
elif [ -f /forcefsck ]; then
 echo &quot;On the next boot fsck will be forced.&quot;
fi
</pre>
<p>The purpose of modifying the system halt files is so that
<b>apcupsd</b> will be recalled after the system is in a stable
state. At that point, <b>apcupsd</b> will instruct the UPS to
shut off the power. This is necessary if you wish your system
to automatically reboot when the mains power is restored. If
you prefer to manually reboot your system, you can skip this
final system dependent installation step by specifying the
<b>--disable-install-distdir</b> option on the <b>./configure</b>
command (see below for more details).</p>
<p>The above pertains to RedHat systems only. 
There are significant differences in the procedures on each system,
as well as the location of the halt script. Also, the information that is inserted in
your halt script varies from system to system. Other systems such as Solaris
require you the make the changes manually, which has the advantage
that you won't have any unpleasant surprises in your halt script should
things go wrong. Please consult the specific system dependent
README files for more details.
<p>Please note that if you install from RPMs for a slave
machine, you will need to remove the changes that the RPM install
script made (similar to what is noted above) to the halt script.
This is because on a slave machine there is no connection to the 
UPS, so there is no need to attempt to power off the UPS. That
will be done by the master.</p>

<H2>Configure Options</H2>
<p>All the available <b>configure</b> options can be printed by
entering:</p>
<P class=tty>./configure --help</p>
<P>When specifying options for ./configure, if in doubt, don't put anything, since
normally the configuration process
will determine the proper settings for your system. The advantage of these options
is that it permits you to customize your version of <b>apcupsd</b>. If you save the
./configure command that you use to create <b>apcupsd</b>, you can quickly 
reset the same customization in the next version of <b>apcupsd</b> by simply
re-using the same ./configure command.
</P>
<p>If you are setting up a master/slave configuration, you will be required
to make some modifications to the <b>apcupsd.conf</b> files after the
configuration process. For more details on a master/slave setup (two computers
powered by the same UPS), please see the <a href="config-examples.html">Configuration Examples Chapter</a>
of this document. In addition, you will find some schematic diagrams of the possible 
configurations in the <a href="configure.html">Configuration Chapter</a>.</p>
<p>The following command line options are available for <b>configure</b> to customize your
installation.</p>
<DL>
  <DT>--prefix=&lt;path&gt;</DT><DD>
        This defines the directory for the non-executable files such as the
        manuals. The default is <B>/usr</B>.</DD>
                <DD STYLE="font-weight: medium"></DD>
  <DT>--sbindir=&lt;path&gt; </DT><DD>
        This defines the directory for the executable files such as <B>apcupsd</B>.
        The default is <B>/sbin</B>. You may be tempted to place the 
                executable files in /usr/sbin or /usr/local/sbin. Please use caution
                here as these directories may be unmounted during a shutdown and thus
                may prevent the <b>halt</b> script from calling <b>apcupsd</b> to
                turn off the UPS power. Though your data will be protected, in this case, your system
                will probably not be automatically rebooted when the power returns.</DD>
  <DT>--enable-powerflute</DT><DD>
        This option enables the building of the <B>powerflute</B>
        executable, which is a ncurses based program to monitor the UPS. This
                program is not necessary for the proper execution of <b>apcupsd</b>.
        </DD>
  <DT>--enable-cgi</DT><DD>
        This enables the building of the CGI programs that permit Web
        browser access to <B>apcupsd</B> data. This option is not necessary for
                the proper execution of <b>apcupsd</b>.
        </DD>
  <DT>--with-cgi-bin=&lt;path&gt;</DT><DD STYLE="margin-bottom: 0.2in">
        The with-cgi-bin configuration option allows you to define the
        directory where the cgi programs will be installed. The default
                is /etc/apcupsd, which is not necessarily what you want.
        </DD>
  <dt>--with-css-dir=&lt;path&gt;</dt><dd>
        This option allows you to specify where you want <b>apcupsd</b>
                to put the Cascading Style Sheet that goes with the <b>multimoncss.cgi</b>
                CGI program.</dd>
  <dt>--enable-pthreads</dt><dd>
        This option enables pthreads support causing <b>apcupsd</b> to be
                built as a threaded program rather than forking to create separate 
                processes. <b>apcupsd</b> built in this fashion is more efficient
                that the standard version being one third the data size and 
                less overhead locking and coping shared memory. This option is
                <b>highly</b> recommended for Windows builds.</dd>
  <dt>--with-libwrap=&lt;path&gt;</dt><dd>
        This option when enabled causes <b>apcupsd</b> to be built with
                the TCP WRAPPER libarary for enhanced security.</dd> In most cases,
                the &lt;path&gt; is optional since configure will determine where the
                libraries are on most systems.
  <dt>--with-nologin=&lt;path&gt;</dt><dd>
        This option allows you to specify where <b>apcupsd</b> will create
                the nologin file when logins are prohibited. The default is
                <b>/etc</b></dd>
  <dt>--with-pid-dir=&lt;path&gt;</dt><dd>
        This option allows you to specify where <b>apcupsd</b> will create
                the process id (PID) file to prevent multiple copies from
                running. The default is system dependent but usually <b>/var/run</b>.
                </dd>
  <dt>--with-log-dir=&lt;path&gt;</dt><dd>
        This option allows you to specify where <b>apcupsd</b> will create
                the EVENTS and STATUS log files. The default is <b>/etc/apcupsd</b>.
                This option simply sets the appropriate path in the <b>apcupsd.conf</b>
                file, which can be changed at any later time.</dd>
  <dt>--with-lock-dir=&lt;path&gt;</dt><dd>
        This option allows you to specify where <b>apcupsd</b> will create
                create the serial port lock file. The default is system dependent
                but usually <b>/var/lock</b>.
                This option simply sets the appropriate path in the <b>apcupsd.conf</b>
                file, which can be changed at any later time.</dd>
  <dt>--with-pwrfail-dir=&lt;path&gt;</dt><dd>
        This option allows you to specify where <b>apcupsd</b> will create
                the <b>powerfail</b> file when a power failure occurs. The default
                is system dependent but usually <b>/etc</b>.</dd>
  <dt>--with-serial-dev=&lt;device-name&gt;</dt><dd>
        This option allows you to specify where <b>apcupsd</b> will look
                for the serial device. The default is system dependent, but often
                <b>/dev/ttyS0</b>.
                This option simply sets the appropriate device name in the <b>apcupsd.conf</b>
                file, which can be changed at any later time.</dd>
  <dt>--with-nis-port=&lt;port&gt;</dt><dd>
        This option allows you to specify what port <b>apcupsd</b> will use
                for the Network Information Server (the CGI programs). The default
                is system dependent but usually 7000.
                This option simply sets the appropriate port in the <b>apcupsd.conf</b>
                file, which can be changed at any later time.</dd>
  <dt>--with-nisip=&lt;IP-Address&gt;</dt><dd>
        This option allows you to specify the value that will be placed
                 on then NISIP directive in the configuration file. The 
                 default is 0.0.0.0. No checking is done on the value entered,
                 so you must ensure that it is a valid IP address.</dd>
  <dt>--with-net-port=&lt;port&gt;</dt><dd>
        This option allows you to specify what port <b>apcupsd</b> will use
                for the Master and Slave communications. The default is system dependent
                but usually 6666.
                This option simply sets the appropriate port in the <b>apcupsd.conf</b>
                file, which can be changed at any later time.</dd>
  <dt>--with-upstype=&lt;type&gt;</dt><dd>
        This option allows you to specify the type of UPS that will be 
                connected to your computer. The default is: <b>smartups</b>.
                This option simply sets the appropriate UPS type in the <b>apcupsd.conf</b>
                file, which can be changed at any later time.</dd>
  <dt>--with-upscable=&lt;path&gt;</dt><dd>
        This option allows you to specify what cable you are using to
                connect to the UPS. The default is: <b>smart</b>.
                This option simply sets the appropriate UPS cable in the <b>apcupsd.conf</b>
                file, which can be changed at any later time.</dd>
  <dt>--disable-install-distdir</dt><dd>
        This option modifies the <b>apcupsd</b> Makefiles disable installation
                of the distribution (platform) directory. Generally, this used to
                do a full installation of <b>apcupsd</b> except the final modification
                of the operating system files (normally /etc/rc.d/halt, etc.). This is
                useful if your operating system is not directly supported by <b>apcupsd</b>
                or if you want to run two copies of <b>apcupsd</b> on the same system.
                This option can also be used by those of you who prefer to manually
                reboot your system after a power failure or who do not want to
                modify your system halt files. </dd>

</DL>
<H2>Recommended Options for most Systems</H2>
<P>For most systems, we recommend the following options: 
</P>
<P class=tty>./configure --prefix=/usr --sbindir=/sbin 
</P>
<P>and you can optionally build and install the CGI programs as
follows: 
</P>
<P class=tty>./configure --prefix=/usr --sbindir=/sbin --enable-cgi --with-cgi-bin=/home/httpd/cgi-bin 
</P>
<h2>Compilers and Options</h2>
Some systems require unusual options for compilation or linking that
the <b>./configure</b> script does not know about.  You can specify
initial values for variables by setting them in the environment.  Using
a Bourne-compatible shell, you can do that on the command line like
this:
<p class=tty>CFLAGS=&quot;-O2 -Wall&quot; LDFLAGS= ./configure</p>

Or on systems that have the <b>env</b> program, you can do it like this:
<p class=tty>env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure</p>
<p>Or for example on the Sun Solaris system, you can use:
<p class=tty>setenv CFLAGS -xO2
<p class=tty>setenv LDFLAGS -O
<p class=tty>./configure

<h1><a name="OS_Specifics"></a>Operating System Specifics</h1>
With the exception of Linux SuSe and Linux RedHat systems used
by the developers, we rely on users to help create installation
scripts and instructions as well as to test that <b>apcupsd</b>
runs correctly on their system. As you can imagine, most of these
people are system adminstrators rather than developers so they
are very busy and don't always have time to test the latest 
releases. With that in mind, we believe that you will find
that a lot of very valuable work has been already done to 
make your installation much easier (and probably totally
automatic).
<p>Below, you will find a list of Operating Systems for
which we have received installation files:</p>
<a href="install.html#Alpha">Alpha</a><br>
<a href="install.html#Caldera">Caldera</a><br>
<a href="install.html#Debian">Debian</a><br>
<a href="install.html#FreeBSD">FreeBSD</a><br>
<a href="install.html#HPUX">HPUX</a><br>
<a href="install.html#NetBSD">NetBSD</a><br>
<a href="install.html#OpenBSD">OpenBSD</a><br>
<a href="install.html#RedHat">RedHat</a><br>
<a href="install.html#RedHatRPM">RedHat RPM Installation</a><br>
<a href="install.html#Slackware">Slackware</a><br>
<a href="install.html#SuSE">SuSE</a><br>
<a href="install.html#Solaris">Solaris</a><br>
<a href="install.html#unknown">Unknown</a><br>
<a href="install.html#Win32">Windows</a><br>

<h2><a name="Alpha"></a>Alpha</h2>
The Alpha V4.0 version of <b>apcupsd</b> builds without compiler
errors with gcc version 2.95.2. It is unlikely that the native
Alpha compiler will work because of varargs differences. Unless
you are a system guru, we recommend that you connect your UPS
to the second serial port <b>/dev/tty01</b> to avoid conflicts
with the console device. 
<pre>DEVICE /dev/tty01</pre>
In addition, you should ensure serial
port lock file in apcupsd.conf is defined as:
<pre>LOCKFILE /var/spool/locks</pre>
<p>Unlike the Linux systems, the system halt routine is located
in <b>/sbin/rc0</b>, so after the <b>make install</b>, please
check that this file has been correctly updated.
<p>The start/stop script can be found in:
<pre>
/sbin/init.d/apcupsd
</pre>
<h2><a name="Caldera"></a>Caldera</h2>
This port appears to be complete, but we have had
no feedback from users. 
 
<h2><a name="Debian"></a>Debian</h2>
This port is complete and is operation by several
users. Since Debian build and install procedures are
somewhat particular, we have put the extra Debian
information into the following two subdirectories:
<b>&lt;src&gt;/distributions/debian/examples/  and
&lt;src&gt;/distributions/debian/packageinfo</b>
<p>You can also find the offical Debian packages
on the Debian site at: 
<p> 
<a href="http://packages.debian.org/stable/admin/apcupsd.html">
http://packages.debian.org/stable/admin/apcupsd.html</a>
<br>
<a href="http://packages.debian.org/testing/admin/apcupsd.html">
http://packages.debian.org/testing/admin/apcupsd.html</a>
<br>
<a href="http://packages.debian.org/unstable/admin/apcupsd.html">
http://packages.debian.org/unstable/admin/apcupsd.html</a>
<br>

<h2><a name="FreeBSD"></a>FreeBSD</h2>
This port is complete and is being used by
several users. As of version 3.8.3, we do not recommend
that you compile <b>apcupsd</b> with pthreads enabled. This
is because the current FreeBSD implementation of pthreads
runs as a single process, and thus is less efficient (consumes
more CPU time) than the forking version of <b>apcupsd</b>.
We hope to rectify this in a future version by using the
FreeBSD LinuxThreads implementation of pthreads.

<h2><a name="HPUX"></a>HPUX</h2>
<p>We have no reports of testing this yet on version 3.8.4,
but worked fine on 3.8.1<p>

<h2><a name="NetBSD"></a>NetBSD</h2>
Submitted during development of 3.8.2, this should be
a complete distribution.<br>
Please read the comments on the pthreads implementation in the
FreeBSD section above as they may apply equally to OpenBSD.

<h2><a name="OpenBSD"></a>OpenBSD</h2>
Ensure that you read the distributions/openbsd/README file before
running apcupsd.  There are some critical differences in how the OpenBSD
implemenation operates when the UPS batteries are exhausted.  Failure
to take this into account may result in the system not being fully 
halted when power is lost.<br>
Please read the comments on the pthreads implementation in the
FreeBSD section above as they may apply equally to OpenBSD.
<p>

<h2><a name="RedHat"></a>RedHat Systems</h2>
RedHat systems are fully supported, and by following the standard
installation instructions given above, you should experience few or no problems.

<h2><a name="RedHatRPM"></a>RedHat RPM Installation</h2>
For RedHat systems 6.0, 6.1, and 6.2, and 7.0, 
there are binary and source RPMs 
available. Follow standard procedures for installing them.
Please note, that the neither the 6.x nor the 7.0 RPMs can
be installed on a RedHat 7.1 system.  
These binary RPMs can be installed with:
<p class="tty">rpm -Uhv &lt;release&gt;</p>
where &lt;release&gt; is the release to be installed,
and is typically something like <b>apcupsd-3.8.0.i386.rpm</b>
(or perhaps apcupsd-3.8.0-pre6.i386.rpm for a pre-release).
<p><b>IMPORTANT</b>If you are doing a binary RPM upgrade,
please remove the previous version of <b>apcupsd</b> because
for some unknown reason, the rpm does
not always update the halt script. To do the upgrade, use the 
following two commands:
<p class="tty">rpm -e apcupsd
<br>rpm -Uhv &lt;release&gt;</p>
<p>After installation of the binary RPM, please verify carefully
that <b>/etc/rc.d/init.d/halt</b> was properly updated and
contains new script lines flagged with <b>***APCUPSD***</b>.
<p>Since there is no standard location for <b>cgi-bin</b>, the
rpm will place the binary CGI programs in 
the directory <b>/etc/apcupsd/cgi</b>. To actually use them,
you must copy or move them to your actual cgi-bin directory,
which on many systems is located in <b>/home/httpd/cgi-bin</b>.


<h2><a name="Slackware"></a>Slackware</h2>
Slackware systems are fully supported, and by following the standard
installation instructions given above, you should experience few or no problems.

<h2><a name="SuSE"></a>SuSE</h2>
SuSE systems are fully supported, and by following the standard
installation instructions given above, you should experience few or no problems.

<h2><a name="Solaris"></a>Sun Solaris</h2>
<p>
Please read this before attempting to compile or install the 
beta software. It contains important information that will make 
your efforts easier.
<p>
If you find bugs, or run into problems that seem to be related to 
the version of Solaris that you run, please feel free to contact 
me by email, or through the development mailing list. I'll attempt
to help with problems getting the beta running, although I can't 
promise a quick response. 
<p>
As always, remember testing UPSes can be hazardous to you system,
and, APCUPSD MAY CONTAIN BUGS THAT CAN DAMAGE YOUR SYSTEM AND DATA FILES! 
You must accept all responsibility for running this software. 
An unexpected power-off of a running system can be 
a disaster. As always, make backups of any critical information 
before you install this software. 
<p>
Remember, we told you. we'll listen sympathetically if you lose data,
but there will be nothing we can do to help you. 
<p>
Sincerely, <br>
Carl Erhorn &lt;cerhorn@hyperion.com&gt; &lt;apcupsd-devel@ro.com&gt;
<p>
<hr>
Please read the general installation instructions given above before 
continuing on with these Solaris-specific instructions. Then come
back and read this section before attempting to build the package.
<p>
For building the system, we suggest that you run the configure and
make processes as your normal UNIX user ID. The <b>make install</b> must 
be run as root. But if your normal ID has an environment setup for 
using the c compiler, it's simpler to do that than setup root to 
have the correct environment. 
<p>
Normally, we support the GCC compiler, but we have also attempted
to support the Solaris workshop compilers and EGCS compilers. Please
be aware that if you do not use GCC, you may experience a few problems.
<p>
Whichever compiler you do have, 
please insure that you can execute 
the compiler from the command line before running configure. If you 
do not have an environment setup to run the compiler first, configure 
will fail. 
<p>
Before running ./configure, please be sure that you do not have
/usr/ucb on your path. This may cause the ./configure to chose the
wrong shutdown program. If ./configure detects that /usr/usb is on
your path, it will print a warning message. Please follow the 
advice to avoid shutdown problems.
<p></p>
Your normal UNIX user ID must own the source tree directories, and 
you must have the normal development tools in your path. This 
includes make, the compiler, the M4 preprocessor, the linker, and ar
or ranlib. If the user you are logged in as can compile and link a c 
program from a source file, then you have all the required tools 
available.
<p>
You will want to install the executables in 
a directory that remains mounted during the shutdown. 
Solaris will unmount almost everything except the root 
directories. Since the ability to power the UPS off requires access 
to the executable programs, they need to be in a directory that will 
never be unmounted. And since they should also be in a directory that
normal users cannot get into, /sbin is the default. However,
please be aware that if you want to follow Sun's filesystem conventions
you would use the following:
<pre>
./configure \
   --prefix=/opt/apcupsd \
   --sbindir=/etc/opt/apcupsd/sbin \
   --sysconfdir=/etc/opt/apcupsd \
   --with-cgi-bin=/opt/apcupsd/cgi-bin
</pre>

<p></p>
The way to setup the /sbin directory as the executables directory is
to pass configure the <b>--sbindir=/sbin</b> option. 
No other arguments should be required, and your setup 
and platform should be detected automatically by configure. 
<p>
Once you have run configure, you will need to do a <b>make</b>. Once the 
make has completed with no errors, you must su to root to complete 
the install. After the su, you may not have a path to the make 
program anymore. In that case, you should do the <b>make install</b> 
step as:
<p class=tty>/usr/ccs/bin/make install</p>

Once the install completes, you must edit the /sbin/rc0 script as 
detailed below, then exit from the su'ed shell.
<p>
In order to support unattended operation and shutdown during a power
failure, it's important that the UPS remove power after the shutdown
completes. This allows the unattended UPS to reboot the system when 
power returns by repowering the system. Of course, you need autoboot
enabled for your system to do this, but all Solaris systems have this
by default. If you have disabled this on your system, please re-enable
it. 
<p>
To get the UPS to remove power from the system at the correct time
during shutdown, i.e., after the disks have done their final sync,
we need to modify a system script. This script is /sbin/rc0. 
<p>
We do not have access to every version of Solaris, but we believe this
file will be almost identical on every version. Please
let us know if this is not true. 
<p>
At the very end of the /sbin/rc0 script, you should find lines just
like the following:

<p class=tty><pre>
# unmount file systems. /usr, /var and /var/adm are not unmounted by umountall
# because they are mounted by rcS (for single user mode) rather than
# mountall.
# If this is changed, mountall, umountall and rcS should also change.
/sbin/umountall
/sbin/umount /var/adm >/dev/null 2>&1
/sbin/umount /var >/dev/null 2>&1
/sbin/umount /usr >/dev/null 2>&1

echo 'The system is down.'
</pre>
</p>

We need to insert the following lines just before the last 'echo':
<p class=tty> <pre>
#see if this is a powerfail situation
if [ -f /etc/apcupsd/powerfail ]; then
        echo 
        echo &quot;APCUPSD will power off the UPS&quot;
        echo
        /etc/apcupsd/apccontrol killpower
        echo
        echo &quot;Please ensure that the UPS has powered off before rebooting&quot;
        echo &quot;Otherwise, the UPS may cut the power during the reboot!!!&quot;
        echo
fi
</pre></p>

We have included these lines in a file called rc0.solaris in the 
distributions/sun subdirectory of the source tree. You can cut and
paste them into the /sbin/rc0 file at the correct place, or yank 
and put them using vi or any other editor. Note that you must be 
root to edit this file. 
<p>
You must be absolutely sure you have them in the right place. If your
/sbin/rc0 file does not look like the lines shown above, do not 
modify the file. Instead, email a copy of the file to me, and I will
attempt to figure out what you should do. If you mess up this file, 
the system will not shut down cleanly, and you could lose data. 
Don't take the chance. 
<p>
This feature has only been tested with APC SmartUPS models. If you
do not have a SmartUPS, you will be one of the first testers to try
this feature. Please send me email to let me know if it works with
your UPS model, what model you have, and if possible, the event logs
located in /etc/apcupsd. We'd be very interested in your results, and
would be glad to work with you to get this feature working correctly
with all the APC models. A detailed description of the screen output
during the shutdown would be very helpful if you see problems. 
<p>
You will then need to make the normal changes to the 
/etc/apcupsd/apcupsd.conf file. This file contains the configuration
settings for the package. It is important that you set the values
to match your UPS model and cable type, and the serial port that 
you have attached the UPS to. I have used both /dev/ttya and /dev/ttyb
with no problems. You should be sure that logins are disabled on the 
port you are going to use, otherwise you will not be able to communicate
with the UPS. If you are not sure that logins are disabled for the
port, run the 'admintool' program as root, and disable the port. The
'admintool' program is a GUI administration program, and required that
you are running CDE, OpenWindows, or another XWindows program such as 
KDE.
<h3>Solaris EEPROM Changes</h3>
Solaris probes the serial ports during boot, and during this process, 
it toggles some handshaking lines used by the UPS.  
As a result, particularly for simple signalling &quot;dumb&quot;
UPSes it seems to kick it into a mode that makes the UPS think 
it's either in a calibration run, or some self-test mode. 
Since at this point we are really not communicating with the UPS, 
it's pretty hard to tell what happened.
But it's easy to prevent this, and you should.
Disconnect the UPS, and boot the system. When you get to a 
login prompt, log in as root. Type the following command:
<pre>
eeprom com1-noprobe=true

or

eeprom com2-noprobe=true
</pre>
depending on which com port your UPS is attached to. 
Then sync and shutdown the system normally, reattach the UPS, and reboot. 
This should solve the problem. However, we have some reports that
recent versions of Solaris (7 &amp; 8) appear to have removed
this eeprom option and there seems to be no way to suppress
the serial port probing during boot.

<p>
At this point, you should have a complete installation. The daemon
will load automatically at the next boot. Watch for any error messages
during boot, and check the event logs in /etc/apcupsd. If everything
looks OK, you can try testing the package by removing power from the
UPS. NOTE! if you have a simple signaling UPS, please run the first
power tests with your computer plugged into the wall rather than into
the UPS. This is because simple signaling UPSes have a tendency to
power off if your configuration or cable are not correct.
<p>
As a user, your input is very helpful in solving problems with
the package, and providing suggestions and future directions for the 
development of the package. We are striving to provide a useful package
that works across all platforms, and welcome your feedback.
<p>
Best regards, and thanks for your interest and help,
The Apcupsd Development Team.

<h2><a name="unknown"></a>Unknown Operating System</h2>
During the <b>./configure</b>, if <b>apcupsd</b> does not find one of
the systems for which it has specific installation programs, it will
set the Operating System to <b>unknown</b> and will use the incomplete
installation scripts that are in <b>&lt;src&gt;/distributions/unknown/</b>.
You will be on your own, or you can ask the developers list (apcupsd-devel@apcupsd.org) 
for installation instructions. This directory also contains a hint file for
<b>Linux From Scratch</b>, which could be helpful for other systems as well.

<h2><a name="Win32"></a>Windows Systems with CYGWIN Installed</h2>
If you have a binary release of the <b>Win32 apcupsd</b>, please
see the instructions in the <a href="win32.html">Win32 section</a>
of this manual.
<p>If you wish to build from the source, and 
if you have CYGWIN version 1.3.2 and GCC 2.95.3-5 installed, it
is possible to build the Win32 version of <b>apcupsd</b>.
Note, <b>apcupsd</b> version 3.8.0 as distributed was built with CYGWIN
version 1.1.2 but works fine when built and run with CYGWIN
1.1.5. Version 3.8.2 was built with CYGWIN version 1.3.1-1, and
versions 3.8.3 and 3.8.4 of <b>apcupsd</b> are
built with CYGWIN version 1.3.2.
Please don't try any other versions of CYGWIN as there
were known problems.  
<p>To date, the Win32 version has only been build on a Win98
SR2 system with the above CYGWIN environment and all the 
available CYGWIN tools loaded. In addition, the builds were
done running under the <b>bash</b> shell. As time permits,
we will experiment with other environments, and if any of you
do build it from source, please let us know. The current
CYGWIN environment was loaded using the CYGWIN setup.exe
program, downloading ALL the latest binaries and installing
them. 
<p>
We recommend that you run the <b>./configure</b> command with
the following options:
<pre>
./configure \
  --prefix=/apcupsd \
  --sbindir=/apcupsd/bin \
  --sysconfdir=/apcupsd/etc/apcupsd \
  --with-pid-dir=/apcupsd/etc/apcupsd \
  --mandir=/apcupsd \
  --with-cgi-bin=/apcupsd/etc/apcupsd/cgi \
  --enable-pthreads
</pre>
After which, you can do a:
<pre>
make
</pre>
And to install <b>apcupsd</b>, do:
<p></p>
<pre>make install</pre>
<p>
During linking of <b>popup.exe</b> and <b>apcupsd.exe</b>, the following warning
message is printed:
<pre>
/USR/BIN/ld: warning: cannot find entry symbol _WinMainCRTStartup; defaulting to 00401000
</pre>
This warning causes no harm. If there is some CYGWIN guru out there who knows how to
eliminate this error, please contact us at: apcupsd-devel@apcupsd.org 
<p>
Finally, you should follow the installation instructions in
the <a href="win32.html">Win32 Installation</a> section of
this document, skipping the part that describes unZipping
the binary release.
<hr>

<a href="quickstart.html" target="_self"><img src="back.gif" border=0 alt="Back"></a>
<a href="configure.html" target="_self"><img src="next.gif" border=0 alt="Next"></a>
<a href="index.html"><img src="home.gif" border=0 alt="Home"></a>
</body>
</html>