Dependencies for DSpace:
- Tomcat
- Postgres
- Java 7
Dependencies for a development environment
- Tomcat
- Postgres
- Java 7
- Git (to download dspace-source)
- Maven (to compile DSpace - part 1)
- Ant (to compile DSpace - part 2)
- IntelliJ (Optional: to edit code)
- pgAdmin3 (Optional: to run queries against postgres)
The process below is an efficient way of setting this all up on OSX. This guide was compiled on May 7, 2014, using a new MacBook Pro, running OSX 10.9 (Maverick), and grabbing the latest DSpace, something like DSpace 4.x or DSpace 5.x. There’s no one-click installer, so some command-line proficiency is required.
The primary things needed for DSpace are: Java JDK, Tomcat, Postgres, and then git, maven, and ant for compiling/installing.
Installation Steps
Table of Contents
Install Brew
Brew is a package installer/manager for OSX. Its great as it allows you to properly install a number of programs (i.e. dependencies) from the command line.
Install brew, and Install: brew, follow instructions from http://brew.sh
brew doctor
brew update
brew install git
...
Install Java 7 JDK
...
Download and Install Java 7 JDK, this step should be done before installing tomcat, and IntelliJ: http://www.oracle.com/technetwork/java/javase/downloads/index.html
Info | ||
---|---|---|
| ||
If vi / vim is too technical for you, you can use nano or sublime text (pro-tip at bottom) instead. Then, instead of vi ~/.bash_profile, it would be nano ~/.bash_profile or subl ~/.bash_profile vi is just common among systems people |
Configure JAVA_HOME for Java 7
...
export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)
Install Git, Maven, Ant, Tomcat
brew install git maven ant tomcat tomcat-native
...
Install Postgres.App
Install postgres.app from: http://postgresapp.com/
...
“\q” gets you out of PSQL.
Configure Tomcat
Tell tomcat that tomcat-native is installed.
...
Create the /dspace directory, below where I have "myUserName", customize that for your local setup, i.e. "peter".
sudo mkdir /dspace
sudo chown -R myUserName /dspace
...
Clone DSpace from GitHub, to your Projects directory, and begin the compile process.
cd ~
mkdir Projects
cd ~/Projects
git clone https://github.com/DSpace/DSpace.git
cd DSpace
git checkout dspace-4_x
mvn package
cd dspace/target/dspace-installer/
...
From here, you should have a ready to go system. You can always check the official installation documentation too: Installing DSpace. It would be best to keep this document Install on OSX guide up-to-date, so if you run into issues, please leave a comment, update this document (if permitted), or contact the author.
PRO-Tips:
Mail Catcher
...
to trap and view emails
...
locally
For development, send all emails to “mailcatcher”, a dummy email account, that runs on localhost, so that real emails don’t get sent out to real people.
...
Once configured, you can view your “inbox”, for outgoing messages from DSpace in your browser at http://localhost:1080
IntelliJ IDEA for a great coding environment
If you plan on doing significant Java programming, then it is recommended to use IntelliJ. The Ultimate version is best suited for this work, either start the trial, or use/buy a license. DSpace Committers have access to an “Open Source Project License”, hooray JetBrains! IntelliJ gives you code-completion i.e. Conf -> ConfigurationManager, and detects syntax errors before you spend time compiling. There are other alternatives, such as Eclipse and NetBeans, but many DSpace developers stick with IntelliJ IDEA.
Sublime Text for a great light-weight config editing environment
If I have to quickly view some config files, its preferable to open that with Sublime. Sublime Text 3 is their latest-and-greatest version.
...
Or to open a directory of config files, you can pass it the directory:
subl /dspace/config
pgAdmin3 for better PostgreSQL query environment
I would recommend pgadmin3, for a better query-environment than PSQL. Google, download, install it.
...
Note: A classically trained database admin may cringe when they see you use the Graphical Query Builder to make joins, but its only because they have too much time on their hands.
respace.sh - Single-Step Redeploy Script
If you are doing development, and find yourself having to make changes to .java files, then cd to your DSpace-source directory, then maven, then cd dspace/target/..., then ant, then stop/start tomcat, and you find that tedious, why not automate that process?
Introducing, respace.sh. https://gist.github.com/peterdietz/7893272
To add it:
curl https://gist.githubusercontent.com/peterdietz/7893272/raw/2f8549cadd42a5f938abac173af1b046fc57cf2a/respace.sh > ~/Projects/DSpace/respace.sh
chmod +x ~/Projects/DSpace/respace.sh
Then to run it, from your ~/Projects/DSpace directory:
./respace.sh
I've gotten fancy with this respace script, it sends a message to OSX's Notification Center, letting you know when it finishes.