From b5f8ee61a7f7e9bd291dd26b0585d03eb686c941 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 5 May 2024 13:19:16 +0200 Subject: Adding upstream version 1.46.3. Signed-off-by: Daniel Baumann --- packaging/installer/methods/source.md | 162 ++++++---------------------------- 1 file changed, 25 insertions(+), 137 deletions(-) (limited to 'packaging/installer/methods/source.md') diff --git a/packaging/installer/methods/source.md b/packaging/installer/methods/source.md index 8f34218a2..c6ff6e6fe 100644 --- a/packaging/installer/methods/source.md +++ b/packaging/installer/methods/source.md @@ -13,7 +13,7 @@ sidebar_position: 100 These instructions are for advanced users and distribution package maintainers. Unless this describes you, you almost certainly want to follow [our guide for manually installing Netdata from a git -checkout](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/manual.md) instead. +checkout](/packaging/installer/methods/manual.md) instead. ## Required dependencies @@ -23,11 +23,15 @@ to build and run successfully: - libuuid - libuv version 1.0 or newer - zlib -- GNU autoconf -- GNU automake +- CMake 3.13 or newer - GCC or Xcode (Clang is known to have issues in certain configurations, see [Using Clang](#using-clang)) -- A version of `make` compatible with GNU automake -- Git (we use git in the build system to generate version info, don't need a full install, just a working `git show` command) +- Ninja or Make (Ninja is preferred as it results in significantly faster builds) +- Git (we use git in the build system to generate version info, you don't need a full install, just a working `git show` command) + +The following additional dependencies are also needed, but will be prepared automatically by CMake if they are not available on the build system. + +- libyaml +- JSON-C Additionally, the following build time features require additional dependencies: @@ -38,66 +42,36 @@ Additionally, the following build time features require additional dependencies: - OpenSSL 1.0 or newer (LibreSSL _amy_ work, but is largely untested). - Netdata Cloud support: - A working internet connection - - A recent version of CMake - OpenSSL 1.0.2 or newer _or_ LibreSSL 3.0.0 or newer. - - JSON-C (may be provided by the user as shown below, or by the system) - - protobuf (Google Protocol Buffers) and protoc compiler + - protobuf (Google Protocol Buffers) and protoc compiler. If protobuf is not available on the system, + CMake can be instructed to fetch and build a usable version for Netdata. +- Netdata Go collectors: + - Go 1.21 or newer ## Preparing the source tree -Certain features in Netdata require custom versions of specific libraries, -which the the build system will link statically into Netdata. These -libraries and their header files must be copied into specific locations -in the source tree to be used. - -Before you begin, make sure that your repo and the repo's submodules are clean from any previous builds and up to date. -Otherwise, [perform a cleanup](https://github.com/netdata/netdata/blob/master/packaging/installer/methods/manual.md#perform-a-cleanup-in-your-netdata-repo) +Netdata uses Git submodules for some of it’s components, which must be fetched prior to building Netdata. If you +are using a source tarball published by the Netdata project, then these are included. If you are using a checkout +of the Git repository, you may need to explicitly fetch and update the submodules using `git submodule update +--init --recursive`. ### Netdata cloud -#### JSON-C - -Netdata requires the use of JSON-C for JSON parsing when using Netdata -Cloud. Netdata is able to use a system-provided copy of JSON-C, but -some systems may not provide it. If your system does not provide JSON-C, -you can do the following to prepare a copy for the build system: - -1. Verify the tag that Netdata expects to be used by checking the contents - of `packaging/jsonc.version` in your Netdata sources. -2. Obtain the sources for that version by either: - - Navigating to https://github.com/json-c/json-c 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 JSON-C sources by running `cmake -DBUILD_SHARED_LIBS=OFF .` - in the JSON-C source directory. -4. Build JSON-C by running `make` in the JSON-C source directory. -5. In the Netdata source directory, create a directory called - `externaldeps/jsonc`. -6. Copy `libjson-c.a` from the JSON-C source directory to - `externaldeps/jsonc/libjson-c.a` in the Netdata source tree. -7. Copy all of the header files (`*.h`) from the JSON-C source directory - to `externaldeps/jsonc/json-c` in the Netdata source tree. - ## Building Netdata Once the source tree has been prepared, Netdata is ready to be configured -and built. Netdata currently uses GNU autotools as it's primary build -system. To build Netdata this way: +and built. Netdata uses CMake for configuration, and strongly prefers +the use of an external build directory. To configure and build Netdata: -1. Run `autoreconf -ivf` in the Netdata source tree. -2. Run `./configure` in the Netdata source tree. -3. Run `make` in the Netdata source tree. +1. Run `cmake -S . -B build -G Ninja` in the source tree. `build` can be replaced with whatever path you want for the build directory. If you wish to use Make instead of Ninja for the build, remove the `-G Ninja` from the command. +2. Run `cmake --build build`, where `build` is the build directory. CMake’s `--parallel` option can be used to control the number of build jobs that are used. +3. Run `cmake --install build`, where `build` is the build directory. ### Configure options -Netdata provides a number of build time configure options. This section -lists some of the ones you are most likely to need: - -- `--prefix`: Specify the prefix under which Netdata will be installed. -- `--with-webdir`: Specify a path relative to the prefix in which to - install the web UI files. -- `--disable-cloud`: Disables all Netdata Cloud functionality for - this build. +Netdata’s CMake build infrastructure intentionally does very little auto-detection, and requires most components +to be explicitly enabled or disabled. A full list of available configuration options for a given version of Netdata, +with help descriptions, can be seen by running `cmake -LH` in the source tree. ### Using Clang @@ -123,92 +97,6 @@ A full featured install of Netdata requires some additional components which must be built and installed separately from the main Netdata agent. All of these should be handled _after_ installing Netdata itself. -### React dashboard - -The above build steps include a deprecated web UI for Netdata that lacks -support for Netdata Cloud. To get a fully featured dashboard, you must -install our new React dashboard. - -#### Installing the pre-built React dashboard - -We provide pre-built archives of the React dashboard for each release -(these are also used during our normal install process). To use one -of these: - -1. Verify the release version that Netdata expects to be used by checking - the contents of `packaging/dashboard.version` in your Netdata sources. -2. Go to https://github.com/netdata/dashboard/releases and download the - `dashboard.tar.gz` file for the required release. -3. Unpack the downloaded archive to a temporary directory. -4. Copy the contents of the `build` directory from the extracted - archive to `/usr/share/netdata/web` or the equivalent location for - your build of Netdata. This _will_ overwrite some files in the target - location. - -#### Building the React dashboard locally - -Alternatively, you may wish to build the React dashboard locally. Doing -so requires a recent version of Node.JS with a working install of -NPM. Once you have the required tools, do the following: - -1. Verify the release version that Netdata expects to be used by checking - the contents of `packaging/dashboard.version` in your Netdata sources. -2. Obtain the sources for that version by either: - - Navigating to https://github.com/netdata/dashboard and downloading - and unpacking the source code archive for that release. - - Cloning the repository with `git` and checking out the required tag. -3. Run `npm install` in the dashboard source tree. -4. Run `npm run build` in the dashboard source tree. -5. Copy the contents of the `build` directory just like step 4 of - installing the pre-built React dashboard. - -### Go collectors - -A number of the collectors for Netdata are written in Go instead of C, -and are developed in a separate repository from the mian Netdata code. -An installation without these collectors is still usable, but will be -unable to collect metrics for a number of network services the system -may be providing. You can either install a pre-built copy of these -collectors, or build them locally. - -#### Installing the pre-built Go collectors - -We provide pre-built binaries of the Go collectors for all the platforms -we officially support. To use one of these: - -1. Verify the release version that Netdata expects to be used by checking - the contents of `packaging/go.d.version` in your Netdata sources. -2. Go to https://github.com/netdata/go.d.plugin/releases, select the - required release, and download the `go.d.plugin-*.tar.gz` file - for your system type and CPu architecture and the `config.tar.gz` - configuration file archive. -3. Extract the `go.d.plugin-*.tar.gz` archive into a temporary - location, and then copy the single file in the archive to - `/usr/libexec/netdata/plugins.d` or the equivalent location for your - build of Netdata and rename it to `go.d.plugin`. -4. Extract the `config.tar.gz` archive to a temporarylocation and then - copy the contents of the archive to `/etc/netdata` or the equivalent - location for your build of Netdata. - -#### Building the Go collectors locally - -Alternatively, you may wish to build the Go collectors locally -yourself. Doing so requires a working installation of Golang 1.13 or -newer. Once you have the required tools, do the following: - -1. Verify the release version that Netdata expects to be used by checking - the contents of `packaging/go.d.version` in your Netdata sources. -2. Obtain the sources for that version by either: - - Navigating to https://github.com/netdata/go.d.plugin and downloading - and unpacking the source code archive for that release. - - Cloning the repository with `git` and checking out the required tag. -3. Run `make` in the go.d.plugin source tree. -4. Copy `bin/godplugin` to `/usr/libexec/netdata/plugins.d` or th - equivalent location for your build of Netdata and rename it to - `go.d.plugin`. -5. Copy the contents of the `config` directory to `/etc/netdata` or the - equivalent location for your build of Netdata. - ### eBPF collector On Linux systems, Netdata has support for using the kernel's eBPF -- cgit v1.2.3