Skip to content

Instantly share code, notes, and snippets.

@bauna
Forked from mmeisinger/gist:fb68f0d7dd02709fd809
Last active August 29, 2015 14:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bauna/052a91ba0ed873e321f3 to your computer and use it in GitHub Desktop.
Save bauna/052a91ba0ed873e321f3 to your computer and use it in GitHub Desktop.
VirtualBox VM Install
=====================
Prerequisites:
- VirtualBox installed
- Ubuntu ISO image downloaded: ubuntu-14.04.1-server-amd64.iso
-- for 64bit architecture AMD/Intel processors
- Thingworx packages downloaded
Create new VM in VirtualBox, select ISO and use these (or other) settings:
Host thing, User Thing
Credentials: thing/thing
No LVM 64 GB
Standard installation, answer Yes to questions
Select packets to install: openssh-server (nothing else)
Reconfigure the network in VirtualBox settings:
- In VirtualBox main Preferences/Network, add a ‘named’ Host-Only network if not yet existing
- In the new VM Settings/Network, set Adapter 1 as Host-Only and select the newly created ‘named’ Host-only network.
Network Variants:
1: When connected to a wireless network, set Adapter 2 to bridge mode
2: When not connected to wireless, set Adapter 2 to NAT mode (to avoid timeouts)
Reboot VMs after a network change
sudo vim /etc/network/interfaces
# Change to following (suggestion):
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.56.10
netmask 255.255.255.0
network 192.168.56.0
broadcast 192.168.56.255
auto eth1
iface eth1 inet dhcp
Execute in VirtualBox window for the VM (on Ubuntu):
# To find out the status and IP addresses of the eth0 and eth1 adapters
ip addr
# On Apple terminal (change IP address based on ip addr output)
ssh -l thing 192.168.56.10
# The following is optional if you want shared folders with the host:
# Mount VBoxLinuxAdditions.iso via VirtualBox menu
sudo apt-get update
sudo apt-get install dkms gcc
sudo mount /dev/sr0 /media/cdrom
cd /media/cdrom
sudo ./VBoxLinuxAdditions.run
sudo apt-get update
# Define Shared Folder in VirtualBox VM settings (named xxxxx)
# https://www.virtualbox.org/manual/ch04.html#sharedfolders
sudo mkdir /mnt/xxxxx
Amazon EC2 Install
==================
Amazon zone US-West 2 (Oregon)
Choose Ubuntu 12.04 LTS Precise HVM EBS-SSD boot ami-ef5e24df
# Create/Associate Security Group
Open ports SSH, HTTP, HTTPS, 8080, SOCKS5
# Associate elastic IP
xx.xx.xx.xx
ssh -i .ssh/key.pem ubuntu@xx.xx.xx.xx
# The following EBS volume setup is not necessary initially:
# Associate new EBS volumes /dev/sdg, /dev/sdh
# Format new EBS volumes
sudo mkfs -t ext4 /dev/xvdg
sudo mkfs -t ext4 /dev/xvdh
sudo vim /etc/fstab
# Add lines
#/dev/xvdm /mnt/ThingworxStorage ext4 noatime 0 0
#/dev/xvdn /mnt/ThingworxBackupStorage ext4 noatime 0 0
sudo mkdir /mnt/ThingworxStorage
sudo mkdir /mnt/ThingworxBackupStorage
sudo mount /dev/xvdg /mnt/ThingworxStorage
sudo mount /dev/xvdh /mnt/ThingworxBackupStorage
ThingworX Install
=================
Based on Thingworx install info:
https://twc.thingworx.com/Thingworx/Runtime/index.html#master=ThingWorxCommunity&mashup=ThingWorxHome
# ---System
sudo aptitude update
sudo apt-get install ntp
sudo apt-get install authbind
sudo touch /etc/authbind/byport/443
sudo chmod 555 /etc/authbind/byport/443
# --- Java
# Java: https://www.digitalocean.com/community/tutorials/how-to-install-java-on-ubuntu-with-apt-get
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
sudo update-alternatives --config java
# no change, was ok
sudo update-alternatives --config javac
# no change, was ok
sudo vim /etc/environment
# Insert line at 0 and change PATH:
JAVA_HOME=/usr/lib/jvm/java-7-oracle
JAVA_BIN=/usr/lib/jvm/java-7-oracle/bin
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:$JAVA_BIN"
source /etc/environment
# --- Tomcat 7 from Ubuntu package
sudo apt-get install tomcat7
#Update config
sudo vim /etc/default/tomcat7
#Uncomment AUTHBIND option and set it to "yes" (usually it's located at EOF)
AUTHBIND=yes
#Change JAVA_OPTS to
JAVA_OPTS="-Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dserver -Dd64 -Xms512m -Xmx2g -XX:+UseNUMA -XX:+UseConcMarkSweepGC"
# --- Tomcat 7 from Apache
# The following are not necessary on a new VM without preinstalled tomcat
# http://askubuntu.com/questions/173981/installing-tomcat-7-on-ubuntu-server-12-04
sudo apt-get purge tomcat6
sudo apt-get remove tomcat6-common
sudo apt-get remove tomcat7
sudo apt-get remove tomcat7-admin
sudo apt-get remove tomcat7-common
sudo apt-get purge tomcat7-common
sudo apt-get purge tomcat7
sudo apt-get autoremove
wget http://apache.petsads.us/tomcat/tomcat-7/v7.0.55/bin/apache-tomcat-7.0.55.tar.gz
tar -xvf apache-tomcat-7.0.55.tar.gz
sudo mv apache-tomcat-7.0.55 /opt/apache-tomcat-7.0.55
sudo ln -s apache-tomcat-7.0.55 tomcat7
sudo chown -R root.root tomcat7
cd /opt/tomcat7
sudo vim bin/catalina.sh
# Add these lines after initial long comment section:
JAVA_OPTS="$JAVA_OPTS -Dserver -Dd64 -Xms512m -Xmx2g -XX:+UseNUMA -XX:+UseConcMarkSweepGC"
CATALINA_OPTS="$CATALINA_OPTS -Djava.net.preferIPv4Stack=true"
sudo vim bin/startup.sh
# Change last line (insert the authbind --deep part):
exec authbind --deep "$PRGDIR"/"$EXECUTABLE" start "$@"
sudo vim /etc/init.d/tomcat7
# Insert the following (up to and not including --EOF):
#!/bin/bash
### BEGIN INIT INFO
# Provides: tomcat7
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/Stop Tomcat server
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
start() {
sh /opt/tomcat7/bin/startup.sh
}
stop() {
sh /opt/tomcat7/bin/shutdown.sh
}
case $1 in
start|stop) $1;;
restart) stop; start;;
*) echo "Run as $0 <start|stop|restart>"; exit 1;;
esac
---EOF
# Tomcat 7 - Common config steps
# if you have used the ubuntu package all config options are located in /etc/tomcat7
sudo vim conf/tomcat-users.xml
# Add in appropriate section:
<role rolename="manager"/>
<role rolename="admin"/>
<role rolename="manager-gui"/>
<user username="admin" password="mypasswd" roles="manager,admini,manager-gui"/>
sudo vim conf/context.xml
# Delete the lines before and after the Manager element, basically uncommenting the Manager element - this way, sessions are NOT persisted when Tomcat is restarted
sudo vim conf/server.xml
# Change 8080 to 80 to change the port number tomcat listens on
# Create a 10 years self signed certificate
sudo keytool -genkey -keyalg RSA -alias selfsigned -keystore conf/keystore.jks -storepass password -validity 3600 -keysize 2048
# Answer keytool questions as bellow
What is your first and last name?
[Unknown]: twd2.skymira.com
What is the name of your organizational unit?
[Unknown]: SkyMira LLC
What is the name of your organization?
[Unknown]: SkyMira
What is the name of your City or Locality?
[Unknown]: Milford
What is the name of your State or Province?
[Unknown]: Connecticut
What is the two-letter country code for this unit?
[Unknown]: US
Is CN=twd2.skymira.com, OU=SkyMira LLC, O=SkyMira, L=Milford, ST=Connecticut, C=US correct?
[no]: yes
Enter key password for <selfsigned>
(RETURN if same as keystore password):
#Uncomment https connector
<Connector port="443" protocol="org.apache.coyote.http11.Http11Protocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
keystoreFile="/opt/tomcat7/conf/keystore.jks" keystorePass="skymira" keyAlias="selfsigned"
clientAuth="false" sslProtocol="TLS" />
sudo chmod 755 /etc/init.d/tomcat7
sudo update-rc.d tomcat7 defaults
# Start tomcat (in the future the daemon scripts autostart)
sudo service tomcat7 start
# --- ThingworX webapp installation
Use the browser to go to http://ipaddr - shows Tomcat main page
Select manager or go to http://ipaddr/manager , log in using above admin/thingad7 login
In “WAR file to deploy” section, select Thingworx WAR file and upload
Wait for upload and start of Thingworx webapp. It should appear as started (Stop is a button, Start is text) in the table of Applications on this page.
Go to http://ipaddr/Thingworx and log in as Administrator/admin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment