Files
LEMPer/scripts/install_dependencies.sh
Edi Septriyanto 0baa7d08f7 Some enhancements.
2020-01-09 21:34:48 +07:00

57 lines
1.9 KiB
Bash
Executable File

#!/usr/bin/env bash
# Dependencies Installer
# Min. Requirement : GNU/Linux Ubuntu 14.04 & 16.04
# Last Build : 02/08/2019
# Author : ESLabs.ID (eslabs.id@gmail.com)
# Since Version : 1.0.0
# Include helper functions.
if [ "$(type -t run)" != "function" ]; then
BASEDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )
# shellchechk source=scripts/helper.sh
# shellcheck disable=SC1090
. "${BASEDIR}/helper.sh"
fi
# Make sure only root can run this installer script.
requires_root
if hash apt 2>/dev/null; then
# Update repositories.
echo "Updating repository..."
run apt update -qq -y
# Install dependencies.
echo "Installing pre-requisite packages..."
run apt install -qq -y apt-transport-https autoconf automake bash build-essential ca-certificates cmake cron \
curl dnsutils gcc geoip-bin geoip-database git gnupg2 htop iptables libc-dev libcurl4-openssl-dev libgd-dev libgeoip-dev \
libssl-dev libxml2-dev libpcre3-dev libxslt1-dev lsb-release make ntpdate openssh-server openssl pkg-config re2c rsync \
software-properties-common sasl2-bin snmp sudo sysstat tar tzdata unzip wget whois zlib1g-dev
# Configure server clock.
echo -e "\nReconfigure server clock..."
# Reconfigure timezone.
if [[ -n ${TIMEZONE} && ${TIMEZONE} != "none" ]]; then
run bash -c "echo '${TIMEZONE}' > /etc/timezone"
run rm -f /etc/localtime
run dpkg-reconfigure -f noninteractive tzdata
# Save config.
save_config "TIMEZONE=${TIMEZONE}"
fi
# Update local time.
# Masked (?).
run systemctl unmask ntp.service
run systemctl stop ntp
run ntpdate -s cn.pool.ntp.org
run systemctl start ntp
else
fail "Unable to install LEMPer, this GNU/Linux distribution is not supported."
fi
status "Required packages installation completed..."