Java Scala Mongo Installation
Getting Scala to work on EC2
Ref: https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04
# Java installation - installing Oracle JDK 8
apt-get -y update
add-apt-repository ppa:webupd8team/java
apt-get -y update
apt-get install -y oracle-java8-installer
# if there are multiple JDK installations on one server, then we can switch between versions using:
# update-alternatives --config java
# Setting JAVA_HOME
# Put the location of java from the config command above at the end of the file
# JAVA_HOME="/usr/lib/jvm/java-8-oracle"
# Then do source /etc/environment
# Scala installation
# First see which version of Scala we should install - We are using 2.11.8
# Got to Scala website and find the link to set.
# Make a directory like /tf_files/scala_bkend and get this tgz file
# wget https://github.com/sbt/sbt/releases/download/v1.0.2/sbt-1.0.2.tgz
# gunzip sbt-1.0.2.tgz
# tar xvf sbt-1.0.2.tar
#Ref: https://gist.github.com/alexislucena/5947c925afc3a0f26b04c3785d482e9f
# Scala Install
mkdir -p /tf_files/DOWNLOAD/Scala_install
cd /tf_files/DOWNLOAD/Scala_install
apt-get remove scala-library scala
wget www.scala-lang.org/files/archive/scala-2.11.8.deb
dpkg -i scala-2.11.8.deb
# SBT install
# Ref: http://www.scala-sbt.org/0.13/docs/Installing-sbt-on-Linux.html
echo "deb https://dl.bintray.com/sbt/debian /" | tee -a /etc/apt/sources.list.d/sbt.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
apt-get update
apt-get install sbt
# Install MongoDB
# Ref: https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-16-04
# Ref: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list
apt-get -y update
apt-get install -y mongodb-org
# Install MongoDB in ubuntu18.04
ubuntu@ip-10-215-55-167:~$ cat mongo_install.sh
#!/bin/bash
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
echo "mongodb-org hold" | sudo dpkg --set-selections
echo "mongodb-org-server hold" | sudo dpkg --set-selections
echo "mongodb-org-shell hold" | sudo dpkg --set-selections
echo "mongodb-org-mongos hold" | sudo dpkg --set-selections
echo "mongodb-org-tools hold" | sudo dpkg --set-selections
sudo service mongod start
./mongo_install.sh
# then follow to initiate systemd as given in the documentation - edit /etc/systemd/system/mongodb.service
# finally start the service - DID NOT WORK IN DOCKER
# systemctl start mongodb
# to start the mongo service manually:
# /usr/bin/mongod --quiet --config /etc/mongod.conf &
# Get AgShift mongoldb zip file from GitHub and then sep to the EC2 docker
# Start mongodb
# 1. To dump the entire database at some location, use the following command.
# mongodump -d databasename -o /path/of/output/
# Then restore the database using the following command
# mongorestore --host localhost --port 27017 --db agshift /path/to/Downloaded unzipped file/agshift
# Ref image: https://s3-us-west-2.amazonaws.com/agskore/Users/IOS/devrelease/A23571BC-A7D4-4739-8778-C57FB36AE54A/2017-09-14/JPEGImages/pic_1505417603796.jpg
# Curl command: curl -X POST -d '{"to":"Support"}' -H "Content-Type: application/json" http://localhost:809
0/api/misc/contact-us -vMongoDB connect
MongoDB upgrade (community edition 4.0.7) and start service
Ref: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
MongoDB commands
MongoDB security
https://medium.com/@raj_adroit/mongodb-enable-authentication-enable-access-control-e8a75a26d332
Getting MongoDB secured in Kubernetes
http://pauldone.blogspot.com/2017/06/deploying-mongodb-on-kubernetes-gke25.html
MongoDB Kubernetes ec2_kops_shadow
Replicate MongoDB from Production DB to Staging DB
MongoDB setting up replicate set on vanilla VM's
Ref: https://computingforgeeks.com/how-to-setup-mongodb-replication-on-ubuntu-18-04-lts/
Scala structure
Scala Setup
Last updated
Was this helpful?