How to Install Samvera Hyrax on Ubuntu Server Latest

Samvera Hyrax is an open-source digital repository platform developed by the Samvera (formerly Hydra) Community. It is designed to manage and provide access to digital resources like documents, images, audio, and video files. In this tutorial, we will show you how to install Samvera Hyrax on Ubuntu Server Latest.

Prerequisites

Step 1: Update Ubuntu Server

First, update your Ubuntu Server to the latest available version by running the following command:

sudo apt update && sudo apt upgrade -y

Step 2: Install Required Dependencies

Samvera Hyrax requires several dependencies to be installed on your Ubuntu Server. Install them by running the following command:

sudo apt install -y build-essential git libxml2-dev libxslt1-dev libssl-dev libreadline-dev imagemagick clamav clamav-daemon clamav-freshclam redis-server postgresql postgresql-contrib libpq-dev solr-tomcat

Step 3: Configure PostgreSQL

Create a PostgreSQL user and database for Samvera Hyrax by running the following commands:

sudo -u postgres psql -c "CREATE USER samvera WITH PASSWORD 'password';"
sudo -u postgres psql -c "CREATE DATABASE samvera OWNER samvera;"

Note: Replace password with a strong password for the PostgreSQL user samvera.

Step 4: Create a Samvera Hyrax User

Create a new user on Ubuntu Server that will be used to install and run Samvera Hyrax by running the following commands:

sudo adduser hyrax
sudo usermod -aG sudo hyrax

Note: You can use any other username instead of hyrax.

Step 5: Download Samvera Hyrax

Switch to the newly created user and download the latest Samvera Hyrax code using Git by running the following commands:

su - hyrax
git clone https://github.com/samvera/hyrax.git
cd hyrax

Step 6: Install Ruby

Samvera Hyrax requires Ruby 2.7.x to be installed on the machine. You can install it by running the following commands:

sudo apt-add-repository -y ppa:rael-gc/rvm
sudo apt update
sudo apt install -y rvm
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc
source ~/.bashrc
rvm install 2.7.1
rvm use 2.7.1 --default

Step 7: Install Samvera Hyrax Dependencies

Switch back to the root user and install the required dependencies for Samvera Hyrax by running the following commands:

gem install bundler
su - hyrax
cd ~/hyrax
bundle install

Step 8: Install and Configure Solr

Samvera Hyrax uses Solr to index and search digital resources. Install Solr and configure it by running the following commands:

sudo su - solr -c "/usr/share/solr/bin/solr start"
sudo su - solr -c "/usr/share/solr/bin/solr create -c hyrax-core"
sudo su - solr -c "/usr/share/solr/bin/solr stop -all"
sudo cp ~/hyrax/solr/config/schema.xml /var/solr/data/hyrax-core/conf/schema.xml
sudo chown solr:solr /var/solr/data/hyrax-core/conf/schema.xml
sudo su - solr -c "/usr/share/solr/bin/solr start"

Step 9: Install and Configure Redis

Samvera Hyrax uses Redis to cache frequently used content. Install Redis and configure it by running the following commands:

sudo systemctl enable redis-server.service
sudo systemct start redis-server.service

Step 10: Configure Database

Switch back to the hyrax user and configure the database by running the following commands:

cd ~/hyrax
cp config/database.yml.example config/database.yml

Edit the config/database.yml file and update the following parameters:

default: &default
  adapter: postgresql
  encoding: unicode
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  host: localhost
  username: samvera
  password: password  # Replace with the password you set for the PostgreSQL user `samvera`.
  port: 5432
  database: samvera
development:
  <<: *default
test:
  <<: *default
production:
  <<: *default

Save and close the file.

Step 11: Initialize the Database

Switch back to the root user and initialize the Samvera Hyrax database by running the following commands:

su - hyrax
cd ~/hyrax
RAILS_ENV=production bundle exec rails db:migrate
RAILS_ENV=production bundle exec rails hyrax:default_admin_set:create
RAILS_ENV=production bundle exec rails hyrax:workflow:load
RAILS_ENV=production bundle exec rails hyrax:default_collection_types:create

Step 12: Run Samvera Hyrax

Finally, start the Samvera Hyrax server by running the following command:

RAILS_ENV=production bundle exec rails server -b 0.0.0.0

You can now access your Samvera Hyrax digital repository by visiting http://[your-server-IP]:3000 in your web browser.

Congratulations! You have successfully installed and configured Samvera Hyrax on Ubuntu Server Latest.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!