Howtos:OCS Inventory 102 OSX Server

From OCS Inventory NG
Jump to: navigation, search

Installing OCS Inventory NG V1.0.2 on OSX Server

General Comments

This is the procedure I followed to get the OCS Inventory Server running under Mac OS X Server. These instruction may be specific to Mac OS X 10.5 (Leopard). Earlier versions may be missing additional Perl modules or libraries. The Leopard Server already has php, perl 5.8.8, and mysql installed so the idea was that minimal extra software be installed.

The web server on Leopard is a 64 bit server so any code that links to it must also be compiled for 64 bit execution.

Hopefully most of the terminal commands can be cut and pasted from this documentation. This seems long but it actually wasn't too bad, just took a little working to find out which was the next change to make.

Install Perl Modules

sudo cpan Apache::DBI
sudo cpan SOAP::Lite
sudo cpan SOAP::Transport::HTTP
sudo cpan XML::Entities

the DBD::mysql perl modules must be compiled with 64 bit capabilities. There is probably a better way to do this. But this will do it.

First you need the include and libraries for mysql installed. Make a temporary source file directory as your working directory

curl http://www.opensource.apple.com/darwinsource/other/MySQL-43.binaries.tar.gz
tar -xvf MySQL-43.binaries.tar
cd MySQL-43.binaries
sudo tar -xzvf MySQL-43.root.tar.gz -C / ./usr/include/mysql ./usr/lib/mysql

Then make the perl libraries

sudo perl -MCPAN -e shell
force install DBD::mysql
cd ~/.cpan/build/DBD-mysql-4.010/
sudo make clean
sudo perl Makefile.PL
edit the Makefile and everywhere there is "-arch ppc -arch i386" add "-arch ppc64 -arch x86_64"
sudo make
sudo make install

Install OCS Inventory Files

download OCS tarball and patch 1 from sourceforge

Comment out in setup.sh all the log rotation stuff. Maybe it can be done in /usr/local/etc/periodic/weekly later. These are the lines that need commenting out, start the line with an octothorpe (#).

#    cp etc/logrotate.d/$COM_SERVER_LOGROTATE_CONF_FILE logrotate.$COM_SERVER_LOGROTATE_CONF_FILE.local                                                                                                      
#    $PERL_BIN -pi -e "s#PATH_TO_LOG_DIRECTORY#$OCS_COM_SRV_LOG#g" logrotate.$COM_SERVER_LOGROTATE_CONF_FILE.local                                                                                           
#    echo "******** Begin updated logrotate.$COM_SERVER_LOGROTATE_CONF_FILE.local ***********" >> $SETUP_LOG                                                                                                 
#    cat logrotate.$COM_SERVER_LOGROTATE_CONF_FILE.local >> $SETUP_LOG                                                                                                                                       
#    echo "******** End updated logrotate.COM_SERVER_LOGROTATE_CONF_FILE.local ***********" >> $SETUP_LOG                                                                                                    
#    echo "Removing old communication server logrotate file $LOGROTATE_CONF_DIR/ocsinventory-NG"                                                                                                             
#    echo "Removing old communication server logrotate file $LOGROTATE_CONF_DIR/ocsinventory-NG" >> $SETUP_LOG                                                                                               
#    rm -f "$LOGROTATE_CONF_DIR/ocsinventory-NG"                                                                                                                                                             
#    echo "Writing communication server logrotate to file $LOGROTATE_CONF_DIR/$COM_SERVER_LOGROTATE_CONF_FILE"                                                                                               
#    echo "Writing communication server logrotate to file $LOGROTATE_CONF_DIR/$COM_SERVER_LOGROTATE_CONF_FILE" >> $SETUP_LOG                                                                                 
#    cp -f logrotate.$COM_SERVER_LOGROTATE_CONF_FILE.local $LOGROTATE_CONF_DIR/$COM_SERVER_LOGROTATE_CONF_FILE >> $SETUP_LOG 2>&1                                                                            

now run the setup command

sudo sh setup.sh

For the question "user include configuration directory" enter "/private/etc/apache2/sites" all other questions, use the defaults

Install the Patches by copying the files to the correct places

cd OCSNG_UNIX_SERVER_1.02RC3_Patch1
sudo mv ocsreports/install.php /usr/share/ocsinventory-reports/ocsreports/
sudo mv ocsreports/files/ocsbase.sql /usr/share/ocsinventory-reports/ocsreports/files/

Installing the GD Graphics Library

These instructions came from topic desk, thank you Athanasios Alexandrides!

  1. You have made a backup of your system.
  2. You have the latest version of Apple's Developer Tools (XCode 3.0 or higher for 10.5) installed. Dev Tools are available on your Server DVD and as a free download from Apple's Developer Connection.
  3. X11 is installed (part of standard OS X Server install unless you deselect it)
  4. X11 SDK is installed (available on your OS X Developer Tools Disc or Image and part of the standard installation. This is different from the X11 client that comes with OS X.)
  5. You do have a backup
  6. You are running 10.5.6 or greater
  7. You have not manually updated anything related to GD, libpng, libjpeg and freetype so far (if you have, you must know how to adapt these instructions to the changes you made).

to make libjpeg libraries, with 64 bit capabilities.

mkdir SourceCache
cd SourceCache/
curl -O http://www.ijg.org/files/jpegsrc.v6b.tar.gz
tar xzpf jpegsrc.v6b.tar.gz
cd jpeg-6b/
cp /usr/share/libtool/config.sub .
cp /usr/share/libtool/config.guess .
MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os  -pipe -no-cpp-precomp" CCFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os  -pipe" CXXFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os  -pipe" LDFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -bind_at_load" ./configure --enable-shared
make
mkdir -p /usr/local/include 
mkdir -p /usr/local/bin 
mkdir -p /usr/local/lib 
mkdir -p /usr/local/man/man1
make 
sudo make install

Now to make the GD libraries that use the JPEG libraries. All the other libraries are included in the standard OS distribution.

curl -O http://www.opensource.apple.com/darwinsource/Current/apache_mod_php-44.1/php-5.2.6.tar.bz2
tar xjf php-5.2.6.tar.bz2
cd php-5.2.6/ext/gd
phpize
MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os  -pipe -no-cpp-precomp" CCFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os  -pipe" CXXFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os  -pipe" LDFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -bind_at_load" ./configure --with-zlib-dir=/usr --with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/X11R6 --with-freetype-dir=/usr/X11R6 --with-xpm-dir=/usr/X11R6
sudo make
make test
sudo make install

Setup PHP correctly

First we must make PHP be able to find these new libraries. This may also be a hack, but it works. Use any favorite editor if you don't like emacs.

sudo cp /etc/php.ini.default /etc/php.ini
sudo emacs /etc/php.ini
change
<pre>
	extension_dir = "./"

to

	extension_dir = "/usr/lib/php/extensions/no-debug-non-zts-20060613/"

add this line near the extensions section. Doesn't really matter where unless you need to find it again.

	extension=gd.so

If have FileMaker installed (as I did) also edit the other php.ini file the same way. This file is "/Library/FileMaker Server/Web Publishing/publishing-engine/php/lib/php.ini", and make the same changes as above.

Configure the Web Server

In the Server Admin Tools, using the GUI interface

  1. For the web server, add module "perl_module", /usr/libexec/apache2/perl_mod.so and enable
  2. stop and start web server

Allow the web server to read and write to the directory with the files in it.

cd /usr/share/ocsinventory-reports/ocsreports
sudo chown -R www *

Finally the setup shell for some reason echos all the "-n" instead of suppressing line endings in the shell. This seems to me to be a bug in sh since the documentation says it should work. Anyway, edit dbconfig.inc.php to remove excess line endings and "-n". File should look like this when you are done:

<?php
$_SESSION["SERVEUR_SQL"]="localhost";
$_SESSION["COMPTE_BASE"]="ocs";
$_SESSION["PSWD_BASE"]="ocs";
?>

Final Setup

You are done!! Just point your favorite browser at the install and answer the questions. http://yourserver.edu/ocsreports/install.php

user is "ocs"

Group is "ocs"

Database host is "localhost"

Then login with admin/admin and go wild!