Difference between revisions of "Moving a repository"

From EPrints Documentation
Jump to: navigation, search
(Migrate EPrints)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[Category:Management]]
 
[[Category:Management]]
 
[[Category:Howto]]
 
[[Category:Howto]]
 +
 +
This Howto has been written for EPrints 3.3. You may need to adjust the instructions for earlier versions.
  
 
You will require your database name, username and password, which can be found in:
 
You will require your database name, username and password, which can be found in:
Line 33: Line 35:
 
Install the version of EPrints that you want to migrate to (e.g. you may want to upgrade). Take a note of the EPrints user and group, as you may need to re-assign the ownership of the transferred repository files.
 
Install the version of EPrints that you want to migrate to (e.g. you may want to upgrade). Take a note of the EPrints user and group, as you may need to re-assign the ownership of the transferred repository files.
  
==Migrate the Repository==
+
==Migrate the repository==
  
Use tar and ssh to transfer your repository to the new server:
+
Use tar and ssh to transfer your repository to the new server ('''note''' the space in the source!):
  
 
  $ tar -czf - -C /opt/eprints3/archives myrepo/ | ssh user@mynewserver "tar -xzf - -C /opt/eprints3/archives"
 
  $ tar -czf - -C /opt/eprints3/archives myrepo/ | ssh user@mynewserver "tar -xzf - -C /opt/eprints3/archives"
Line 41: Line 43:
 
Fix permissions and ownership:
 
Fix permissions and ownership:
  
  $ chown -R eprints:eprints /opt/eprints3/
+
  $ sudo chown -R eprints:eprints /opt/eprints3/
  $ chmod -R 02775 /opt/eprints3/archives/
+
  $ sudo chmod -R 02775 /opt/eprints3/archives/
  
===Migrate the Apache Configuration===
+
===Migrate the repository's Apache configuration===
  
 
If you have customised your Apache configuration you will need to transfer it:
 
If you have customised your Apache configuration you will need to transfer it:
Line 51: Line 53:
 
  $ scp /opt/eprints3/cfg/apache_ssl/myrepo.conf user@mynewserver:/opt/eprints3/cfg/apache_ssl/myrepo.conf
 
  $ scp /opt/eprints3/cfg/apache_ssl/myrepo.conf user@mynewserver:/opt/eprints3/cfg/apache_ssl/myrepo.conf
  
==Upgrading the Repository==
+
==Upgrading the repository==
  
 
'''Skip if you installed the same EPrints version'''
 
'''Skip if you installed the same EPrints version'''
Line 70: Line 72:
  
 
Restart Apache.
 
Restart Apache.
 +
 +
'''Optional''' you may - especially when upgrading - need to clear out static files:
 +
 +
$ rm -rf /opt/eprints3/archives/myrepo/html/*

Latest revision as of 15:55, 18 May 2012


This Howto has been written for EPrints 3.3. You may need to adjust the instructions for earlier versions.

You will require your database name, username and password, which can be found in:

archives/[archiveid/cfg/cfg.d/database.pl

The remainder of this page assumes your database name and repository are called 'myrepo' and your database username and password are 'myrepo'/'XYXY'.

Migrate the MySQL database

Dump the MySQL database for the repository:

$ mysqldump --user=myrepo --password=XYXY myrepo | gzip > myrepo.sql.gz

Transfer the MySQL dump file to your new server e.g.:

$ scp myrepo.sql.gz user@mynewserver:/tmp

Create the MySQL database on the new server and give it the appropriate permissions:

$ mysql --user=root --password
{ root password }
mysql> create database myrepo;
mysql> grant all privileges on myrepo.* to myrepo@localhost identified by 'XYXY';

Load the database:

$ gunzip -c /tmp/myrepo.sql.gz | mysql --user=myrepo --password=XYXY myrepo

Install EPrints on the new server

Install the version of EPrints that you want to migrate to (e.g. you may want to upgrade). Take a note of the EPrints user and group, as you may need to re-assign the ownership of the transferred repository files.

Migrate the repository

Use tar and ssh to transfer your repository to the new server (note the space in the source!):

$ tar -czf - -C /opt/eprints3/archives myrepo/ | ssh user@mynewserver "tar -xzf - -C /opt/eprints3/archives"

Fix permissions and ownership:

$ sudo chown -R eprints:eprints /opt/eprints3/
$ sudo chmod -R 02775 /opt/eprints3/archives/

Migrate the repository's Apache configuration

If you have customised your Apache configuration you will need to transfer it:

$ scp /opt/eprints3/cfg/apache/myrepo.conf user@mynewserver:/opt/eprints3/cfg/apache/myrepo.conf
$ scp /opt/eprints3/cfg/apache_ssl/myrepo.conf user@mynewserver:/opt/eprints3/cfg/apache_ssl/myrepo.conf

Upgrading the repository

Skip if you installed the same EPrints version

$ ./bin/epadmin upgrade myrepo

Finishing

Make sure your repository is OK:

$ ./bin/epadmin test

For example you may need to install extra dependencies.

Generate any missing Apache configuration:

$ ./bin/generate_apacheconf

Restart Apache.

Optional you may - especially when upgrading - need to clear out static files:

$ rm -rf /opt/eprints3/archives/myrepo/html/*