SUNScholar/Prepare Ubuntu/S04

From Libopedia
Jump to: navigation, search
 STEP 5

Step 4. Setup Maven Java Installer

Step 4.1: Install Maven

Type as follows:

sudo apt-get install maven

Please note:

  1. Check this first: https://wiki.duraspace.org/display/DSDOC4x/Installing+DSpace#InstallingDSpace-ApacheMaven3.x(Javabuildtool)
  2. See the output of the maven version on Ubuntu 12.04 LTS
root@dspace:~# mvn -v
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.7.0_51, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_ZA, platform encoding: UTF-8
OS name: "linux", version: "3.2.0-60-generic", arch: "amd64", family: "unix"

Step 4.2: Create the Maven home folder

(Optional: This may or may not be needed) Type the following;

mkdir /home/dspace/.m2

Step 4.3: Setup the Maven config file

The Maven configuration file is only needed if your connection to the internet is via a campus proxy server. You can skip this step if you have a direct connection to the internet.

Maven proxy notes

Use the proxy settings for your campus. Check with your IT department. You need to ensure that the following two sites are allowed to pass through your campus proxy server and/or campus firewall:

  1. maven.apache.org
  2. repo1.maven.org

More information about Maven can be found here at the following links:

Maven proxy config file

Type the following to enable Maven proxy settings:

nano /home/dspace/.m2/settings.xml

Tip: It is always a good idea to maximise the open nano window so that the copy and paste of long lines does not wrap around.

Add the following:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <localRepository/>
  <interactiveMode/>
  <usePluginRegistry/>
  <offline/>
  <pluginGroups/>
  <servers/>
  <mirrors/>
  <proxies>
    <proxy>
      <id>%my-name-for-maven-settings%</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>%my-campus-proxy-hostname%</host>
      <port>%my-campus-proxy-port%</port>
      <username>%my-campus-proxy-username%</username>
      <password>%my-campus-proxy-password%</password>
      <nonProxyHosts></nonProxyHosts>
    </proxy>
  </proxies>
  <profiles/>
  <activeProfiles/>
</settings>
Replace everything between the % signs with your campus settings !

NANO Editor Help
CTL+O = Save the file and then press Enter
CTL+X = Exit "nano"
CTL+K = Delete line
CTL+U = Undelete line
CTL+W = Search for $string$
CTL+\ = Search for and replace $string$
ALT+C = Show line numbers

More info = http://en.wikipedia.org/wiki/Nano_(text_editor)


Step 4.4: Fix file permissions

Fix file permissions for maven folder in the DSpace user home folder.

Type as follows:

chown -R dspace.dspace /home/dspace/.m2/
chmod -R 0777 /home/dspace/.m2/