Difference between revisions of "Installing EPrints on Debian/Ubuntu"

From EPrints Documentation
Jump to: navigation, search
(Added instrictions on addting an archive)
(Added security notice)
(34 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
[[Category:Debian and Ubuntu]]
 
[[Category:Debian and Ubuntu]]
 
[[Category:Installation]]
 
[[Category:Installation]]
 +
 +
== Security Notice ==
 +
* [[EPrints 3.4.2]] has several known vulnerabilities that can be patched with the patch file at [https://files.eprints.org/2548/ https://files.eprints.org/2548/].  This will be required whatever means of installation is used in the instructions below.
  
 
== Requirements ==
 
== Requirements ==
* Ubuntu 14.04 LTS, 16.04 LTS or 18.04 LTS (non-LTS versions not recommended) or Debian 7 (Wheezy) or 8 (Jessie).
+
* Ubuntu 16.04 LTS or 18.04 LTS (non-LTS versions not recommended) or Debian 8 (Jessie), 9 (Stretch) or 10 (Buster, not thoroughly tested).
 
 
== Installing from EPrints 3.3.x DEB ==
 
The latest version of EPrints 3.3 is 3.3.16.  This version can be installed as follows
 
  
1. As the root user create a file at /etc/apt/sources.list.d/eprints.list and add the following line:
+
== Installing from DEB ==
  deb http://deb.eprints.org/stable ./
+
<ol><li>As the root user create a file at <code>/etc/apt/sources.list.d/eprints.list</code> containing</li>
2. Now to install EPrints and all its dependencies execute the following command, again as the root user:
+
<!--- http://deb.eprints.org/stable is the location of the 3.3 branch ... -->
 +
  deb http://deb.eprints.org/3.4/stable/ ./
 +
<li>Ensure ''gnupg'' package is installed to allow APT keys to added, again as the root user</li>
 +
apt-get install gnupg
 +
<li>To allow the installation of EPrints and all its dependencies execute the following commands, again as the root user</li>
 
  wget -O - http://deb.eprints.org/keyFile | apt-key add -
 
  wget -O - http://deb.eprints.org/keyFile | apt-key add -
 
  apt-get update
 
  apt-get update
  apt-get install eprints
+
<li>Select the appropriate current [http://files.eprints.org/view/type/release.html release] depending on output of</li>
 +
apt-cache show eprints
 +
<li>Finally install the selected version, e.g.</li>
 +
  apt-get install eprints=3.4.2
 +
</ol>
 +
EPrints ''3.3'' will be installed to <code>/usr/share/eprints3/</code>. EPrints ''3.4'' will be installed to <code>/usr/share/eprints/</code>.
 +
 
 +
However, '''you will not yet have a running archive'''.  Follow the [[Getting Started with EPrints 3]] instructions to set this up.
 +
 
 +
Below are some [[Installing_EPrints_3_via_apt_(Debian/Ubuntu)#Operating_System_Version_Specific_Requirements | caveats for particular versions of Debian and Ubuntu]].
  
EPrints will now be installed at /usr/share/eprints3/. However, you will not yet have a running archive. Follow the [[Getting Started with EPrints 3]] instructions to set this upBelow are some caveats for particular version of Debian and Ubuntu.
+
'''N.B. If you are installing EPrints ''3.4'' from the DEB package then you will ''only'' get the ''zero flavour''. If you want the publications flavour you will need to download the [https://files.eprints.org/2500/8/eprints-3.4.2-flavours.tar.gz flavours tarball] (see [[Installing_EPrints_3_via_apt_(Debian/Ubuntu)#Downloading_and_Deploying_EPrints_Source | Downloading and Deploying EPrints Source]] below) and copy the <code>./pub_lib</code> subdirectory into <code>/usr/share/eprints/flavours/</code>It is planned that future versions of EPrints 3.4 will have their own publication flavours DEB package.'''
  
== Installing EPrints 3.3.x or 3.4.x from Source ==
+
== Installing EPrints from Source ==
  
 
=== Dependencies and Pre-configuration ===
 
=== Dependencies and Pre-configuration ===
  
'''N.B. Installing from source is generally discouraged particularly for production repositories.  However, if want to develop the EPrints code or a plugin or Bazaar package it may be useful to install from source, ideally from [https://github.com/eprints/eprints EPrints Core Git repository].'''
+
'''N.B. Installing from a source tarball is generally discouraged particularly for production repositories.  However, if you want to develop the EPrints code or a plugin or Bazaar package it may be useful to install from source, ideally from [https://github.com/eprints/eprints EPrints 3.3] or [https://github.com/eprints/eprints3.4 EPrints 3.4] Core Git repositories.'''
  
 
First, as the root user install all the dependencies for EPrints:
 
First, as the root user install all the dependencies for EPrints:
  
  apt-get install perl libncurses5 libselinux1 libsepol1 apache2 libapache2-mod-perl2 libxml-libxml-perl libunicode-string-perl \
+
  apt-get install perl libncurses5 libselinux1 libsepol1 apache2 libapache2-mod-perl2 libxml-libxml-perl \
  libterm-readkey-perl libmime-lite-perl libmime-types-perl libdigest-sha-perl libdbd-mysql-perl libxml-parser-perl libxml2-dev \
+
  libunicode-string-perl libterm-readkey-perl libmime-lite-perl libmime-types-perl libdigest-sha-perl \
  libxml-twig-perl libarchive-any-perl libjson-perl lynx wget ghostscript xpdf antiword elinks texlive-base texlive-base-bin \
+
  libdbd-mysql-perl libxml-parser-perl libxml2-dev libxml-twig-perl libarchive-any-perl libjson-perl \
  psutils imagemagick adduser tar gzip mysql-server mysql-client unzip libsearch-xapian-perl
+
  liblwp-protocol-https-perl libtext-unidecode-perl lynx wget ghostscript xpdf antiword elinks \
 +
  texlive-base texlive-base-bin psutils imagemagick adduser tar gzip mysql-server mysql-client unzip \
 +
  libsearch-xapian-perl libtex-encode-perl
  
 
Next, create the eprints user
 
Next, create the eprints user
  
  useradd eprints
+
  adduser eprints
 
 
 
 
 
 
Next, as the eprints user copy /opt/eprints3/perl_lib/EPrints/SystemSettings.pm.tmpl to /opt/eprints3/perl_lib/EPrints/SystemSettings.pm
 
  
EPrints is now fully installed at /opt/eprints3. However, you will not yet have a running archive. Follow the [[Getting Started with EPrints 3]] instructions to set this up.
+
Now, update Apache configuration to set it up to use the eprints user and group, by ensuring the following lines are set thus in <code>/etc/apache2/envvars</code>:
 
 
Now, update Apache configuration to set it up to use the eprints user and group, by ensuring the following lines are set thus in /etc/apache2/envvars:
 
  
 
  export APACHE_RUN_USER=eprints
 
  export APACHE_RUN_USER=eprints
Line 49: Line 58:
  
 
  apt-get install git
 
  apt-get install git
  git clone https://github.com/eprints/eprints.git /opt/eprints3
+
  git clone https://github.com/eprints/eprints.git /usr/share/eprints3
  cd /opt/eprints3/
+
  cd /usr/share/eprints3
 
  git checkout tags/v3.3.16
 
  git checkout tags/v3.3.16
 
  chown -R eprints:eprints .
 
  chown -R eprints:eprints .
Line 57: Line 66:
  
 
  apt-get install git
 
  apt-get install git
  git clone https://github.com/eprints/eprints3.4.git /opt/eprints3
+
  git clone https://github.com/eprints/eprints3.4.git /usr/share/eprints
  cd /opt/eprints3/
+
  cd /usr/share/eprints
  git checkout tags/v3.4.0
+
  git checkout tags/v3.4.2
 
  chown -R eprints:eprints .
 
  chown -R eprints:eprints .
  
Line 65: Line 74:
  
 
  cd /tmp/
 
  cd /tmp/
  wget https://files.eprints.org/2305/4/eprints-3.4.0.tar.gz
+
  wget https://files.eprints.org/2500/7/eprints-3.4.2.tar.gz
tar -xzvf eprints-3.4.0.tar.gz
+
  tar -xzvf eprints-3.4.2.tar.gz
 
If you want a publications flavoured repository, then also:
 
 
 
wget https://files.eprints.org/2305/5/eprints-3.4.0-flavours.tar.gz
 
  tar -xzvf eprints-3.4.0-flavours.tar.gz
 
  
 
Then put in the source code in place:
 
Then put in the source code in place:
  
  mv eprints-3.4.0 /opt/eprints3
+
  mv eprints-3.4.2 /usr/share/eprints
  chmod 2775 /opt/eprints3
+
  chmod 2775 /usr/share/eprints
  chown -R eprints:eprints /opt/eprints3
+
  chown -R eprints:eprints /usr/share/eprints
  
=== Adding an archive ===
+
If you want a publications flavoured repository, then also:
If you have installed from the package you will be provided instructions on how to create a new archive.  For those installing from source, you will need to run the following for 3.3 as the eprints user:
 
  
  /opt/eprints3/bin/epadmin create
+
  wget https://files.eprints.org/2500/8/eprints-3.4.2-flavours.tar.gz
 +
tar -xzvf eprints-3.4.2-flavours.tar.gz
 +
mv eprints-3.4.2/flavours/pub_lib /usr/share/eprints/flavours
 +
chmod -R g+w /usr/share/eprints/flavours/pub_lib
 +
chown -R eprints:eprints /usr/share/eprints/flavours/pub_lib
  
If you are running EPrints 3.4 you will need to run the same command with a suffix of ''pub'' or ''zero'' to indicate the flavour (or lack of) repository archive you want.  You will then be given guided instructions for setting up your archive.
+
=== Configuration ===
 +
Next, as the eprints user copy <code>EPRINTS_PATH/perl_lib/EPrints/SystemSettings.pm.tmpl</code> to <code>EPRINTS_PATH/perl_lib/EPrints/SystemSettings.pm</code>
  
If you already have a repository you want to copy across, as the root user, justcreate a archives directory owned by the eprints user and copy the archive in as a subdirectory:
+
<code>EPRINTS_PATH</code> will be either <code>/usr/share/eprints3/</code> or <code>/usr/share/eprints</code> depending on which instructions you followed above.
  
mkdir /opt/eprints3/archives/
+
EPrints is now fully installed at <code>EPRINTS_PATH/</code>. However, you will not yet have a running archive. Follow the [[Getting Started with EPrints 3]] instructions to set this up.
mv /PATH_TO/myarchive /opt/eprints3/archives/
 
chown -R eprints:eprints /opt/eprints3/archives
 
  
 
=== Post-configuration ===
 
=== Post-configuration ===
Next, add the file /etc/apache2/sites-available/eprints.conf with the following line:
+
Next, add the file <code>/etc/apache2/sites-available/eprints.conf</code> with the following line:
  
 
  Include EPRINTS_PATH/cfg/apache.conf
 
  Include EPRINTS_PATH/cfg/apache.conf
 
EPRINTS_PATH will be either /opt/eprints3/ or /usr/share/eprints depending on which instructions you followed above.
 
  
 
To enable this as root run the command:
 
To enable this as root run the command:
  
 
  a2ensite eprints
 
  a2ensite eprints
 +
 +
Also it may be necessary to disable the default site otherwise the default Apache page will still be shown:
 +
 +
a2dissite 000-default
  
 
Finally, restart Apache:
 
Finally, restart Apache:
  
  apachectl restart
+
  service apache2 restart
  
You should now be able to access your vanilla repository at the hostname you specified when running '''epadmin create''' from the [[Getting Started with EPrints 3]] instructions.
+
You should now be able to access your vanilla repository at the hostname you specified when running '''epadmin create''' from the [[Getting Started with EPrints 3]] instructions.  You should then login as the admin user you created during this process and turn on the indexer.  This can be done by clicking on the '''Admin''' link under the Logged in menu, then clicking on the '''System Tools''' tab and finally the '''Start Indexer''' button.
  
 
== Operating System Version Specific Requirements ==
 
== Operating System Version Specific Requirements ==
 
  
 
=== Ubuntu 18.04 LTS ===
 
=== Ubuntu 18.04 LTS ===
==== epadmin script errors with Perl version ====
+
{{:Issues with Installing EPrints on Ubuntu 18.04}}
When trying to run epadmin you will may see a couple of error messages that prevents you from creating an archive, especially if you are using the 3.4.0 tarball from files.eprints.org:
 
 
 
Experimental keys on scalar is now forbidden at EPRINTS_PATH/bin/epadmin line 384
 
 
 
To fix this add the following line at the top of the epadmin file just after the ''use'' lines:
 
 
 
no if $] >= 5.017011, warnings => 'experimental::smartmatch';
 
 
 
A second error message you may see is:
 
 
 
Type of arg 1 to keys must be hash or array (not single ref constructor) at /usr/share/eprints/bin/epadmin line 384, near "};"
 
 
 
Go to the line number reported and change it to:
 
 
 
my @flavours = keys %{$conf->{flavours}};
 
 
 
You should now be able to run "epadmin create" without issue.
 
 
 
==== MySQL root user cannot be used ====
 
On Ubuntu 18.04 LTS rather than prompting you to set a password for MySQL server when installing this as a dependency, it just installs it without.  However, this means on the root user can login to MySQL to add a database.  As "epadmin create" runs at the eprints user, this will not be able to create a database for EPrints.  The get round this as the root user connect to MySQL (just type "mysql" at the command line) and type the following two commands.  You will want to set your own password (i.e. not 'changeme') , you may also want to restrict which databases the eprints user has control over.  If you know the "Archive ID" you are going to use.
 
CREATE USER 'eprints'@'localhost' IDENTIFIED by 'changeme';
 
GRANT ALL PRIVILEGES ON *.* TO 'eprints'@'localhost' WITH GRANT OPTION;
 
 
 
 
 
=== Ubuntu 14.04 LTS and Debian 8 onwards ===
 
This operating system versions use Apache 2.3+ and PERL v5.16+ introduce a few changes which break older 3.3.x versions EPrints.  The current versions of EPrints 3.3.16 and 3.4.0 should not suffer from the same issues.
 
 
 
A complete HOW-TO guide to install EPrints3 on Ubuntu 14.04 is available [http://wiki.unimas.my/unimaswiki//bin/view/HOW-TO,+Tutorial+&+User+Manual/HOW-TO+:+Install+Eprints+v3.3.12++on+Ubuntu+14.04+With+LDAP+Authentication here]
 
 
 
Current patches on github are:
 
 
 
* See last comment on https://github.com/eprints/eprints/issues/214  [ use of remote_ip ]
 
* https://github.com/eprints/eprints/issues/237 [ NameVirtualHost deprecated ]
 
* https://github.com/eprints/eprints/issues/236 [ Order allow,deny deprecated ]
 
* https://github.com/eprints/eprints/commit/157db0d27d423d38f9c0fc31ce47e519cd861d45 [ utf8::decode and URI parameters ]
 
 
 
Ensure that mpm_prefork module is enabled in /etc/apache2/mods-enabled (among others).
 
  
Complete list of modules for a working repository include the following (although some may be surplus to requirements e.g. php5 is not strictly necessary)
+
=== Ubuntu 20.04 LTS ===
 +
{{:Issues with Installing EPrints on Ubuntu 20.04}}
  
*access_compat.load                   
+
=== Debian Known Issues ===
*alias.conf                                   
+
See [[Debian Known Issues]]
*alias.load                             
 
*auth_basic.load                           
 
*authn_core.load
 
*authn_file.load
 
*authz_core.load
 
*authz_host.load
 
*authz_user.load
 
*autoindex.conf
 
*autoindex.load
 
*deflate.conf
 
*deflate.load
 
*dir.conf
 
*dir.load
 
*env.load
 
*filter.load
 
*mime.conf
 
*mime.load
 
*mpm_prefork.conf
 
*mpm_prefork.load
 
*negotiation.conf
 
*negotiation.load
 
*perl.load
 
*php5.conf
 
*php5.load
 
*setenvif.conf
 
*setenvif.load
 
*status.conf
 
*status.load
 

Revision as of 23:41, 23 February 2021


Security Notice

Requirements

  • Ubuntu 16.04 LTS or 18.04 LTS (non-LTS versions not recommended) or Debian 8 (Jessie), 9 (Stretch) or 10 (Buster, not thoroughly tested).

Installing from DEB

  1. As the root user create a file at /etc/apt/sources.list.d/eprints.list containing
  2. deb http://deb.eprints.org/3.4/stable/ ./
    
  3. Ensure gnupg package is installed to allow APT keys to added, again as the root user
  4. apt-get install gnupg
    
  5. To allow the installation of EPrints and all its dependencies execute the following commands, again as the root user
  6. wget -O - http://deb.eprints.org/keyFile | apt-key add -
    apt-get update
    
  7. Select the appropriate current release depending on output of
  8. apt-cache show eprints
    
  9. Finally install the selected version, e.g.
  10. apt-get install eprints=3.4.2
    

EPrints 3.3 will be installed to /usr/share/eprints3/. EPrints 3.4 will be installed to /usr/share/eprints/.

However, you will not yet have a running archive. Follow the Getting Started with EPrints 3 instructions to set this up.

Below are some caveats for particular versions of Debian and Ubuntu.

N.B. If you are installing EPrints 3.4 from the DEB package then you will only get the zero flavour. If you want the publications flavour you will need to download the flavours tarball (see Downloading and Deploying EPrints Source below) and copy the ./pub_lib subdirectory into /usr/share/eprints/flavours/. It is planned that future versions of EPrints 3.4 will have their own publication flavours DEB package.

Installing EPrints from Source

Dependencies and Pre-configuration

N.B. Installing from a source tarball is generally discouraged particularly for production repositories. However, if you want to develop the EPrints code or a plugin or Bazaar package it may be useful to install from source, ideally from EPrints 3.3 or EPrints 3.4 Core Git repositories.

First, as the root user install all the dependencies for EPrints:

apt-get install perl libncurses5 libselinux1 libsepol1 apache2 libapache2-mod-perl2 libxml-libxml-perl \
  libunicode-string-perl libterm-readkey-perl libmime-lite-perl libmime-types-perl libdigest-sha-perl \ 
  libdbd-mysql-perl libxml-parser-perl libxml2-dev libxml-twig-perl libarchive-any-perl libjson-perl \
  liblwp-protocol-https-perl libtext-unidecode-perl lynx wget ghostscript xpdf antiword elinks \ 
  texlive-base texlive-base-bin psutils imagemagick adduser tar gzip mysql-server mysql-client unzip \
  libsearch-xapian-perl libtex-encode-perl

Next, create the eprints user

adduser eprints

Now, update Apache configuration to set it up to use the eprints user and group, by ensuring the following lines are set thus in /etc/apache2/envvars:

export APACHE_RUN_USER=eprints
export APACHE_RUN_GROUP=eprints

Downloading and Deploying EPrints Source

EPrints 3.3.x for GitHub

apt-get install git
git clone https://github.com/eprints/eprints.git /usr/share/eprints3
cd /usr/share/eprints3
git checkout tags/v3.3.16
chown -R eprints:eprints .

EPrints 3.4.x for GitHub

apt-get install git
git clone https://github.com/eprints/eprints3.4.git /usr/share/eprints
cd /usr/share/eprints
git checkout tags/v3.4.2
chown -R eprints:eprints .

EPrints 3.4.x from files.eprints.org

cd /tmp/
wget https://files.eprints.org/2500/7/eprints-3.4.2.tar.gz
tar -xzvf eprints-3.4.2.tar.gz

Then put in the source code in place:

mv eprints-3.4.2 /usr/share/eprints
chmod 2775 /usr/share/eprints
chown -R eprints:eprints /usr/share/eprints

If you want a publications flavoured repository, then also:

wget https://files.eprints.org/2500/8/eprints-3.4.2-flavours.tar.gz
tar -xzvf eprints-3.4.2-flavours.tar.gz
mv eprints-3.4.2/flavours/pub_lib /usr/share/eprints/flavours
chmod -R g+w /usr/share/eprints/flavours/pub_lib
chown -R eprints:eprints /usr/share/eprints/flavours/pub_lib

Configuration

Next, as the eprints user copy EPRINTS_PATH/perl_lib/EPrints/SystemSettings.pm.tmpl to EPRINTS_PATH/perl_lib/EPrints/SystemSettings.pm

EPRINTS_PATH will be either /usr/share/eprints3/ or /usr/share/eprints depending on which instructions you followed above.

EPrints is now fully installed at EPRINTS_PATH/. However, you will not yet have a running archive. Follow the Getting Started with EPrints 3 instructions to set this up.

Post-configuration

Next, add the file /etc/apache2/sites-available/eprints.conf with the following line:

Include EPRINTS_PATH/cfg/apache.conf

To enable this as root run the command:

a2ensite eprints

Also it may be necessary to disable the default site otherwise the default Apache page will still be shown:

a2dissite 000-default

Finally, restart Apache:

service apache2 restart

You should now be able to access your vanilla repository at the hostname you specified when running epadmin create from the Getting Started with EPrints 3 instructions. You should then login as the admin user you created during this process and turn on the indexer. This can be done by clicking on the Admin link under the Logged in menu, then clicking on the System Tools tab and finally the Start Indexer button.

Operating System Version Specific Requirements

Ubuntu 18.04 LTS

N.B. It is assumed that you are installing the latest version of 3.4. Earlier versions may have issues not listed here.

MySQL root user cannot be used

On Ubuntu 18.04 LTS rather than prompting you to set a password for MySQL server when installing this as a dependency, it just installs it without. However, this means on the root user can login to MySQL to add a database. As "epadmin create" runs at the eprints user, this will not be able to create a database for EPrints. To get round this as the root user connect to MySQL (just type "mysql" at the command line) and type the following two commands. You will want to set your own password (i.e. not 'changeme'), you may also want to restrict which databases the eprints user has control over. If you know the "Archive ID" you are going to use.

CREATE USER 'eprints'@'localhost' IDENTIFIED by 'changeme';
GRANT ALL PRIVILEGES ON *.* TO 'eprints'@'localhost' WITH GRANT OPTION;

Ubuntu 20.04 LTS

N.B. It is assumed that you are installing the latest version of 3.4. Earlier versions may have issues not listed here.

MySQL root user cannot be used

On Ubuntu 18.04 LTS rather than prompting you to set a password for MySQL server when installing this as a dependency, it just installs it without. However, this means on the root user can login to MySQL to add a database. As "epadmin create" runs at the eprints user, this will not be able to create a database for EPrints. The get round this as the root user connect to MySQL (just type "mysql" at the command line) and type the following two commands. You will want to set your own password (i.e. not 'changeme') , you may also want to restrict which databases the eprints user has control over. If you know the "Archive ID" you are going to use.

CREATE USER 'eprints'@'localhost' IDENTIFIED by 'changeme';
GRANT ALL PRIVILEGES ON *.* TO 'eprints'@'localhost' WITH GRANT OPTION;

Previous issues

xpdf Deb package no longer exists 
This has been removed as a dependency since EPrints 3.4.3, as it is no longer specifically required by EPrints.
MySQL deprecated syntax 
GRANT PRIVILEGES command used by epadmin has been modified to avoid using deprecated syntax since EPrints 3.4.3.

Debian Known Issues

See Debian Known Issues