############################################### ############################################### The following setup steps were completed in advance of the live installation ############################################### ############################################### # install git, curl sudo apt install git sudo apt install curl ## Backend requiremens # JDK 17 sudo apt install openjdk-17-jdk-headless # Maven 3.5.4+ sudo apt install maven # Ant 1.10.x+ sudo apt install ant # PostgreSQL (12.x-17.x) and pgcrypto (in postgresql-contrib) sudo apt install postgresql postgresql-contrib # Follow docs (excerpt from docs below): # goto: postgresql.conf # In postgresql.conf: uncomment the line starting: listen_addresses = 'localhost'. This is the default, in recent PostgreSQL releases, but you should at least check it. # Then tighten up security a bit by editing pg_hba.conf and adding this line: # host dspace dspace 127.0.0.1 255.255.255.255 md5 # This should appear before any lines matching all databases, because the first matching rule governs. /etc/init.d/postgresql restart # Solr (8.11.x, 9 not yet fully supported) # https://solr.apache.org/guide/solr/latest/getting-started/solr-tutorial.html # Download Solr8: https://solr.apache.org/downloads.html # unzip .. # sudo ./bin/install_solr_service.sh ~/solr-.....tgz # Tomcat 9 sudo useradd -m -U -d /opt/tomcat -s /bin/false tomcat # Download: https://dlcdn.apache.org/tomcat/tomcat-9/ unzip .. sudo mv apache-tomcat-9.0.102 /opt/tomcat/ sudo ln -s /opt/tomcat/apache-tomcat-9.0.102 /opt/tomcat/latest # configure setenv.sh: sudo vi /opt/tomcat/apache-tomcat-9.0.102/bin/setenv.sh JRE_HOME=/usr/lib/jvm/java-17-openjdk-amd64 JAVA_OPTS="-Xmx512M -Xms64M -Dfile.encoding=UTF-8" sudo chown -R tomcat: /opt/tomcat sudo sh -c 'chmod +x /opt/tomcat/latest/bin/*.sh' # Excerpt docs: Modifications in [tomcat]/conf/server.xml : You also need to alter Tomcat's default configuration to support searching and browsing of multi-byte UTF-8 correctly. You need to add a configuration option to the element in [tomcat]/config/server.xml: URIEncoding="UTF-8" e.g. if you're using the default Tomcat config, it should read: # Create tomcat service sudo vim /etc/systemd/system/tomcat.service """ [Unit] Description=Tomcat 9 servlet container After=network.target [Service] Type=forking User=tomcat Group=tomcat Environment="JAVA_HOME=/usr/lib/jvm/jre" Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom" Environment="CATALINA_BASE=/opt/tomcat/latest" Environment="CATALINA_HOME=/opt/tomcat/latest" Environment="CATALINA_PID=/opt/tomcat/latest/temp/tomcat.pid" Environment="CATALINA_OPTS=-Xms2048M -Xmx2048M -server -XX:+UseParallelGC" ExecStart=/opt/tomcat/latest/bin/startup.sh ExecStop=/opt/tomcat/latest/bin/shutdown.sh ReadWritePaths=/opt/dspace [Install] WantedBy=multi-user.target """ ## Frontend requirements # DSpace user to run NodeJS stuff sudo bash useradd -m dspace chsh -s /bin/bash dspace su dspace # Install NVM curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh | bash # append .bashrc: export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion # NodeJS 18 nvm install 18 # yarn (global) npm install --global yarn # pm2 npm install --global pm2 ############################################### ############################################### End of requirements setup ############################################### ############################################### # clone repos git clone https://github.com/4Science/dspace-angular.git cd dspace-angular git checkout dspace-cris-2023.02.06 => this is [dspace-angular] git clone https://github.com/4Science/DSpace.git git checkout dspace-cris-2023.02.06 => this is [dspace-source] /opt/dspace => this is [dspace], where the dspace backend will be installed ############################################## ############################################## Backend installation ############################################## ############################################## sudo chown dspace:dspace /opt/dspace-angular -R sudo mkdir /opt/dspace-ui sudo chown dspace:dspace /opt/dspace-ui sudo bash su postgres # create database user "dspace" # for sake of simplicity, password here is "dspace" (NOTE!!! MUST match admin username in local.cfg) createuser --username=postgres --no-superuser --pwprompt dspace # create database "dspace", owned by "dspace" user createdb --username=postgres --owner=dspace --encoding=UNICODE dspace # enable pgcrypto in a separate database schema psql --username=postgres dspace # run the following (cf. documentation!): # Create a new schema in this database named "extensions" (or whatever you want to name it) CREATE SCHEMA extensions; # Enable this extension in this new schema CREATE EXTENSION pgcrypto SCHEMA extensions; # Grant rights to call functions in the extensions schema to your dspace user GRANT USAGE ON SCHEMA extensions TO dspace; # Append "extensions" on the current session's "search_path" (if it doesn't already exist in search_path) # The "search_path" config is the list of schemas that Postgres will use SELECT set_config('search_path',current_setting('search_path') || ',extensions',false) WHERE current_setting('search_path') !~ '(^|,)extensions(,|$)'; # Verify the current session's "search_path" and make sure it's correct SHOW search_path; # Now, update the "dspace" Database to use the same "search_path" (for all future sessions) as we've set for this current session (i.e. via set_config() above) ALTER DATABASE dspace SET search_path FROM CURRENT; # next, create config /opt/DSpace/dspace/config/local.cfg # add the following line to make file uploads for entity instances optional: webui.submit.upload.required = false # set dspace.dir! (e.g. /opt/dspace) # create dspace dir mkdir /opt/dspace # build the package cd /opt/DSpace # takes initially long due to downloads mvn package # install DSpace cd /opt/DSpace/dspace/target/dspace-installer ant fresh_install # init db /opt/dspace/bin/dspace database migrate # check if init of db was actually successful /opt/dspace/bin/dspace database info # deploy webapp to tomcat cp -R /opt/dspace/webapps/server /opt/tomcat/latest/webapps chown tomcat:tomcat /opt/tomcat/latest/webapps -R # copy solr cores (these files might be located elsewhere if OS is not debian) mkdir /var/solr/data/configsets cp -R /opt/dspace/solr/* /var/solr/data/configsets/ chown -R solr:solr /var/solr/data/configsets/ systemctl restart solr # check if core is there: http://localhost:8983/solr/ # create dspace admin /opt/dspace/bin/dspace create-administrator # ensure tomcat can access the dspace install files and restart it chown tomcat:tomcat /opt/dspace -R systemctl restart tomcat # check status of endpoint REST API: http://localhost:8080/server/ OAI-PMH: http://localhost:8080/server/oai/request?verb=Identify ############################################## ############################################## Frontend installation ############################################## ############################################## su dspace cd /opt/dspace-angular # install dependencies yarn install # 1s # install ui for production to dist/ export NODE_OPTIONS=--max-old-space-size=4096 yarn build:prod # 3,5 min cp -r /opt/dspace-angular/dist /opt/dspace-ui ? chown dspace /opt/dspace-ui -R # config mkdir /opt/dspace-ui/config vim /opt/dspace-ui/config/config.prod.yml rest: ssl: false host: localhost port: 8080 nameSpace: /server # init entities /opt/dspace/bin/dspace dsrun org.dspace.app.util.InitializeEntityTypesOnly -d # init relationships /opt/dspace/bin/dspace dsrun org.dspace.app.util.InitializeEntities -f /opt/dspace/config/entities/correction-relationship-types.xml /opt/dspace/bin/dspace dsrun org.dspace.app.util.InitializeEntities -f /opt/dspace/config/entities/hide-sort-relationship-types.xml # build communities & collections - here using sample structure /opt/dspace/bin/dspace dsrun org.dspace.administer.StructBuilder -e dspace@clt.de \ -o /opt/dspace/log/output-sample-structure.xml \ -f /opt/dspace/config/sample-structure.xml # make upload step optional in submission vi /opt/dspace/config/item-submission.xml # startup frontend cd /opt/dspace-ui/ node ./dist/server/main.js # better: start frontend via pm2: vi /opt/dspace-ui/dspace-ui.json # add: { "apps": [ { "name": "dspace-ui", "cwd": "/opt/dspace-ui", "script": "dist/server/main.js", "env": { "NODE_ENV": "production" } } ] } # then run it with pm2 pm2 start dspace-ui.json