Skip to content

Commit

Permalink
added sh:mvn:install
Browse files Browse the repository at this point in the history
  • Loading branch information
mbandiaak committed Sep 15, 2022
1 parent a4092b0 commit e8accae
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
39 changes: 39 additions & 0 deletions maven-install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
The following are instructions for installing Apache Maven and Java 8 on an Amazon EC2 instance. These are required for the Amazon Neptune Signature Version 4 authentication samples.

## Steps To Install Apache Maven and Java 8 on your EC2 instance

1. Connect to your Amazon EC2 instance with an SSH client.

2. Install Apache Maven on your EC2 instance. First, enter the following to add a repository with a Maven package.

``sudo wget https://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo``

- Enter the following to set the version number for the packages.

`sudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo`
- Then you can use yum to install Maven.

`sudo yum install -y apache-maven`
3. The Gremlin libraries require Java 8. Enter the following to install Java 8 on your EC2 instance.

`sudo yum install java-1.8.0-devel`
4. Enter the following to set Java 8 as the default runtime on your EC2 instance.

`sudo /usr/sbin/alternatives --config java`
- When prompted, enter the number for Java 8.

5. Enter the following to set Java 8 as the default compiler on your EC2 instance.

`sudo /usr/sbin/alternatives --config javac`
- When prompted, enter the number for Java 8.

6. Verify your maven version
`mvn -v`

### Project Preparation
7. Create the `.m2` directory in the home directory of your current user
`mkdir ~/.m2`

8. Create the Settings file inside of the `~/.m2` directory
`cd ~/.m2/`
`mv demo/settings.xml ~/.m2/`
35 changes: 35 additions & 0 deletions nexus-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
yum install java-1.8.0-openjdk.x86_64 wget -y
mkdir -p /opt/nexus/
mkdir -p /tmp/nexus/
cd /tmp/nexus/
NEXUSURL="https://download.sonatype.com/nexus/3/latest-unix.tar.gz"
wget $NEXUSURL -O nexus.tar.gz
EXTOUT=`tar xzvf nexus.tar.gz`
NEXUSDIR=`echo $EXTOUT | cut -d '/' -f1`
rm -rf /tmp/nexus/nexus.tar.gz
rsync -avzh /tmp/nexus/ /opt/nexus/
useradd nexus
chown -R nexus.nexus /opt/nexus
cat <<EOT>> /etc/systemd/system/nexus.service
[Unit]
Description=nexus service
After=network.target
[Service]
Type=forking
LimitNOFILE=65536
ExecStart=/opt/nexus/$NEXUSDIR/bin/nexus start
ExecStop=/opt/nexus/$NEXUSDIR/bin/nexus stop
User=nexus
Restart=on-abort
[Install]
WantedBy=multi-user.target
EOT
echo 'run_as_user="nexus"' > /opt/nexus/$NEXUSDIR/bin/nexus.rc
systemctl daemon-reload
systemctl start nexus
systemctl enable nexus

0 comments on commit e8accae

Please # to comment.