Installing Dspace 3.x on Ubuntu 12.04

Installation of prerequisite applications

Open  Applications > Accessories > Terminal and execute following commands. Text in italics are commands to be executed.

sudo apt-get install openjdk-7-jdk
sudo apt-get install tasksel 
sudo tasksel

Select the following packages.
Use space bar for select applications from list.

[*] LAMP server [*] PostgreSQL database [*] Tomcat Java server

 use tab to select OK button and enter. Packages will start to install.
On the way you have to give MySQL root password. MySQL not necessary for Dspace installation.

sudo apt-get install ant maven
Create the database user (dspace)

sudo su postgres 
createuser -U postgres -d -A -P dspace

enter password for new role (select a password like dspace) Shall the new role be allowed to create more new roles? (y/n) n

Exit from the promp, type exit

Allow the database user (dspace) to connect to the database [If the following command not open, check the postgresql version number and apply in the command]

sudo gedit /etc/postgresql/9.1/main/pg_hba.conf

Add this line to the configuration file at the end:   

local all dspace md5 

save and close the file 

Restart PostgreSQL : sudo su      enter,

then paste the following line and enter

/etc/init.d/postgresql restart

Create the Unix 'dspace' user, update the passwd, create the directory in which you will install dspace, and ensure that the Unix 'dspace' user has write privileges on that directory:

sudo useradd -m dspace

sudo passwd dspace (enter any password like dspace for the new user dspace)

sudo mkdir /dspace

sudo chown dspace /dspace

Create the PostgreSQL 'dspace' database.
sudo -u dspace createdb -U dspace -E UNICODE dspace  

Configure Tomcat to know about the DSpace webapps.
[If the following command not open, check the tomcat version number and apply in the command]

sudo gedit /etc/tomcat7/server.xml

Insert the following chunk of text just above the closing </Host> 

<!-- Define a new context path for all DSpace web apps -->
<Context path="/xmlui" docBase="/dspace/webapps/xmlui" allowLinking="true"/>
<Context path="/sword" docBase="/dspace/webapps/sword" allowLinking="true"/>
<Context path="/oai" docBase="/dspace/webapps/oai" allowLinking="true"/>
<Context path="/jspui" docBase="/dspace/webapps/jspui" allowLinking="true"/>
<Context path="/lni" docBase="/dspace/webapps/lni" allowLinking="true"/>
<Context path="/solr" docBase="/dspace/webapps/solr" allowLinking="true"/>

save and close  the file a

This following  step downloads the compressed archive from SourceForge, and unpacks it in your current directory. The dspace-1.x.x-src-release directory is typically referred to as [dspace-src]. You can also download direct from Sourceforge website.

sudo mkdir /build
sudo chmod -R 777 /build
cd /build

tar -xvjf dspace-3.1-src-release.tar.bz2

cd /build/dspace-3.1-src-release
mvn -U package  
cd dspace/target/dspace-3.1-build
sudo ant fresh_install 
Fix Tomcat permissions, and restart the Tomcat server

sudo chown tomcat7:tomcat7 /dspace -R

Restart Tomcat

/etc/init.d/tomcat7 restart

 Make an initial administrator account (an e-person) in DSpace:

/dspace/bin/dspace create-administrator

Test it out in your browser
That is all that is required to install DSpace on Ubuntu. There are two main webapps that provide a similar turn-key repository interface


  1. sudo su postgres createuser -U postgres -d -A -P dspace

    When i execute this command in Ubuntu 12.04 terminal it show U as invalid option.. \

    Any Suggestions

    1. Both are two commands and apply one by one;

      sudo su postgres
      createuser -U postgres -d -A -P dspace

    2. amigo trato de seguir en el tuto pero no me crea el usario en postgres coloco lo que dice y me sale este error createuser: could not connect to database postgres: could not translate host name "postgres" to address: Nombre o servicio desconocido

  2. are you sure is this secure method ? instead of tomcat running as dspace user

    sudo chmod -R 777 /build
    sudo chown tomcat7:tomcat7 /dspace -R

    1. I followed steps mentioned in official Dspace installation manual.
      I am not sure about the more deep technical side.
      What you think about it?

    2. well on wiki i found below in both version 3 and 4 docs

      Note that DSpace will need to run as the same user as Tomcat, so you might want to install and run Tomcat as a user called 'dspace'. Set the environment variable TOMCAT_USER appropriately.

      i think 777 /build is not a secure, as its allow all users to do any thing including delete files from build directory. so i think best is only /build directory should only rights for tomcat user or tomcat running as dspace user to secure , so only require user rights on /build directory, instead of all users.

    3. Thank you for give me insight about that command.
      Can you suggest suitable command instead of sudo chmod -R 777 /build ?
      It will be very helpful for readers of this blog.

  3. Hi,

    After installation dspace 4.0, I'm having "HTTP Status 404 - /xmlui" error message. Any suggestion?

    1. I have not tried Dspace 4.0.
      Here is the documentation for 4.0

  4. Thankyu Dear Kumar,

    I hope you will install DSpace 4.x and prepare installation guide in wery soon. Your guides useful for basic users same as me.

    Thank you.

    1. Dear Friend,
      I will try 4.0 soon and prepare a documentation.
      Initial version may be buggy. So I do not try.
      I will try to install new version soon.
      For production purpose use stable version like 3.x.

    2. Dea Kumar,

      I installed DSpace 4.0 on Ubuntu 12.04. I used your 3.x installation guide and dspace documetation. It is working well. I have prepared an installation guide but it is only Turkish. I am planning to prepare Englis version. The gude is accessible via

  5. I enjoyed your post and responses to queries. I want to install soon. I'll come up this blog again to make some inquiries as need arises. Thank you for good job.

  6. dspace backup and resotration is very important please guide me further on this topic. it is also required to give details on two points-1. email configuration for gmail in dspace and basic page customisation.

  7. good day sir. i have a question is dspace and koha can be installed in one server?? is there will be no conflict if i do this kind of environment? thanks and more power to you sir..

    1. You can install two software in one server. Remember to change Koha default port number (8080) to another one. Dspace default port number is 8080.
      See the link

  8. I installed dspace and connected to webmin server but when I add items in dspace am not able to search them.What settings does webmin need to allow querying the database

  9. I installed it in the server which has KOHA which is using webmin.For the installation to complete I had to have Dspace in webmin too.Now am not able to view anything that I upload

    1. Dspace and Webmin has no relation.
      You can find items in Dspace interface.

  10. How to check dspace version in ubuntu and fedora


  11. During the command i got a problem
    cd dspace/target/dspace-3.1-build
    bash: cd: dspace/target/dspace-4.1-build: No such file or directory

    1. Change the directory location based on Dspace version number, e.g. ../dspace-4.2-build

  12. When I try to unpack the DSpace into the installation it give an error message ~/pom/

  13. When I try to unpack dspace into the system it gives me this error'
    [ERROR] [Help 1]
    [ERROR] [Help 2]

    I tried to uninstall and install maven but it's still giving me the error.

    Please help, I want to use dspace for my Institution

    1. I think you have not downloaded the package properly, it might broken.

  14. Not success complete process > # mvn -U Package
    Error as A.R. Sibson Library
    Tries two times from scratch

    [Help 1]
    [Help 2]

  15. Hi, Im successfully install my dspace with this tutorial. Thanks man.
    Can u post for the email config coz im using gmail server. thanks..

  16. I had an installation of Dspace on Debian. The same got corrupted. However, the data is intact. Now I have installed Dspace on Ubuntu with Postgres. I want to use the data from Debian installation. What all precautions I need to take and also, what all folders I need to copy.

  17. why error on:
    createdb -U dspace -E UNICODE dspace
    createdb: could not connect to database template1: FATAL: Peer authentication failed for user "dspace"