From 0ce692f2add209c6f5d449ee2be7af725f1813e8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 15 Feb 2022 04:25:22 +0100 Subject: Adding upstream version 1.33.1. Signed-off-by: Daniel Baumann --- packaging/installer/README.md | 10 +- packaging/installer/dependencies/alpine.sh | 99 ++++++++++++ packaging/installer/dependencies/arch.sh | 101 +++++++++++++ packaging/installer/dependencies/centos.sh | 185 +++++++++++++++++++++++ packaging/installer/dependencies/clearlinux.sh | 87 +++++++++++ packaging/installer/dependencies/debian.sh | 105 +++++++++++++ packaging/installer/dependencies/fedora.sh | 119 +++++++++++++++ packaging/installer/dependencies/freebsd.sh | 145 ++++++++++++++++++ packaging/installer/dependencies/gentoo.sh | 99 ++++++++++++ packaging/installer/dependencies/ol.sh | 144 ++++++++++++++++++ packaging/installer/dependencies/opensuse.sh | 103 +++++++++++++ packaging/installer/dependencies/rockylinux.sh | 162 ++++++++++++++++++++ packaging/installer/dependencies/ubuntu.sh | 102 +++++++++++++ packaging/installer/functions.sh | 128 +++++++--------- packaging/installer/install-required-packages.sh | 9 +- packaging/installer/kickstart.sh | 120 ++++++++++----- packaging/installer/methods/kickstart.md | 20 +-- packaging/installer/methods/macos.md | 114 +++++++------- packaging/installer/methods/manual.md | 3 +- packaging/installer/methods/source.md | 55 ------- packaging/installer/methods/synology.md | 17 ++- packaging/installer/netdata-updater.sh | 14 +- 22 files changed, 1685 insertions(+), 256 deletions(-) create mode 100755 packaging/installer/dependencies/fedora.sh create mode 100755 packaging/installer/dependencies/rockylinux.sh (limited to 'packaging/installer') diff --git a/packaging/installer/README.md b/packaging/installer/README.md index b9d754206..f2f826edb 100644 --- a/packaging/installer/README.md +++ b/packaging/installer/README.md @@ -5,6 +5,8 @@ custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/instal import { Install, InstallBox } from '../../../src/components/Install/' +import { OneLineInstallWget, OneLineInstallCurl } from '../../../src/components/OneLineInstall/' + # Installation guide Netdata is a monitoring agent designed to run on all your systems: physical and virtual servers, containers, even @@ -37,15 +39,11 @@ This method is fully automatic on all Linux distributions, including Ubuntu, Deb To install Netdata, including all dependencies required to connect to Netdata Cloud, and get _automatic nightly updates_, run the following as your normal user: -```bash -wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh -``` + Or, if you have cURL but not wget (such as on macOS): -```bash -curl https://my-netdata.io/kickstart.sh > /tmp/netdata-kickstart.sh && sh /tmp/netdata-kickstart.sh -``` + This script will preferentially use native DEB/RPM packages if we provide them for your platform. diff --git a/packaging/installer/dependencies/alpine.sh b/packaging/installer/dependencies/alpine.sh index e69de29bb..8cbd98adf 100755 --- a/packaging/installer/dependencies/alpine.sh +++ b/packaging/installer/dependencies/alpine.sh @@ -0,0 +1,99 @@ +#!/usr/bin/env bash +# Package tree used for installing netdata on distribution: +# << Alpine: [3.12] [3.13] [3.14] [3.15] [edge] >> + +set -e + +NON_INTERACTIVE=0 +DONT_WAIT=0 + +package_tree=" + alpine-sdk + git + gcc + g++ + automake + autoconf + cmake + make + libtool + pkgconfig + tar + curl + gzip + netcat-openbsd + libuv-dev + lz4-dev + openssl-dev + elfutils-dev + python3 + zlib-dev + util-linux-dev + libmnl-dev + json-c-dev + " + +usage() { + cat << EOF +OPTIONS: +[--dont-wait] [--non-interactive] [ ] +EOF +} + +check_flags() { + while [ -n "${1}" ]; do + case "${1}" in + dont-wait | --dont-wait | -n) + DONT_WAIT=1 + ;; + + non-interactive | --non-interactive | -y) + NON_INTERACTIVE=1 + ;; + + help | -h | --help) + usage + exit 1 + ;; + *) + echo >&2 "ERROR: Cannot understand option '${1}'" + echo >&2 + usage + exit 1 + ;; + esac + shift + done + + if [ "${DONT_WAIT}" -eq 0 ] && [ "${NON_INTERACTIVE}" -eq 0 ]; then + read -r -p "Press ENTER to run it > " || exit 1 + fi +} + +# shellcheck disable=2068 +check_flags ${@} + +packages_to_install= + +for package in $package_tree; do + if apk -e info "$package" &> /dev/null; then + echo "Package '${package}' is installed" + else + echo "Package '${package}' is NOT installed" + packages_to_install="$packages_to_install $package" + fi +done + +if [[ -z $packages_to_install ]]; then + echo "All required packages are already installed. Skipping .." +else + echo "packages_to_install:" "$packages_to_install" + opts="--force-broken-world" + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode" + else + opts="${opts} -i" + fi + # shellcheck disable=SC2086 + apk add ${opts} $packages_to_install +fi diff --git a/packaging/installer/dependencies/arch.sh b/packaging/installer/dependencies/arch.sh index e69de29bb..fbad75406 100755 --- a/packaging/installer/dependencies/arch.sh +++ b/packaging/installer/dependencies/arch.sh @@ -0,0 +1,101 @@ +#!/usr/bin/env bash +# Package tree used for installing netdata on distribution: +# << ArchLinux: [base] [base-devel] >> | << Manjaro >> + +set -e + +NON_INTERACTIVE=0 +DONT_WAIT=0 + +declare -a package_tree=( + gcc + make + autoconf + autoconf-archive + autogen + automake + libtool + cmake + gnu-netcat + zlib + util-linux + libmnl + json-c + libuv + lz4 + openssl + judy + libelf + git + pkgconfig + tar + curl + gzip + python3 + binutils +) + +usage() { + cat << EOF +OPTIONS: +[--dont-wait] [--non-interactive] [ ] +EOF +} + +check_flags() { + while [ -n "${1}" ]; do + case "${1}" in + dont-wait | --dont-wait | -n) + DONT_WAIT=1 + ;; + + non-interactive | --non-interactive | -y) + NON_INTERACTIVE=1 + ;; + + help | -h | --help) + usage + exit 1 + ;; + *) + echo >&2 "ERROR: Cannot understand option '${1}'" + echo >&2 + usage + exit 1 + ;; + esac + shift + done + + if [ "${DONT_WAIT}" -eq 0 ] && [ "${NON_INTERACTIVE}" -eq 0 ]; then + read -r -p "Press ENTER to run it > " || exit 1 + fi +} + +# shellcheck disable=SC2068 +check_flags ${@} + +packages_to_install= + +# shellcheck disable=SC2068 +for package in ${package_tree[@]}; do + if pacman -Qn "$package" &> /dev/null; then + echo "Package '${package}' is installed" + else + echo "Package '$package' is NOT installed" + packages_to_install="$packages_to_install $package" + fi +done + +if [[ -z $packages_to_install ]]; then + echo "All required packages are already installed. Skipping .." +else + echo "packages_to_install: " "${packages_to_install[@]}" + opts= + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode" + opts="--noconfirm" + fi + # shellcheck disable=SC2068 + pacman -Sy ${opts} ${packages_to_install[@]} +fi diff --git a/packaging/installer/dependencies/centos.sh b/packaging/installer/dependencies/centos.sh index e69de29bb..d17911664 100755 --- a/packaging/installer/dependencies/centos.sh +++ b/packaging/installer/dependencies/centos.sh @@ -0,0 +1,185 @@ +#!/usr/bin/env bash +# Package tree used for installing netdata on distribution: +# << CentOS: [7] [8] >> + +set -e + +declare -a package_tree=( + gcc + gcc-c++ + make + autoconf + autoconf-archive + autogen + automake + libtool + pkgconfig + cmake + nmap-ncat + zlib-devel + libuuid-devel + libmnl-devel + json-c-devel + libuv-devel + lz4-devel + openssl-devel + python3 + elfutils-libelf-devel + git + tar + curl + gzip +) + +os_version() { + if [[ -f /etc/os-release ]]; then + # shellcheck disable=SC2002 + cat /etc/os-release | grep VERSION_ID | cut -d'=' -f2 | cut -d'"' -f2 + else + echo "Erorr: Cannot determine OS version!" + exit 1 + fi +} + +prompt() { + if [[ "${NON_INTERACTIVE}" == "1" ]]; then + echo >&2 "Running in non-interactive mode, assuming yes (y)" + echo >&2 " > Would have prompted for ${1} ..." + return 0 + fi + + while true; do + read -r -p "${1} [y/n] " yn + case $yn in + [Yy]*) return 0 ;; + [Nn]*) return 1 ;; + *) echo >&2 "Please answer with yes (y) or no (n)." ;; + esac + done +} + +usage() { + cat << EOF +OPTIONS: +[--dont-wait] [--non-interactive] [ ] +EOF +} + +check_flags() { + while [ -n "${1}" ]; do + case "${1}" in + dont-wait | --dont-wait | -n) + DONT_WAIT=1 + ;; + + non-interactive | --non-interactive | -y) + NON_INTERACTIVE=1 + ;; + + help | -h | --help) + usage + exit 1 + ;; + *) + echo >&2 "ERROR: Cannot understand option '${1}'" + echo >&2 + usage + exit 1 + ;; + esac + shift + done + + if [[ "${DONT_WAIT}" == "0" ]] && [[ "${NON_INTERACTIVE}" == "0" ]]; then + read -r -p "Press ENTER to run it > " || exit 1 + fi +} + +validate_tree_centos() { + local opts= + export local package_manager= + if [[ "${NON_INTERACTIVE}" == "1" ]]; then + echo >&2 "Running in non-interactive mode" + opts="-y" + fi + + echo >&2 " > CentOS Version: $(os_version) ..." + + if [[ $(os_version) =~ ^8(\..*)?$ ]]; then + package_manager=dnf + echo >&2 " > Checking for config-manager ..." + if ! dnf config-manager --help &> /dev/null; then + if prompt "config-manager not found, shall I install it?"; then + dnf ${opts} install 'dnf-command(config-manager)' + fi + fi + + echo >&2 " > Checking for PowerTools ..." + if ! dnf repolist | grep PowerTools; then + if prompt "PowerTools not found, shall I install it?"; then + dnf ${opts} config-manager --set-enabled powertools || enable_powertools_repo + fi + fi + + echo >&2 " > Updating libarchive ..." + dnf ${opts} install libarchive + + echo >&2 " > Installing Judy-devel directly ..." + dnf ${opts} install http://mirror.centos.org/centos/8/PowerTools/x86_64/os/Packages/Judy-devel-1.0.5-18.module_el8.3.0+757+d382997d.x86_64.rpm + dnf makecache --refresh +elif [[ $(os_version) =~ ^7(\..*)?$ ]]; then + package_manager=yum + echo >&2 " > Checking for EPEL ..." + if ! rpm -qa | grep epel-release > /dev/null; then + if prompt "EPEL not found, shall I install it?"; then + yum ${opts} install epel-release + fi + fi + yum makecache + fi +} + +enable_powertools_repo() { + if ! dnf repolist | grep -q powertools; then + cat > /etc/yum.repos.d/powertools.repo <<-EOF + [powertools] + name=CentOS Linux \$releasever - PowerTools + mirrorlist=http://mirrorlist.centos.org/?release=\$releasever&arch=\$basearch&repo=PowerTools&infra=\$infra + #baseurl=http://mirror.centos.org/\$contentdir/\$releasever/PowerTools/\$basearch/os/ + gpgcheck=1 + enabled=1 + gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial +EOF + else + echo "Something went wrong!" + exit 1 + fi +} + +# shellcheck disable=SC2068 +check_flags ${@} +validate_tree_centos + +packages_to_install= + +for package in "${package_tree[@]}"; do + if rpm -q "$package" &> /dev/null; then + echo "Package '${package}' is installed" + else + echo "Package '$package' is NOT installed" + packages_to_install="$packages_to_install $package" + fi +done + +if [[ -z $packages_to_install ]]; then + echo "All required packages are already installed. Skipping .." +else + echo "packages_to_install:" "${packages_to_install[@]}" + opts= + if [[ "${NON_INTERACTIVE}" == "1" ]]; then + echo >&2 "Running in non-interactive mode" + opts="-y" + fi + # shellcheck disable=SC2068 + ${package_manager} install ${opts} ${packages_to_install[@]} +fi diff --git a/packaging/installer/dependencies/clearlinux.sh b/packaging/installer/dependencies/clearlinux.sh index e69de29bb..832dac55a 100755 --- a/packaging/installer/dependencies/clearlinux.sh +++ b/packaging/installer/dependencies/clearlinux.sh @@ -0,0 +1,87 @@ +#!/usr/bin/env bash +# Package tree used for installing netdata on distribution: +# << ClearLinux: [base] >> + +set -e + +NON_INTERACTIVE=0 +DONT_WAIT=0 + +declare -a package_tree=( + c-basic + make + sysadmin-basic + devpkg-zlib + devpkg-util-linux + devpkg-libmnl + devpkg-json-c + devpkg-libuv + devpkg-lz4 + devpkg-openssl + devpkg-elfutils + git + findutils + curl + gzip + python3-basic +) + +usage() { + cat << EOF +OPTIONS: +[--dont-wait] [--non-interactive] [ ] +EOF +} + +check_flags() { + while [ -n "${1}" ]; do + case "${1}" in + dont-wait | --dont-wait | -n) + DONT_WAIT=1 + ;; + + non-interactive | --non-interactive | -y) + NON_INTERACTIVE=1 + ;; + + help | -h | --help) + usage + exit 1 + ;; + *) + echo >&2 "ERROR: Cannot understand option '${1}'" + echo >&2 + usage + exit 1 + ;; + esac + shift + done + + if [ "${DONT_WAIT}" -eq 0 ] && [ "${NON_INTERACTIVE}" -eq 0 ]; then + read -r -p "Press ENTER to run it > " || exit 1 + fi +} + +# shellcheck disable=SC2068 +check_flags ${@} + +packages_to_install= + +# shellcheck disable=SC2068 +for package in ${package_tree[@]}; do + if [[ "$(swupd bundle-info "$package" | grep Status | cut -d':' -f2)" == " Not installed" ]]; then + echo "Package '$package' is NOT installed" + packages_to_install="$packages_to_install $package" + else + echo "Package '$package' is installed" + fi +done + +if [[ -z $packages_to_install ]]; then + echo "All required packages are already installed. Skipping .." +else + echo "packages_to_install: " "${packages_to_install[@]}" + # shellcheck disable=SC2068 + swupd bundle-add ${packages_to_install[@]} +fi diff --git a/packaging/installer/dependencies/debian.sh b/packaging/installer/dependencies/debian.sh index e69de29bb..66a4b6826 100755 --- a/packaging/installer/dependencies/debian.sh +++ b/packaging/installer/dependencies/debian.sh @@ -0,0 +1,105 @@ +#!/usr/bin/env bash +# Package tree used for installing netdata on distribution: +# << Debian: [9] [10] [11] >> + +set -e + +NON_INTERACTIVE=0 +DONT_WAIT=0 + +package_tree=" + git + gcc + g++ + make + automake + cmake + autoconf + autoconf-archive + autogen + libtool + pkg-config + tar + curl + gzip + netcat + zlib1g-dev + uuid-dev + libmnl-dev + libjson-c-dev + libuv1-dev + liblz4-dev + libssl-dev + libjudy-dev + libelf-dev + python + python3 + " + +usage() { + cat << EOF +OPTIONS: +[--dont-wait] [--non-interactive] [ ] +EOF +} + +check_flags() { + while [ -n "${1}" ]; do + case "${1}" in + dont-wait | --dont-wait | -n) + DONT_WAIT=1 + ;; + + non-interactive | --non-interactive | -y) + NON_INTERACTIVE=1 + ;; + + help | -h | --help) + usage + exit 1 + ;; + *) + echo >&2 "ERROR: Cannot understand option '${1}'" + echo >&2 + usage + exit 1 + ;; + esac + shift + done + + if [ "${DONT_WAIT}" -eq 0 ] && [ "${NON_INTERACTIVE}" -eq 0 ]; then + read -r -p "Press ENTER to run it > " || exit 1 + fi +} + +# shellcheck disable=2068 +check_flags ${@} + +packages_to_install= + +for package in $package_tree; do + if dpkg -s "$package" &> /dev/null; then + echo "Package '${package}' is installed" + else + echo "Package '${package}' is NOT installed" + packages_to_install="$packages_to_install $package" + fi +done + +if [[ -z "$packages_to_install" ]]; then + echo "All required packages are already installed. Skipping .." +else + echo "packages_to_install:" "$packages_to_install" + opts= + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode" + # shellcheck disable=SC2034 + DEBIAN_FRONTEND="noninteractive" + opts="${opts} -yq" + fi + echo "Running apt-get update and updating your APT caches ..." + apt-get update + # shellcheck disable=2086 + apt-get install ${opts} $packages_to_install +fi diff --git a/packaging/installer/dependencies/fedora.sh b/packaging/installer/dependencies/fedora.sh new file mode 100755 index 000000000..edb695bca --- /dev/null +++ b/packaging/installer/dependencies/fedora.sh @@ -0,0 +1,119 @@ +#!/usr/bin/env bash +# Package tree used for installing netdata on distribution: +# << Fedora: [24->35] >> + +set -e + +NON_INTERACTIVE=0 +DONT_WAIT=0 + +os_version() { + if [[ -f /etc/os-release ]]; then + # shellcheck disable=SC2002 + cat /etc/os-release | grep VERSION_ID | cut -d'=' -f2 + else + echo "Erorr: Cannot determine OS version!" + exit 1 + fi +} + +if [[ $(os_version) -gt 24 ]]; then + ulogd_pkg= +else + ulogd_pkg=ulogd +fi + +declare -a package_tree=( + findutils + gcc + gcc-c++ + make + autoconf + autoconf-archive + autogen + automake + libtool + cmake + nmap-ncat + zlib-devel + libuuid-devel + libmnl-devel + json-c-devel + libuv-devel + lz4-devel + openssl-devel + Judy-devel + elfutils-libelf-devel + git + pkgconfig + tar + curl + gzip + python3 + "${ulogd_pkg}" +) + +usage() { + cat << EOF +OPTIONS: +[--dont-wait] [--non-interactive] [ ] +EOF +} + +check_flags() { + while [ -n "${1}" ]; do + case "${1}" in + dont-wait | --dont-wait | -n) + DONT_WAIT=1 + ;; + + non-interactive | --non-interactive | -y) + NON_INTERACTIVE=1 + ;; + + help | -h | --help) + usage + exit 1 + ;; + *) + echo >&2 "ERROR: Cannot understand option '${1}'" + echo >&2 + usage + exit 1 + ;; + esac + shift + done + + if [ "${DONT_WAIT}" -eq 0 ] && [ "${NON_INTERACTIVE}" -eq 0 ]; then + read -r -p "Press ENTER to run it > " || exit 1 + fi +} + +# shellcheck disable=SC2068 +check_flags ${@} + +packages_to_install= + +# shellcheck disable=SC2068 +for package in ${package_tree[@]}; do + if rpm -q "$package" &> /dev/null; then + echo "Package '${package}' is installed" + else + echo "Package '$package' is NOT installed" + packages_to_install="$packages_to_install $package" + fi +done + +if [[ -z $packages_to_install ]]; then + echo "All required packages are already installed. Skipping .." +else + echo "packages_to_install:" "${packages_to_install[@]}" + opts= + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode" + opts="-y" + fi + # shellcheck disable=SC2068 + dnf install ${opts} ${packages_to_install[@]} +fi diff --git a/packaging/installer/dependencies/freebsd.sh b/packaging/installer/dependencies/freebsd.sh index e69de29bb..f9c53f428 100755 --- a/packaging/installer/dependencies/freebsd.sh +++ b/packaging/installer/dependencies/freebsd.sh @@ -0,0 +1,145 @@ +#!/usr/bin/env bash +# Package tree used for installing netdata on distribution: +# << FreeBSD >> + +set -e + +NON_INTERACTIVE=0 +DONT_WAIT=0 + +package_tree=" + git + gcc + autoconf + autoconf-archive + autogen + automake + libtool + pkgconf + cmake + curl + gzip + netcat + lzlib + e2fsprogs-libuuid + json-c + libuv + liblz4 + openssl + Judy + python3 + " + +prompt() { + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode, assuming yes (y)" + echo >&2 " > Would have prompted for ${1} ..." + return 0 + fi + + while true; do + read -r -p "${1} [y/n] " yn + case $yn in + [Yy]*) return 0 ;; + [Nn]*) return 1 ;; + *) echo >&2 "Please answer with yes (y) or no (n)." ;; + esac + done +} + +usage() { + cat << EOF +OPTIONS: +[--dont-wait] [--non-interactive] [ ] +EOF +} + +check_flags() { + while [ -n "${1}" ]; do + case "${1}" in + dont-wait | --dont-wait | -n) + DONT_WAIT=1 + ;; + + non-interactive | --non-interactive | -y) + NON_INTERACTIVE=1 + ;; + + help | -h | --help) + usage + exit 1 + ;; + *) + echo >&2 "ERROR: Cannot understand option '${1}'" + echo >&2 + usage + exit 1 + ;; + esac + shift + done + + if [ "${DONT_WAIT}" -eq 0 ] && [ "${NON_INTERACTIVE}" -eq 0 ]; then + read -r -p "Press ENTER to run it > " || exit 1 + fi +} + +validate_tree_freebsd() { + opts= + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode" + opts="-y" + fi + + echo >&2 " > Checking for gmake ..." + if ! pkg query %n-%v | grep -q gmake; then + if prompt "gmake is required to build on FreeBSD and is not installed. Shall I install it?"; then + pkg install ${opts} gmake + fi + fi +} + +enable_repo () { + if ! dnf repolist | grep -q codeready; then +cat >> /etc/yum.repos.d/oracle-linux-ol8.repo <<-EOF + +[ol8_codeready_builder] +name=Oracle Linux \$releasever CodeReady Builder (\$basearch) +baseurl=http://yum.oracle.com/repo/OracleLinux/OL8/codeready/builder/\$basearch +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle +gpgcheck=1 +enabled=1 +EOF + else + echo "Something went wrong!" + exit 1 + fi +} + +# shellcheck disable=SC2068 +check_flags ${@} +validate_tree_freebsd + +packages_to_install= + +for package in $package_tree; do + if pkg info -Ix "$package" &> /dev/null; then + echo "Package '${package}' is installed" + else + echo "Package '${package}' is NOT installed" + packages_to_install="$packages_to_install $package" + fi +done + +if [[ -z "$packages_to_install" ]]; then + echo "All required packages are already installed. Skipping .." +else + echo "packages_to_install:" "$packages_to_install" + opts= + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode" + opts="-y" + fi + # shellcheck disable=SC2086 + pkg install ${opts} $packages_to_install +fi diff --git a/packaging/installer/dependencies/gentoo.sh b/packaging/installer/dependencies/gentoo.sh index e69de29bb..ae1a4af27 100755 --- a/packaging/installer/dependencies/gentoo.sh +++ b/packaging/installer/dependencies/gentoo.sh @@ -0,0 +1,99 @@ +#!/usr/bin/env bash +# Package tree used for installing netdata on distribution: +# << Gentoo >> | << Pentoo >> + +set -e + +NON_INTERACTIVE=0 +DONT_WAIT=0 + +package_tree=" + dev-vcs/git + sys-apps/findutils + sys-devel/gcc + sys-devel/make + sys-devel/autoconf + sys-devel/autoconf-archive + sys-devel/autogen + sys-devel/automake + virtual/pkgconfig + dev-util/cmake + app-arch/tar + net-misc/curl + app-arch/gzip + net-analyzer/netcat + sys-apps/util-linux + net-libs/libmnl + dev-libs/json-c + dev-libs/libuv + app-arch/lz4 + dev-libs/openssl + dev-libs/judy + virtual/libelf + dev-lang/python + dev-libs/libuv + " +usage() { + cat << EOF +OPTIONS: +[--dont-wait] [--non-interactive] [ ] +EOF +} + +check_flags() { + while [ -n "${1}" ]; do + case "${1}" in + dont-wait | --dont-wait | -n) + DONT_WAIT=1 + ;; + + non-interactive | --non-interactive | -y) + NON_INTERACTIVE=1 + ;; + + help | -h | --help) + usage + exit 1 + ;; + *) + echo >&2 "ERROR: Cannot understand option '${1}'" + echo >&2 + usage + exit 1 + ;; + esac + shift + done + + if [ "${DONT_WAIT}" -eq 0 ] && [ "${NON_INTERACTIVE}" -eq 0 ]; then + read -r -p "Press ENTER to run it > " || exit 1 + fi +} + +# shellcheck disable=SC2068 +check_flags ${@} + +packages_to_install= + +# shellcheck disable=SC2068 +for package in $package_tree; do + if qlist -IRv "$package" &> /dev/null; then + echo "Package '${package}' is installed" + else + echo "Package '${package}' is NOT installed" + packages_to_install="$packages_to_install $package" + fi +done + +if [[ -z "$packages_to_install" ]]; then + echo "All required packages are already installed. Skipping .." +else + echo "packages_to_install:" "$packages_to_install" + opts="--ask" + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode" + opts="" + fi + # shellcheck disable=SC2086 + emerge ${opts} $packages_to_install +fi diff --git a/packaging/installer/dependencies/ol.sh b/packaging/installer/dependencies/ol.sh index e69de29bb..4b95722a8 100755 --- a/packaging/installer/dependencies/ol.sh +++ b/packaging/installer/dependencies/ol.sh @@ -0,0 +1,144 @@ +#!/usr/bin/env bash +# Package tree used for installing netdata on distribution: +# << Oracle Linux: [8] >> + +set -e + +NON_INTERACTIVE=0 +DONT_WAIT=0 + +declare -a package_tree=( + gcc + gcc-c++ + make + autoconf + autoconf-archive + autogen + automake + libtool + pkgconfig + cmake + nmap-ncat + tar + zlib-devel + libuuid-devel + libmnl-devel + json-c-devel + libuv-devel + lz4-devel + openssl-devel + python3 + elfutils-libelf-devel + git + curl + gzip +) + +prompt() { + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode, assuming yes (y)" + echo >&2 " > Would have prompted for ${1} ..." + return 0 + fi + + while true; do + read -r -p "${1} [y/n] " yn + case $yn in + [Yy]*) return 0 ;; + [Nn]*) return 1 ;; + *) echo >&2 "Please answer with yes (y) or no (n)." ;; + esac + done +} + +usage() { + cat << EOF +OPTIONS: +[--dont-wait] [--non-interactive] [ ] +EOF +} + +check_flags() { + while [ -n "${1}" ]; do + case "${1}" in + dont-wait | --dont-wait | -n) + DONT_WAIT=1 + ;; + + non-interactive | --non-interactive | -y) + NON_INTERACTIVE=1 + ;; + + help | -h | --help) + usage + exit 1 + ;; + *) + echo >&2 "ERROR: Cannot understand option '${1}'" + echo >&2 + usage + exit 1 + ;; + esac + shift + done + + if [ "${DONT_WAIT}" -eq 0 ] && [ "${NON_INTERACTIVE}" -eq 0 ]; then + read -r -p "Press ENTER to run it > " || exit 1 + fi +} + +validate_tree_ol() { + + opts= + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode" + opts="-y" + fi + + + echo >&2 " > Checking for config-manager ..." + if ! dnf config-manager &> /dev/null; then + if prompt "config-manager not found, shall I install it?"; then + dnf ${opts} install 'dnf-command(config-manager)' + fi + fi + + echo " > Checking for CodeReady Builder ..." + if ! dnf repolist | grep ol8_codeready_builder; then + if prompt "CodeReadyBuilder not found, shall I install it?"; then + dnf ${opts} config-manager --set-enabled ol8_codeready_builder || enable_repo + fi + fi + + dnf makecache --refresh +} + +# shellcheck disable=SC2068 +check_flags ${@} +validate_tree_ol + +packages_to_install= + +# shellcheck disable=SC2068 +for package in ${package_tree[@]}; do + if rpm -q "$package" &> /dev/null; then + echo "Package '${package}' is installed" + else + echo "Package '$package' is NOT installed" + packages_to_install="$packages_to_install $package" + fi +done + +if [[ -z $packages_to_install ]]; then + echo "All required packages are already installed. Skipping .." +else + opts= + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode" + opts="-y" + fi + echo "packages_to_install:" "${packages_to_install[@]}" + # shellcheck disable=SC2068 + dnf install ${opts} ${packages_to_install[@]} +fi diff --git a/packaging/installer/dependencies/opensuse.sh b/packaging/installer/dependencies/opensuse.sh index e69de29bb..cfaaf6753 100755 --- a/packaging/installer/dependencies/opensuse.sh +++ b/packaging/installer/dependencies/opensuse.sh @@ -0,0 +1,103 @@ +#!/usr/bin/env bash +# Package tree used for installing netdata on distribution: +# << opeSUSE >> +# supported versions: leap/15.3 and tumbleweed +# it may work with SLES as well, although we have not tested with it + +set -e + +NON_INTERACTIVE=0 +DONT_WAIT=0 + +declare -a package_tree=( + gcc + gcc-c++ + make + autoconf + autoconf-archive + autogen + automake + libtool + pkg-config + cmake + netcat-openbsd + zlib-devel + libuuid-devel + libmnl-devel + libjson-c-devel + libuv-devel + liblz4-devel + libopenssl-devel + judy-devel + libelf-devel + git + tar + curl + gzip + python3 +) + +usage() { + cat << EOF +OPTIONS: +[--dont-wait] [--non-interactive] [ ] +EOF +} + +check_flags() { + while [ -n "${1}" ]; do + case "${1}" in + dont-wait | --dont-wait | -n) + DONT_WAIT=1 + ;; + + non-interactive | --non-interactive | -y) + NON_INTERACTIVE=1 + ;; + + help | -h | --help) + usage + exit 1 + ;; + *) + echo >&2 "ERROR: Cannot understand option '${1}'" + echo >&2 + usage + exit 1 + ;; + esac + shift + done + + if [ "${DONT_WAIT}" -eq 0 ] && [ "${NON_INTERACTIVE}" -eq 0 ]; then + read -r -p "Press ENTER to run it > " || exit 1 + fi +} + +# shellcheck disable=SC2068 +check_flags ${@} + +packages_to_install= + +# shellcheck disable=SC2068 +for package in ${package_tree[@]}; do + if zypper search -i "$package" &> /dev/null; then + echo "Package '${package}' is installed" + else + echo "Package '$package' is NOT installed" + packages_to_install="$packages_to_install $package" + fi +done + +if [[ -z $packages_to_install ]]; then + echo "All required packages are already installed. Skipping .." +else + echo "packages_to_install:" "${packages_to_install[@]}" + opts="--ignore-unknown" + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode" + opts="--non-interactive" + fi + # shellcheck disable=SC2068 + zypper ${opts} install ${packages_to_install[@]} +fi diff --git a/packaging/installer/dependencies/rockylinux.sh b/packaging/installer/dependencies/rockylinux.sh new file mode 100755 index 000000000..1cf07fc58 --- /dev/null +++ b/packaging/installer/dependencies/rockylinux.sh @@ -0,0 +1,162 @@ +#!/usr/bin/env bash +# Package tree used for installing netdata on distribution: +# << Rocky Linux:[8.5] >> + +set -e + +NON_INTERACTIVE=0 +DONT_WAIT=0 + +declare -a package_tree=( + gcc + gcc-c++ + make + autoconf + autoconf-archive + autogen + automake + libtool + pkgconfig + cmake + nmap-ncat + zlib-devel + libuuid-devel + libmnl-devel + json-c-devel + libuv-devel + lz4-devel + openssl-devel + python3 + elfutils-libelf-devel + git + tar + curl + gzip +) + +prompt() { + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode, assuming yes (y)" + echo >&2 " > Would have prompted for ${1} ..." + return 0 + fi + + while true; do + read -r -p "${1} [y/n] " yn + case $yn in + [Yy]*) return 0 ;; + [Nn]*) return 1 ;; + *) echo >&2 "Please answer with yes (y) or no (n)." ;; + esac + done +} + +usage() { + cat << EOF +OPTIONS: +[--dont-wait] [--non-interactive] [ ] +EOF +} + +check_flags() { + while [ -n "${1}" ]; do + case "${1}" in + dont-wait | --dont-wait | -n) + DONT_WAIT=1 + ;; + + non-interactive | --non-interactive | -y) + NON_INTERACTIVE=1 + ;; + + help | -h | --help) + usage + exit 1 + ;; + *) + echo >&2 "ERROR: Cannot understand option '${1}'" + echo >&2 + usage + exit 1 + ;; + esac + shift + done + + if [ "${DONT_WAIT}" -eq 0 ] && [ "${NON_INTERACTIVE}" -eq 0 ]; then + read -r -p "Press ENTER to run it > " || exit 1 + fi +} + +validate_tree_rockylinux() { + local opts= + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode" + opts="-y" + fi + + echo >&2 " > Checking for config-manager ..." + if ! dnf config-manager; then + if prompt "config-manager not found, shall I install it?"; then + dnf ${opts} install 'dnf-command(config-manager)' + fi + fi + + echo >&2 " > Checking for PowerTools ..." + if ! dnf repolist | grep PowerTools; then + if prompt "PowerTools not found, shall I install it?"; then + dnf ${opts} config-manager --set-enabled powertools || enable_powertools_repo + fi + fi + + echo >&2 " > Updating libarchive ..." + dnf ${opts} install libarchive + + dnf makecache --refresh +} + +enable_powertools_repo() { + if ! dnf repolist | grep -q powertools; then + cat > /etc/yum.repos.d/powertools.repo <<-EOF + [powertools] + name=Rocky Linux \$releasever - PowerTools + mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=\$basearch&repo=PowerTools-\$releasever + #baseurl=http://dl.rockylinux.org/\$contentdir/\$releasever/PowerTools/\$basearch/os/ + gpgcheck=1 + enabled=1 + gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial +EOF + else + echo "Something went wrong!" + exit 1 + fi +} + +# shellcheck disable=SC2068 +check_flags ${@} +validate_tree_rockylinux + +packages_to_install= + +# shellcheck disable=SC2068 +for package in ${package_tree[@]}; do + if rpm -q "$package" &> /dev/null; then + echo "Package '${package}' is installed" + else + echo "Package '$package' is NOT installed" + packages_to_install="$packages_to_install $package" + fi +done + +if [[ -z $packages_to_install ]]; then + echo "All required packages are already installed. Skipping .." +else + echo "packages_to_install:" "${packages_to_install[@]}" + opts= + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode" + opts="-y" + fi + # shellcheck disable=SC2068 + dnf install ${opts} ${packages_to_install[@]} +fi diff --git a/packaging/installer/dependencies/ubuntu.sh b/packaging/installer/dependencies/ubuntu.sh index e69de29bb..3d0bb5959 100755 --- a/packaging/installer/dependencies/ubuntu.sh +++ b/packaging/installer/dependencies/ubuntu.sh @@ -0,0 +1,102 @@ +#!/usr/bin/env bash +# Package tree used for installing netdata on distribution: +# << Ubuntu: [18.04] [20.04] [20.10] [21.04] [21.10] >> | << Linux Mint >> + +set -e + +NON_INTERACTIVE=0 +DONT_WAIT=0 + +package_tree=" + git + gcc + g++ + make + automake + cmake + autoconf + autoconf-archive + autogen + libtool + pkg-config + tar + curl + gzip + netcat + zlib1g-dev + uuid-dev + libmnl-dev + libjson-c-dev + libuv1-dev + liblz4-dev + libssl-dev + libjudy-dev + libelf-dev + python3 + " +usage() { + cat << EOF +OPTIONS: +[--dont-wait] [--non-interactive] [ ] +EOF +} + +check_flags() { + while [ -n "${1}" ]; do + case "${1}" in + dont-wait | --dont-wait | -n) + DONT_WAIT=1 + ;; + + non-interactive | --non-interactive | -y) + NON_INTERACTIVE=1 + ;; + + help | -h | --help) + usage + exit 1 + ;; + *) + echo >&2 "ERROR: Cannot understand option '${1}'" + echo >&2 + usage + exit 1 + ;; + esac + shift + done + + if [ "${DONT_WAIT}" -eq 0 ] && [ "${NON_INTERACTIVE}" -eq 0 ]; then + read -r -p "Press ENTER to run it > " || exit 1 + fi +} + +# shellcheck disable=SC2068 +check_flags ${@} + +packages_to_install= + +for package in $package_tree; do + if dpkg -s "$package" &> /dev/null; then + echo "Package '${package}' is installed" + else + echo "Package '${package}' is NOT installed" + packages_to_install="$packages_to_install $package" + fi +done + +if [[ -z "$packages_to_install" ]]; then + echo "All required packages are already installed. Skipping .." +else + echo "packages_to_install:" "$packages_to_install" + opts= + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode" + export DEBIAN_FRONTEND="noninteractive" + opts="${opts} -yq" + fi + echo "Running apt-get update and updating your APT caches ..." + apt-get update + # shellcheck disable=SC2086 + apt-get install ${opts} $packages_to_install +fi diff --git a/packaging/installer/functions.sh b/packaging/installer/functions.sh index bd9ca39b5..56f1a5658 100644 --- a/packaging/installer/functions.sh +++ b/packaging/installer/functions.sh @@ -1,10 +1,9 @@ -#!/bin/bash +#!/bin/sh # SPDX-License-Identifier: GPL-3.0-or-later # make sure we have a UID [ -z "${UID}" ] && UID="$(id -u)" - # ----------------------------------------------------------------------------- setup_terminal() { @@ -51,6 +50,7 @@ setup_terminal() { TPUT_BLUE="$(tput setaf 4)" # shellcheck disable=SC2034 TPUT_PURPLE="$(tput setaf 5)" + # shellcheck disable=SC2034 TPUT_CYAN="$(tput setaf 6)" TPUT_WHITE="$(tput setaf 7)" # shellcheck disable=SC2034 @@ -129,11 +129,11 @@ download_file() { # external component handling fetch_and_verify() { - local component=${1} - local url=${2} - local base_name=${3} - local tmp=${4} - local override=${5} + component="${1}" + url="${2}" + base_name="${3}" + tmp="${4}" + override="${5}" if [ -z "${override}" ]; then download_file "${url}" "${tmp}/${base_name}" "${component}" @@ -159,24 +159,20 @@ fetch_and_verify() { # ----------------------------------------------------------------------------- netdata_banner() { - local l1=" ^" \ + l1=" ^" \ l2=" |.-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-" \ - l3=" | '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' " \ l4=" +----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+--->" \ - sp=" " \ - netdata="netdata" start end msg="${*}" chartcolor="${TPUT_DIM}" - - [ ${#msg} -lt ${#netdata} ] && msg="${msg}${sp:0:$((${#netdata} - ${#msg}))}" - [ ${#msg} -gt $((${#l2} - 20)) ] && msg="${msg:0:$((${#l2} - 23))}..." + space=" " + l3f=" | '-' '-' '-' '-' '-'" + l3e=" '-' '-' '-' '-' '-' " - start="$((${#l2} / 2 - 4))" - [ $((start + ${#msg} + 4)) -gt ${#l2} ] && start=$((${#l2} - ${#msg} - 4)) - end=$((start + ${#msg} + 4)) + netdata="netdata" + chartcolor="${TPUT_DIM}" echo >&2 echo >&2 "${chartcolor}${l1}${TPUT_RESET}" - echo >&2 "${chartcolor}${l2:0:start}${sp:0:2}${TPUT_RESET}${TPUT_BOLD}${TPUT_GREEN}${netdata}${TPUT_RESET}${chartcolor}${sp:0:$((end - start - 2 - ${#netdata}))}${l2:end:$((${#l2} - end))}${TPUT_RESET}" - echo >&2 "${chartcolor}${l3:0:start}${sp:0:2}${TPUT_RESET}${TPUT_BOLD}${TPUT_CYAN}${msg}${TPUT_RESET}${chartcolor}${sp:0:2}${l3:end:$((${#l2} - end))}${TPUT_RESET}" + echo >&2 "${chartcolor}${l2%-. .-. .-. .-. .-. .-. .-. .-}${space}${TPUT_RESET}${TPUT_BOLD}${TPUT_GREEN}${netdata}${TPUT_RESET}${chartcolor}${l2# |.-. .-. .-. .-. .-. .-. .-. }${TPUT_RESET}" + echo >&2 "${chartcolor}${l3f}${l3e}${TPUT_RESET}" echo >&2 "${chartcolor}${l4}${TPUT_RESET}" echo >&2 } @@ -189,7 +185,8 @@ rcservice_cmd="$(command -v rc-service 2> /dev/null || true)" systemctl_cmd="$(command -v systemctl 2> /dev/null || true)" service() { - local cmd="${1}" action="${2}" + cmd="${1}" + action="${2}" if [ -n "${systemctl_cmd}" ]; then run "${systemctl_cmd}" "${action}" "${cmd}" @@ -208,7 +205,6 @@ service() { # portable pidof safe_pidof() { - local pidof_cmd pidof_cmd="$(command -v pidof 2> /dev/null)" if [ -n "${pidof_cmd}" ]; then ${pidof_cmd} "${@}" @@ -234,7 +230,6 @@ find_processors() { gnproc && return fi - local cpus if [ -f "/proc/cpuinfo" ]; then # linux cpus=$(grep -c ^processor /proc/cpuinfo) @@ -264,12 +259,12 @@ run_failed() { } ESCAPED_PRINT_METHOD= -if printf "%q " test > /dev/null 2>&1; then +if printf "%s " test > /dev/null 2>&1; then ESCAPED_PRINT_METHOD="printfq" fi escaped_print() { if [ "${ESCAPED_PRINT_METHOD}" = "printfq" ]; then - printf "%q " "${@}" + printf "%s " "${@}" else printf "%s" "${*}" fi @@ -278,14 +273,14 @@ escaped_print() { run_logfile="/dev/null" run() { - local user="${USER--}" dir="${PWD}" info info_console - + local_user="${USER--}" + local_dir="${PWD}" if [ "${UID}" = "0" ]; then - info="[root ${dir}]# " - info_console="[${TPUT_DIM}${dir}${TPUT_RESET}]# " + info="[root ${local_dir}]# " + info_console="[${TPUT_DIM}${local_dir}${TPUT_RESET}]# " else - info="[${user} ${dir}]$ " - info_console="[${TPUT_DIM}${dir}${TPUT_RESET}]$ " + info="[${local_user} ${local_dir}]$ " + info_console="[${TPUT_DIM}${local_dir}${TPUT_RESET}]$ " fi { @@ -300,7 +295,7 @@ run() { "${@}" - local ret=$? + ret=$? if [ ${ret} -ne 0 ]; then run_failed printf >> "${run_logfile}" "FAILED with exit code %s\n" "${ret}" @@ -314,7 +309,6 @@ run() { iscontainer() { # man systemd-detect-virt - local cmd cmd=$(command -v systemd-detect-virt 2> /dev/null) if [ -n "${cmd}" ] && [ -x "${cmd}" ]; then "${cmd}" --container > /dev/null 2>&1 && return 0 @@ -322,7 +316,6 @@ iscontainer() { # /proc/1/sched exposes the host's pid of our init ! # http://stackoverflow.com/a/37016302 - local pid pid=$(head -n 1 /proc/1/sched 2> /dev/null | { # shellcheck disable=SC2034 IFS='(),#:' read -r name pid th threads @@ -353,18 +346,22 @@ iscontainer() { get_os_key() { if [ -f /etc/os-release ]; then # shellcheck disable=SC1091 - source /etc/os-release || return 1 + . /etc/os-release || return 1 echo "${ID}-${VERSION_ID}" elif [ -f /etc/redhat-release ]; then - echo "$(< /etc/redhat-release)" + cat /etc/redhat-release else echo "unknown" fi } issystemd() { - local pids p myns ns systemctl + pids='' + p='' + myns='' + ns='' + systemctl='' # if the directory /lib/systemd/system OR /usr/lib/systemd/system (SLES 12.x) does not exit, it is not systemd if [ ! -d /lib/systemd/system ] && [ ! -d /usr/lib/systemd/system ]; then @@ -398,47 +395,35 @@ issystemd() { } get_systemd_service_dir() { - local SYSTEMD_DIRECTORY="" - local key - key="$(get_os_key)" - if [ -w "/lib/systemd/system" ]; then - SYSTEMD_DIRECTORY="/lib/systemd/system" + echo "/lib/systemd/system" elif [ -w "/usr/lib/systemd/system" ]; then - SYSTEMD_DIRECTORY="/usr/lib/systemd/system" + echo "/usr/lib/systemd/system" elif [ -w "/etc/systemd/system" ]; then - SYSTEMD_DIRECTORY="/etc/systemd/system" + echo "/etc/systemd/system" fi - - if [[ ${key} =~ ^devuan* ]] || [ "${key}" = "debian-7" ] || [ "${key}" = "ubuntu-12.04" ] || [ "${key}" = "ubuntu-14.04" ]; then - SYSTEMD_DIRECTORY="/etc/systemd/system" - fi - - echo "${SYSTEMD_DIRECTORY}" } install_non_systemd_init() { [ "${UID}" != 0 ] && return 1 - - local key key="$(get_os_key)" if [ -d /etc/init.d ] && [ ! -f /etc/init.d/netdata ]; then - if [[ ${key} =~ ^(gentoo|alpine).* ]]; then + if expr "${key}" : "^(gentoo|alpine).*"; then echo >&2 "Installing OpenRC init file..." run cp system/netdata-openrc /etc/init.d/netdata && run chmod 755 /etc/init.d/netdata && run rc-update add netdata default && return 0 - elif [[ ${key} =~ ^devuan* ]] || [ "${key}" = "debian-7" ] || [ "${key}" = "ubuntu-12.04" ] || [ "${key}" = "ubuntu-14.04" ]; then + elif expr "${key}" : "^devuan*" || [ "${key}" = "debian-7" ] || [ "${key}" = "ubuntu-12.04" ] || [ "${key}" = "ubuntu-14.04" ]; then echo >&2 "Installing LSB init file..." run cp system/netdata-lsb /etc/init.d/netdata && run chmod 755 /etc/init.d/netdata && run update-rc.d netdata defaults && run update-rc.d netdata enable && return 0 - elif [[ ${key} =~ ^(amzn-201[5678]|ol|CentOS release 6|Red Hat Enterprise Linux Server release 6|Scientific Linux CERN SLC release 6|CloudLinux Server release 6).* ]]; then + elif expr "${key}" : "^(amzn-201[5678]|ol|CentOS release 6|Red Hat Enterprise Linux Server release 6|Scientific Linux CERN SLC release 6|CloudLinux Server release 6).*"; then echo >&2 "Installing init.d file..." run cp system/netdata-init-d /etc/init.d/netdata && run chmod 755 /etc/init.d/netdata && @@ -466,7 +451,6 @@ NETDATA_START_CMD="netdata" NETDATA_INSTALLER_START_CMD="" install_netdata_service() { - local uname uname="$(uname 2> /dev/null)" if [ "${UID}" -eq 0 ]; then @@ -512,7 +496,7 @@ install_netdata_service() { if [ "${SYSTEMD_DIRECTORY}x" != "x" ]; then ENABLE_NETDATA_IF_PREVIOUSLY_ENABLED="run systemctl enable netdata" IS_NETDATA_ENABLED="$(systemctl is-enabled netdata 2> /dev/null || echo "Netdata not there")" - if [ "${IS_NETDATA_ENABLED}" == "disabled" ]; then + if [ "${IS_NETDATA_ENABLED}" = "disabled" ]; then echo >&2 "Netdata was there and disabled, make sure we don't re-enable it ourselves" ENABLE_NETDATA_IF_PREVIOUSLY_ENABLED="true" fi @@ -527,7 +511,7 @@ install_netdata_service() { fi else install_non_systemd_init - local ret=$? + ret=$? if [ ${ret} -eq 0 ]; then if [ -n "${service_cmd}" ]; then @@ -566,12 +550,14 @@ pidisnetdata() { } stop_netdata_on_pid() { - local pid="${1}" ret=0 count=0 + pid="${1}" + ret=0 + count=0 pidisnetdata "${pid}" || return 0 printf >&2 "Stopping netdata on pid %s ..." "${pid}" - while [ -n "$pid" ] && [ ${ret} -eq 0 ]; do + while [ -n "${pid}" ] && [ ${ret} -eq 0 ]; do if [ ${count} -gt 24 ]; then echo >&2 "Cannot stop the running netdata on pid ${pid}." return 1 @@ -607,8 +593,6 @@ stop_netdata_on_pid() { } netdata_pids() { - local p myns ns - myns="$(readlink /proc/self/ns/pid 2> /dev/null)" for p in \ @@ -624,7 +608,6 @@ netdata_pids() { } stop_all_netdata() { - local p uname if [ "${UID}" -eq 0 ]; then uname="$(uname 2> /dev/null)" @@ -649,7 +632,7 @@ stop_all_netdata() { fi fi - if [ -n "$(netdata_pids)" ] && [ -n "$(builtin type -P netdatacli)" ]; then + if [ -n "$(netdata_pids)" ] && [ -n "$(type netdatacli)" ]; then netdatacli shutdown-agent sleep 20 fi @@ -664,10 +647,10 @@ stop_all_netdata() { # restart netdata restart_netdata() { - local netdata="${1}" + netdata="${1}" shift - local started=0 + started=0 progress "Restarting netdata instance" @@ -737,7 +720,8 @@ install_netdata_logrotate() { # create netdata.conf create_netdata_conf() { - local path="${1}" url="${2}" + path="${1}" + url="${2}" if [ -s "${path}" ]; then return 0 @@ -778,7 +762,8 @@ create_netdata_conf() { } portable_add_user() { - local username="${1}" homedir="${2}" + username="${1}" + homedir="${2}" [ -z "${homedir}" ] && homedir="/tmp" @@ -790,7 +775,6 @@ portable_add_user() { echo >&2 "Adding ${username} user account with home ${homedir} ..." - local nologin nologin="$(command -v nologin || echo '/bin/false')" # Linux @@ -819,7 +803,7 @@ portable_add_user() { } portable_add_group() { - local groupname="${1}" + groupname="${1}" # Check if group exist if cut -d ':' -f 1 < /etc/group | grep "^${groupname}$" 1> /dev/null 2>&1; then @@ -854,7 +838,8 @@ portable_add_group() { } portable_add_user_to_group() { - local groupname="${1}" username="${2}" + groupname="${1}" + username="${2}" # Check if group exist if ! cut -d ':' -f 1 < /etc/group | grep "^${groupname}$" > /dev/null 2>&1; then @@ -863,7 +848,7 @@ portable_add_user_to_group() { fi # Check if user is in group - if [[ ",$(grep "^${groupname}:" < /etc/group | cut -d ':' -f 4)," =~ ,${username}, ]]; then + if expr ",$(grep "^${groupname}:" < /etc/group | cut -d ':' -f 4)," : ",""${username}"","; then # username is already there echo >&2 "User '${username}' is already in group '${groupname}'." return 0 @@ -984,7 +969,6 @@ cleanup_old_netdata_updater() { } enable_netdata_updater() { - local updater_type if [ -n "${1}" ] ; then updater_type="${1}" diff --git a/packaging/installer/install-required-packages.sh b/packaging/installer/install-required-packages.sh index 28605a142..52fdc348c 100755 --- a/packaging/installer/install-required-packages.sh +++ b/packaging/installer/install-required-packages.sh @@ -198,7 +198,7 @@ get_os_release() { eval "$(grep -E "^(NAME|ID|ID_LIKE|VERSION|VERSION_ID)=" "${os_release_file}")" for x in "${ID}" ${ID_LIKE}; do case "${x,,}" in - alpine | arch | centos | clear-linux-os | debian | fedora | gentoo | manjaro | opensuse-leap | ol | rhel | sabayon | sles | suse | ubuntu) + alpine | arch | centos | clear-linux-os | debian | fedora | gentoo | manjaro | opensuse-leap | ol | rhel | rocky | sabayon | sles | suse | ubuntu) distribution="${x}" version="${VERSION_ID}" codename="${VERSION}" @@ -419,7 +419,7 @@ detect_package_manager_from_distribution() { fi ;; - centos* | clearos*) + centos* | clearos* | rocky*) package_installer="" tree="centos" [ -n "${dnf}" ] && package_installer="install_dnf" @@ -695,6 +695,7 @@ declare -A pkg_json_c_dev=( ['sabayon']="dev-libs/json-c" ['suse']="libjson-c-devel" ['freebsd']="json-c" + ['macos']="json-c" ['default']="json-c-devel" ) @@ -828,7 +829,7 @@ declare -A pkg_libuuid_dev=( ['rhel']="libuuid-devel" ['ol']="libuuid-devel" ['suse']="libuuid-devel" - ['macos']="NOTREQUIRED" + ['macos']="ossp-uuid" ['freebsd']="e2fsprogs-libuuid" ['default']="" ) @@ -1171,7 +1172,7 @@ declare -A pkg_openssl=( ['gentoo']="dev-libs/openssl" ['arch']="openssl" ['freebsd']="openssl" - ['macos']="openssl@1.1" + ['macos']="openssl" ['default']="openssl-devel" ) diff --git a/packaging/installer/kickstart.sh b/packaging/installer/kickstart.sh index 2fe627022..3f1197407 100755 --- a/packaging/installer/kickstart.sh +++ b/packaging/installer/kickstart.sh @@ -150,6 +150,7 @@ telemetry_event() { "error_code": "${3}", "error_message": "${2}", "install_options": "${KICKSTART_OPTIONS}", + "install_interactivity": "${INTERACTIVE}", "total_runtime": "${total_duration}", "selected_install_method": "${SELECTED_INSTALL_METHOD}", "netdata_release_channel": "${RELEASE_CHANNEL:-null}", @@ -399,33 +400,47 @@ get_system_info() { elif [ -s "/usr/lib/os-release" ] && [ -r "/usr/lib/os-release" ]; then os_release_file="/usr/lib/os-release" else - fatal "Cannot find an os-release file ..." F0401 + warning "Cannot find an os-release file ..." fi - # shellcheck disable=SC1090 - . "${os_release_file}" + if [ -n "${os_release_file}" ]; then + # shellcheck disable=SC1090 + . "${os_release_file}" - DISTRO="${ID}" - SYSVERSION="${VERSION_ID}" - SYSCODENAME="${VERSION_CODENAME}" - SYSARCH="$(uname -m)" + DISTRO="${ID}" + SYSVERSION="${VERSION_ID}" + SYSCODENAME="${VERSION_CODENAME}" + SYSARCH="$(uname -m)" - supported_compat_names="debian ubuntu centos fedora opensuse" + supported_compat_names="debian ubuntu centos fedora opensuse ol" - if str_in_list "${DISTRO}" "${supported_compat_names}"; then - DISTRO_COMPAT_NAME="${DISTRO}" - else - case "${DISTRO}" in - opensuse-leap) - DISTRO_COMPAT_NAME="opensuse" - ;; - rhel) - DISTRO_COMPAT_NAME="centos" - ;; - *) - DISTRO_COMPAT_NAME="unknown" + if str_in_list "${DISTRO}" "${supported_compat_names}"; then + DISTRO_COMPAT_NAME="${DISTRO}" + else + case "${DISTRO}" in + opensuse-leap) + DISTRO_COMPAT_NAME="opensuse" + ;; + rocky|rhel) + DISTRO_COMPAT_NAME="centos" + ;; + *) + DISTRO_COMPAT_NAME="unknown" + ;; + esac + fi + + case "${DISTRO_COMPAT_NAME}" in + centos|ol) + SYSVERSION=$(echo "$SYSVERSION" | cut -d'.' -f1) ;; esac + else + DISTRO="unknown" + DISTRO_COMPAT_NAME="unknown" + SYSVERSION="unknown" + SYSCODENAME="unknown" + SYSARCH="$(uname -m)" fi ;; Darwin) @@ -452,11 +467,19 @@ str_in_list() { confirm_root_support() { if [ "$(id -u)" -ne "0" ]; then if [ -z "${ROOTCMD}" ] && command -v sudo > /dev/null; then - ROOTCMD="sudo" + if [ "${INTERACTIVE}" -eq 0 ]; then + ROOTCMD="sudo -n" + else + ROOTCMD="sudo" + fi fi if [ -z "${ROOTCMD}" ] && command -v doas > /dev/null; then - ROOTCMD="doas" + if [ "${INTERACTIVE}" -eq 0 ]; then + ROOTCMD="doas -n" + else + ROOTCMD="doas" + fi fi if [ -z "${ROOTCMD}" ] && command -v pkexec > /dev/null; then @@ -502,9 +525,11 @@ update() { fi } -handle_existing_install() { +detect_existing_install() { if pkg_installed netdata; then ndprefix="/" + elif [ -n "${INSTALL_PREFIX}" ]; then + ndprefix="${INSTALL_PREFIX}" else if [ -n "${INSTALL_PREFIX}" ]; then searchpath="${INSTALL_PREFIX}/bin:${INSTALL_PREFIX}/sbin:${INSTALL_PREFIX}/usr/bin:${INSTALL_PREFIX}/usr/sbin:${PATH}" @@ -539,7 +564,13 @@ handle_existing_install() { fi fi - if [ -z "${ndprefix}" ]; then + INSTALL_PREFIX="${ndprefix}" +} + +handle_existing_install() { + detect_existing_install + + if [ -z "${INSTALL_PREFIX}" ] || [ -z "${INSTALL_TYPE}" ]; then progress "No existing installations of netdata found, assuming this is a fresh install." return 0 fi @@ -547,13 +578,13 @@ handle_existing_install() { case "${INSTALL_TYPE}" in kickstart-*|legacy-*|binpkg-*|manual-static|unknown) if [ "${INSTALL_TYPE}" = "unknown" ]; then - warning "Found an existing netdata install at ${ndprefix}, but could not determine the install type." + warning "Found an existing netdata install at ${INSTALL_PREFIX}, but could not determine the install type." else - progress "Found an existing netdata install at ${ndprefix}, with installation type '${INSTALL_TYPE}'." + progress "Found an existing netdata install at ${INSTALL_PREFIX}, with installation type '${INSTALL_TYPE}'." fi if [ -n "${NETDATA_REINSTALL}" ] || [ -n "${NETDATA_UNSAFE_REINSTALL}" ]; then - progress "Found an existing netdata install at ${ndprefix}, but user requested reinstall, continuing." + progress "Found an existing netdata install at ${INSTALL_PREFIX}, but user requested reinstall, continuing." case "${INSTALL_TYPE}" in binpkg-*) NETDATA_ONLY_NATIVE=1 ;; @@ -581,21 +612,20 @@ handle_existing_install() { if [ "${NETDATA_CLAIM_ONLY}" -eq 0 ] && echo "${INSTALL_TYPE}" | grep -vq "binpkg-*"; then if ! update; then - warning "Unable to find usable updater script, not updating existing install at ${ndprefix}." + warning "Unable to find usable updater script, not updating existing install at ${INSTALL_PREFIX}." fi else - warning "Not updating existing install at ${ndprefix}." + warning "Not updating existing install at ${INSTALL_PREFIX}." fi if [ -n "${NETDATA_CLAIM_TOKEN}" ]; then - progress "Attempting to claim existing install at ${ndprefix}." - INSTALL_PREFIX="${ndprefix}" + progress "Attempting to claim existing install at ${INSTALL_PREFIX}." claim ret=$? elif [ "${NETDATA_CLAIM_ONLY}" -eq 1 ]; then fatal "User asked to claim, but did not proide a claiming token." F0202 else - progress "Not attempting to claim existing install at ${ndprefix} (no claiming token provided)." + progress "Not attempting to claim existing install at ${INSTALL_PREFIX} (no claiming token provided)." fi cleanup @@ -619,7 +649,7 @@ handle_existing_install() { fi fi else - fatal "Found an existing netdata install at ${ndprefix}, but the install type is '${INSTALL_TYPE}', which is not supported, refusing to proceed." F0103 + fatal "Found an existing netdata install at ${INSTALL_PREFIX}, but the install type is '${INSTALL_TYPE}', which is not supported, refusing to proceed." F0103 fi ;; esac @@ -751,10 +781,10 @@ claim() { pkg_installed() { case "${DISTRO_COMPAT_NAME}" in debian|ubuntu) - dpkg -l "${1}" > /dev/null 2>&1 + dpkg-query --show --showformat '${Status}' "${1}" 2>&1 | cut -f 1 -d ' ' | grep -q '^install$' return $? ;; - centos|fedora|opensuse) + centos|fedora|opensuse|ol) rpm -q "${1}" > /dev/null 2>&1 return $? ;; @@ -771,7 +801,7 @@ netdata_avail_check() { env DEBIAN_FRONTEND=noninteractive apt-cache policy netdata | grep -q packagecloud.io/netdata/netdata; return $? ;; - centos|fedora) + centos|fedora|ol) # shellcheck disable=SC2086 ${pm_cmd} search -v netdata | grep -qE 'Repo *: netdata(-edge)?$' return $? @@ -813,7 +843,7 @@ check_special_native_deps() { } try_package_install() { - if [ -z "${DISTRO}" ]; then + if [ -z "${DISTRO}" ] || [ "${DISTRO}" = "unknown" ]; then warning "Unable to determine Linux distribution for native packages." return 1 fi @@ -905,6 +935,22 @@ try_package_install() { uninstall_subcmd="remove" INSTALL_TYPE="binpkg-rpm" ;; + ol) + if command -v dnf > /dev/null; then + pm_cmd="dnf" + repo_subcmd="makecache" + else + pm_cmd="yum" + fi + repo_prefix="ol/${SYSVERSION}" + pkg_type="rpm" + pkg_suffix=".noarch" + pkg_vsep="-" + pkg_install_opts="${interactive_opts}" + repo_update_opts="${interactive_opts}" + uninstall_subcmd="remove" + INSTALL_TYPE="binpkg-rpm" + ;; *) warning "We do not provide native packages for ${DISTRO}." return 2 diff --git a/packaging/installer/methods/kickstart.md b/packaging/installer/methods/kickstart.md index bc7c4de95..5bd9633da 100644 --- a/packaging/installer/methods/kickstart.md +++ b/packaging/installer/methods/kickstart.md @@ -3,30 +3,27 @@ title: "Install Netdata with kickstart.sh" description: "The kickstart.sh script installs Netdata from source, including all dependencies required to connect to Netdata Cloud, with a single command." custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/installer/methods/kickstart.md --> +import { OneLineInstallWget, OneLineInstallCurl } from '../../../../../src/components/OneLineInstall/' # Install Netdata with kickstart.sh -![](https://registry.my-netdata.io/api/v1/badge.svg?chart=web_log_nginx.requests_per_url&options=unaligned&dimensions=kickstart&group=sum&after=-3600&label=last+hour&units=installations&value_color=orange&precision=0) ![](https://registry.my-netdata.io/api/v1/badge.svg?chart=web_log_nginx.requests_per_url&options=unaligned&dimensions=kickstart&group=sum&after=-86400&label=today&units=installations&precision=0) +![](https://registry.my-netdata.io/api/v1/badge.svg?chart=web_log_nginx.requests_per_url&options=unaligned&dimensions=kickstart&group=sum&after=-3600&label=last+hour&units=kickstart%20downloads&value_color=orange&precision=0) ![](https://registry.my-netdata.io/api/v1/badge.svg?chart=web_log_nginx.requests_per_url&options=unaligned&dimensions=kickstart&group=sum&after=-86400&label=today&units=kickstart%20downloads&precision=0) This page covers detailed instructions on using and configuring the automatic one-line installation script named `kickstart.sh`. -The kickstart script works on all Linux distributions and macOS environments. By default, automatic nightly updates are enabled. If you are installing on macOS, make sure to check the [install documentation for macOS](packaging/installer/methods/macos) before continuing. +The kickstart script works on all Linux distributions and macOS environments. By default, automatic nightly updates are enabled. If you are installing on macOS, make sure to check the [install documentation for macOS](packaging/installer/methods/macos.md) before continuing. > If you are unsure whether you want nightly or stable releases, read the [installation guide](/packaging/installer/README.md#nightly-vs-stable-releases). > If you want to turn off [automatic updates](/packaging/installer/README.md#automatic-updates), use the `--no-updates` option. You can find more installation options below. To install Netdata, run the following as your normal user: -```bash -wget -O ./kickstart.sh https://my-netdata.io/kickstart.sh && sh ./kickstart.sh -``` + Or, if you have cURL but not wget (such as on macOS): -```bash -curl https://my-netdata.io/kickstart.sh > /tmp/netdata-kickstart.sh && sh /tmp/netdata-kickstart.sh -``` + ## What does `kickstart.sh` do? @@ -89,15 +86,14 @@ area](https://learn.netdata.cloud/docs/cloud/spaces#manage-spaces). - `--claim-token`: Specify a unique claiming token associated with your Space in Netdata Cloud to be used to connect to the node after the install. - `--claim-rooms`: Specify a comma-separated list of tokens for each War Room this node should appear in. -- `--claim-proxy`: Specify a proxy to use when connecting to the cloud in the form of - `socks5[h]://[user:pass@]host:ip` for a SOCKS5 proxy, or `http://[user:pass@]host:ip` for an HTTP(S) proxy. +- `--claim-proxy`: Specify a proxy to use when connecting to the cloud in the form of `http://[user:pass@]host:ip` for an HTTP(S) proxy. See [connecting through a proxy](/claim/README.md#connect-through-a-proxy) for details. - `--claim-url`: Specify a URL to use when connecting to the cloud. Defaults to `https://app.netdata.cloud`. For example: ```bash -wget -O ./kickstart.sh https://my-netdata.io/kickstart.sh && sh ./kickstart.sh --claim-token=TOKEN --claim-rooms=ROOM1,ROOM2 +wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --claim-token=TOKEN --claim-rooms=ROOM1,ROOM2 ``` Please note that to run it you will either need to have root privileges or run it with the user that is running the agent, more details on the [Connect an agent without root privileges](/claim/README.md#connect-an-agent-without-root-privileges) section. @@ -140,7 +136,7 @@ To use `md5sum` to verify the integrity of the `kickstart.sh` script you will do run the following: ```bash -[ "dc50e88ee6e19f50dd395e1e5117a1fa" = "$(curl -Ss https://my-netdata.io/kickstart.sh | md5sum | cut -d ' ' -f 1)" ] && echo "OK, VALID" || echo "FAILED, INVALID" +[ "2ea326514c5166eabf02622e75d10a53" = "$(curl -Ss https://my-netdata.io/kickstart.sh | md5sum | cut -d ' ' -f 1)" ] && echo "OK, VALID" || echo "FAILED, INVALID" ``` If the script is valid, this command will return `OK, VALID`. diff --git a/packaging/installer/methods/macos.md b/packaging/installer/methods/macos.md index 0ae1d9f23..4fa0300c6 100644 --- a/packaging/installer/methods/macos.md +++ b/packaging/installer/methods/macos.md @@ -5,94 +5,99 @@ custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/instal # Install Netdata on macOS -Netdata works on macOS, albeit with some limitations. The number of charts displaying system metrics is limited, but you -can use any of Netdata's [external plugins](/collectors/plugins.d/README.md) to monitor any services you might -have installed on your macOS system. You could also use a macOS system as the parent node in a [streaming -configuration](/streaming/README.md). +Netdata works on macOS, albeit with some limitations. +The number of charts displaying system metrics is limited, but you can use any of Netdata's [external plugins](/collectors/plugins.d/README.md) to monitor any services you might have installed on your macOS system. +You could also use a macOS system as the parent node in a [streaming configuration](/streaming/README.md). -We recommend you to **[install Netdata with the our automatic one-line installation script](#install-netdata-with-our-automatic-one-line-installation-script)**, +You can install Netdata in one of the three following ways: - -As an alternative you also have community-created and -maintained [**Homebrew -package**](#install-netdata-with-the-homebrew-package). - -- [Install Netdata via the Homebrew package](#install-netdata-with-the-homebrew-package) +- **[Install Netdata with the our automatic one-line installation script (recommended)](#install-netdata-with-our-automatic-one-line-installation-script)**, +- [Install Netdata via Homebrew](#install-netdata-with-the-homebrew-package) - [Install Netdata from source](#install-netdata-from-source) -Being community-created and -maintained we don't guarantee that the features made available on our installation script will also be available or give support to it. +Each of these installation option requires [Homebrew](https://brew.sh/) for handling dependencies. + +> The Netdata Homebrew package is community-created and -maintained. +> Community-maintained packages _may_ receive support from Netdata, but are only a best-effort affair. Learn more about [Netdata's platform support policy](/packaging/platform_support). ## Install Netdata with our automatic one-line installation script -To install Netdata using our automatic [kickstart](/packaging/installer/README.md#automatic-one-line-installation-script) script you will just need to run: +**Local Netdata Agent installation** +To install Netdata using our automatic [kickstart](/packaging/installer/README.md#automatic-one-line-installation-script) open a new terminal and run: ```bash -wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh +curl https://my-netdata.io/kickstart.sh > /tmp/netdata-kickstart.sh && sh /tmp/netdata-kickstart.sh ``` +The Netdata Agent is be installed under `/usr/local/netdata`. Dependencies are handled via Homebrew. -With this script, you are also able to connect your nodes directly to Netdata Cloud if you wish, see more details on [Connect an agent running in macOS](/claim/README.md#connect-an-agent-running-in-macos) - -This currently only supports building Netdata locally, and requires dependencies to be handled either via Homebrew -or MacPorts (we preferentially use Homebrew if both are found). By default, this will install Netdata under -`/usr/local/netdata`. +**Automatically connect to Netdata Cloud during installation** + + -## Install Netdata with the Homebrew package +The `kickstart.sh` script accepts additional parameters to automatically [connect](/claim/README.md) your node to Netdata +Cloud immediately after installation. Find the `token` and `rooms` strings by [signing in to Netdata +Cloud](https://app.netdata.cloud/sign-in?cloudRoute=/spaces), then clicking on **Connect Nodes** in the [Spaces management +area](https://learn.netdata.cloud/docs/cloud/spaces#manage-spaces). -If you don't have [Homebrew](https://brew.sh/) installed already, begin with their installation script: +- `--claim-token`: Specify a unique claiming token associated with your Space in Netdata Cloud to be used to connect to the node + after the install. +- `--claim-rooms`: Specify a comma-separated list of tokens for each War Room this node should appear in. +- `--claim-proxy`: Specify a proxy to use when connecting to the cloud in the form of `http://[user:pass@]host:ip` for an HTTP(S) proxy. + See [connecting through a proxy](/claim/README.md#connect-through-a-proxy) for details. +- `--claim-url`: Specify a URL to use when connecting to the cloud. Defaults to `https://app.netdata.cloud`. +For example: ```bash -/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" +curl https://my-netdata.io/kickstart.sh > /tmp/netdata-kickstart.sh && sh /tmp/netdata-kickstart.sh --install /usr/local/ --claim-token TOKEN --claim-rooms ROOM1,ROOM2 --claim-url https://app.netdata.cloud ``` +The Netdata Agent is installed under `/usr/local/netdata` on your machine. Your machine will also show up as a node in your Netdata Cloud. -Next, you can use Homebrew's package, which installs Netdata all its dependencies in a single step: +If you experience issues while claiming your node, follow the steps in our [Troubleshooting](claim/README.md#troubleshooting) documentation. +## Install Netdata via Homebrew + +To install Netdata and all its dependencies, run Homebrew using the following command: ```sh brew install netdata ``` +Homebrew will place your Netdata configuration directory at `/usr/local/etc/netdata/`. -> Homebrew will place your Netdata configuration directory at `/usr/local/etc/netdata/`. Use the `edit-config` script -> and the files in this directory to configure Netdata. For reference, you can find stock configuration files at -> `/usr/local/Cellar/netdata/{NETDATA_VERSION}/lib/netdata/conf.d/`. +Use the `edit-config` script and the files in this directory to configure Netdata. For reference, you can find stock configuration files at `/usr/local/Cellar/netdata/{NETDATA_VERSION}/lib/netdata/conf.d/`. Skip on ahead to the [What's next?](#whats-next) section to find links to helpful post-installation guides. ## Install Netdata from source -We don't recommend installing Netdata from source on macOS, as it can be difficult to configure and install dependencies -manually. +We don't recommend installing Netdata from source on macOS, as it can be difficult to configure and install dependencies manually. -First open your terminal of choice and install the Xcode development packages. +1. Open your terminal of choice and install the Xcode development packages: -```bash -xcode-select --install -``` + ```bash + xcode-select --install + ``` -Click **Install** on the Software Update popup window that appears. Then, use the same terminal session to use Homebrew -to install some of Netdata's prerequisites. You can omit `cmake` in case you do not want to use -[Netdata Cloud](https://learn.netdata.cloud/docs/cloud/). +2. Click **Install** on the Software Update popup window that appears. +3. Use the same terminal session to install some of Netdata's prerequisites using Homebrew. If you don't want to use [Netdata Cloud](https://learn.netdata.cloud/docs/cloud/), you can omit `cmake`. -```bash -brew install ossp-uuid autoconf automake pkg-config libuv lz4 json-c openssl@1.1 libtool cmake -``` - -If you want to use the [database engine](/database/engine/README.md) to store your metrics, you need to download -and install the [Judy library](https://sourceforge.net/projects/judy/) before proceeding compiling Netdata. + ```bash + brew install ossp-uuid autoconf automake pkg-config libuv lz4 json-c openssl libtool cmake + ``` + +4. Download Netdata from our GitHub repository: -Next, download Netdata from our GitHub repository: + ```bash + git clone https://github.com/netdata/netdata.git --recursive + ``` -```bash -git clone https://github.com/netdata/netdata.git --recursive -``` +5. `cd` into the newly-created directory and then start the installer script: -Finally, `cd` into the newly-created directory and then start the installer script: - -```bash -cd netdata/ -sudo ./netdata-installer.sh --install /usr/local -``` + ```bash + cd netdata/ + sudo ./netdata-installer.sh --install /usr/local + ``` -> Your Netdata configuration directory will be at `/usr/local/netdata/`, and your stock configuration directory will -> be at **`/usr/local/lib/netdata/conf.d/`.** -> +> Your Netdata configuration directory will be at `/usr/local/netdata/`. +> Your stock configuration directory will be at `/usr/local/lib/netdata/conf.d/`. > The installer will also install a startup plist to start Netdata when your macOS system boots. ## What's next? @@ -102,8 +107,5 @@ When you're finished with installation, check out our [single-node](/docs/quicks Or, skip straight to [configuring the Netdata Agent](/docs/configure/nodes.md). -Read through Netdata's [documentation](https://learn.netdata.cloud/docs), which is structured based on actions and -solutions, to enable features like health monitoring, alarm notifications, long-term metrics storage, exporting to -external databases, and more. [![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fpackaging%2Finstaller%2Fmethods%2Fmacos&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)](<>) diff --git a/packaging/installer/methods/manual.md b/packaging/installer/methods/manual.md index 73cedd24d..6d88fbd8e 100644 --- a/packaging/installer/methods/manual.md +++ b/packaging/installer/methods/manual.md @@ -220,8 +220,7 @@ cd netdata ### Connect node to Netdata Cloud during installation -Unlike the [`kickstart.sh`](/packaging/installer/methods/kickstart.md) or -[`kickstart-static64.sh`](/packaging/installer/methods/kickstart-64.md) methods, the `netdata-installer.sh` script does +Unlike the [`kickstart.sh`](/packaging/installer/methods/kickstart.md), the `netdata-installer.sh` script does not allow you to automatically [connect](/claim/README.md) your node to Netdata Cloud immediately after installation. See the [connect to cloud](/claim/README.md) doc for details on connecting a node with a manual installation of Netdata. diff --git a/packaging/installer/methods/source.md b/packaging/installer/methods/source.md index 5345a1a4c..737ea166a 100644 --- a/packaging/installer/methods/source.md +++ b/packaging/installer/methods/source.md @@ -48,61 +48,6 @@ libraries and their header files must be copied into specific locations in the source tree to be used. ### Netdata cloud - -Netdata Cloud functionality requires custom builds of libmosquitto and -libwebsockets. - -#### libmosquitto - -Netdata maintains a custom fork of libmosquitto at -https://github.com/netdata/mosquitto with patches to allow for proper -integration with libwebsockets, which is needed for correct operation of -Netdata Cloud functionality. To prepare this library for the build system: - -1. Verify the tag that Netdata expects to be used by checking the contents - of `packaging/mosquitto.version` in your Netdata sources. -2. Obtain the sources for that version by either: - - Navigating to https://github.com/netdata/mosquitto/releases and - downloading and unpacking the source code archive for that release. - - Cloning the repository with `git` and checking out the required tag. -3. If building on a platform other than Linux, prepare the mosquitto - sources by running `cmake -D WITH_STATIC_LIBRARIES:boolean=YES .` in - the mosquitto source directory. -4. Build mosquitto by running `make -C lib` in the mosquitto source directory. -5. In the Netdata source directory, create a directory called `externaldeps/mosquitto`. -6. Copy `lib/mosquitto.h` from the mosquitto source directory to - `externaldeps/mosquitto/mosquitto.h` in the Netdata source tree. -7. Copy `lib/libmosquitto.a` from the mosquitto source directory to - `externaldeps/mosquitto/libmosquitto.a` in the Netdata source tree. If - building on a platform other than Linux, the file that needs to be - copied will instead be named `lib/libmosquitto_static.a`, but it - still needs to be copied to `externaldeps/mosquitto/libmosquitto.a`. - -#### libwebsockets - -Netdata uses the standard upstream version of libwebsockets located at -https://github.com/warmcat/libwebsockets, but requires a build with SOCKS5 -support, which is not enabled by most pre-built versions. Currently, -we do not support using a system copy of libwebsockets. To prepare this -library for the build system: - -1. Verify the tag that Netdata expects to be used by checking the contents - of `packaging/libwebsockets.version` in your Netdata sources. -2. Obtain the sources for that version by either: - - Navigating to https://github.com/warmcat/libwebsockets/releases and - downloading and unpacking the source code archive for that release. - - Cloning the repository with `git` and checking out the required tag. -3. Prepare the libwebsockets sources by running `cmake -D - LWS_WITH_SOCKS5:bool=ON .` in the libwebsockets source directory. -4. Build libwebsockets by running `make` in the libwebsockets source - directory. -5. In the Netdata source directory, create a directory called - `externaldeps/libwebsockets`. -6. Copy `lib/libwebsockets.a` from the libwebsockets source directory to - `externaldeps/libwebsockets/libwebsockets.a` in the Netdata source tree. -7. Copy the entire contents of `include/` from the libwebsockets source - directory to `externaldeps/libwebsockets/include` in the Netdata source tree. - #### JSON-C Netdata requires the use of JSON-C for JSON parsing when using Netdata diff --git a/packaging/installer/methods/synology.md b/packaging/installer/methods/synology.md index 07b1596fd..8e55924c1 100644 --- a/packaging/installer/methods/synology.md +++ b/packaging/installer/methods/synology.md @@ -6,14 +6,15 @@ custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/instal # Install Netdata on Synology -The documentation previously recommended installing the Debian Chroot package from the Synology community package -sources and then running Netdata from within the chroot. This does not work, as the chroot environment does not have -access to `/proc`, and therefore exposes very few metrics to Netdata. Additionally, [this -issue](https://github.com/SynoCommunity/spksrc/issues/2758), still open as of 2018/06/24, indicates that the Debian -Chroot package is not suitable for DSM versions greater than version 5 and may corrupt system libraries and render the -NAS unable to boot. - -The good news is that the [64-bit static installer](kickstart-64.md) works fine if your NAS is one that uses the amd64 architecture. It +> 💡 This document is maintained by Netdata's community, and may not be completely up-to-date. Please double-check the +> details of the installation process, before proceeding. +> +> You can help improve this document by +> [submitting a PR](https://github.com/netdata/netdata/edit/master/packaging/installer/methods/synology.md) +> with your recommended improvements or changes. Thank you! + + +The good news is that our [one-line installation script](kickstart.md) works fine if your NAS is one that uses the amd64 architecture. It will install the content into `/opt/netdata`, making future removal safe and simple. ## Run as netdata user diff --git a/packaging/installer/netdata-updater.sh b/packaging/installer/netdata-updater.sh index 964710058..bfb5503ca 100755 --- a/packaging/installer/netdata-updater.sh +++ b/packaging/installer/netdata-updater.sh @@ -304,18 +304,24 @@ update_available() { } set_tarball_urls() { - extension="tar.gz" + filename="netdata-latest.tar.gz" if [ "$2" = "yes" ]; then - extension="gz.run" + if [ -e /opt/netdata/etc/netdata/.install-type ]; then + # shellcheck disable=SC1091 + . /opt/netdata/etc/netdata/.install-type + filename="netdata-${PREBUILT_ARCH}-latest.gz.run" + else + filename="netdata-x86_64-latest.gz.run" + fi fi if [ "$1" = "stable" ]; then latest="$(get_netdata_latest_tag /dev/stdout)" - export NETDATA_TARBALL_URL="https://github.com/netdata/netdata/releases/download/$latest/netdata-latest.${extension}" + export NETDATA_TARBALL_URL="https://github.com/netdata/netdata/releases/download/$latest/${filename}" export NETDATA_TARBALL_CHECKSUM_URL="https://github.com/netdata/netdata/releases/download/$latest/sha256sums.txt" else - export NETDATA_TARBALL_URL="$NETDATA_NIGHTLIES_BASEURL/netdata-latest.${extension}" + export NETDATA_TARBALL_URL="$NETDATA_NIGHTLIES_BASEURL/${filename}" export NETDATA_TARBALL_CHECKSUM_URL="$NETDATA_NIGHTLIES_BASEURL/sha256sums.txt" fi } -- cgit v1.2.3