Skip to content

Instantly share code, notes, and snippets.

@tiagocardosos
Last active March 26, 2020 01:39
Show Gist options
  • Save tiagocardosos/6d3fc2c3d1cced519bb5c63da642f421 to your computer and use it in GitHub Desktop.
Save tiagocardosos/6d3fc2c3d1cced519bb5c63da642f421 to your computer and use it in GitHub Desktop.
Server setup for Ubuntu and Elasticsearch Cluster on Digital Ocean

Server setup for Ubuntu and Elasticsearch Cluster on Digital Ocean

Update system

apt-get update && apt-get dist-upgrade -y
apt-get autoremove -y

Create and expose a SSH Key for the new user

ssh-keygen -t rsa -C "[email protected]"
cat ~/.ssh/id_rsa.pub

Install packages

apt-get install -y \
build-essential \
python \
software-properties-common \
g++ \
make \
curl \
bc \
htop \
ntp \
ntpdate

Set correct timezone

dpkg-reconfigure tzdata
timedatectl set-timezone America/Sao_Paulo
timedatectl set-ntp on

Install JDK 9

wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/9.0.4+11/c2514751926b4512b076cc82f959763f/jdk-9.0.4_linux-x64_bin.tar.gz
tar vxfz jdk-9.0.4_linux-x64_bin.tar.gz
mv jdk-9.0.4 /usr/local/jdk

Set JAVA_HOME

vi /etc/profile
#add variables

JAVA_HOME=/usr/local/jdk
export JAVA_HOME
PATH=$PATH:$JAVA_HOME/bin:
export PATH
source /etc/profile
java -version

Install Elasticsearch with Debian Packageedit

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
sudo apt-get install apt-transport-https
echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list
sudo apt-get update && sudo apt-get install elasticsearch

sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service

sudo systemctl start elasticsearch.service
sudo systemctl stop elasticsearch.service

sudo journalctl -f
sudo journalctl --unit elasticsearch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment