nut/INSTALL

321 lines
9.8 KiB
Text
Raw Normal View History

2011-01-26 09:35:08 +00:00
Installation instructions
=========================
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
This chapter describe the various methods for installing Network UPS Tools.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
Whenever it is possible, prefer <<Installing_packages, installing from packages>>.
Packagers have done an excellent and hard work at improving NUT integration into
their system.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
[[Installing_source]]
Installing from source
----------------------
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
These are the essential steps for compiling and installing this software.
The NUT linkdoc:packager-guide[Packager Guide], which presents the best
practices for installing and integrating NUT, is also a good reading.
[NOTE]
.Keep in mind that...
================================================================================
- the paths shown below are the default values you get by just calling
configure by itself. If you have used --prefix or similar, things will be
different. Also, if you didn't install this program from source yourself, the
paths will probably have a number of differences.
- by default, your system probably won't find the man pages, since they
install to /usr/local/ups/man. You can fix this by editing your MANPATH, or
just do this:
2010-03-25 23:20:59 +00:00
man -M /usr/local/ups/man <man page>
2011-01-26 09:35:08 +00:00
- if your favorite system offers up to date binary packages, you should always
prefer these over a source installation. Along with the known advantages of such
systems for installation, upgrade and removal, there are many integration issues
that have been addressed.
================================================================================
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
Prepare your system
~~~~~~~~~~~~~~~~~~~~
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
System User creation
^^^^^^^^^^^^^^^^^^^^
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
Create at least one system user and a group for running this software. You
might call them "ups" and "nut". The exact names aren't important as
long as you are consistent.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
The process for doing this varies from one system to the next, and
explaining how to add users is beyond the scope of this document.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
For the purposes of this document, the user name and group name
will be 'ups' and 'nut' respectively.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
Be sure the new user is a member of the new group! If you forget to
do this, you will have problems later on when you try to start upsd.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
Build and install
~~~~~~~~~~~~~~~~~
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
[[Configuration]]
Configuration
^^^^^^^^^^^^^
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
Configure the source tree for your system. Add the '--with-user' and
'--with-group' switch to set the user name and group that you created
above.
2010-03-25 23:20:59 +00:00
./configure --with-user=ups --with-group=nut
2011-01-26 09:35:08 +00:00
If you need any other switches for configure, add them here. For example:
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
* to build and install USB drivers, add '--with-usb' (note that you
need to install libusb development package or files).
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
* to build and install SNMP drivers, add '--with-snmp' (note that
you need to install libsnmp development package or files).
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
* to build and install CGI scripts, add '--with-cgi'.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
See <<Configure_options,Configure options>> from the User Manual,
docs/configure.txt or './configure --help' for all the available
options.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
If you alter paths with additional switches, be sure to use those
new paths while reading the rest of the steps.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
Reference: <<Configure_options,Configure options>> from the
User Manual.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
Build the programs
^^^^^^^^^^^^^^^^^^
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
make
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
This will build the NUT client and server programs and the
selected drivers. It will also build any other features that were
selected during <<Configuration,configuration>> step above.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
Installation
^^^^^^^^^^^^
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
[NOTE]
=====================================================================
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
you should now gain privileges for installing software if necessary:
2010-03-25 23:20:59 +00:00
su
2011-01-26 09:35:08 +00:00
=====================================================================
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
Install the files to a system level directory:
2010-03-25 23:20:59 +00:00
make install
2011-01-26 09:35:08 +00:00
This will install the compiled programs and man pages, as well as
some data files required by NUT. Any optional features selected
during configuration will also be installed.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
This will also install sample versions of the NUT configuration
files. Sample files are installed with names like ups.conf.sample
so they will not overwrite any existing real config files you may
have created.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
If you are packaging this software, then you will probably want to
use the DESTDIR variable to redirect the build into another place,
i.e.:
2010-03-25 23:20:59 +00:00
make DESTDIR=/tmp/package install
make DESTDIR=/tmp/package install-conf
2011-01-26 09:35:08 +00:00
[[StatePath]]
State path creation
^^^^^^^^^^^^^^^^^^^
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
Create the state path directory for the driver(s) and server to use
for storing UPS status data and other auxiliary files, and make it
owned by the user you created.
2010-03-25 23:20:59 +00:00
mkdir -p /var/state/ups
chmod 0770 /var/state/ups
chown root:nut /var/state/ups
2011-01-26 09:35:08 +00:00
[[Ownership]]
Ownership and permissions
^^^^^^^^^^^^^^^^^^^^^^^^^
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
Set ownership data and permissions on your serial or USB ports
that go to your UPS hardware. Be sure to limit access to just
the user you created earlier.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
These examples assume the second serial port (ttyS1) on a typical
Slackware system. On FreeBSD, that would be cuaa1. Serial ports
vary greatly, so yours may be called something else.
2010-03-25 23:20:59 +00:00
chmod 0660 /dev/ttyS1
chown root:nut /dev/ttyS1
2011-01-26 09:35:08 +00:00
////////////////////////////////////////////////////////////////////////////////
FIXME: TBR
////////////////////////////////////////////////////////////////////////////////
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
The setup for USB ports is slightly more complicated. Device files
for USB devices, such as /proc/bus/usb/002/001, are usually
created "on the fly" when a device is plugged in, and disappear
when the device is disconnected. Moreover, the names of these
device files can change randomly. To set up the correct
permissions for the USB device, you may need to set up (operating
system dependent) hotplugging scripts. Sample scripts and
information are provided in the scripts/hotplug and
scripts/udev directories. For most users, the hotplugging scripts
will be installed automatically by "make install".
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
(If you want to try if a driver works without setting up
hotplugging, you can add the "-u root" option to upsd, upsmon, and
drivers; this should allow you to follow the below
instructions. However, don't forget to set up the correct
permissions later!).
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
NOTE: if you are using something like devfs or udev, make sure
these permissions stay set across a reboot. If they revert to the
old values, your drivers may fail to start.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
You are now ready to configure NUT, and start testing and using it.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
You can jump directly to the <<Configuration_notes,NUT configuration>>.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
[[Installing_packages]]
Installing from packages
------------------------
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
This chapter describes the specific installation steps when using
binary packages that exist on various major systems.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
[[Debian]]
Debian, Ubuntu and other derivatives
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
NOTE: NUT is packaged and well maintained in these systems.
The official Debian packager is part of the NUT Team.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
Using your prefered method (apt-get, aptitude, Synaptic, ...), install
the 'nut' package, and optionaly the following:
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
- 'nut-cgi', if you need the CGI (HTML) option,
- 'nut-snmp', if you need the snmp-ups driver,
- 'nut-xml', for the netxml-ups driver,
- 'nut-powerman-pdu', to control the PowerMan daemon (PDU management)
- 'nut-dev', if you need the development files.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
////////////////////////////////////////////////////////////////////////////////
- nut-client
- nut-hal-drivers
////////////////////////////////////////////////////////////////////////////////
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
Configuration files are located in /etc/nut.
2012-06-01 13:55:19 +00:00
linkman:nut.conf[5] must be edited to be able to invoke /etc/init.d/nut
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
NOTE: Ubuntu users can access the APT URL installation by clicking on link:apt://nut[this link].
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
[[Mandriva]]
Mandriva
~~~~~~~~
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
NOTE: NUT is packaged and well maintained in these systems.
The official Mandriva packager is part of the NUT Team.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
Using your prefered method (urpmi, RPMdrake, ...), install one of the two below
packages:
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
- 'nut-server' if you have a 'standalone' or 'netserver' installation,
- 'nut' if you have a 'netclient' installation.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
Optionaly, you can also install the following:
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
- 'nut-cgi', if you need the CGI (HTML) option,
- 'nut-devel', if you need the development files.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
[[Suse]]
Suse / Opensuse
~~~~~~~~~~~~~~~
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
NOTE: NUT is packaged and well maintained in these systems.
The official Suse packager is part of the NUT Team.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
Install the 'nut-classic' package, and optionaly the following:
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
- 'nut-drivers-net', if you need the snmp-ups or the netxml-ups drivers,
- 'nut-cgi', if you need the CGI (HTML) option,
- 'nut-devel', if you need the development files,
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
NOTE: Suse and Opensuse users can use the
link:http://software.opensuse.org/search?baseproject=ALL&p=1&q=nut[one-click install method]
to install NUT.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
[[RedHat]]
Red Hat, Fedora and CentOS
~~~~~~~~~~~~~~~~~~~~~~~~~~
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
NOTE: NUT is packaged and well maintained in these systems.
The official Red Hat packager is part of the NUT Team.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
Using your prefered method (yum, Add/Remove Software, ...), install one of the
two below packages:
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
- 'nut' if you have a 'standalone' or 'netserver' installation,
- 'nut-client' if you have a 'netclient' installation.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
Optionaly, you can also install the following:
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
- 'nut-cgi', if you need the CGI (HTML) option,
- 'nut-xml', if you need the netxml-ups driver,
- 'nut-devel', if you need the development files.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
[[FreeBSD]]
FreeBSD
~~~~~~~
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
You can either install NUT as a binary package or as a port.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
Binary package
^^^^^^^^^^^^^^
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
To install the main component, use the following command:
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
# pkg_add -r nut
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
Port
^^^^
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
The port is located under /usr/ports/sysutils/nut.
To install it, use the following command:
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
# cd /usr/ports/sysutils/nut/ && make install clean
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
You have to define WITH_NUT_CGI to build the optional CGI scripts.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
Optionaly, you can also install the following ports:
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
- sysutils/nut-snmp, for the SNMP driver,
- sysutils/nut-usb, for the USB drivers,
- sysutils/nut-libupsclient, for the upsclient library.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
You are now ready to configure NUT, and start testing and using it.
2010-03-25 23:20:59 +00:00
2011-01-26 09:35:08 +00:00
You can jump directly to the
<<Configuration_notes,NUT configuration>>.