Difference between revisions of "MOSS/Distribution Specific Instructions"

From OpenUru
Jump to: navigation, search
(MacOS X)
Line 1: Line 1:
This document is meant to collect any known distribution-specific instructions
+
This document is meant to collect any known distribution-specific instructions for installing [[MOSS]]. For general directions on installation, or if your distribution isn't listed here, you can consult [[MOSS-Setup]]. There are two main parts: installing the prerequisite packages, and setting up the PostgreSQL database. Feel free to add any other notes you may find useful.
for installing MOSS. There are two main parts: installing the prerequisite
 
packages, and setting up the PostgreSQL database. Feel free to add any other
 
notes you may find useful.
 
 
 
  
 
== Prerequisite Packages ==
 
== Prerequisite Packages ==
Line 9: Line 5:
 
=== NetBSD pkgsrc ===
 
=== NetBSD pkgsrc ===
  
Only PostgreSQL and the autotools are needed. You can build the packages
+
Only PostgreSQL and the autotools are needed. You can build the packages or use the prebuilt packages with pkg_add.
or use the prebuilt packages with pkg_add.
 
 
 
 
  pkg_add automake
 
  pkg_add automake
 
  pkg_add libtool
 
  pkg_add libtool
 
  pkg_add libpqxx
 
  pkg_add libpqxx
I recommend starting with libpqxx because it seems to lag the postgresql-client
+
I recommend starting with libpqxx because it seems to lag the postgresql-client package, and installing libpqxx will get the correct client.
package, and installing libpqxx will get the correct client.
 
 
  pkg_add postgresqlNN-server
 
  pkg_add postgresqlNN-server
 
Get the version number to match the client installed for pqxx.
 
Get the version number to match the client installed for pqxx.

Revision as of 15:25, 15 February 2012

This document is meant to collect any known distribution-specific instructions for installing MOSS. For general directions on installation, or if your distribution isn't listed here, you can consult MOSS-Setup. There are two main parts: installing the prerequisite packages, and setting up the PostgreSQL database. Feel free to add any other notes you may find useful.

Prerequisite Packages

NetBSD pkgsrc

Only PostgreSQL and the autotools are needed. You can build the packages or use the prebuilt packages with pkg_add.

pkg_add automake
pkg_add libtool
pkg_add libpqxx

I recommend starting with libpqxx because it seems to lag the postgresql-client package, and installing libpqxx will get the correct client.

pkg_add postgresqlNN-server

Get the version number to match the client installed for pqxx.

Now follow the instructions:

  • copy /usr/pkg/share/examples/rc.d/pgsql to /etc/rc.d/pgsql
  • chmod 555 /etc/rc.d/pgsql
  • append pgsql=YES to /etc/rc.conf

MacOS X

First, you will need the MacOS X developer tools installed.

Second, you will need to install libpqxx, zlib, and postgresql. Here is one approach:

You can use [MacPorts] to install as follows:

sudo port install libpqxx zlib postgresql84 postgresql84-server

Some instruction guides for installing PostgreSQL (such as the README for EnterpriseDB's version) suggest editing /etc/sysctl.conf and increasing the shmall setting from the default (8192 under Mac OS X 10.6, exactly 1/4096th of shmmax). Whatever number you choose for shmall, it should be (a) smaller than shmmax, and (b) divisible by 4096. For example, a valid value might be:

kern.sysv.shmall=65536

MacPorts might not create the user and group accounts for postgres. For some reason, most instructions for installing PostgreSQL from MacPorts seem to gloss over this issue. You may need to manually create the postgres User and Group. This is accomplished in two phases.

First, identify the last user and group IDs already present.

sudo dscl . -list /Users UniqueID | sort -n -k 2 | tail -n 1
sudo dscl . -list /Groups PrimaryGroupID | sort -n -k 2 | tail -n 1

For each, take the number shown and add 1. These are your UniqueID and PrimaryGroupID numbers.

Second, replace the ### in the following commands as indicated to create the user and group.

sudo dscl . -create /Users/postgres UniqueID ###
sudo dscl . -create /Users/postgres PrimaryGroupID ###
sudo dscl . -create /Users/postgres HomeDirectory /opt/local/var/db/postgresql84
sudo dscl . -create /Users/postgres NFSHomeDirectory /opt/local/var/db/postgresql84
sudo dscl . -create /Users/postgres RealName "PostgreSQL Administrator"
sudo dscl . -create /Users/postgres Password \*
sudo dscl . -create /Groups/postgres PrimaryGroupID ###
sudo dscl . -create /Groups/postgres Password \*

The following instructions must be performed after installing PostgreSQL. If the 'chown' step fails, then you're probably missing the user and group settings indicated above.

sudo mkdir -p /opt/local/var/db/postgresql84/defaultdb
sudo chown -R postgres:postgres /opt/local/var/db/postgresql84
sudo su postgres -c '/opt/local/lib/postgresql84/bin/initdb -D /opt/local/var/db/postgresql84/defaultdb'
sudo launchctl load -w /Library/LaunchDaemons/org.macports.postgresql84-server.plist

The last line above should cause the server to start on reboot. Don't reboot yet - proceed to the database setup instructions where there are more steps you'll want to complete before starting the server.

Security Suggestion

For some installations of Postgres, experts recommend an additional step:

sudo dscl . -create /Users/postgres UserShell /usr/bin/false

After setting this up, you'll lose the ability to su to the postgres account to run other programs. So, this is a step you might take only after getting everything else working. To revert this step:

sudo dscl . -create /Users/postgres UserShell /bin/bash

Database Setup

NetBSD pkgsrc

Copy moss_uuidgen.so to /usr/pkg/lib/postgresql/

The database user is pgsql. It has root access to the DB by default. Connect from localhost (the default).

Create the database:

su -m pgsql -c "psql postgres"
create database moss with encoding='UTF8';
\c moss
create role moss with login;
\q
su -m pgsql -c "psql postgres -f moss.sql"

Then set db_user=moss in moss_backend.cfg.

MacOS X

Copy moss_uuidgen.so to /opt/local/lib/postgresql84/. From the root of your MOSS build tree:

sudo cp postgresql/moss_uuidgen.so /opt/local/lib/postgresql84/

Now you'll need to start the server. The & will background the process:

sudo su postgres -c '/opt/local/lib/postgresql84/bin/postgres -D /opt/local/var/db/postgresql84/defaultdb' &

The database user is postgres. Start psql, the postgreSQL command line interface, as user postgres:

sudo su -m postgres -c "/opt/local/lib/postgresql84/bin/psql postgres"

At the postgres prompt run these commands. If you are going to run MOSS as a user other than "moss", change the role name appropriately:

create database moss with encoding='UTF8' template = template0;
\c moss
create role moss with login;
\q

Then from the root of your MOSS build tree:

sudo su -m postgres -c "/opt/local/lib/postgresql84/bin/psql postgres -f postgresql/moss.sql"

Additional Notes

MacOS X

The bootstrap.sh file does not currently work because libtoolize is named glibtoolize under MacOS. A patch has been submitted. With the patched boostrap, you'll just need to export LIBTOOLIZE=glibtoolize.

If you installed PostgreSQL and libpqxx from MacPorts, your configure command line will need to look like this:

./configure --with-postgres=/opt/local/lib/postgresql84 --with-libpqxx=/opt/local

In the postgres subdirectory, the Makefile for the UUID generator expects pg_config to be in your PATH.

export PATH=${PATH}:/opt/local/lib/postgresql84/bin

The UUID generator Makefile may also fail because the MacPorts package doesn't automate linking to SSL. Alternate Makefile:

MODULE_big = moss_uuidgen
SHLIB_LINK += -lssl
PGXS := $(shell pg_config --pgxs)
include $(PGXS)