In Memoriam: Tai'lahr

OpenUru.org, along with the rest of the Mystonline community, is mourning the loss of Tai'lahr on October 16th, 2019.

Rest in Peace, friend.

Difference between revisions of "MOSS/Distribution Specific Instructions"

From OpenUru
Jump to navigation Jump to search
(More MacOS X)
m (Add link to Ubuntu Server download page to test wiki captcha)
 
(27 intermediate revisions by 5 users not shown)
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]]. The general steps described in the main setup article are detailed for each individual OS or distribution for which documentation has been contributed. Feel free to contribute to the knowledge gathered here by adding information on the subject of your own distribution.
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.
 
  
 +
== Linux - Ubuntu ==
 +
Installing MOSS on [http://www.ubuntu.com Ubuntu] is comparatively easy, and very few changes need to be made to the default instructions. In fact, what follows is mostly just applying general instructions to the specifics of this Linux distribution. Please note however that this does not provide full instructions for installation, as [[MOSS-Setup]] does a more-than-decent job of it already.
  
== Prerequisite Packages ==
+
It is recommend to install MOSS only on Server LTS releases of Ubuntu for increased stability and reliability.
  
=== NetBSD pkgsrc ===
+
'''[https://www.ubuntu.com/download/server Ubuntu Server LTS version]:''' Current tested version: Ubuntu 18.04.1 LTS.
  
Only PostgreSQL and the autotools are needed. You can build the packages
+
=== Compile ===
or use the prebuilt packages with pkg_add.
 
  
  pkg_add automake
+
==== Prerequisites ====
  pkg_add libtool
+
 
  pkg_add libpqxx
+
The programs listed on the main setup page are all conveniently available using APT.
I recommend starting with libpqxx because it seems to lag the postgresql-client
+
 
package, and installing libpqxx will get the correct client.
+
# Add the "restricted" and "universe" repositories to your "sources.list" file if they are not already there and update the APT cache using the following commands.
  pkg_add postgresqlNN-server
+
 
Get the version number to match the client installed for pqxx.
+
  sudo apt-add-repository restricted
 +
 
 +
sudo apt-add-repository universe
 +
 
 +
  sudo apt update
 +
 
 +
# Run this command to install the prerequisites:
 +
sudo apt-get install libssl-dev postgresql postgresql-server-dev-all libpqxx-dev autoconf libtool zlib1g-dev unzip
 +
 
 +
If you also need to clone a Mercurial repository snapshot, you need to install Mercurial through the following command:
 +
  sudo apt-get install mercurial
 +
 
 +
==== configure ====
 +
 
 +
By default in Ubuntu, MOSS will be installed under <code>/usr/local</code>. If you prefer another location (such as the home directory of the user who will run MOSS), be sure to specify with the '''--prefix''' option.  I also recommended to use the '''--enable-fast-download''' option, as the zero seconds bug does not exist in MOSS.
 +
 
 +
==== Compile ====
 +
 
 +
'''MOSS:''' MOSS should compile without any problems. If you are installing to a root-owned directory, make sure to use <code>sudo make install</code>, unless you rejoice in seeing a permission error message.
 +
 
 +
'''PostgreSQL module:''' assuming you run <code>sudo make install</code>, the PostgreSQL module should automatically be copied over to your PostgreSQL directory. Make sure to restart PostgreSQL with the following command:
 +
sudo service postgresql restart
 +
 
 +
=== Set Up the Database ===
 +
 
 +
The default PostgreSQL user in Ubuntu is <code>postgres</code>. If you don't change anything, only he is allowed to connect to the database, even if you have created a new role in PostgreSQL. It might therefore be to your advantage to create a new role in PostgreSQL matching the user which will run the server (e.g. moss); to do so:
 +
sudo -u postgres createuser -l $USER
 +
Which will automatically create a new role with the same name as your current user. You can now edit SQL tables you have access to without su-ing to the postgres user (don't forget to change all appropriate moss configuration files, as detailed below).
 +
 
 +
Now you can follow all other instructions as detailed in the main setup instructions.
 +
 
 +
=== Configuration Files ===
 +
 
 +
When setting up <code>moss_backend.cfg</code>, make sure you specify a PostgreSQL role with read and write access to your database (this can be same user as the one who will run MOSS, already authorized of access if you followed the previous recommendations).
 +
 
 +
== Mac OS X ==
 +
 
 +
=== Compile ===
 +
 
 +
==== Prerequesites ====
 +
 
 +
First, you need the Mac OS X [https://developer.apple.com/technologies/tools/ Developer Tools] installed.
 +
 
 +
Second, you need to install <code>libpqxx</code>, <code>zlib</code>, and <code>postgresql</code>. You can use [http://www.macports.org/ 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 <code>/etc/sysctl.conf</code> 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 <code>chown</code> 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.
 +
 
 +
===== Note on OpenSSL on Mac OS X 10.4 =====
 +
If you install OpenSSL from source (this is necessary on Mac OS X 10.4, which ships with an older version (0.9.7) than required), make sure to also build shared libraries (''./config shared''). If you only build static libraries (the default choice), you will run into missing symbol errors, because the Mac OS X linker always prefers shared to static libraries and will therefore try to link to the system-provided shared library instead of the static one that the command line options point to.
 +
 
 +
==== configure ====
 +
 
 +
The bootstrap.sh file does not currently work because <code>libtoolize</code> is named <code>glibtoolize</code> under Mac OS X. A patch has been submitted. With the patched boostrap, you'll just need to <code>export LIBTOOLIZE=glibtoolize</code>.
 +
 
 +
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
 +
 
 +
==== Compile ====
 +
 
 +
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)
 +
 
 +
=== Set Up the Database ===
 +
 
 +
Copy <code>moss_uuidgen.so</code> to <code>/opt/local/lib/postgresql84/</code>. From the root of your MOSS build tree:
 +
 
 +
sudo cp postgresql/moss_uuidgen.so /opt/local/lib/postgresql84/
 +
 
 +
Now you need to start the server.  The <code>&</code> backgrounds 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 <code>psql</code>, 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"
  
Now follow the instructions:
+
==== Security Suggestion ====
* 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 ===
+
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
  
First, you will need the MacOS X developer tools installed.
+
== NetBSD ==
  
Second, you will need to install libpqxx, zlib, and postgresql.  Here is one approach:
+
=== Compile ===
  
You can use [[http://www.macports.org/ MacPorts]] to install libpqxx and zlib:
+
==== Prerequesites ====
sudo port install libpqxx zlib
 
  
Download and install PostgreSQL in .dmg format from http://www.enterprisedb.com/products-services-training/pgdownload#osx ; this will set up user accountsYou can use Version 8.x on PowerPC or Intel 32-bit, but if you need 64-bit you'll have to download version 9 or later.  Be certain to follow the included README for a prerequisite step involving shared memory.
+
Only PostgreSQL and the autotools are needed. You can build the packages or use the prebuilt packages with <code>pkg_add</code>.
 +
pkg_add automake
 +
pkg_add libtool
 +
pkg_add libpqxx
 +
I recommend starting with <code>libpqxx</code> because it seems to lag the postgresql-client package, and installing libpqxx will get the correct client.
 +
  pkg_add postgresqlNN-server
 +
Where "NN" is the version number to match the client installed for pqxx.
  
== Database Setup ==
+
Now follow these 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
  
=== NetBSD pkgsrc ===
+
=== Set Up the Database ===
  
Copy moss_uuidgen.so to /usr/pkg/lib/postgresql/
+
Copy <code>moss_uuidgen.so</code> to <code>/usr/pkg/lib/postgresql/</code>
  
The database user is <tt>pgsql</tt>. It has root access to the DB by default.
+
The database user is <code>pgsql</code>. It has root access to the DB by default. Connect from localhost (the default).
Connect from localhost (the default).
 
  
 
Create the database:
 
Create the database:
Line 53: Line 174:
 
  su -m pgsql -c "psql postgres -f moss.sql"
 
  su -m pgsql -c "psql postgres -f moss.sql"
  
Then set db_user=moss in moss_backend.cfg.
+
Then set "db_user = moss" in <code>moss_backend.cfg</code>.
 
 
=== MacOS X ===
 
 
 
{{tba}}
 
 
 
== Additional Notes ==
 
  
=== MacOS X ===
+
== Solaris ==
  
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 <code>export LIBTOOLIZE=glibtoolize</code>.
+
''This section is currently a placeholder. If you have knowledge of the installation procedures, please fill in this section.''
  
If you use the PostgreSQL package from EnterpriseDB then by default it is installed to /Library/PostgreSQL/<version>/<bin, data, doc, include, lib, etcetera>.  You will need to use the <code>--with-postgres=PREFIX</code> option when you run <code>./configure</code>.  Configure will then expect libpqxx to be installed in the same place as PostgreSQL, so if you installed libpqxx from MacPorts then you'll need to use the <code>--with-libpqxx=PREFIX</code> option to point at /opt/local .  So, your command line may look like this:
+
Substantial customizations need to be applied to MOSS in order for it to be installed on Solaris. Examples of Solaris installations of MOSS include the Minkata shard.
./configure --with-postgres=/Library/PostgreSQL/9.0 --with-libpqxx=/opt/local
 
  
 +
== See Also ==
 +
{{:MOSS/See Also}}
  
 
[[Category:MOSS]]
 
[[Category:MOSS]]

Latest revision as of 19:38, 20 February 2019

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. The general steps described in the main setup article are detailed for each individual OS or distribution for which documentation has been contributed. Feel free to contribute to the knowledge gathered here by adding information on the subject of your own distribution.

Linux - Ubuntu

Installing MOSS on Ubuntu is comparatively easy, and very few changes need to be made to the default instructions. In fact, what follows is mostly just applying general instructions to the specifics of this Linux distribution. Please note however that this does not provide full instructions for installation, as MOSS-Setup does a more-than-decent job of it already.

It is recommend to install MOSS only on Server LTS releases of Ubuntu for increased stability and reliability.

Ubuntu Server LTS version: Current tested version: Ubuntu 18.04.1 LTS.

Compile

Prerequisites

The programs listed on the main setup page are all conveniently available using APT.

  1. Add the "restricted" and "universe" repositories to your "sources.list" file if they are not already there and update the APT cache using the following commands.
sudo apt-add-repository restricted
sudo apt-add-repository universe
sudo apt update
  1. Run this command to install the prerequisites:
sudo apt-get install libssl-dev postgresql postgresql-server-dev-all libpqxx-dev autoconf libtool zlib1g-dev unzip

If you also need to clone a Mercurial repository snapshot, you need to install Mercurial through the following command:

sudo apt-get install mercurial

configure

By default in Ubuntu, MOSS will be installed under /usr/local. If you prefer another location (such as the home directory of the user who will run MOSS), be sure to specify with the --prefix option. I also recommended to use the --enable-fast-download option, as the zero seconds bug does not exist in MOSS.

Compile

MOSS: MOSS should compile without any problems. If you are installing to a root-owned directory, make sure to use sudo make install, unless you rejoice in seeing a permission error message.

PostgreSQL module: assuming you run sudo make install, the PostgreSQL module should automatically be copied over to your PostgreSQL directory. Make sure to restart PostgreSQL with the following command:

sudo service postgresql restart

Set Up the Database

The default PostgreSQL user in Ubuntu is postgres. If you don't change anything, only he is allowed to connect to the database, even if you have created a new role in PostgreSQL. It might therefore be to your advantage to create a new role in PostgreSQL matching the user which will run the server (e.g. moss); to do so:

sudo -u postgres createuser -l $USER

Which will automatically create a new role with the same name as your current user. You can now edit SQL tables you have access to without su-ing to the postgres user (don't forget to change all appropriate moss configuration files, as detailed below).

Now you can follow all other instructions as detailed in the main setup instructions.

Configuration Files

When setting up moss_backend.cfg, make sure you specify a PostgreSQL role with read and write access to your database (this can be same user as the one who will run MOSS, already authorized of access if you followed the previous recommendations).

Mac OS X

Compile

Prerequesites

First, you need the Mac OS X Developer Tools installed.

Second, you need to install libpqxx, zlib, and postgresql. 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.

Note on OpenSSL on Mac OS X 10.4

If you install OpenSSL from source (this is necessary on Mac OS X 10.4, which ships with an older version (0.9.7) than required), make sure to also build shared libraries (./config shared). If you only build static libraries (the default choice), you will run into missing symbol errors, because the Mac OS X linker always prefers shared to static libraries and will therefore try to link to the system-provided shared library instead of the static one that the command line options point to.

configure

The bootstrap.sh file does not currently work because libtoolize is named glibtoolize under Mac OS X. 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

Compile

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)

Set Up the Database

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 need to start the server. The & backgrounds 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"

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

NetBSD

Compile

Prerequesites

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

Where "NN" is the version number to match the client installed for pqxx.

Now follow these 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

Set Up the Database

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.

Solaris

This section is currently a placeholder. If you have knowledge of the installation procedures, please fill in this section.

Substantial customizations need to be applied to MOSS in order for it to be installed on Solaris. Examples of Solaris installations of MOSS include the Minkata shard.

See Also