Home > Computers and Internet, Linux, VirtualBox, Windows 7 > Install DSpace in Debian 6.0 (Squeeze)

Install DSpace in Debian 6.0 (Squeeze)

I was tasked by our IT director (who, by the way, is a hardcore Debian fan) to install DSpace for the library for them to try and eventually use it as their archive repository. I searched the web for an idiot’s guide (because am a Windows guy) to install Dspace on Debian but didn’t find a suitable one, unfortunately. Here, am sharing what I did to successfully install and run Dspace after all the trial and error. By the way, I used SSH via Putty doing the procedures below; it made the task even lighter. Hope this helps…

Host PC:
Lenovo 3000
CPU Intel Centrino 1.66GHz
RAM 2.99GB usable
OS Windows 7 32bit Ultimate

Virtual Machine:
Hypervisor Oracle VirtualBox 4.0.4r70112
Audio Disabled
Network Bridged
OS Debian 6.0 (Squeeze)
Hostname dspace
Network DHCP reservation


1. Start the VM and login as root then install the pre-requisite applications (Java, Tomcat, Maven, Ant, PostgreSQL)
apt-get install sun-java6-jdk
During the Java package installation, just answer Y (Y is the default action when you hit Enter as with other application installation except if the application cannot be authenticated where N is the default action), OK (press the Tab key) and Yes (left arrow key) when prompted.
apt-get install tomcat6
apt-get install maven2 (Ant is bundled with this package. No need to install separately)
apt-get install postgresql

or if you have a very fast connection, you can do a single liner
apt-get install sun-java6-jdk tomcat6 maven2 postgresql

2. Just to make sure you won’t get a Java runtime misconfiguration, you do this
update-alternatives –config java

Select the selection number that says:
/usr/lib/jvm/java-6-sun/jre/bin/java 63 manual mode (in my case, I selected option 2 see screenshot)

3. Download the latest Dspace package. For some unknown reason, I am not able to access sourceforge.net so I downloaded the package here.
Before downloading, change directory to /usr/src
cd /usr/src/
Then download the package
wget -c http://www.sfr-fresh.com/unix/www/dspace-1.7.0-release.tar.gz

4. Unpack the package.
ls dspace-1.7.0-release.tar.gz (just to verify the package is in the directory)
tar zxvf dspace-1.7.0-release.tar.gz

5. Create Linux user account for Dspace
useradd -m dspace (-m option creates user home directory)

6. Change ownership of newly unpacked directory
chown -R dspace:adm dspace-1.7.0-release

7. The next step involves Postgresql. It requires you to change the file system permission setting to trust localhost connections you do this by editing the pg_hba.conf file.
nano /etc/postgresql/8.4/main/pg_hba.conf

When you open the file, scroll down to the last portion where you will see the following entries

# Database administrative login by UNIX sockets
#local all postgres ident <<< comment this line and add line below
local all postgres trust

# “local” is for Unix domain socket connections only
#local all all ident <<< comment this line and add line below
local all all trust

8. Restart Postgresql to use the modified configuration
/etc/init.d/postgresql restart

9. Create Postgresql user account for DSpace
To verify Postgresql is running, type psql -U postgres
You should be able to login to Postgresql. Type \q to quit
Proceed by typing this command
createuser -U postgres -d -A -P dspace ; createdb -U dspace -E UNICODE dspace

key-in dspace when prompted for password and when asked to confirm password
key-in y when prompted to take action on role

10. Change directory to the initial configuration files repository
cd dspace-1.7.0-release/dspace/config/

10.1 Edit dspace.cfg particularly the following parameters:

# DSpace host name
dspace.hostname = dspace.your-domain-name.edu

# DSpace base host URL
dspace.baseUrl = http://dspace.your-domain.edu:8080 or http://ip_address:8080

– It is extremely important that you enter the correct information otherwise Dspace will not work
– If hostname is used, then an entry on your DNS server is a must. In BIND for example
dspace.xxxxxx.edu. IN A x.x.x.x
or in the Windows host, add an entry in the Windows\System32\Drivers\etc\hosts file the should point to the DSpace VM.

# Name of the site
dspace.name — Dspace for AIIAS Hardinge Library

# Database name (“oracle”, or “postgres”)
#db.name = ${default.db.name} <<< comment this entry
db.name = postgres <<< uncomment this
#db.name = oracle

# URL for connecting to database
#db.url = ${default.db.url} <<< comment this
db.url = jdbc:postgresql://localhost:5432/dspace <<< uncomment this

# JDBC Driver
#db.driver = ${default.db.driver} <<< comment this
db.driver = org.postgresql.Driver <<< uncomment this

# Database username and password
#db.username = ${default.db.username} \__ comment these
#db.password = ${default.db.password} /
db.username = dspace \__ uncomment these
db.password = dspace /

# SMTP mail server
mail.server = smtp.your-domain.edu

# From address for mail
mail.from.address = dspace-noreply@your-domain.edu

# Currently limited to one recipient!
feedback.recipient = dspace-help@your-domain.edu

# General site administration (Webmaster) e-mail
mail.admin = dspace-help@your-domain.edu

11. Change directory to /var then create dspace directory and chown directory ownership
cd /var
mkdir dspace
chown dspace dspace

12. Build the Maven package
cd /usr/src/dspace-1.7.0-release/dspace
mvn package

it will start downloading a lot of jar and pom files… until you see something like this:

[INFO] Copying 1386 files to /usr/src/dspace-1.7.0-release/dspace/target/dspace-1.7.0-build.dir
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] ------------------------------------------------------------------------
[INFO] DSpace Addon Modules .................................. SUCCESS [8:46.193s]
[INFO] DSpace XML-UI (Manakin) :: Web Application ............ SUCCESS [1:02:46.078s]
[INFO] DSpace LNI :: Web Application ......................... SUCCESS [2:39.578s]
[INFO] DSpace OAI :: Web Application ......................... SUCCESS [43.201s]
[INFO] DSpace JSP-UI :: Web Application ...................... SUCCESS [3:26.257s]
[INFO] DSpace SWORD :: Web Application ....................... SUCCESS [1:22.040s]
[INFO] DSpace SOLR :: Web Application ........................ SUCCESS [17:28.865s]
[INFO] DSpace Assembly and Configuration ..................... SUCCESS [5:06.675s]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 102 minutes 23 seconds
[INFO] Finished at: Wed Mar 09 06:57:19 PST 2011
[INFO] Final Memory: 40M/92M
[INFO] ------------------------------------------------------------------------

13. Change directory to Dspace source directory and run ant
cd /usr/src/dspace-1.7.0-release/dspace/target/dspace-1.7.0-build.dir
ant fresh_install

this will start a process, connecting database and updating a lot of files. Until you will see something like this:

     [echo] ====================================================================
     [echo]  The DSpace code has been installed, and the database initialized.
     [echo]  To complete installation, you should do the following:
     [echo]  * Setup your Web servlet container (e.g. Tomcat) to look for your
     [echo]    DSpace web applications in: /dspace/webapps/
     [echo]    OR, copy any web applications from /dspace/webapps/ to
     [echo]    the appropriate place for your servlet container.
     [echo]    (e.g. '$CATALINA_HOME/webapps' for Tomcat)
     [echo]  * Make an initial administrator account (an e-person) in DSpace:
     [echo]    /dspace/bin/dspace create-administrator
     [echo]  * Start up your servlet container (Tomcat etc.)
     [echo]  You should then be able to access your DSpace's 'home page':
     [echo]    http://localhost:8080/xmlui
     [echo]  You should also be able to access the administrator UI:
     [echo]    http://localhost:8080/xmlui/dspace-admin
     [echo] ====================================================================

Total time: 17 minutes 33 seconds

14. For your own sanity’s sake, instead of tweaking Tomcat as suggested by the installer, copy instead the DSpace webapps directory content to the Tomcat webapps directory.
cp -R /dspace/webapps/* /var/lib/tomcat6/webapps/

15. Create the initial administrator account.
cd bin
chmod 775 dspace
./dspace create-administrator

Creating an initial administrator account
E-mail address: xxxxxxx@xxxxx.edu
First name: xxxxxxx
Last name: xxxxxxx
WARNING: Password will appear on-screen.
Password: your_password
Again to confirm: your_password
Is the above data correct? (y or n): y
Administrator account created

16. Check if Tomcat is running. Launch your favorite web browser and go to cp

A webpage should say something like IT WORKS

17. Access your Dspace home page at

or access the administrator at

CONGRATULATIONS! You have successfully installed Dspace…

  1. Brazilian Friend!
    April 20, 2011 at 10:57 am

    Hey! Thanks for write this post! We´ve needed this knowledge to raise up a DSpace service for our Educacional Institute. Thank You! Congratulations, you´ve done a really good job. Keep writing…
    Hi 5 from Brazil!!!

  2. June 2, 2011 at 12:02 am

    You just saved my day.
    I needed exactly an “How to” for Debian 6.
    This is an excelent post and you are the one that deserves a big “CONGRATULATIONS”!
    And by the way… i’m glad your IT director is a hardcore Debian fan 🙂

  3. Alexander Colesnicov
    August 12, 2011 at 10:19 pm

    Hi! Your work is perfect, I tried this several days before I found your report. A little thing was lost: DSpace did not worked after installation, e.g., it can not upload logos and execute other editing operations. I found that ‘dspace’ user account was blocked by the system, and unblocked it with Gnome menu: System | Administration | Users and Groups. It was necessary to set the password for this user, then the system permits to uncheck the blocking. I propose that this action was performed in the step 5 by using ‘adduser’ instead of low-level ‘useradd’.

    • October 25, 2011 at 5:27 pm

      Your point has been noted. Thanks…

  4. dspacenewbie
    August 14, 2011 at 8:58 pm

    This is great guide.
    Could you tell me how to install another database user with the username and password not the same as ‘dspace’?


    • August 15, 2011 at 3:24 pm

      Use the following command in the console:
      createuser -U postgres -d -A -P anotherusername ; createdb -U anotherusername -E UNICODE anotherdatabasename

      key-in your_new_user_password when prompted for password and when asked to confirm password
      key-in y when prompted to take action on roleu

      • dspacenewbie
        August 20, 2011 at 7:47 pm

        Thank you now i can install with any name.
        Now i’m stuck in moving dspace from local into my server.
        I follow DSpace Documentation : AIP Backup and Restore :
        [dspace]/bin/dspace packager -d -t AIP -e -i

        but i can not find anywhere explain about the handle where should i get it?

        Thanks again for your help.

  5. rafiq
    November 16, 2011 at 6:16 pm

    Really great job…………..thanx a lot

  6. January 23, 2012 at 6:22 pm

    I install sucessfully but new can’t editable in admin side

  7. January 24, 2012 at 3:50 pm

    its gr8 jop tnxs,but i wanna be ask one qn my news can’t edit pls help me

  8. J Teixeira
    January 27, 2012 at 9:20 pm

    Great Job! Thank u very much.

  9. TGIF
    January 28, 2012 at 4:04 am

    I followed this tutorial and everything worked perfectly, the Dspace was working, the GUI was OK, I could add, delete and edit files, communities, collections, and groups. But when I was trying to use the search engine, it didn´t return me anything! The DSpace documentation tells that the dspace and tomcat must run as the same user. Is there any adition configuration I must do?

  10. daneyson
    April 11, 2012 at 6:10 am

    Cara muito bom este seu post PARABENS MSM…..

  11. May 23, 2013 at 3:57 am

    Valeu, muito obrigado, me ajudou e muito, entretanto, acho que seria interessante para o seu tutorial, acrescentar possíveis erros, como os que aconteceram comigo.

    1) O primeiro foi de proxy, tive que alterar o arquivo settings.xml na pasta do maven2 (etc/maven2/settings.xml) o proxy, que solicitava;
    2) Como a conexão funciona com proxy, mas para o funcionamento do Dspace requer vários pré-requisitos (Maven, Apache, JVM, Ant), cada um desses serviços precisa ser configurada a proxy, no caso que eu não consegui configurar a proxy (Apache Ant) , fiz o download manual dos arquivos e comentei a linha em que era feito o get desses files, no build.xml do Dspace;
    3) Como eu fiz o primeiro comando # ant fresh_install, e deu erro no meio da instalação, e eu precisei alterar o proxy, quando fui dar o comando novamente precisei utilizar o # ant clean_database para reiniciar a instalação.

    Mais uma vez, muito obrigado.

  12. Deee
    May 27, 2013 at 6:14 pm

    please do i really need to be connected to d internet before i can begin to install dspace on a debian machine?


  13. mr fakename
    March 14, 2015 at 1:45 am

    Hi, thanks for the howto!
    Step two should be:
    update-alternatives –config java (with two dashes)

    • July 15, 2015 at 2:59 pm

      For some reason, WordPress renders the two dashes as an extended dash; HTML code reveals two dashes.

      Thanks, for pointing this out…

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: