AWS Setup for OFBiz

This section of the guide is to setup an AWS t2micro server for use with OFBiz. I initially set it up for version 16.11, but have since used it for 18.12.

Create an AWS account and sign in at: https://aws.amazon.com/

aws-amazon-signin-screen

Create IAM User Account:

Download the AWS User Guide for Linux Instances Copyright 2019: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-ug.pdf

Best practices says to create an IAM user and turn on Multi-Factor Authentication.

See Page 19


aws-IAM-security-credentials

When complete your dashboard should look something like this:

aws-IAM-dashboard

Login to AWS Console

Select Services Drop Down Menu

Select Compute - EC2

aws-services-ec2-dashboard

Select Security Groups

Edit Default Group

Select Inbound Tab

Click on Edit

Select All Traffic for all Ports from Your IP address

Click on Save

This secures the server to only your location.

aws-security-groups-inbound-all-traffic

Select Key Pairs

Click on Create Key Pair

Enter Key Pair Name"YourNameEtc"

Click on Create

Watch for Download pem file in Lower Left Corner

aws-creat-key-pairs-download

Downlkoad WinSCP 5.15: https://winscp.net/eng/download.php

Install

winscp-download

From Putty Menu

Run PuTTYgen

Click Load NewKeyPair.pem

Click Save Private Key

Click No on Passphrase Message

Name the file NewKeyPair.ppk


puttygen-create-ppk-file-from-pem

From AWS Console Select Launch Image

Choose Amazon Linux AMI 2018.03.0

Click on Select

aws-ec2-launch-amazon-linux-ami

Select t2.micro

Click on:

Next: Configure Instance Details

aws-instance-type-t2-micro-free

Use all Default Values

Click on:

Next: Add Storage

aws-configure-instance-default-values

Use all Default Values

Click on:

Next: Add Tags

aws-ec2-instance-add-storage

No Tags are Needed

Click on:

Next: Configure Security Group

aws-ec2-instance-add-tags

Click on "Select an existing security group"

This is the firewall ports from your IP address to only access your server instance.

Click on:

Review and Launch

Review Settings

Click on:

Launch

C:\Users\Bill Harder\Documents\OFBiz Installtion Images\aws-ec2-instance-launch.png

Select Existing Key Pair

Click on: I Acknowledge box

Click on: Launch Instances


aws-ec2-select-key-pair-launch

Click on:

View Instances

aws-ec2-launce-status-view-instances

AWS EC2 Instance

Select Running Instance

Select the Copy Icon in the details section.

This is what you will feed into PuTTY for an SSH connection.

aws-ec2-instance-copy-dns

Past Host Name

Verify Port 22

Verify SSH is Selected

Type OFBiz Server in Saved Sessions

Click on:

Save

Click on SSH Below Connection

Click on Auth Below SSH

Click on : Browse

Select Your NewKeyPair.ppk File

Click on Data Below Connection

Enter ec2-user in Auto-login

Go back to top and Click on Session

Click on Save again.

putty-connection-ssh-auth-browse-open

Highly recommend visiting this site and getting your PuTTY settings right.

https://www.linux.com/tutorials/improving-putty-settings-windows/

linux-com-tutorials-improving-putty-settings-windows

Click on Yes

This acknowledges that the servers host key is not cached in the registry.

putty-servers-host-key-not-cached-registry

You are now connected to your AWS Instance via PuTTY

putty-aws-connection

Type sudo yum update

Press Enter

This will apply outstanding updates to your linux server.

Type:

sudo yum install java-1.8.0-openjdk-devel

Press Enter

Press y

When Prompted to Install

This will install Java 1.8.0 to your AWS server.

putty-aws-sudo-yum-install-java-openjdk-devel

Type:

sudo yum remove java-1.7.0

Press Enter

Press y

When Prompted to Uninstall

This will remove Java 1.7.0 from your AWS server.

putty-aws-sudo-yum-remove-java-1-7-0

Type:

export PATH=$PATH:/usr/lib/jvm/jre/bin

This will add the path to your Java binary directory to the current system PATH environment variable.

putty-aws-export-path-usr-lib-jvm-jre-bin

Type:

sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024

Press Enter

Be patient. This is creating a 1GB block device of all zero's.

C:\Users\Bill Harder\Documents\OFBiz Installtion Images\putty-aws-sudo-create-swap-space-ofbiz-java-memory-error.png

Type:

sudo /sbin/mkswap /var/swap.1

Press Enter

This sets up the swap space.

putty-aws-sudo-mkswap-swap

Type:

sudo chmod 600 /var/swap.1

Press Enter

This sets the permissions on the /var/swap.1 device.

putty-aws-sudo-chmod-swap

Type:

sudo /sbin/swapon /var/swap.1

Press Enter

This turns on the swap device.

putty-aws-sudo-swapon-var-swap-1

Type:

top

Press Enter

About 5 lines down you will see Swap with the total, used, and free

Type:

q

This quits the memory display.

putty-aws-swap-running-top-memory-check

Type:

sudo nano /etc/fstab

Press Enter


putty-aws-sudu-nano-etc-fstab-swap

Edit the /etc/fstab file

Arrow Down

Insert a Line

Type:

/var/swap.1 swap swap defaults 0 0

Press Control+X

Press Y

Press Enter

This will add the swap device on startup each time your reboot the server.

putty-aws-sudo-nano-etc-fstab-edit-swap-defaults-startup

This completes the basic AWS server setup to work with OFBiz Version 16.11