Fedora Commons 2.2.1 on Debian Etch
From FedoraWiki
On this page I will document how I installed Fedora at our institution. You can find the official installation guide at the Fedora homepage
Contents |
Preliminary considerations
The decision has been made to use Postgres as our database, because we might be using MPTStore together with Resource Index.
Because Tomcat is neither a very powerful nor a secure webserver, I decided to hide it behind an Apache HTTP-Server, which will handle all communications with the clients.
Prerequisited software
Install the following software with your favorite package manager (apt-get, aptitude, dselect). All of these steps require root privileges.
sun-java5-jdk
apt-get install sun-java5-jdk
This will install the Java SE Development Kit (JDK) 5.0 from Sun. During the installation, you'll have to accept the License Agreement.
PostgreSQL
apt-get install postgresql-8.1
On Debian Etch Installing postgresql without providing the version number provides you with a transitional version (7.5) which is of no use in a new installation and should therefore be avoided.
Tomcat
After the installation, we'll create a symbolic link to the webapps directory of Tomcat, otherwise the Fedora installer won't find it.
apt-get install tomcat5.5
ln -s /var/lib/tomcat5.5/webapps /usr/share/tomcat5.5/
The official release has been tested with Tomcat5.0.28, but it has been reported to run with Tomcat5.5 as well.
Apache
Apache will be used as the werbserver which does all the communication with clients accessing our service. Additionally, it will be needed for our Fez frontend.
apt-get install apache2
We will be using Apache 2, which is slowly replacing the older Apache versions.
mod_jk
This is module that handles the communication between Apache and Tomcat.
apt-get install libapache2-mod-jk
Fedora directory
Following a proposition by Filesystem Hierarchy Standard, we will install Fedora in the /opt directory: This directory has to be created by root.
mkdir /opt/fedora
Environment variables
Edit /etc/default/tomcat5.5
# The home directory of the Java development kit (JDK). You need at least
# JDK version 1.4. If JAVA_HOME is not set, some common directories for
# the Sun JDK, various J2SE 1.4 versions, and the free runtimes
# java-gcj-compat-dev and kaffe are tried.
#JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun
JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun
This will make sure that Tomcat is using the correct Java environment. Additionally it will be needed in the next step when defining the PATH variable.
Edit /etc/init.d/tomcat5.5
#Added for the Fedora Commons Repository
FEDORA_HOME=/opt/fedora
export FEDORA_HOME
PATH=$FEDORA_HOME/server/bin:$FEDORA_HOME/client/bin:$JAVA_HOME/bin:/bin:/usr/bin:/sbin:/usr/sbin
# Use the Java security manager? (yes/no) TOMCAT5_SECURITY=no
The last line deactivates the Java Security Manager. I didn't get Fedora to start properly with the Security Manager switched on, but you do this at your own risk.
Postgres database
In order for the Fedora installation to run smoothly, we'll have to create the Fedora database and a database user beforehand.
su postgres
psql -d postgres
This will start a command line interface to the postgres service. Keep going replacing 'fedoraAdmin' withh your own choices.
CREATE ROLE "fedoraAdmin" LOGIN PASSWORD 'fedoraAdmin';
CREATE DATABASE "fedora22" WITH ENCODING='UTF8' OWNER="fedoraAdmin";
\q
Don't forget to leave the postgres user (exit)
Fedora installation
We'll first download the current version of Fedora Commons from their homepage and save it in the /tmp-directory
cd /tmp
wget http://prdownloads.sourceforge.net/fedora-commons/fedora-2.2.1-installer.jar
Next, we'll start the installer (again as root).
java -jar fedora-2.2.1-installer.jar
Choose the appropriate options for you installation if prompted by the installer. Here are the settings used for our machine.
Installation type: custom
Fedora home directory: /opt/fedora
Fedora administrator password: <CHOOSE ONE>
Fedora server host: localhost OR <IP NAME/ADDRESS OF YOUR MACHINE>
Authentication requirement for API-A: false
SSL availability: true
SSL required for API-A: false
SSL required for API-M: true
Servlet engine: existingTomcat
Tomcat home directory: /usr/share/tomcat5.5
Tomcat HTTP port: 8080
Tomcat shutdown port: 8005
Tomcat Secure HTTP port: 8443
Keystore file: included
Policy enforcement enabled: true
Database: postgresql
Postgresql JDBC driver: included
Database username: <DB USER as defined above (fedoraAdmin)>
Database password: <DB PWD (fedoraAdmin)>
JDBC URL: jdbc:postgresql://localhost/fedora22
JDBC DriverClass: org.postgresql.Driver
Deploy local services and demos: true
If you are going to run Fedora thru Apache (see instructions further down this page) and let Apache handle the SSL access, you can enter 'false' when asked about SSL availabilty.
Tomcat configuration
The newly generated file server.xml has been placed in /opt/fedora/install/server.xml, we'll have to move it to its correct position (and making a backup of the original configuration file).
mv /etc/tomcat5.5/server.xml /etc/tomcat5.5/server_debian.xml
cp /opt/fedora/install/server.xml /etc/tomcat5.5/server.xml
You can now (re)start the Tomcat daemon
/etc/init.d/tomcat5.5 restart
If all pieces fall in the right place, you should get a response if you enter the address of your Fedora installation (e.g http://localhost:8080 OR http://example.com:8080) in your favorite browser.
Fedora configuration
It's time to adjust the Fedora configuration file FEDORA_HOME/server/config/fedora.fcfg. Open it in your favorite text editor and adjust the bold parts according to your situation. Here are some excerpts you might like to change.
<?xml version="1.0" encoding="UTF-8"?>
<server xmlns="http://www.fedora.info/definitions/1/0/config/" class="fedora.server.BasicServer">
<param name="repositoryName" value="Fedora Repository">
<comment>Defines a human readable name for the Fedora server; default is
Fedora Repository.</comment>
</param>
<param name="adminEmailList" value="bob@example.org sally@example.org">
<comment>Defines one or more email addresses for server administrators;
list is space delimited.</comment>
</param>
<param name="pidNamespace" value="changeme">
<comment>This is the namespace id for pids of newly-created objects.
This should be unique for a repository. It can be from 1 to 17
characters, and may only contain A-Z, a-z, 0-9, '.', or '-' (dash).</comment>
</param>
<param name="retainPIDs" value="demo test changeme fedora-bdef fedora-bmech tutorial">
<comment>Namespaces of PIDs to retain during the ingest process. When an
object is ingested, Fedora normally allocates a unique PID within
pidNamespace for it regardless of what the object says its PID is. This
option provides a way to override that behavior on a per-pid-namespace
basis. If specified, this should be a space-delimited list of pid
namespaces that will be accepted in the object as-is. Default value is
"demo test".</comment>
</param>
<module role="fedora.oai.OAIProvider" class="fedora.server.oai.FedoraOAIProviderModule">
<comment>Description: Exposes the repository for OAI harvesters.</comment>
<param name="repositoryName" value="Your Fedora Repository Name Here"/>
<param name="repositoryDomainName" value="example.org"/>
<param name="adminEmails" value="oai-admin@example.org bob@example.org"/>
<param name="friends" value="http://arXiv.org/oai2 http://memory.loc.gov/cgi-bin/oai2_0"/>
<param name="maxRecords" value="100"/>
<param name="maxHeaders" value="100"/>
</module>
Restart Tomcat and open the following page http://localhost:8080/fedora/describe (replace localhost with the name of your server if appropriate) in your browser. You should see some general information about your Fedora repository. Congratulations!
Apache configuration
Next, we'll configure Apache to run in front of our Tomcat service. This includes several steps.
workers.properties
Open /etc/libapache2-mod-jk/workers.properties with a texteditor and change the bold parts
#
# workers.tomcat_home should point to the location where you
# installed tomcat. This is where you have your conf, webapps and lib
# directories.
#
workers.tomcat_home=/usr/share/tomcat5.5
#
# workers.java_home should point to your Java installation. Normally
# you should have a bin and lib directories beneath it.
#
workers.java_home=/usr/lib/jvm/java-1.5.0-sun
httpd.conf
Open /etc/apache2/httpd.conf (it might be empty) and enter the following code.
<IfModule mod_jk.c>
JkWorkersFile "/etc/libapache2-mod-jk/workers.properties"
JkLogFile "/var/log/apache2/mod_jk.log"
JkLogLevel warn
JkMount /fedora ajp13_worker
JkMount /fedora/* ajp13_worker
</IfModule>
Reload Apache (/etc/init.d/apache2 reload) and open http://localhost/fedora/describe (notice the difference, no more 8080 in the URL), which should give you the same result as above. You now access your repository thru the Apache HTTP Server.
