summaryrefslogtreecommitdiffstats
path: root/packaging/installer
diff options
context:
space:
mode:
Diffstat (limited to 'packaging/installer')
-rw-r--r--packaging/installer/README.md107
-rw-r--r--packaging/installer/UNINSTALL.md19
-rwxr-xr-xpackaging/installer/kickstart-static64.sh50
-rwxr-xr-xpackaging/installer/kickstart.sh74
-rwxr-xr-xpackaging/installer/netdata-uninstaller.sh7
5 files changed, 223 insertions, 34 deletions
diff --git a/packaging/installer/README.md b/packaging/installer/README.md
index 3d404e77..22633895 100644
--- a/packaging/installer/README.md
+++ b/packaging/installer/README.md
@@ -33,7 +33,7 @@ This method is **fully automatic on all Linux distributions**. FreeBSD and MacOS
To install Netdata from source, and keep it up to date with our **nightly releases** automatically, run the following:
```bash
-$ bash <(curl -Ss https://my-netdata.io/kickstart.sh)
+bash <(curl -Ss https://my-netdata.io/kickstart.sh)
```
!!! note
@@ -48,7 +48,7 @@ To learn more about the pros and cons of using *nightly* vs. *stable* releases,
Verify the integrity of the script with this:
```bash
-[ "b6d16c171ccad073b86327246151d875" = "$(curl -Ss https://my-netdata.io/kickstart.sh | md5sum | cut -d ' ' -f 1)" ] && echo "OK, VALID" || echo "FAILED, INVALID"
+[ "735e9966a4cf0187863e06a5282b34a7" = "$(curl -Ss https://my-netdata.io/kickstart.sh | md5sum | cut -d ' ' -f 1)" ] && echo "OK, VALID" || echo "FAILED, INVALID"
```
_It should print `OK, VALID` if the script is the one we ship._
@@ -67,16 +67,17 @@ The `kickstart.sh` script passes all its parameters to `netdata-installer.sh`, s
- `--dont-start-it`: Prevent the installer from starting Netdata automatically.
- `--stable-channel`: Automatically update only on the release of new major versions.
- `--no-updates`: Prevent automatic updates of any kind.
+- `--local-files`: Used for offline installations. Pass four file paths: the Netdata tarball, the checksum file, the go.d plugin tarball, and the go.d plugin config tarball, to force kickstart run the process using those files.
Example using all the above parameters:
```bash
-$ bash <(curl -Ss https://my-netdata.io/kickstart.sh) --dont-wait --dont-start-it --no-updates --stable-channel
+bash <(curl -Ss https://my-netdata.io/kickstart.sh) --dont-wait --dont-start-it --no-updates --stable-channel --local-files /tmp/my-selfdownloaded-tarball.tar.gz /tmp/checksums.txt /tmp/manually.downloaded.go.d.binary.tar.gz /tmp/manually.downloaded.go.d.config.tar.gz
```
-
+Note: `--stable-channel` and `--local-files` overlap, if you use the tarball override the stable channel option is not effective
</details>
-Once Netdata is installed, see [Getting Started](../../docs/GettingStarted.md).
+Once Netdata is installed, see [Getting Started](../../docs/getting-started.md).
---
@@ -89,7 +90,7 @@ You can install a pre-compiled static binary of Netdata on any Intel/AMD 64bit L
To install Netdata from a binary package on any Linux distro and any kernel version on **Intel/AMD 64bit** systems, and keep it up to date with our **nightly releases** automatically, run the following:
```bash
-$ bash <(curl -Ss https://my-netdata.io/kickstart-static64.sh)
+bash <(curl -Ss https://my-netdata.io/kickstart-static64.sh)
```
!!! note
@@ -108,7 +109,7 @@ This script installs Netdata at `/opt/netdata`.
Verify the integrity of the script with this:
```bash
-[ "4415e8c13e529a795abb953a9be14ad5" = "$(curl -Ss https://my-netdata.io/kickstart-static64.sh | md5sum | cut -d ' ' -f 1)" ] && echo "OK, VALID" || echo "FAILED, INVALID"
+[ "c529e4eb7ce201845cef605d450f8380" = "$(curl -Ss https://my-netdata.io/kickstart-static64.sh | md5sum | cut -d ' ' -f 1)" ] && echo "OK, VALID" || echo "FAILED, INVALID"
```
*It should print `OK, VALID` if the script is the one we ship.*
@@ -119,12 +120,14 @@ The `kickstart-static64.sh` script passes all its parameters to `netdata-install
- `--dont-start-it`: Prevent the installer from starting Netdata automatically.
- `--stable-channel`: Automatically update only on the release of new major versions.
- `--no-updates`: Prevent automatic updates of any kind.
+- `--local-files`: Used for offline installations. Pass two file paths, one for the tarball and one fir the checksum file, to force kickstart run the process using those files.
Example using all the above parameters:
```sh
-$ bash <(curl -Ss https://my-netdata.io/kickstart-static64.sh) --dont-wait --dont-start-it --no-updates --stable-channel
+bash <(curl -Ss https://my-netdata.io/kickstart-static64.sh) --dont-wait --dont-start-it --no-updates --stable-channel --local-files /tmp/my-selfdownloaded-tarball.tar.gz /tmp/checksums.txt
```
+Note: `--stable-channel` and `--local-files` overlap, if you use the tarball override the stable channel option is not effective
If your shell fails to handle the above one liner, do this:
@@ -146,7 +149,7 @@ sh /tmp/kickstart-static64.sh
</details>
-Once Netdata is installed, see [Getting Started](../../docs/GettingStarted.md).
+Once Netdata is installed, see [Getting Started](../../docs/getting-started.md).
---
@@ -469,9 +472,9 @@ When Netdata is first installed, it will run as *root*. This may or may not be a
3. Change ownership of the following directories, as defined in [Netdata Security](../../docs/netdata-security.md#security-design):
```sh
-$ chown -R root:netdata /opt/netdata/usr/share/netdata
-$ chown -R netdata:netdata /opt/netdata/var/lib/netdata /opt/netdata/var/cache/netdata
-$ chown -R netdata:root /opt/netdata/var/log/netdata
+chown -R root:netdata /opt/netdata/usr/share/netdata
+chown -R netdata:netdata /opt/netdata/var/lib/netdata /opt/netdata/var/cache/netdata
+chown -R netdata:root /opt/netdata/var/log/netdata
```
Additionally, as of 2018/06/24, the Netdata installer doesn't recognize DSM as an operating system, so no init script is installed. You'll have to do this manually:
@@ -504,6 +507,86 @@ The Netdata team maintains two releases of the Netdata agent: **nightly** and **
- Protect yourself from the rare instance when major bugs slip through our testing and negatively affect a Netdata installation
- Retain more control over the Netdata version you use
+## Offline installations
+
+You can install Netdata on systems without internet access, but you need to take
+a few extra steps to make it work.
+
+By default, the `kickstart.sh` and `kickstart-static64.sh` download Netdata
+assets, like the precompiled binary and a few dependencies, using the system's
+internet connection, but you can also supply these files from the local filesystem.
+
+First, download the required files. If you're using `kickstart.sh`, you need the
+Netdata tarball, the checksums, the go.d plugin binary, and the go.d plugin
+configuration. If you're using `kickstart-static64.sh`, you need only the
+Netdata tarball and checksums.
+
+Download the files you need to a system of yours that's connected to the
+internet. You can use the commands below, or visit the [latest Netdata release
+page](https://github.com/netdata/netdata/releases/latest) and [latest go.d
+plugin release page](https://github.com/netdata/go.d.plugin/releases) to
+download the required files manually.
+
+#### kickstart.sh
+```bash
+cd /tmp
+
+curl -s https://my-netdata.io/kickstart.sh > kickstart.sh
+
+# Netdata tarball
+curl -s https://api.github.com/repos/netdata/netdata/releases/latest | grep "browser_download_url.*tar.gz" | cut -d '"' -f 4 | wget -qi -
+
+# Netdata checksums
+curl -s https://api.github.com/repos/netdata/netdata/releases/latest | grep "browser_download_url.*txt" | cut -d '"' -f 4 | wget -qi -
+
+# Netdata dependency handling script
+curl -s https://raw.githubusercontent.com/netdata/netdata-demo-site/master/install-required-packages.sh | wget -qi -
+
+# go.d plugin
+# For binaries for OS types and architectures not listed on [go.d releases](https://github.com/netdata/go.d.plugin/releases/latest), kindly open a github issue and we will do our best to serve your request
+export OS=$(uname -s | tr '[:upper:]' '[:lower:]') ARCH=$(uname -m | sed -e 's/i386/386/g' -e 's/i686/386/g' -e 's/x86_64/amd64/g' -e 's/aarch64/arm64/g' -e 's/armv64/arm64/g' -e 's/armv6l/arm/g' -e 's/armv7l/arm/g' -e 's/armv5tel/arm/g') && curl -s https://api.github.com/repos/netdata/go.d.plugin/releases/latest | grep "browser_download_url.*${OS}-${ARCH}.tar.gz" | cut -d '"' -f 4 | wget -qi -
+
+# go.d configuration
+curl -s https://api.github.com/repos/netdata/go.d.plugin/releases/latest | grep "browser_download_url.*config.tar.gz" | cut -d '"' -f 4 | wget -qi -
+```
+
+#### kickstart-static64.sh
+```bash
+cd /tmp
+
+curl -s https://my-netdata.io/kickstart-static64.sh > kickstart-static64.sh
+
+# Netdata static64 tarball
+curl -s https://api.github.com/repos/netdata/netdata/releases/latest | grep "browser_download_url.*gz.run" | cut -d '"' -f 4 | wget -qi -
+
+# Netdata checksums
+curl -s https://api.github.com/repos/netdata/netdata/releases/latest | grep "browser_download_url.*txt" | cut -d '"' -f 4 | wget -qi -
+```
+
+Move downloaded files to the `/tmp` directory on the offline system in whichever way
+your defined policy allows (if any).
+
+Now you can run either the `kickstart.sh` or `kickstart-static64.sh` scripts
+using the `--local-files` option. This option requires you to specify
+the location and names of the files you just downloaded.
+
+!!! note When using `--local-files`, the `kickstart.sh` or
+ `kickstart-static64.sh` scripts won't download any Netdata assets from the
+ internet. But, you may still need a connection to install dependencies using
+ your system's package manager. The scripts will warn you if your system
+ doesn't have all the dependencies.
+
+```bash
+# kickstart.sh
+bash kickstart.sh --local-files /tmp/netdata-version-number-here.tar.gz /tmp/sha256sums.txt /tmp/go.d-binary-filename.tar.gz /tmp/config.tar.gz /tmp/install-required-packages.sh
+
+# kickstart-static64.sh
+bash kickstart-static64.sh --local-files /tmp/netdata-version-number-here.gz.run /tmp/sha256sums.txt
+```
+
+Now that you're finished with your offline installation, you can move on to our
+[getting started guide](../../docs/getting-started.md)!
+
## Automatic updates
By default, Netdata's installation scripts enable automatic updates for both nightly and stable release channels.
diff --git a/packaging/installer/UNINSTALL.md b/packaging/installer/UNINSTALL.md
index b8e5bd9e..d2bd1ebd 100644
--- a/packaging/installer/UNINSTALL.md
+++ b/packaging/installer/UNINSTALL.md
@@ -1,8 +1,14 @@
# Uninstalling Netdata
-Our self-contained uninstaller is able to remove Netdata installations created with shell installer. It doesn't need any other Netdata repository files to be run. All it needs is an .environment file, which is created during installation (with shell installer) and put in ${NETDATA_USER_CONFIG_DIR}/.environment (by default /etc/netdata/.environment). That file contains some parameters which are passed to our installer and which are needed during uninstallation process. Mainly two parameters are needed:
+Our self-contained uninstaller is able to remove Netdata installations created with shell installer.
+It doesn't need any other Netdata repository files to be run.
+All it needs is an `.environment` file, which is created during installation (with shell installer)
+and put in `${NETDATA_USER_CONFIG_DIR}/.environment` (by default `/etc/netdata/.environment`).
+That file contains some parameters which are passed to our installer
+and which are needed during uninstallation process.
+Mainly two parameters are needed:
-```
+```sh
NETDATA_PREFIX
NETDATA_ADDED_TO_GROUPS
```
@@ -10,16 +16,16 @@ NETDATA_ADDED_TO_GROUPS
A workflow for uninstallation looks like this:
1. Find your `.environment` file, which is usually `/etc/netdata/.environment` in a default installation.
-2. If you cannot find that file and would like to uninstall Netdata, then create new file with following content:
+2. If you cannot find that file and would like to uninstall Netdata, then create a new file with the following content:
-```
+```sh
NETDATA_PREFIX="<installation prefix>" # put what you used as a parameter to shell installed `--install` flag. Otherwise it should be empty
NETDATA_ADDED_TO_GROUPS="<additional groups>" # Additional groups for a user running the Netdata process
```
3. Run `netdata-uninstaller.sh` as follows
-```
+```sh
${NETDATA_PREFIX}/usr/libexec/netdata/netdata-uninstaller.sh --yes --env <environment_file>
```
@@ -34,6 +40,7 @@ chmod +x ./netdata-uninstaller.sh
The default `environment_file` is `/etc/netdata/.environment`.
-Note: This uninstallation method assumes previous installation with `netdata-installer.sh` or the kickstart script. Currently using it when Netdata was installed by a package manager can work or cause unexpected results.
+Note: This uninstallation method assumes previous installation with `netdata-installer.sh` or the kickstart script.
+Currently using it when Netdata was installed by a package manager can work or cause unexpected results.
[![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%2Finstaller%2FUNINSTALL&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)](<>)
diff --git a/packaging/installer/kickstart-static64.sh b/packaging/installer/kickstart-static64.sh
index 34ca116d..a988e4f6 100755
--- a/packaging/installer/kickstart-static64.sh
+++ b/packaging/installer/kickstart-static64.sh
@@ -1,7 +1,15 @@
#!/usr/bin/env sh
+#
# SPDX-License-Identifier: GPL-3.0-or-later
# shellcheck disable=SC1117,SC2039,SC2059,SC2086
-
+#
+# Options to run
+# --dont-wait do not wait for input
+# --non-interactive do not wait for input
+# --dont-start-it do not start netdata after install
+# --stable-channel Use the stable release channel, rather than the nightly to fetch sources
+# --local-files Use a manually provided tarball for the installation
+#
# ---------------------------------------------------------------------------------------------------------------------
# library functions copied from packaging/installer/functions.sh
@@ -127,6 +135,11 @@ download() {
}
set_tarball_urls() {
+ if [ -n "${NETDATA_LOCAL_TARBALL_OVERRIDE}" ]; then
+ progress "Not fetching remote tarballs, local override was given"
+ return
+ fi
+
if [ "$1" = "stable" ]; then
local latest
# Simple version
@@ -175,15 +188,31 @@ RELEASE_CHANNEL="nightly"
while [ -n "${1}" ]; do
if [ "${1}" = "--dont-wait" ] || [ "${1}" = "--non-interactive" ] || [ "${1}" = "--accept" ]; then
opts="${opts} --accept"
+ shift 1
elif [ "${1}" = "--dont-start-it" ]; then
inner_opts="${inner_opts} ${1}"
+ shift 1
elif [ "${1}" = "--stable-channel" ]; then
RELEASE_CHANNEL="stable"
+ shift 1
+ elif [ "${1}" = "--local-files" ]; then
+ shift 1
+ if [ -z "${1}" ]; then
+ fatal "Option --local-files requires extra information. The desired tarball full filename is needed"
+ fi
+
+ NETDATA_LOCAL_TARBALL_OVERRIDE="${1}"
+ shift 1
+ if [ -z "${1}" ]; then
+ fatal "Option --local-files requires a pair of the tarball source and the checksum file"
+ fi
+
+ NETDATA_LOCAL_TARBALL_OVERRIDE_CHECKSUM="${1}"
+ shift 1
else
- echo >&2 "Unknown option '${1}'"
+ echo >&2 "Unknown option '${1}' or invalid number of arguments. Please check the README for the available arguments of ${0} and try again"
exit 1
fi
- shift
done
[ -n "${inner_opts}" ] && inner_opts="-- ${inner_opts}"
@@ -191,11 +220,18 @@ done
TMPDIR=$(create_tmp_directory)
cd "${TMPDIR}"
-set_tarball_urls "${RELEASE_CHANNEL}"
-progress "Downloading static netdata binary: ${NETDATA_TARBALL_URL}"
+if [ -z "${NETDATA_LOCAL_TARBALL_OVERRIDE}" ]; then
+ set_tarball_urls "${RELEASE_CHANNEL}"
+ progress "Downloading static netdata binary: ${NETDATA_TARBALL_URL}"
+
+ download "${NETDATA_TARBALL_CHECKSUM_URL}" "${TMPDIR}/sha256sum.txt"
+ download "${NETDATA_TARBALL_URL}" "${TMPDIR}/netdata-latest.gz.run"
+else
+ progress "Installation sources were given as input, running installation using \"${NETDATA_LOCAL_TARBALL_OVERRIDE}\""
+ run cp "${NETDATA_LOCAL_TARBALL_OVERRIDE}" "${TMPDIR}/netdata-latest.gz.run"
+ run cp "${NETDATA_LOCAL_TARBALL_OVERRIDE_CHECKSUM}" "${TMPDIR}/sha256sum.txt"
+fi
-download "${NETDATA_TARBALL_CHECKSUM_URL}" "${TMPDIR}/sha256sum.txt"
-download "${NETDATA_TARBALL_URL}" "${TMPDIR}/netdata-latest.gz.run"
if ! grep netdata-latest.gz.run "${TMPDIR}/sha256sum.txt" | safe_sha256sum -c - >/dev/null 2>&1; then
fatal "Static binary checksum validation failed. Stopping netdata installation and leaving binary in ${TMPDIR}"
fi
diff --git a/packaging/installer/kickstart.sh b/packaging/installer/kickstart.sh
index bab95fda..1612d561 100755
--- a/packaging/installer/kickstart.sh
+++ b/packaging/installer/kickstart.sh
@@ -10,9 +10,10 @@
# bash <(curl -Ss https://my-netdata.io/kickstart.sh) all
#
# Other options:
-# --dont-wait do not prompt for user input
-# --non-interactive do not prompt for user input
-# --no-updates do not install script for daily updates
+# --dont-wait do not prompt for user input
+# --non-interactive do not prompt for user input
+# --no-updates do not install script for daily updates
+# --local-files set the full path of the desired tarball to run install with
#
# This script will:
#
@@ -163,6 +164,11 @@ download() {
}
set_tarball_urls() {
+ if [ -n "${NETDATA_LOCAL_TARBALL_OVERRIDE}" ]; then
+ progress "Not fetching remote tarballs, local override was given"
+ return
+ fi
+
if [ "$1" = "stable" ]; then
local latest
# Simple version
@@ -216,8 +222,17 @@ dependencies() {
if ! detect_bash4 "${bash}"; then
warning "Cannot detect packages to be installed in this system, without BASH v4+."
else
- progress "Downloading script to detect required packages..."
- download "${PACKAGES_SCRIPT}" "${TMPDIR}/install-required-packages.sh"
+ progress "Fetching script to detect required packages..."
+ if [ -n "${NETDATA_LOCAL_TARBALL_OVERRIDE_DEPS_SCRIPT}" ]; then
+ if [ -f "${NETDATA_LOCAL_TARBALL_OVERRIDE_DEPS_SCRIPT}" ]; then
+ run cp "${NETDATA_LOCAL_TARBALL_OVERRIDE_DEPS_SCRIPT}" "${TMPDIR}/install-required-packages.sh"
+ else
+ fatal "Invalid given dependency file, please check your --local-files parameter options and try again"
+ fi
+ else
+ download "${PACKAGES_SCRIPT}" "${TMPDIR}/install-required-packages.sh"
+ fi
+
if [ ! -s "${TMPDIR}/install-required-packages.sh" ]; then
warning "Downloaded dependency installation script is empty."
else
@@ -293,6 +308,42 @@ while [ -n "${1}" ]; do
elif [ "${1}" = "--stable-channel" ]; then
RELEASE_CHANNEL="stable"
shift 1
+ elif [ "${1}" = "--local-files" ]; then
+ shift 1
+ if [ -z "${1}" ]; then
+ fatal "Missing netdata: Option --local-files requires extra information. The desired tarball for netdata, the checksum, the go.d plugin tarball , the go.d plugin config tarball and the dependency management script, in this particular order"
+ fi
+
+ export NETDATA_LOCAL_TARBALL_OVERRIDE="${1}"
+ shift 1
+
+ if [ -z "${1}" ]; then
+ fatal "Missing checksum file: Option --local-files requires extra information. The desired tarball for netdata, the checksum, the go.d plugin tarball , the go.d plugin config tarball and the dependency management script, in this particular order"
+ fi
+
+ export NETDATA_LOCAL_TARBALL_OVERRIDE_CHECKSUM="${1}"
+ shift 1
+
+ if [ -z "${1}" ]; then
+ fatal "Missing go.d tarball: Option --local-files requires extra information. The desired tarball for netdata, the checksum, the go.d plugin tarball , the go.d plugin config tarball and the dependency management script, in this particular order"
+ fi
+
+ export NETDATA_LOCAL_TARBALL_OVERRIDE_GO_PLUGIN="${1}"
+ shift 1
+
+ if [ -z "${1}" ]; then
+ fatal "Missing go.d config tarball: Option --local-files requires extra information. The desired tarball for netdata, the checksum, the go.d plugin tarball , the go.d plugin config tarball and the dependency management script, in this particular order"
+ fi
+
+ export NETDATA_LOCAL_TARBALL_OVERRIDE_GO_PLUGIN_CONFIG="${1}"
+ shift 1
+
+ if [ -z "${1}" ]; then
+ fatal "Missing dependencies management scriptlet: Option --local-files requires extra information. The desired tarball for netdata, the checksum, the go.d plugin tarball , the go.d plugin config tarball and the dependency management script, in this particular order"
+ fi
+
+ export NETDATA_LOCAL_TARBALL_OVERRIDE_DEPS_SCRIPT="${1}"
+ shift 1
else
break
fi
@@ -311,10 +362,17 @@ dependencies
# ---------------------------------------------------------------------------------------------------------------------
# download netdata package
-set_tarball_urls "${RELEASE_CHANNEL}"
+if [ -z "${NETDATA_LOCAL_TARBALL_OVERRIDE}" ]; then
+ set_tarball_urls "${RELEASE_CHANNEL}"
+
+ download "${NETDATA_TARBALL_CHECKSUM_URL}" "${TMPDIR}/sha256sum.txt"
+ download "${NETDATA_TARBALL_URL}" "${TMPDIR}/netdata-latest.tar.gz"
+else
+ progress "Installation sources were given as input, running installation using \"${NETDATA_LOCAL_TARBALL_OVERRIDE}\""
+ run cp "${NETDATA_LOCAL_TARBALL_OVERRIDE_CHECKSUM}" "${TMPDIR}/sha256sum.txt"
+ run cp "${NETDATA_LOCAL_TARBALL_OVERRIDE}" "${TMPDIR}/netdata-latest.tar.gz"
+fi
-download "${NETDATA_TARBALL_CHECKSUM_URL}" "${TMPDIR}/sha256sum.txt"
-download "${NETDATA_TARBALL_URL}" "${TMPDIR}/netdata-latest.tar.gz"
if ! grep netdata-latest.tar.gz "${TMPDIR}/sha256sum.txt" | safe_sha256sum -c - >/dev/null 2>&1; then
fatal "Tarball checksum validation failed. Stopping netdata installation and leaving tarball in ${TMPDIR}"
fi
diff --git a/packaging/installer/netdata-uninstaller.sh b/packaging/installer/netdata-uninstaller.sh
index 41ada623..5c8caeaf 100755
--- a/packaging/installer/netdata-uninstaller.sh
+++ b/packaging/installer/netdata-uninstaller.sh
@@ -158,7 +158,12 @@ portable_del_group() {
# Linux
if command -v groupdel 1>/dev/null 2>&1; then
- run groupdel -f "${groupname}" && return 0
+ if grep -q "${groupname}" /etc/group; then
+ run groupdel -f "${groupname}" && return 0
+ else
+ echo >&2 "Group ${groupname} already removed in a previous step."
+ run_ok
+ fi
fi
# mac OS