Monday, December 12, 2022

Upgrading DSpace 6 to 7

Take a backup of the DSpace 6 database and folders

Open a Terminal and apply the following commands,

sudo su - postgres
pg_dump dspace > dspace.backup


The above command takes a backup of the DSpace database and stores in /var/lib/postgresql. Copy the database.backup file to a safe place.

Copy assetstore and log folders

Here we are going to back up essential things. All uploaded files are stored in assetstore folder.

sudo zip -r assetstore.zip /dspace/assetstore
sudo zip -r log.zip /dspace/log

Restoration of backup to the latest version of Dspace

Install Dspace 7 version. Copy the assetstorelog folders, and database backup to the home folder of the system. Extract the assetstore and log folders. Follow the below steps to restore the old Dspace backup.

Stop Tomcat server

sudo systemctl stop tomcat9.service

Remove asset store and log folders

sudo rm -rf /dspace/assetstore
sudo rm -rf /dspace/log/

Move your old assetstore and log folders to /dspace folder.

sudo mv assetstore /dspace
sudo mv log /dspace

Restoration of database

Restart PostgreSQL

sudo systemctl stop postgresql
sudo systemctl start postgresql


Drop the database and create a new one. Apply the following commands one by one,

sudo -u postgres psql
DROP DATABASE dspace;
CREATE DATABASE dspace;
quit

Make sure that the dspace.backup file in the folder, /var/lib/postgresql. Here is the command to move the database backup to /var/lib/postgresql; change the backup file name.

sudo mv dspace-29-02-2024.backup /var/lib/postgresql/

Apply the following command to restore the database backup.

su - postgres
psql -f dspace.backup dspace 
\quit

Apply the following commands one by one to upgrade the database.
sudo /dspace/bin/dspace database info 
sudo /dspace/bin/dspace update-sequences
sudo /dspace/bin/dspace database migrate ignored

Restart Solr
Login to the dspace user account to start Solr.

su dspace

Start Solr by applying the command,

/opt/solr/bin/solr restart

Wait until Solr Starts.

Apply the following command to exit from the dspace user account.
exit

Reindex items in the DSpace site.
sudo /dspace/bin/dspace index-discovery -b
sudo /dspace/bin/dspace filter-media
sudo /dspace/bin/dspace index-discovery
sudo /dspace/bin/dspace index-discovery -o

Restart Tomcat

sudo systemctl restart tomcat9.service

No comments:

Post a Comment