Skip to content

Instantly share code, notes, and snippets.

@softmentor
Last active February 27, 2021 18:38
Show Gist options
  • Select an option

  • Save softmentor/553aca5f1966e12e00c1 to your computer and use it in GitHub Desktop.

Select an option

Save softmentor/553aca5f1966e12e00c1 to your computer and use it in GitHub Desktop.
unbuntu_install_softwares.sh
#!/bin/sh
REQUIRED_JAVA_VERSION=17
#===============================================================================================
# Installation script to install basic utilities for a developer machine
#===============================================================================================
apt-get install -y systat
apt-get install -y wget
apt-get install -y curl
apt-get install -y unzip
apt-get install -y python-software-properties
#===============================================================================================
# Installation script to install sun jdk 7 on unbuntu 12.04
#===============================================================================================
# Pre-requisite: wget, curl, unzip, python-software-properties
add-apt-repository -y ppa:webupd8team/java
apt-get -q -y update
echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
apt-get install -y oracle-java7-installer
apt-get install -y oracle-java7-set-default
#To install daemon cron services
#===============================================================================================
apt-get install -y jsvc
#To install AWS s3 by command line.
#===============================================================================================
apt-get install -y s3cmd
#To install git
#===============================================================================================
add-apt-repository -y ppa:git-core/ppa
apt-get update
apt-get install -y git git-core git-sh git-doc gitk gitstats
#Install certs - refer github.com
#To install maven, version 3 for 12.x
#===============================================================================================
# apt-cache search maven
apt-get install -y maven
#To install scala, sbt
#===============================================================================================
sudo apt-get remove scala-library scala
export SCALA_INSTALL_VERSION=2.11.4
sudo wget http://downloads.typesafe.com/scala/$SCALA_INSTALL_VERSION/scala-$SCALA_INSTALL_VERSION.tgz
echo 'SCALA_HOME=/usr/local/scala/scala-$SCALA_INSTALL_VERSION' >> scala.sh
echo 'export SCALA_HOME' >> /etc/profile.d/scala.sh
sudo -s cp scala.sh /etc/profile.d/scala.sh
rm -f scala.sh
sudo mkdir -p /usr/local/scala
sudo -s cp scala-$SCALA_INSTALL_VERSION.tgz /usr/local/scala/
pushd /usr/local/scala/
sudo -s tar xvf scala-$SCALA_INSTALL_VERSION.tgz
sudo rm -f scala-$SCALA_INSTALL_VERSION.tgz
sudo chown -R root:root /usr/local/scala
popd
sudo update-alternatives --install "/usr/bin/scala" "scala" "/usr/local/scala/scala-$SCALA_INSTALL_VERSION/bin/scala" 1
sudo update-alternatives --install "/usr/bin/scalac" "scalac" "/usr/local/scala/scala-$SCALA_INSTALL_VERSION/bin/scalac" 1
sudo update-alternatives --install "/usr/bin/scalap" "scalap" "/usr/local/scala/scala-$SCALA_INSTALL_VERSION/bin/scalap" 1
sudo update-alternatives --install "/usr/bin/scaladoc" "scaladoc" "/usr/local/scala/scala-$SCALA_INSTALL_VERSION/bin/scaladoc" 1
sudo update-alternatives --install "/usr/bin/fsc" "fsc" "/usr/local/scala/scala-$SCALA_INSTALL_VERSION/bin/fsc" 1
# sbt installation
# remove sbt:>
sudo apt-get purge sbt.
wget http://dl.bintray.com/sbt/debian/sbt-0.13.7.deb
sudo dpkg -i sbt-0.13.7.deb
sudo apt-get update
sudo apt-get install sbt
#===============================================================================================
# Installation redis-server latest stable version on unbuntu 12.04
#===============================================================================================
#https://library.linode.com/databases/redis/ubuntu-12.04-precise-pangolin
#https://github.com/antirez/redis
dpkg --purge -y redis-server
add-apt-repository -y ppa:rwky/redis
apt-get update
apt-get install -y redis-server
#===============================================================================================
# Installation script to install datastax cassandra free edition.
#===============================================================================================
# Pre-requisites: Java is installed. You are logged as sudo user.
# Reference: EC2 installation
# http://www.datastax.com/docs/1.2/install/install_ami
# Reference: Ubuntu deb installations.
# http://www.datastax.com/documentation/cassandra/1.2/index.html?pagename=docs&version=1.2&file=index#cassandra/install/installDeb_t.html
# http://www.datastax.com/documentation/gettingstarted/index.html?pagename=docs&version=quick_start&file=quickstart
# Pre-requisites:
#http://www.datastax.com/documentation/cassandra/1.2/index.html?pagename=docs&version=1.2&file=index#cassandra/install/installJnaDeb.html
apt-get install -y libjna-java
# 1. Add the DataStax Community repository to the /etc/apt/sources.list.d/cassandra.sources.list
#echo 'deb http://debian.datastax.com/community stable main'>> /etc/apt/sources.list.d/cassandra.sources.list
sudo sh -c 'echo "deb http://debian.datastax.com/community/ stable main" >> /etc/apt/sources.list.d/datastax.list'
# 2. Add the DataStax repository key to your aptitude trusted keys.
curl -L http://debian.datastax.com/debian/repo_key | sudo apt-key add -
# 3. Install the package
# This installs the DataStax Community distribution of Cassandra and the OpsCenter Community Edition.
# By default, the Debian packages start the Cassandra service automatically.
apt-get update && apt-get install -y dsc20
# 4. Verify that DataStax Community is running
nodetool status
# 5. Stop the service and cleanup the directories
service cassandra stop
#rm -rf /var/lib/cassandra/*
# Note: If you want latest cassandra version to be available from apache repositories, follow the below steps:
#echo 'deb http://www.apache.org/dist/cassandra/debian 12x main'>> /etc/apt/sources.list.d/cassandra.sources.list
#echo 'deb-src http://www.apache.org/dist/cassandra/debian 12x main'>> /etc/apt/sources.list.d/cassandra.sources.list
#
# Cassandra production settings
# http://www.datastax.com/documentation/cassandra/1.2/webhelp/index.html?pagename=docs&version=1.2&file=configuration/node_configuration#cassandra/install/installRecommendSettings.html
#===============================================================================================
# Installing Ops-Center free
#===============================================================================================
# References:
# http://www.datastax.com/docs/opscenter/install/install_deb
# http://www.datastax.com/2012/01/how-to-set-up-and-monitor-a-multi-node-cassandra-and-hadoop-cluster-on-linux
# 1. Pre-requisite: Need java 6+, python 2.6+, openssl 0.9.8
apt-get install -y libssl0.9.8
# Ensure DataStax Community repository to the /etc/apt/sources.list.d/cassandra.sources.list
# echo 'deb http://debian.datastax.com/community stable main'>> /etc/apt/sources.list.d/cassandra.sources.list
# Ensure cassandra is installed on this machine
# 2 Install ops-center free edition
#apt-get update && apt-get install -y opscenter-free
apt-get install -y opscenter
# 3. Configure OpsCenter machine in the /etc/opscenter/opscenterd.conf file
echo -e "# opscenterd.conf\n[webserver]\nport = 8888\ninterface = [IP]" > /etc/opscenter/opscenterd.conf
sed -i 's/[IP]/$host_ip/g' /etc/opscenter/opscenterd.conf
# 4. Service can be started
service opscenterd start
service opscenterd status
#===============================================================================================
#===============================================================================================
# Installing Ops-Center agents
#===============================================================================================
# Reference
# http://www.datastax.com/docs/opscenter/agent/agent_manual#agent-manual
#===============================================================================================
# 1. Pre-requisite: Need cassandra node running on this box and part of the cluster,
# ops-center is installed on a node in this cluster, set it to $OPSCENTER_HOST
# JMX connectivity is enabled on each node in the cluster
#apt-get install opscenter-free
apt-get install datastax-agent
#OPSCENTER_HOST=10.xx.xxx.xxx
#cd /usr/share/opscenter
#tar -xzf agent.tar.gz
#cd agent
#bin/install_agent.sh opscenter-agent.deb $OPSCENTER_HOST
#In address.yaml set stomp_interface to the IP address that OpsCenter is using.
echo "stomp_interface: <reachable_opscenterd_ip>" | sudo tee -a /var/lib/datastax-agent/conf/address.yaml
#If SSL communication is enabled in /etc/opscenter/opscenterd.conf, use SSL in address.yaml.
echo "use_ssl: 1" | sudo tee -a /var/lib/datastax-agent/conf/address.yaml
#Start the OpsCenter agent:
bin/opscenter-agent
# bin/opscenter-agent -f (in the foreground)
# if custom variables need to be set refer
# http://www.datastax.com/docs/opscenter/agent/agent_variables#agent-variables
#===============================================================================================
# Installing Ruby
#===============================================================================================
# Reference
# http://askubuntu.com/questions/261329/package-for-ruby-2-0-on-precise
#===============================================================================================
git clone https://github.com/fdietz/team_dashboard
sudo add-apt-repository ppa:brightbox/ruby-ng-experimental
sudo apt-get update
sudo apt-get install -y ruby2.0 ruby2.0-dev ruby2.0-doc
Install Rubygems
sudo apt-get install rubygems
sudo apt-get install rails
git clone https://github.com/sstephenson/ruby-build.git
rbenv install 2.0.0-p353 --keep
rbenv global 2.0.0-p353
sudo gem install debugger -v '1.6.2' -- --with-ruby-include="/home/jiny/.rbenv/sources/2.0.0-p353/ruby-2.0.0-p353"
sudo apt-get install libsqlite3-dev
#===============================================================================================
# Installing Ruby on Rails and MySQL
#===============================================================================================
sudo apt-get install -y mysql-server mysql-workbench
sudo gem install rails
#===============================================================================================
# Installing Thrift on Unbuntu
#===============================================================================================
sudo apt-get update
sudo apt-get install libboost-dev libboost-test-dev libboost-program-options-dev libboost-system-dev libboost-filesystem-dev libevent-dev automake libtool flex bison pkg-config g++ libssl-dev python-dev ruby-dev
# Install Apache Thrift 0.9.x
wget --quiet -c http://archive.apache.org/dist/thrift/0.9.1/thrift-0.9.1.tar.gz
tar -xvf thrift-0.9.1.tar.gz
pushd thrift-0.9.1
./configure --program-suffix=_0_9_1 --without-tests
make
sudo make install
popd
echo "Done. Installing Apache 0.9.1"
# Install Apache Thrift 0.8.x
wget --quiet -c http://archive.apache.org/dist/thrift/0.8.0/thrift-0.8.0.tar.gz
tar -xvf thrift-0.8.0.tar.gz
pushd thrift-0.8.0
wget -O - https://issues.apache.org/jira/secure/attachment/12521431/thrift_1515.patch | patch -p0 # THRIFT-1515
pushd compiler/cpp
wget -O - https://issues.apache.org/jira/secure/attachment/12521190/primitive_result_fix.patch | patch -p0 # THRIFT-1474
wget -O - https://issues.apache.org/jira/secure/attachment/12526247/py_generator.patch | patch -p0 # THRIFT-1601
make
popd
./configure --program-suffix=_0_8_0 --without-tests
pushd lib/py
sudo python setup.py install
popd
sudo make install
popd
echo "Done. Installing Apache 0.8.0 with patches"
# Install Apache Thrift 0.6.x
wget --quiet -c http://archive.apache.org/dist/thrift/0.6.1/thrift-0.6.1.tar.gz
tar -xvf thrift-0.6.1.tar.gz
pushd thrift-0.6.1
# If you are using unbuntu 14.x need to turn off ruby as it does not work.
./configure --program-suffix=_0_6_1 --without-tests --without-ruby
make
sudo make install
popd
echo "Done. Installing Apache 0.6.1"
check_java(){
JAVA_VER=$(java -version 2>&1 | sed 's/java version "\(.*\)\.\(.*\)\..*"/\1\2/; 1q')
if [ "$JAVA_VER" -ge ${REQUIRED_JAVA_VERSION} ]
then echo "ok, java is 1.5 or newer"
else echo "it's too old..."
}
add_ppa() {
grep -h "^deb.*$1" /etc/apt/sources.list.d/* > /dev/null 2>&1
if [ $? -ne 0 ]
then
echo "Adding ppa:$1"
sudo add-apt-repository -y ppa:$1
return 0
fi
echo "ppa:$1 already exists"
return 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment