How to install Netdata on Debian Buster

Install netdata on Debian Buster to perform real-time performance monitoring.

Installation process

Install required dependencies.

$ sudo apt-get install zlib1g-dev libuv1-dev uuid-dev libmnl-dev gcc make git autoconf autoconf-archive autogen automake pkg-config curl
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  autogen-doc autotools-dev binutils binutils-common binutils-x86-64-linux-gnu cpp cpp-8 gcc-8 git-man guile-2.0-libs libasan5 libatomic1 libbinutils
  libc-dev-bin libc6-dev libcc1-0 libcurl4 libdpkg-perl liberror-perl libfile-fcntllock-perl libgc1c2 libgcc-8-dev libglib2.0-0 libglib2.0-data libgomp1
  libisl19 libitm1 liblsan0 libltdl7 libmpc3 libmpfr6 libmpx2 libopts25 libopts25-dev libquadmath0 libsigsegv2 libtsan0 libubsan1 libuv1 linux-libc-dev m4
  manpages-dev patch shared-mime-info xdg-user-dirs
Suggested packages:
  gnu-standards autoconf-doc libtool gettext binutils-doc cpp-doc gcc-8-locales gcc-multilib flex bison gdb gcc-doc gcc-8-multilib gcc-8-doc libgcc1-dbg
  libgomp1-dbg libitm1-dbg libatomic1-dbg libasan5-dbg liblsan0-dbg libtsan0-dbg libubsan1-dbg libmpx2-dbg libquadmath0-dbg git-daemon-run
  | git-daemon-sysvinit git-doc git-el git-email git-gui gitk gitweb git-cvs git-mediawiki git-svn glibc-doc debian-keyring gnupg | gnupg2 bzr m4-doc make-doc
  ed diffutils-doc dpkg-dev
The following NEW packages will be installed:
  autoconf autoconf-archive autogen autogen-doc automake autotools-dev binutils binutils-common binutils-x86-64-linux-gnu cpp cpp-8 curl gcc gcc-8 git git-man
  guile-2.0-libs libasan5 libatomic1 libbinutils libc-dev-bin libc6-dev libcc1-0 libcurl4 libdpkg-perl liberror-perl libfile-fcntllock-perl libgc1c2
  libgcc-8-dev libglib2.0-0 libglib2.0-data libgomp1 libisl19 libitm1 liblsan0 libltdl7 libmnl-dev libmpc3 libmpfr6 libmpx2 libopts25 libopts25-dev
  libquadmath0 libsigsegv2 libtsan0 libubsan1 libuv1 libuv1-dev linux-libc-dev m4 make manpages-dev patch pkg-config shared-mime-info uuid-dev xdg-user-dirs
  zlib1g-dev
0 upgraded, 58 newly installed, 0 to remove and 0 not upgraded.
Need to get 54.5 MB of archives.
After this operation, 225 MB of additional disk space will be used.
Get:1 http://security.debian.org/debian-security buster/updates/main amd64 git-man all 1:2.20.1-2+deb10u1 [1,620 kB]
Get:2 http://deb.debian.org/debian buster/main amd64 autoconf-archive all 20180313-1 [749 kB]
Get:3 http://security.debian.org/debian-security buster/updates/main amd64 git amd64 1:2.20.1-2+deb10u1 [5,620 kB]
Get:4 http://security.debian.org/debian-security buster/updates/main amd64 linux-libc-dev amd64 4.19.67-2+deb10u2 [1,234 kB]
Get:5 http://deb.debian.org/debian buster/main amd64 libsigsegv2 amd64 2.12-2 [32.8 kB]
Get:6 http://deb.debian.org/debian buster/main amd64 m4 amd64 1.4.18-2 [203 kB]
Get:7 http://deb.debian.org/debian buster/main amd64 autoconf all 2.69-11 [341 kB]
Get:8 http://deb.debian.org/debian buster/main amd64 libgc1c2 amd64 1:7.6.4-0.4 [224 kB]
Get:9 http://deb.debian.org/debian buster/main amd64 libltdl7 amd64 2.4.6-9 [390 kB]
Get:10 http://deb.debian.org/debian buster/main amd64 guile-2.0-libs amd64 2.0.13+1-5.1 [2,232 kB]
[...]
Setting up cpp (4:8.3.0-1) ...
Setting up libc6-dev:amd64 (2.28-10) ...
Setting up automake (1:1.16.1-4) ...
update-alternatives: using /usr/bin/automake-1.16 to provide /usr/bin/automake (automake) in auto mode
Setting up gcc-8 (8.3.0-6) ...
Setting up gcc (4:8.3.0-1) ...
Setting up uuid-dev:amd64 (2.33.1-0.1) ...
Setting up zlib1g-dev:amd64 (1:1.2.11.dfsg-1) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for libc-bin (2.28-10) ...

Download the source code.

$ sudo git clone --depth=1 https://github.com/firehol/netdata.git /srv/netdata_installer
Cloning into '/srv/netdata_installer'...
remote: Enumerating objects: 1769, done.
remote: Counting objects: 100% (1769/1769), done.
remote: Compressing objects: 100% (1472/1472), done.
remote: Total 1769 (delta 352), reused 1058 (delta 262), pack-reused 0
Receiving objects: 100% (1769/1769), 3.65 MiB | 5.31 MiB/s, done.
Resolving deltas: 100% (352/352), done.

Change working directory, build and install application to the /srv/netdata directory.

$ cd /srv/netdata_installer && sudo ./netdata-installer.sh --dont-wait --dont-start-it  --disable-telemetry --install /srv
  ^
  |.-.   .-.   .-.   .-.   .  netdata                                        
  |   '-'   '-'   '-'   '-'   real-time performance monitoring, done right!  
  +----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+--->


  You are about to build and install netdata to your system.

  It will be installed at these locations:

   - the daemon     at /srv/netdata/usr/sbin/netdata
   - config files   in /srv/netdata/etc/netdata
   - web files      in /srv/netdata/usr/share/netdata
   - plugins        in /srv/netdata/usr/libexec/netdata
   - cache files    in /srv/netdata/var/cache/netdata
   - db files       in /srv/netdata/var/lib/netdata
   - log files      in /srv/netdata/var/log/netdata
   - pid file       at /srv/netdata/var/run/netdata.pid
   - logrotate file at /etc/logrotate.d/netdata

  This installer allows you to change the installation path.
  Press Control-C and run the same command with --help for help.

[...]

 --- Telemetry configuration --- 
[/srv/netdata_installer]# touch /srv/netdata/etc/netdata/.opt-out-from-anonymous-statistics 
 OK   

 --- Install netdata at system init --- 
Installing systemd service...
[/srv/netdata_installer]# cp system/netdata.service /lib/systemd/system/netdata.service 
 OK   

[/srv/netdata_installer]# systemctl daemon-reload 
 OK   

[/srv/netdata_installer]# systemctl enable netdata 
Created symlink /etc/systemd/system/multi-user.target.wants/netdata.service -> /lib/systemd/system/netdata.service.
 OK   

 --- Restarting netdata instance --- 

Stopping all netdata threads
[/srv/netdata_installer]# stop_all_netdata 
 OK   

Starting netdata using command 'systemctl start netdata'
[/srv/netdata_installer]# systemctl start netdata 
 OK   

 OK  netdata started! 

Downloading default configuration from netdata...
[/srv/netdata_installer]# curl -sSL --connect-timeout 10 --retry 3 http://localhost:19999/netdata.conf 
 OK   

[/srv/netdata_installer]# mv /srv/netdata/etc/netdata/netdata.conf.new /srv/netdata/etc/netdata/netdata.conf 
 OK   

 OK  New configuration saved for you to edit at /srv/netdata/etc/netdata/netdata.conf 

[/srv/netdata_installer]# chmod 0644 /srv/netdata/etc/netdata/netdata.conf 
 OK   

 --- Check KSM (kernel memory deduper) --- 

Memory de-duplication instructions

You have kernel memory de-duper (called Kernel Same-page Merging,
or KSM) available, but it is not currently enabled.

To enable it run:

    echo 1 >/sys/kernel/mm/ksm/run
    echo 1000 >/sys/kernel/mm/ksm/sleep_millisecs

If you enable it, you will save 40-60% of netdata memory.

 --- Check version.txt --- 
 --- Check apps.plugin --- 
 --- Copy uninstaller --- 
 --- Basic netdata instructions --- 

netdata by default listens on all IPs on port 19999,
so you can access it with:

  http://this.machine.ip:19999/

To stop netdata run:

  systemctl stop netdata

To start netdata run:

  systemctl start netdata

Uninstall script copied to: /srv/netdata/usr/libexec/netdata/netdata-uninstaller.sh

 --- Installing (but not enabling) the netdata updater tool --- 
Update script is located at /srv/netdata/usr/libexec/netdata/netdata-updater.sh

 --- Check if we must enable/disable the netdata updater tool --- 
You chose *NOT* to enable auto-update, removing any links to the updater from cron (it may have happened if you are reinstalling)

Did not find any cron entries to remove

 --- Wrap up environment set up --- 
Preparing .environment file
[/srv/netdata_installer]# chmod 0644 /srv/netdata/etc/netdata/.environment 
 OK   

Setting netdata.tarball.checksum to 'new_installation'

 --- We are done! --- 

  ^
  |.-.   .-.   .-.   .-.   .-.   .  netdata                          .-.   .-
  |   '-'   '-'   '-'   '-'   '-'   is installed and running now!  -'   '-'  
  +----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+--->

  enjoy real-time performance and health monitoring...

Notice, enable Kernel Same-page Merging if available.

Service will be started automatically.

$ sudo systemctl start netdata
● netdata.service - Real time performance monitoring
   Loaded: loaded (/lib/systemd/system/netdata.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2020-01-20 20:31:46 GMT; 1min 35s ago
  Process: 21203 ExecStartPre=/bin/mkdir -p /srv/netdata/var/cache/netdata (code=exited, status=0/SUCCESS)
  Process: 21204 ExecStartPre=/bin/chown -R netdata:netdata /srv/netdata/var/cache/netdata (code=exited, status=0/SUCCESS)
  Process: 21205 ExecStartPre=/bin/mkdir -p /srv/netdata/var/run/netdata (code=exited, status=0/SUCCESS)
  Process: 21206 ExecStartPre=/bin/chown -R netdata:netdata /srv/netdata/var/run/netdata (code=exited, status=0/SUCCESS)
 Main PID: 21207 (netdata)
    Tasks: 26 (limit: 242)
   Memory: 63.9M
   CGroup: /system.slice/netdata.service
           ├─21207 /srv/netdata/usr/sbin/netdata -P /srv/netdata/var/run/netdata/netdata.pid -D -W set global process scheduling policy keep -W set global OOM s
           ├─21274 bash /srv/netdata/usr/libexec/netdata/plugins.d/tc-qos-helper.sh 1
           ├─21280 /srv/netdata/usr/libexec/netdata/plugins.d/go.d.plugin 1
           └─21282 /srv/netdata/usr/libexec/netdata/plugins.d/apps.plugin 1

Update initial configuration.

$ curl http://localhost:19999/netdata.conf | sudo tee /srv/netdata/etc/netdata/netdata.conf 

Update process

I am not using an automatic updater, so there are two possible solutions.

The fist one is to use latest nightly.

$ sudo /srv/netdata/usr/libexec/netdata/netdata-updater.sh

The second one is to update already downloaded source code and rebuild an application.

$ sudo git -C /srv/netdata_installer pull --depth=1
                                                                                                                                                                              
$ cd /srv/netdata_installer && sudo ./netdata-installer.sh --dont-wait --disable-telemetry --install /srv                                                         

Additional information

Installation options.

$ cd /srv/netdata_installer && sudo ./netdata-installer.sh --help
  ^
  |.-.   .-.   .-.   .-.   .-.   .  netdata                          .-.   .-
  |   '-'   '-'   '-'   '-'   '-'   installer command line options  '   '-'  
  +----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+--->


USAGE: ./netdata-installer.sh [options]
       where options include:

  --install            Install netdata in . Ex. --install /opt will put netdata in /opt/netdata
  --dont-start-it            Do not (re)start netdata after installation
  --dont-wait                Run installation in non-interactive mode
  --auto-update or -u        Install netdata-updater in cron to update netdata automatically once per day
  --stable-channel           Use packages from GitHub release pages instead of GCS (nightly updates).
                             This results in less frequent updates.
  --nightly-channel          Use most recent nightly udpates instead of GitHub releases.
                             This results in more frequent updates.
  --disable-go               Disable installation of go.d.plugin.
  --enable-plugin-freeipmi   Enable the FreeIPMI plugin. Default: enable it when libipmimonitoring is available.
  --disable-plugin-freeipmi
  --disable-https            Explicitly disable TLS support
  --disable-dbengine         Explicitly disable DB engine support
  --enable-plugin-nfacct     Enable nfacct plugin. Default: enable it when libmnl and libnetfilter_acct are available.
  --disable-plugin-nfacct
  --enable-plugin-xenstat    Enable the xenstat plugin. Default: enable it when libxenstat and libyajl are available
  --disable-plugin-xenstat   Disable the xenstat plugin.
  --enable-backend-kinesis   Enable AWS Kinesis backend. Default: enable it when libaws_cpp_sdk_kinesis and libraries
                             it depends on are available.
  --disable-backend-kinesis
  --enable-backend-prometheus-remote-write Enable Prometheus remote write backend. Default: enable it when libprotobuf and
                             libsnappy are available.
  --disable-backend-prometheus-remote-write
  --enable-backend-mongodb   Enable MongoDB backend. Default: enable it when libmongoc is available.
  --disable-backend-mongodb
  --enable-lto               Enable Link-Time-Optimization. Default: enabled
  --disable-lto
  --disable-x86-sse          Disable SSE instructions. By default SSE optimizations are enabled.
  --zlib-is-really-here or
  --libs-are-really-here     If you get errors about missing zlib or libuuid but you know it is available, you might
                             have a broken pkg-config. Use this option to proceed without checking pkg-config.
  --disable-telemetry        Use this flag to opt-out from our anonymous telemetry progam.

Netdata will by default be compiled with gcc optimization -O2
If you need to pass different CFLAGS, use something like this:

  CFLAGS="<gcc options>" ./netdata-installer.sh [options]

If you also need to provide different LDFLAGS, use something like this:

  LDFLAGS="<extra ldflag options>" ./netdata-installer.sh [options]

or use the following if both LDFLAGS and CFLAGS need to be overriden:

  CFLAGS="<gcc options>" LDFLAGS="<extra ld options>" ./netdata-installer.sh [options]

For the installer to complete successfully, you will need these packages installed:

  gcc make autoconf automake pkg-config zlib1g-dev (or zlib-devel) uuid-dev (or libuuid-devel)

For the plugins, you will at least need:

  curl, bash v4+, python v2 or v3, node.js

Enjoy!