You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.3 KiB
44 lines
1.3 KiB
#!/bin/bash
|
|
|
|
# This script will:
|
|
# - install docker
|
|
# - make temporary changes to your system (vm.max_map_count, fs.file-max and other)
|
|
|
|
# ATENTION: run this script as root (use sudo if needed)!
|
|
|
|
# Checks for root privileges
|
|
if [ "$EUID" -ne 0 ]
|
|
then echo "Please run as root."
|
|
exit 1
|
|
fi
|
|
|
|
# Checks if ports 80 and 443 are in use
|
|
SHOULD_EXIT=0
|
|
if [[ `lsof -i -P -n | grep LISTEN | grep '*:80 (LISTEN)'` ]]; then
|
|
PORT80USER=`lsof -i -P -n | grep LISTEN | grep '*:80 (LISTEN)' | awk '{ print $1 }'`
|
|
echo "Port 80 is in use by another program ($PORT80USER). Please free the port and try again."
|
|
SHOULD_EXIT=1
|
|
fi
|
|
|
|
if [[ `lsof -i -P -n | grep LISTEN | grep '*:443 (LISTEN)'` ]]; then
|
|
PORT443USER=`lsof -i -P -n | grep LISTEN | grep '*:443 (LISTEN)' | awk '{ print $1 }'`
|
|
echo "Port 443 is in use by another program ($PORT80USER). Please free the port and try again."
|
|
SHOULD_EXIT=1
|
|
fi
|
|
|
|
if [[ "$SHOULD_EXIT" = "1" ]]; then
|
|
echo "Exiting..."
|
|
exit 1
|
|
fi
|
|
|
|
# Installs docker using the get.docker.com method
|
|
VERSION="18.09"
|
|
curl -fsSL https://get.docker.com -o get-docker.sh | sh
|
|
|
|
# Bellow settings are needed for Sonarqube to run on linux.
|
|
# These settings are valid only for the session and are lost after reboot
|
|
# TODO: make the changes permanent
|
|
sysctl -w vm.max_map_count=262144
|
|
sysctl -w fs.file-max=65536
|
|
ulimit -n 65536
|
|
ulimit -u 4096
|
|
|