Installing on Ubuntu LTS
About
This guide will help you manually install CollectionSpace on a Linux server running a recent Ubuntu LTS release. You'll need to be comfortable with the Linux bash shell and with using common Linux command-line tools. You will also need to have an account on the targeted Ubuntu server that has elevated (i.e., sudo) privileges/permissions.
Selecting a Host Server/Machine
Ideally, the Ubuntu server on which you're going to install CollectionSpace has been created solely for the purpose of running CollectionSpace. If the server is an existing system that is being used or has been used to host other software, you may encounter problems that will require advanced system administration and support.
There are a few options to create a new Ubuntu 22.04 LTS server solely for running CollectionSpace:
VirtualBox can be used to create an Ubuntu server capable of running CollectionSpace.
Linode.com provides cloud-based Ubuntu servers capable of running CollectionSpace for as little as $5-10/month (USD).
Amazon's AWS also provides cloud-based Ubuntu servers capable of running CollectionSpace.
Last tested on: 2024: Ubuntu 22.04
Installation Prerequisites
Before attempting to install CollectionSpace, please review the System Requirements for a CollectionSpace Server. First, log in to your Ubuntu server and make sure you have sudo
(super user) privileges. Try the following command:
|
You may be prompted for your password. If after entering your password, you don't encounter any errors then you're all set. If you do encounter errors and don't have sudo privileges, you cannot install CollectionSpace. Talk with your system administrator or learn how to grant yourself sudo privileges.
Next, create a system account for installing and managing CollectionSpace. Use the name collectionspace
for the account:
|
Next, set a password for the new collectionspace
account. Do NOT use the following example password. Create your own password and record it somewhere secure:
|
Next, install the prerequisites using apt:
|
If all went well, you should see a message like:
|
Installing PostgreSQL Database Server
Source: Postgresql wiki
|
Configuring PostgreSQL Files
After installing the PostgreSQL server, a system user named postgres
should have automatically been created.
In your Linux shell, change/switch to this user:
|
Changes to pg_hba.conf File
Next, edit the PostgreSQL pg_hba.conf
configuration file using a tool like vi or vim. The location differs between Linux flavors, e.g.:
Debian/Ubuntu:
/etc/postgresql/12/main/pg_hba.conf
So, in Ubuntu 22.04, for example, open it up with your preferred text editor:
|
Towards the end of the file, add (or modify) the following lines of text to the section starting with something like "# IPv4 local connections:":
|
Next, make sure entries under "IPv6 local connections" are disabled by adding the '#' character to beginning of this line:
|
Save the changes and quit your editor.
Changes to postgresql.conf File
Finally, set the max_prepared_transactions
property in the main PostgreSQL config file named postgresql.conf
. The file's location differs between Linux flavors, e.g.:
Debian/Ubuntu:
/etc/postgresql/12/main/postgresql.conf
So, in Ubuntu 22.04, for example, open it with your favorite text editor
|
then make the following changes to that file:
|
The max_prepared_transactions
property might be commented out with the '#
' character. If you see the '#
' character at the beginning of this line, remove it.
A max_prepared_transactions
variable setting of 64 might be too memory consuming for your system. If this value is indeed too high for your system, you'll get an error when restarting the PostgreSQL server. Something like:
|
Lowering this setting to 32 should also be fine, but you might need to adjust based on your system.
Save your changes and quit.
Log out of the 'postgres
' account (use the shell 'exit
' command to return to your normal linux account) and restart your PostgreSQL service:
|
Set up datatype 'casts'
Now we need to create some datatype casts that CollectionSpace uses. While logged in as the postgres
user, enter the psql
shell:
|
then enter the following commands into the psql
shell:
|
Remain in the psql
shell and continue to the next section.
Create the csadmin
User
At psql
's command prompt (ending in #
), switch to the postgres
database from the template1
database by entering the following (starting with a backslash character as shown):
|
In response, you should see a message similar to this: You are now connected to database "postgres" as user "postgres".
Enter the following command to create a csadmin
user/role with appropriate privileges. (Be sure to substitute a password of your choosing for replacemewithyourpassword
below:
|
In response, you should see a message similar to this: CREATE ROLE
Quit the psql
program by typing \q
(or press ctrl+d)
.
Log out of the 'postgres
' Linux account (the 'exit' command returns you to your normal linux account) and then restart the PostgreSQL server:
|
Verify that you are able to connect to the PostgreSQL server using the csadmin
account username and password you just added:
|
If successful, you should be in the psql shell and see something like this:
|
Next, exit the psql shell by typing \q
(or press ctrl+d)
.
You're finished with the PostgreSQL setup.
Installing CollectionSpace
Once all prerequisites have been installed and satisfied, you can begin installing the CollectionSpace server.
Set up Tomcat
Login to your Ubuntu server using an account with sudo
privileges. Go to the directory where you want to install CollectionSpace. We recommend /opt/collectionspace
:
|
CollectionSpace runs as a Tomcat 8 server application. A pre-configured version of Tomcat 8 is provided with the CollectionSpace distribution package.
Start by downloading the CollectionSpace distribution package "tarball":
|
Unpack the tarball:
|
This will create an apache-tomcat-8.5.51
directory in /opt/collectionspace
.
Next, make necessary files owned by the collectionspace
user:
|
You can remove the tarball if you want/need:
|
Setting the CollectionSpace Environment Variables
For the CollectionSpace server to install and run properly, it requires the following shell environment variables to be defined for the collectionspace
user account. Ensure that the following values correspond to the collectionspace
user's shell environment. In the next paragraph, we provide instructions for setting these environment variables automatically when you login as the collectionspace
user.
CSPACE_JEESERVER_HOME: The full path to the apache-tomcat-8.5.51 directory that was created when you unpacked the CollectionSpace tarball; example,
"/opt/collectionspace/apache-tomcat-8.5.51"
CATALINA_HOME: The full path to the apache-tomcat-8.5.51 directory, usually identical to the value of
CSPACE_JEESERVER_HOME
.CATALINA_PID: The full path to a file which will hold the Tomcat server process number. This is used by the Tomcat shutdown script.
CATALINA_OPTS: Environment options for the Tomcat server process. The example value for this variable in the next section is a Java Virtual Machine (JVM) memory setting.
JAVA_HOME: The full path to your Java 8 directory.
DB_HOST: The hostname or IP address of the server running PostgreSQL. (Commonly 'localhost' when running on the same machine as tomcat)
DB_PORT: The port for the Postgresql servicer. Usually
5432
DB_CSADMIN_PASSWORD: The password for the administrative database user for the CollectionSpace application. This must match the password for the user that you specified while setting up PostgreSQL in the prerequisites section. (This administrative user by default will be named csadmin, and will be a postgresql superuser. However, this user will have fewer privileges than the overall database administrator superuser, by default named postgres.)
DB_NUXEO_PASSWORD: Any database-legal password of your choice for the nuxeo database user. This user can work with CollectionSpace data stored in Nuxeo databases. Nuxeo is the content management system underlying CollectionSpace.
DB_CSPACE_PASSWORD: Any database-legal password of your choice for the cspace database user. This user can work with CollectionSpace data for users, roles, and authentication and authorization.
DB_READER_PASSWORD: Any database-legal password of your choice for the reader database user. This user will have read-only access to CollectionSpace data stored in Nuxeo databases.
CSPACE_INSTANCE_ID: String appended to default CollectionSpace database names. Use a value of "
_default
" by default. If your instance of CollectionSpace is sharing a PostgreSQL server with other CollectionSpace instances, this environment variable provides a way to distinguish your databases from others.JEE_PORT: The HTTP port for the Services layer. Usually
8180
ANT_OPTS: Environment options for the Apache Ant build tool. The recommended options below are Java Virtual Machine (JVM) memory settings.
MAVEN_OPTS: Environment options for the Maven build tool. The recommended options below are Java Virtual Machine (JVM) memory settings.
By default, all but the "core
" CollectionSpace tenants/profiles are disabled. You'll need to explicitly enable the tenants you want to use by setting environment variables for them.
CSPACE_CORE_CREATE_DISABLED_OPT: Default value is
true
. If set tofalse
, enables the core/common tenant.CSPACE_ANTHRO_CREATE_DISABLED_OPT: Default value is
true
. If set tofalse
, enables the Anthropology tenant.CSPACE_BONSAI_CREATE_DISABLED_OPT: Default value is
true
. If set tofalse
, enables the Bonsai tenant.CSPACE_BOTGARDEN_CREATE_DISABLED_OPT: Default value is
true
. If set tofalse
, enables the Botanical Garden tenant.CSPACE_FCART_CREATE_DISABLED_OPT: Default value is
true
. If set tofalse
, enables the Fine and Contemporary Art tenant.CSPACE_HERBARIUM_CREATE_DISABLED_OPT: Default value is
true
. If set tofalse
, enables the Herbarium tenant.CSPACE_LHMC_CREATE_DISABLED_OPT: Default value is
true
. If set tofalse
, enables the Local History and Material Culture tenant.CSPACE_MATERIALS_CREATE_DISABLED_OPT: Default value is
true
. If set tofalse
, enables the Materials tenant.CSPACE_PUBLICART_CREATE_DISABLED_OPT: Default value is
true
. If set tofalse
, enables the Public Art tenant.
Your CollectionSpace instance can be configured to fetch data from another CollectionSpace instance. For example, the Materials profile/tenant can be configured to fetch shared authority and vocabulary data from a CollectionSpace instance that is set up to share common authority data. The following environment variables can used to create a connection to that CollectionSpace instance.
CSPACE_CLIENT_SAS_URL_OPT: The URL to the "shared" CollectionSpace instance -e.g.,
https://core.dev.collectionspace.org:8180/cspace-services/
CSPACE_CLIENT_SAS_USER_OPT: A username for an account on the "shared" CollectionSpace instance.
CSPACE_CLIENT_SAS_PASSWORD_OPT: The password for the account on the "shared" CollectionSpace instance.
CSPACE_CLIENT_SAS_SSL_OPT: Set to
true
if the "shared" CollectionSpace instance is running SSL/HTTS.
The example below is for a Linux Bash shell. As the collectionspace
user, edit ~/.bashrc (or ~/.bash_profile) and be sure to substitute the actual values for that are specific to your environment. Log in as the collectionspace
user:
|
Now edit the .bashrc
file:
|
Add the following lines of text to the end of the .bashrc file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
|
Save your changes and exit the vim editor. Next, make sure to source your ~/.bashrc so the environment variables are set and available. The next time you login to the collectionspace
account, these environment variables will be set automatically.
|
WARNING: Use difficult to guess values for the password environment variables above -i.e., the ones ending with "_PASSWORD
". The value for the environment variable DB_CSADMIN_PASSWORD
should be the password you created when you setup PostgreSQL in a previous section of this installation guide.
Now that we have the environment set up, we can grab the source code for CollectionSpace. The source code resides in two projects hosted on GitHub: services, and application. Staying logged in as thecollectionspace
user, enter the following commands:
|
Before running the next set of commands, ensure that your tenant will be enabled by checking the corresponding environment variable. For example, to ensure the core tenant is enabled, verify that the CSPACE_CORE_CREATE_DISABLED_OPT
environment variable is set to the value false
.
|
You should see the following output: CSPACE_CORE_CREATE_DISABLED_OPT=false
. If you don't, return to the "Setting the CollectionSpace Environment Variables" section of this document and follow the instructions for enabling/disabling a tenant.
Next, let's build and deploy CollectionSpace from its source code.
|
If successful, enter these commands:
|
Change back to the services directory, and redeploy the application.
|
Finally, create the CollectionSpace databases and a default set of users and permissions.
|
And that's it. If all went well, CollectionSpace is now installed and ready to launch.
Starting the CollectionSpace server
To start the CollectionSpace server, login to the host machine as the collectionspace
user (or sudo su - collectionspace
) and run this command:
|
Wait for it to fully start up, which might take 2-3 minutes the first time. For more information on verifying server startup, see Starting Up CollectionSpace Servers.
Testing installation
To see if the installation was successful and that the CollectionSpace server started up without problems. Try the following command:
|
If successful, you should see output that looks something like this:
|
If you do not see "HTTP/1.1 200 OK
" in the first line of the output, review the installation instructions to see if you missed a step.
Logging in to CollectionSpace
Now that your CollectionSpace server is running, open a browser and go to http://<hostname>:8180/cspace/core/login
where <hostname> is the hostname or IP address of the machine where you installed CollectionSpace. If you have a web browser running on the same server where you installed CollectionSpace, you should be able to use this URL: http://localhost:8180/cspace/core/login
You should be able to log in to the default (core) tenant using the user admin@core.collectionspace.org
and the password Administrator
.
Shutting down the CollectionSpace server
To properly shutdown the CollectionSpace, login to the host machine as the collectionspace
user and enter this command:
|
Changing passwords of default users
Administrator and reader users are created when CollectionSpace is installed, with default passwords. These passwords must be changed to secure your system. See Changing Password Built-in Administrator and Reader Users.
Next Steps
Now that you have a working system you may want to: