@cryptotaxi247 / netdata-1 / commits / 486ee8a1a

Initial release of new kickstart script. (#11764)

* Replace existing kickstart scripts with kickstart-ng. This change looks more complicated than it actually is due to git not sanely recognizing the rename. * Fix CI for new kickstart script. * Initial revision of install documentation. * Further documentation updates. * Even more documentation updates. * Fix telemetry event handling if neither curl nor wget are installed. * Remove dependence on `pgrep` for claiming. * Fix fatal error message handling. * Formally outline our support policy. * Updates to platform support doc. * Platform support doc updates. * Minor documentation updates. * Remove accidentally commited file from rebase process. * Apply suggestions from code review, part 1. Co-authored-by: Tina Luedtke <kickoke@users.noreply.github.com> * Made one-line installer consistent. * Apply suggestions from code review, part 2. * Update architecture list for static builds. * Restructure platform support doc so that things are clearer. Especially for cases of linking directly to the section on a specific support category. * Apply suggestions from code review, part 3. Co-authored-by: Tina Luedtke <kickoke@users.noreply.github.com> * Apply suggestions from code review, part 4 Co-authored-by: Tina Luedtke <kickoke@users.noreply.github.com> * Further updates to platform support document. * Further documentation updates. * Rework update documentation. Co-authored-by: Tina Luedtke <kickoke@users.noreply.github.com>

Austin S. Hemmelgarn committed Jan 18, 2022 at 08:30 UTC 486ee8a1a3d8538c01cb4e705a4304643122f59b
19 files changed +1414 -2816
.github/scripts/run-updater-check.sh
+1 -1
@@ -1,7 +1,7 @@
1 #!/bin/sh
2
3 echo ">>> Installing Netdata..."
4 -/netdata/packaging/installer/kickstart.sh --dont-wait --disable-telemetry || exit 1
4 +/netdata/packaging/installer/kickstart.sh --dont-wait --build-only --disable-telemetry || exit 1
5 echo ">>> Updating Netdata..."
6 export NETDATA_NIGHTLIES_BASEURL="http://localhost:8080/artifacts/" # Pull the tarball from the local web server.
7 /netdata/packaging/installer/netdata-updater.sh --not-running-from-cron --no-updater-self-update || exit 1
.github/workflows/build.yml
+2 -2
@@ -386,7 +386,7 @@ jobs:
386 - name: Verify that artifacts work with installer
387 env:
388 NETDATA_TARBALL_BASEURL: http://localhost:8080/artifacts
389 - run: packaging/installer/kickstart.sh --dont-start-it --disable-telemetry --dont-wait
389 + run: packaging/installer/kickstart.sh --build-only --dont-start-it --disable-telemetry --dont-wait
390 - name: Failure Notification
391 uses: rtCamp/action-slack-notify@v2
392 env:
@@ -427,7 +427,7 @@ jobs:
427 - name: Verify that artifacts work with installer
428 env:
429 NETDATA_TARBALL_BASEURL: http://localhost:8080/artifacts
430 - run: packaging/installer/kickstart-static64.sh --dont-start-it --disable-telemetry --dont-wait
430 + run: packaging/installer/kickstart.sh --static-only --dont-start-it --disable-telemetry
431 - name: Failure Notification
432 uses: rtCamp/action-slack-notify@v2
433 env:
packaging/DISTRIBUTIONS.md deleted
-258
@@ -1,258 +0,0 @@
1 -<!--
2 -title: "Netdata distribution support matrix"
3 -custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/DISTRIBUTIONS.md
4 --->
5 -
6 -# Netdata distribution support matrix
7 -
8 -![](https://raw.githubusercontent.com/netdata/netdata/master/web/gui/images/packaging-beta-tag.svg?sanitize=true)
9 -
10 -In the following table we've listed Netdata's official supported operating systems. We detail the distributions, flavors, and the level of support Netdata is currently capable to provide.
11 -
12 -The following table is a work in progress. We have concluded on the list of distributions
13 -that we currently supporting and we are working on documenting our current state so that our users
14 -have complete visibility over the range of support.
15 -
16 -**Legend**:
17 -
18 -- **Version**: Operating system version supported
19 -- **Family**: The family that the OS belongs to
20 -- **CI: Smoke Testing**: Smoke testing has been implemented on our CI, to prevent broken code reaching our users
21 -- **CI: Testing**: Testing has been implemented to prevent broken or problematic code reaching our users
22 -- **CD**: Continuous deployment support has been fully enabled for this operating system
23 -- **.DEB**: We provide a `.DEB` package for that particular operating system
24 -- **.RPM**: We provide a `.RPM` package for that particular operating system
25 -- **Installer**: Running netdata from source, using our installer, is working for this operating system
26 -- **Kickstart**: Kickstart installation is working fine for this operating system
27 -- **Kickstart64**: Kickstart static64 installation is working fine for this operating system
28 -- **Community**: This operating system receives community support, such as packaging maintainers, contributors, and so on
29 -
30 -## AMD64 Architecture
31 -
32 -| Version | Family | CI: Smoke testing | CI: Testing | CD | .DEB | .RPM | Installer | Kickstart | Kickstart64 | Community |
33 -|:---------------------------:|:--------:|:-----------------:|:-----------:|:--------:|:--------:|:--------:|:---------:|:---------:|:-----------:|:---------:|
34 -| 14.04.6 LTS (Trusty Tahr) | Ubuntu | &#10007; | &#63; | &#10007; | &#10007; | N/A | &#10004; | &#10004; | &#10004; | &#63; |
35 -| 16.04.6 LTS (Xenial Xerus) | Ubuntu | &#10004; | &#63; | &#10004; | &#10004; | N/A | &#10004; | &#10004; | &#10004; | &#63; |
36 -| 18.04.2 LTS (Bionic Beaver) | Ubuntu | &#10004; | &#63; | &#10004; | &#10004; | N/A | &#10004; | &#10004; | &#10004; | &#63; |
37 -| 19.10 (Eoan Ermine) Latest | Ubuntu | &#10004; | &#63; | &#10004; | &#10004; | N/A | &#10004; | &#10004; | &#10004; | &#63; |
38 -| Debian 8 (Jessie) | Debian | &#10004; | &#63; | &#10004; | &#10004; | N/A | &#10004; | &#10004; | &#10004; | &#63; |
39 -| Debian 9 (Stretch) | Debian | &#10004; | &#63; | &#10004; | &#10004; | N/A | &#10004; | &#10004; | &#10004; | &#63; |
40 -| Debian 10 (Buster) | Debian | &#10004; | &#63; | &#10004; | &#10004; | N/A | &#10004; | &#10004; | &#10004; | &#63; |
41 -| Versions 6.x | RHEL | &#10007; | &#63; | &#10007; | N/A | &#10004; | &#10004; | &#10004; | &#10004; | &#63; |
42 -| Versions 7.x | RHEL | &#10004; | &#63; | &#10004; | N/A | &#10004; | &#10004; | &#10004; | &#10004; | &#63; |
43 -| Versions 8.x | RHEL | &#63; | &#63; | &#63; | N/A | &#10007; | &#63; | &#63; | &#10004; | &#63; |
44 -| Fedora 30 | Fedora | &#10004; | &#63; | &#10004; | N/A | &#10004; | &#10004; | &#10004; | &#10004; | &#63; |
45 -| Fedora 31 | Fedora | &#10004; | &#63; | &#10004; | N/A | &#10004; | &#10004; | &#10004; | &#10004; | &#63; |
46 -| CentOS 6.x | Cent OS | &#10007; | &#63; | &#10007; | N/A | &#10007; | &#10004; | &#10004; | &#10004; | &#63; |
47 -| CentOS 7.x | Cent OS | &#10004; | &#63; | &#10004; | N/A | &#10004; | &#10004; | &#10004; | &#10004; | &#63; |
48 -| CentOS 8.x | Cent OS | &#63; | &#63; | &#63; | N/A | &#10007; | &#63; | &#63; | &#10004; | &#63; |
49 -| openSUSE Leap 15.1 | openSUSE | &#10004; | &#63; | &#10004; | N/A | &#10004; | &#10004; | &#10004; | &#10004; | &#63; |
50 -| openSUSE Tumbleweed | openSUSE | &#10004; | &#63; | &#63; | N/A | &#10007; | &#10004; | &#63; | &#10004; | &#63; |
51 -| SLES 11 | SLES | &#63; | &#63; | &#63; | N/A | &#10007; | &#63; | &#63; | &#10004; | &#63; |
52 -| SLES 12 | SLES | &#63; | &#63; | &#63; | N/A | &#10007; | &#63; | &#63; | &#10004; | &#63; |
53 -| SLES 15 | SLES | &#63; | &#63; | &#63; | N/A | &#10007; | &#63; | &#63; | &#10004; | &#63; |
54 -| Alpine | Alpine | &#10004; | &#63; | &#10007; | N/A | N/A | &#10004; | &#10004; | &#10004; | &#63; |
55 -| Arch Linux (latest) | Arch | &#10004; | &#63; | &#10007; | N/A | &#10007; | &#10004; | &#10004; | &#10004; | &#63; |
56 -| Gentoo Linux (latest) | Gentoo | &#63; | &#63; | &#10007; | N/A | N/A | &#10004; | &#10004; | &#10004; | &#10004; |
57 -| All other linux | Other | &#10007; | &#63; | &#63; | &#10007; | &#10007; | &#63; | &#63; | &#10004; | &#63; |
58 -
59 -## x86 Architecture
60 -
61 -| Version | Family | CI: Smoke testing | CI: Testing | CD | .DEB | .RPM | Installer | Kickstart | Kickstart64 | Community |
62 -|:---------------------------:|:--------:|:-----------------:|:-----------:|:--------:|:--------:|:--------:|:---------:|:---------:|:-----------:|:---------:|
63 -| 14.04.6 LTS (Trusty Tahr) | Ubuntu | &#10007; | &#63; | &#10007; | &#10007; | N/A | &#10004; | &#10004; | &#10007; | &#63; |
64 -| 16.04.6 LTS (Xenial Xerus) | Ubuntu | &#10007; | &#63; | &#10004; | &#10004; | N/A | &#10004; | &#10004; | &#10007; | &#63; |
65 -| 18.04.2 LTS (Bionic Beaver) | Ubuntu | &#10007; | &#63; | &#10004; | &#10004; | N/A | &#10004; | &#10004; | &#10007; | &#63; |
66 -| 19.10 (Enoan Ermine) Latest | Ubuntu | &#10007; | &#63; | &#10004; | &#10004; | N/A | &#10004; | &#10007; | &#10004; | &#63; |
67 -| Debian 8 (Jessie) | Debian | &#10007; | &#63; | &#10004; | &#10004; | N/A | &#10004; | &#10004; | &#10007; | &#63; |
68 -| Debian 9 (Stretch) | Debian | &#10007; | &#63; | &#10004; | &#10004; | N/A | &#10004; | &#10004; | &#10007; | &#63; |
69 -| Debian 10 (Buster) | Debian | &#10007; | &#63; | &#10004; | &#10004; | N/A | &#10004; | &#10004; | &#10007; | &#63; |
70 -| Versions 6.x | RHEL | &#10007; | &#63; | &#10007; | N/A | &#10004; | &#10004; | &#10004; | &#10007; | &#63; |
71 -| Versions 7.x | RHEL | &#10007; | &#63; | &#10004; | N/A | &#10007; | &#10004; | &#10004; | &#10007; | &#63; |
72 -| Versions 8.x | RHEL | &#63; | &#63; | &#63; | N/A | &#10007; | &#63; | &#63; | &#10004; | &#63; |
73 -| Fedora 30 | Fedora | &#10007; | &#63; | &#10004; | N/A | &#10007; | &#10004; | &#10004; | &#10007; | &#63; |
74 -| Fedora 31 | Fedora | &#10007; | &#63; | &#10007; | N/A | &#10007; | &#10007; | &#10007; | &#10007; | &#63; |
75 -| CentOS 6.x | Cent OS | &#10007; | &#63; | &#10007; | N/A | &#10007; | &#10004; | &#10004; | &#10007; | &#63; |
76 -| CentOS 7.x | Cent OS | &#10007; | &#63; | &#10004; | N/A | &#10007; | &#10004; | &#10004; | &#10007; | &#63; |
77 -| CentOS 8.x | Cent OS | &#63; | &#63; | &#63; | N/A | &#10007; | &#63; | &#63; | &#10004; | &#63; |
78 -| openSUSE Leap 15.1 | openSUSE | &#10007; | &#63; | &#10004; | N/A | &#10007; | &#10004; | &#10004; | &#10007; | &#63; |
79 -| openSUSE Tumbleweed | openSUSE | &#10007; | &#63; | &#63; | N/A | &#10007; | &#10004; | &#63; | &#10007; | &#63; |
80 -| SLES 11 | SLES | &#63; | &#63; | &#63; | N/A | &#10007; | &#63; | &#63; | &#10007; | &#63; |
81 -| SLES 12 | SLES | &#63; | &#63; | &#63; | N/A | &#10007; | &#63; | &#63; | &#10007; | &#63; |
82 -| SLES 15 | SLES | &#63; | &#63; | &#63; | N/A | &#10007; | &#63; | &#63; | &#10007; | &#63; |
83 -| Alpine | Alpine | &#10007; | &#63; | &#10007; | N/A | N/A | &#10004; | &#10004; | &#10007; | &#63; |
84 -| Arch Linux (latest) | Arch | &#10007; | &#63; | &#10007; | N/A | &#10007; | &#10004; | &#10004; | &#10007; | &#63; |
85 -| Gentoo Linux (latest) | Gentoo | &#63; | &#63; | &#10007; | N/A | N/A | &#10004; | &#10004; | &#10004; | &#10004; |
86 -| All other linux | Other | &#10007; | &#63; | &#63; | &#10007; | &#10007; | &#63; | &#63; | &#10007; | &#63; |
87 -
88 -## Supported functionalities across different distribution channels
89 -
90 -On the following section we try to depict what functionalities are available, across the different distribution channels.
91 -There are various limitations and problems we try to attend as we evolve and grow. Through this report we want to provide some clarity as to what is available and in what way. Of course we strive to deliver our full solution through all channels, but that may not be feasible yet for some cases.
92 -
93 -**Legend**:
94 -
95 -- **Auto-detect**: Depends on the programs package dependencies. If the required dependencies are covered during compile time, capability is enabled
96 -- **YES**: This flag implies that the functionality is available for that distribution channel
97 -- **NO**: Not available at the moment for that distribution channel at this time, but may be a work-in-progress effort from the Netdata team.
98 -- **At Runtime**: The given module or functionality is available and only requires configuration after install to enable it
99 -
100 -### Core functionality
101 -
102 -#### Core
103 -
104 -This is the base netdata capability, that includes basic monitoring, embedded web server, and so on.
105 -
106 -|make/make install|netdata-installer.sh|kickstart.sh|kickstart-static64.sh|Docker image|RPM packaging|DEB packaging|
107 -|:---------------:|:------------------:|:----------:|:-------------------:|:----------:|:-----------:|:-----------:|
108 -|YES|YES|YES|YES|YES|YES|YES|
109 -
110 -- **Flags/instructions to enable**: None
111 -- **Flags to disable from source**: None
112 -- **What packages required for auto-detect?**: `install-required-packages.sh netdata`
113 -
114 -#### DB Engine
115 -
116 -This is the brand new database engine capability of netdata. It is a mandatory facility required by netdata. Given it's special needs and dependencies though, it remains an optional facility so that users can enjoy netdata even when they cannot cover the dependencies or the H/W requirements.
117 -
118 -|make/make install|netdata-installer.sh|kickstart.sh|kickstart-static64.sh|Docker image|RPM packaging|DEB packaging|
119 -|:---------------:|:------------------:|:----------:|:-------------------:|:----------:|:-----------:|:-----------:|
120 -|Auto-detect|Auto-detect|YES|YES|YES|YES|YES|
121 -
122 -- **Flags/instructions to enable**: None
123 -- **Flags to disable from source**: `--disable-dbengine`
124 -- **What packages required for auto-detect?**: `openssl`, `libuv1`, `lz4`, `Judy`
125 -
126 -#### Encryption Support (HTTPS)
127 -
128 -This is Netdata's TLS capability that incorporates encryption on the web server and the APIs between parent and child
129 -nodes. Also a mandatory facility for Netdata, but remains optional for users who are limited or not interested in tight
130 -security
131 -
132 -|make/make install|netdata-installer.sh|kickstart.sh|kickstart-static64.sh|Docker image|RPM packaging|DEB packaging|
133 -|:---------------:|:------------------:|:----------:|:-------------------:|:----------:|:-----------:|:-----------:|
134 -|Auto-detect|Auto-detect|YES|YES|YES|YES|YES|
135 -
136 -- **Flags/instructions to enable**: None
137 -- **Flags to disable from source**: --disable-https
138 -- **What packages required for auto-detect?**: `openssl`
139 -
140 -### Libraries/optimizations
141 -
142 -#### JSON-C Support
143 -
144 -|make/make install|netdata-installer.sh|kickstart.sh|kickstart-static64.sh|Docker image|RPM packaging|DEB packaging|
145 -|:---------------:|:------------------:|:----------:|:-------------------:|:----------:|:-----------:|:-----------:|
146 -|Auto-detect|Auto-detect|Auto-detect|Auto-detect|NO|YES|YES|
147 -
148 -- **Flags/instructions to enable**: None
149 -- **Flags to disable from source**: --disable-jsonc
150 -- **What packages required for auto-detect?**: `json-c`
151 -
152 -#### Link time optimizations
153 -
154 -|make/make install|netdata-installer.sh|kickstart.sh|kickstart-static64.sh|Docker image|RPM packaging|DEB packaging|
155 -|:---------------:|:------------------:|:----------:|:-------------------:|:----------:|:-----------:|:-----------:|
156 -|Auto-detect|Auto-detect|Auto-detect|Auto-detect|Auto-detect|Auto-detect|Auto-detect|
157 -
158 -- **Flags/instructions to enable**: None
159 -- **Flags to disable from source**: --disable-lto
160 -- **What packages required for auto-detect?**: No package dependency, depends on GCC version
161 -
162 -### External plugins, built with netdata build tools
163 -
164 -#### FREEIPMI
165 -
166 -|make/make install|netdata-installer.sh|kickstart.sh|kickstart-static64.sh|Docker image|RPM packaging|DEB packaging|
167 -|:---------------:|:------------------:|:----------:|:-------------------:|:----------:|:-----------:|:-----------:|
168 -|Auto-detect|Auto-detect|Auto-detect|Auto-detect|YES|YES|YES|
169 -
170 -- **Flags/instructions to enable**: None
171 -- **Flags to disable from source**: --disable-plugin-freeipmi
172 -- **What packages required for auto-detect?**: `freeipmi-dev (or -devel)`
173 -
174 -#### NFACCT
175 -
176 -|make/make install|netdata-installer.sh|kickstart.sh|kickstart-static64.sh|Docker image|RPM packaging|DEB packaging|
177 -|:---------------:|:------------------:|:----------:|:-------------------:|:----------:|:-----------:|:-----------:|
178 -|Auto-detect|Auto-detect|Auto-detect|Auto-detect|NO|YES|YES|
179 -
180 -- **Flags/instructions to enable**: None
181 -- **Flags to disable from source**: --disable-plugin-nfacct
182 -- **What packages required for auto-detect?**: `libmnl-dev`, `libnetfilter_acct-dev`
183 -
184 -#### Xenstat
185 -
186 -|make/make install|netdata-installer.sh|kickstart.sh|kickstart-static64.sh|Docker image|RPM packaging|DEB packaging|
187 -|:---------------:|:------------------:|:----------:|:-------------------:|:----------:|:-----------:|:-----------:|
188 -|Auto-detect|Auto-detect|Auto-detect|Auto-detect|NO|NO|NO|
189 -
190 -- **Flags/instructions to enable**: None
191 -- **Flags to disable from source**: --disable-plugin-xenstat
192 -- **What packages required for auto-detect?**: `xen-dom0-libs-devel or xen-devel`, `yajl-dev or yajl-devel`
193 - Note: for cent-OS based systems you will need `centos-release-xen` repository to get xen-devel
194 -
195 -#### CUPS
196 -
197 -|make/make install|netdata-installer.sh|kickstart.sh|kickstart-static64.sh|Docker image|RPM packaging|DEB packaging|
198 -|:---------------:|:------------------:|:----------:|:-------------------:|:----------:|:-----------:|:-----------:|
199 -|Auto-detect|Auto-detect|Auto-detect|Auto-detect|NO|YES|YES|
200 -
201 -- **Flags/instructions to enable**: None
202 -- **Flags to disable from source**: --disable-plugin-cups
203 -- **What packages required for auto-detect?**: `cups-devel >= 1.7`
204 -
205 -#### FPING
206 -
207 -|make/make install|netdata-installer.sh|kickstart.sh|kickstart-static64.sh|Docker image|RPM packaging|DEB packaging|
208 -|:---------------:|:------------------:|:----------:|:-------------------:|:----------:|:-----------:|:-----------:|
209 -|At Runtime|At Runtime|At Runtime|At Runtime|At Runtime|At Runtime|At Runtime|
210 -
211 -- **Flags/instructions to enable**: ${INSTALL_PATH}/netdata/plugins.d/fping.plugin install
212 -- **Flags to disable from source**: None -- just dont install
213 -- **What packages required for auto-detect?**: None - only fping installed to start it up
214 -
215 -#### IOPING
216 -
217 -|make/make install|netdata-installer.sh|kickstart.sh|kickstart-static64.sh|Docker image|RPM packaging|DEB packaging|
218 -|:---------------:|:------------------:|:----------:|:-------------------:|:----------:|:-----------:|:-----------:|
219 -|At Runtime|At Runtime|At Runtime|At Runtime|At Runtime|At Runtime|At Runtime|
220 -
221 -- **Flags/instructions to enable**: ${INSTALL_PATH}/netdata/plugins.d/ioping.plugin install
222 -- **Flags to disable from source**: None -- just dont install
223 -- **What packages required for auto-detect?**: None - only ioping installed to start it up
224 -
225 -#### PERF
226 -
227 -|make/make install|netdata-installer.sh|kickstart.sh|kickstart-static64.sh|Docker image|RPM packaging|DEB packaging|
228 -|:---------------:|:------------------:|:----------:|:-------------------:|:----------:|:-----------:|:-----------:|
229 -|At Runtime|At Runtime|At Runtime|At Runtime|At Runtime|At Runtime|At Runtime|
230 -
231 -- **Flags/instructions to enable**: Inside netdata.conf, section `[Plugins]`, set `"perf = yes"`
232 -- **Flags to disable from source**: --disable-perf
233 -- **What packages required for auto-detect?**: None
234 -
235 -### Backends
236 -
237 -#### Prometheus remote write
238 -
239 -|make/make install|netdata-installer.sh|kickstart.sh|kickstart-static64.sh|Docker image|RPM packaging|DEB packaging|
240 -|:---------------:|:------------------:|:----------:|:-------------------:|:----------:|:-----------:|:-----------:|
241 -|Auto-detect|Auto-detect|Auto-detect|Auto-detect|NO|YES|YES|
242 -
243 -- **Flags/instructions to enable**: None
244 -- **Flags to disable from source**: --disable-backend-prometheus-remote-write
245 -- **What packages required for auto-detect?**: `snappy-devel`, `protobuf`, `protobuf-compiler`
246 -
247 -#### AWS Kinesis
248 -
249 -|make/make install|netdata-installer.sh|kickstart.sh|kickstart-static64.sh|Docker image|RPM packaging|DEB packaging|
250 -|:---------------:|:------------------:|:----------:|:-------------------:|:----------:|:-----------:|:-----------:|
251 -|Auto-detect|Auto-detect|Auto-detect|Auto-detect|NO|NO|NO|
252 -
253 -- **Flags/instructions to enable**: [Instructions for AWS
254 - Kinesis](https://learn.netdata.cloud/docs/agent/backends/aws_kinesis)
255 -- **Flags to disable from source**: --disable-backend-kinesis
256 -- **What packages required for auto-detect?**: `AWS SDK for C++`, `libcurl`, `libssl`, `libcrypto`
257 -
258 -[![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%2Fdocs%2Fpackaging%2FDISTRIBUTIONS&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)](<>)
packaging/PLATFORM_SUPPORT.md new
+175
@@ -0,0 +1,175 @@
1 +<!--
2 +title: "Netdata platform support policy"
3 +custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/PLATFORM_SUPPORT.md
4 +-->
5 +
6 +# Netdata platform support policy
7 +
8 +Netdata defines three tiers of official support:
9 +
10 +- [Core](#core)
11 +- [Intermediate](#intermediate)
12 +- [Community](#community)
13 +
14 +Each tier defines different guarantees for platforms in that tier, described below in the section about that tier.
15 +
16 +Additionally, we define two categories for special cases that we do not support:
17 +
18 +- [Third-party supported platforms](#third-party-supported-platforms)
19 +- [Previously supported platforms](#previously-supported-platforms)
20 +
21 +These two categories are explained further below.
22 +
23 +Any platforms not listed in any of these categories may or may not work.
24 +
25 +The following table shows a general outline of the various support tiers and categories.
26 +
27 +| | Bug Support | Guaranteed Configurations | CI Coverage | Native Packages | Static Build Support |
28 +| - | ----------- | ------------------------- | ----------- | --------------- | -------------------- |
29 +| Core | High priority | Everything but rare edge cases | Full | Yes, if we can provide them | Full |
30 +| Intermediate | Normal priority | Common cases | Partial (CI mostly equivalent to **Core**, but possibly with some gaps, and not required to pass) | Possibly | Full |
31 +| Community | Best Effort | Default only | None | No | Best Effort |
32 +| Third-party Supported | Users directed to platform maintainers | None | None | No | Best Effort |
33 +| Previously Supported | Users asked to upgrade | None | None | Yes, but only already published versions | Best Effort |
34 +
35 +- ‘Bug Support’: How we handle of platform-specific bugs.
36 +- ‘Guaranteed Configurations’: Which runtime configurations for the agent we try to guarantee will work with minimal effort from users.
37 +- ‘CI Coverage’: What level of coverage we provide for the platform in CI.
38 +- ‘Native Packages’: Whether we provide native packages for the system package manager for the platform.
39 +- ‘Static Build Support’: How well our static builds are expected to work on the platform.
40 +
41 +## Currently supported platforms
42 +
43 +### Core
44 +
45 +Platforms in the core support tier are our top priority. They are covered rigorously in our CI, usually
46 +include official binary packages, and any platform-specific bugs receive a high priority. From the perspective
47 +of our developers, platforms in the core support tier _must_ work, with almost no exceptions. Our [static
48 +builds](#static-builds) are expected to work on these platforms if available. Source-based installs are expected
49 +to work on these platforms with minimal user effort.
50 +
51 +| Platform | Version | Official Native Packages | Notes |
52 +| -------- | ------- | ------------------------ | ----- |
53 +| Alpine Linux | 3.15 | No | The latest release of Alpine Linux is guaranteed to remain at **Core** tier due to usage for our Docker images |
54 +| CentOS | 7.x | x86\_64 | |
55 +| CentOS | 8.x | x86\_64, AArch64 | Includes Rocky Linux 8.x support, which will be our primary platform long-term for RHEL compatiblitiy |
56 +| Docker | 19.03 or newer | x86\_64, i386, ARMv7, AArch64, POWER8+ | See our [Docker documentation](/packaging/docker/README.md) for more info on using Netdata on Docker |
57 +| Debian | 11.x | x86\_64, i386, ARMv7, AArch64 | |
58 +| Debian | 10.x | x86\_64, i386, ARMv7, AArch64 | |
59 +| Debian | 9.x | x86\_64, i386, ARMv7, AArch64 | |
60 +| Fedora | 35 | x86\_64, ARMv7, AArch64 | |
61 +| Fedora | 34 | x86\_64, ARMv7, AArch64 | |
62 +| openSUSE | Leap 15.3 | x86\_64, AArch64 | |
63 +| Oracle Linux | 8.x | x86\_64, AArch64 | |
64 +| Red Hat Enterprise Linux | 7.x | x86\_64 | |
65 +| Red Hat Enterprise Linux | 8.x | x86\_64, AArch64 | |
66 +| Ubuntu | 21.10 | x86\_64, i386, ARMv7, AArch64 | |
67 +| Ubuntu | 20.04 | x86\_64, i386, ARMv7, AArch64 | |
68 +| Ubuntu | 18.04 | x86\_64, i386, ARMv7, AArch64 | |
69 +
70 +### Intermediate
71 +
72 +Platforms in the intermediate support tier are those which Netdata wants to support, but cannot justify core level
73 +support for. They are also covered in CI, but not as rigorously as the core tier. They may or may not include
74 +official binary packages, and any platform-specific bugs receive a normal priority. Generally, we will add new
75 +platforms that we officially support ourselves to the intermediate tier. Our [static builds](#static-builds) are
76 +expected to work on these platforms if available. Source-based installs are expected to work on these platforms
77 +with minimal user effort.
78 +
79 +| Platform | Version | Official Native Packages | Notes |
80 +| -------- | ------- | ------------------------ | ----- |
81 +| Alpine Linux | 3.14 | No | |
82 +| Alpine Linux | 3.13 | No | |
83 +| Alpine Linux | 3.12 | No | |
84 +| Arch Linux | Latest | No | We officially recommend the community packages available for Arch Linux |
85 +| Manjaro Linux | Latest | No | We officially recommend the community packages available for Arch Linux |
86 +
87 +### Community
88 +
89 +Platforms in the community support tier are those which are primarily supported by community contributors. They may
90 +receive some support from Netdata, but are only a best-effort affair. When a community member makes a contribution
91 +to add support for a new platform, that platform generally will start in this tier. Our [static builds](#static-builds)
92 +are expected to work on these platforms if available. Source-based installs are usually expected to work on these
93 +platforms, but may require some extra effort from users.
94 +
95 +| Platform | Version | Official Native Packages | Notes |
96 +| -------- | ------- | ------------------------ | ----- |
97 +| Alpine Linux | Edge | No | |
98 +| Clear Linux | Latest | No | |
99 +| Debian | Sid | No | |
100 +| Fedora | Rawhide | No | |
101 +| FreeBSD | 13-STABLE | No | Netdata is included in the FreeBSD Ports Tree, and this is the recommended installation method on FreeBSD |
102 +| FreeBSD | 12-STABLE | No | Netdata is included in the FreeBSD Ports Tree, and this is the recommended installation method on FreeBSD |
103 +| Gentoo | Latest | No | |
104 +| macOS | 12 | No | Planned for **Core** tier support. Currently only works for Intel-based hardware. Requires Homebrew for dependencies |
105 +| macOS | 11 | No | Planned for **Core** tier support. Currently only works for Intel-based hardware. Requires Homebrew for dependencies. |
106 +| macOS | 10.15 | No | Planned for **Core** tier support. Requires Homebrew for dependencies. |
107 +| openSUSE | Tumbleweed | No | |
108 +
109 +## Third-party supported platforms
110 +
111 +Some platform maintainers actively support Netdata on their platforms even though we do not provide official
112 +support. Third-party supported platforms may work, but the experience of using Netdata on such platforms is not
113 +something we can guarantee. When you use an externally supported platform and report a bug, we will either ask
114 +you to reproduce the issue on a supported platform or submit a support request directly to the platform maintainers.
115 +
116 +Currently, we know of the following platforms having some degree of third-party support for Netdata:
117 +
118 +- NixOS: Netdata’s official installation methods do not support NixOS, but the NixOS maintainers provide their
119 + own Netdata packages for their platform.
120 +- Rockstor: Rockstor provides support for a Netdata add-on for their NAS platform. The Rockstor community and
121 + developers are the primary source for support on their platform.
122 +
123 +## Previously supported platforms
124 +
125 +As platforms become end of life upstream, Netdata will stop officially supporting them. We will not actively break
126 +things on these platforms, but we will also not make any effort to ensure that things keep working on them either.
127 +If you report a bug on a previously supported platforms, we will ask you to reproduce the issue on a currently
128 +supported platform. If the issue is not reproducible, it will be closed.
129 +
130 +We consider a platform to be end of life when the upstream maintainers of that platform stop providing official
131 +support for it themselves, or when that platform transitions into an ‘extended security maintenance’ period.
132 +Platforms that meet these criteria will be immediately transitioned to the **Previously Supported** category,
133 +with no prior warning from Netdata and no deprecation notice, unlike those being dropped for technical reasons,
134 +as our end of support should already coincide with the end of the normal support lifecycle for that platform.
135 +
136 +On occasion, we may also drop support for a platform due to technical limitations. In such cases, this will be
137 +announced in the release notes of the next stable release with a deprecation notice. The platform will be supported
138 +for _that release_, and will be removed from nightlies some time before the next release after that one.
139 +
140 +This is a list of platforms that we have supported in the recent past but no longer officially support:
141 +
142 +| Platform | Version | Notes |
143 +| -------- | ------- | ----- |
144 +| Alpine Linux | 3.11 | EOL as of 2021-11-01 |
145 +| Alpine Linux | 3.10 | EOL as of 2021-05-01 |
146 +| Fedora | 33 | EOL as of 2021-11-30 |
147 +| Fedora | 32 | EOL as of 2021-05-25 |
148 +| FreeBSD | 11-STABLE | EOL as of 2021-10-30 |
149 +| openSUSE | Leap 15.2 | EOL as of 2021-12-01 |
150 +| openSUSE | Leap 15.1 | EOL as of 2021-01-31 |
151 +| Ubuntu | 21.04 | EOL as of 2022-01-01 |
152 +| Ubuntu | 20.10 | EOL as of 2021-07-22 |
153 +| Ubuntu | 16.04 | EOL as of 2021-04-02 |
154 +
155 +## Static builds
156 +
157 +The Netdata team provides static builds of Netdata for Linux systems with a selection of common CPU
158 +architectures. These static builds are largely self-contained, only requiring a a POSIX-compliant shell on the target
159 +system to provide their basic functionality. Static builds are built in an Alpine Linux environment using musl. This
160 +means that they generally do not support non-local username mappings or exotic name resolution configurations.
161 +
162 +We currently provide static builds for the following CPU architectures:
163 +
164 +- 32-bit x86
165 +- 64-bit x86
166 +- ARMv7
167 +- AArch64
168 +- POWER8+
169 +
170 +## Platform-specific support considerations
171 +
172 +### IPMI
173 +
174 +Our IPMI collector is based on FreeIPMI. Due to upstream limitations in FreeIPMI, we are unable to support our
175 +IPMI collector on POWER-based hardware.
packaging/installer/README.md
+13 -36
@@ -11,9 +11,7 @@ Netdata is a monitoring agent designed to run on all your systems: physical and
11 IoT/edge devices. Netdata runs on Linux, FreeBSD, macOS, Kubernetes, Docker, and all their derivatives.
12
13 The best way to install Netdata is with our [**automatic one-line installation
14 -script**](#automatic-one-line-installation-script), which works with all Linux distributions and macOS environments, or our [**.deb/rpm
15 -packages**](/packaging/installer/methods/packages.md), which seamlessly install with your distribution's package
16 -manager.
14 +script**](#automatic-one-line-installation-script), which works with all Linux distributions and most macOS environments.
15
16 If you want to install Netdata with Docker, on a Kubernetes cluster, or a different operating system, see [Have a
17 different operating system, or want to try another
@@ -36,24 +34,18 @@ _actively_ contributing to Netdata's future.
34
35 This method is fully automatic on all Linux distributions, including Ubuntu, Debian, Fedora, CentOS, and others, as well as on mac OS environments.
36
39 -To install Netdata from source, including all dependencies required to connect to Netdata Cloud, and get _automatic
40 -nightly updates_, run the following as your normal user:
41 -
42 -**Linux**
37 +To install Netdata, including all dependencies required to connect to Netdata Cloud, and get _automatic nightly
38 +updates_, run the following as your normal user:
39
40 ```bash
45 -bash <(curl -Ss https://my-netdata.io/kickstart.sh)
41 +wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh
42 ```
43
48 -**macOS**
49 -
50 -```bash
51 -bash <(curl -Ss https://my-netdata.io/kickstart.sh) --install /usr/local/
52 -```
44 +This script will preferentially use native DEB/RPM packages if we provide them for your platform.
45
46 To see more information about this installation script, including how to disable automatic updates, get nightly vs.
47 stable releases, or disable anonymous statistics, see the [`kickstart.sh` method
56 -page](/packaging/installer/methods/kickstart.md).
48 +page](/packaging/installer/methods/kickstart.md).
49
50 Scroll down for details about [automatic updates](#automatic-updates) or [nightly vs. stable
51 releases](#nightly-vs-stable-releases).
@@ -71,9 +63,8 @@ external databases, and more.
63
64 ## Have a different operating system, or want to try another method?
65
74 -Netdata works on many different operating systems, each with a few possible installation methods. To see the full list
75 -of approved methods for each operating system/version we support, see our [distribution
76 -matrix](/packaging/DISTRIBUTIONS.md).
66 +Netdata works on many different platforms. To see all supported platforms, check out our [platform support
67 +policy](/packaging/PLATFORM_SUPPORT.md).
68
69 Below, you can find a few additional installation methods, followed by separate instructions for a variety of unique
70 operating systems.
@@ -87,27 +78,19 @@ operating systems.
78 svg="linux" />
79 <InstallBox
80 to="/docs/agent/packaging/docker"
90 - os="Run with Docker"
81 + os="Run with Docker"
82 svg="docker" />
83 <InstallBox
84 to="/docs/agent/packaging/installer/methods/kubernetes"
94 - os="Deploy on Kubernetes"
85 + os="Deploy on Kubernetes"
86 svg="kubernetes" />
87 <InstallBox
88 to="/docs/agent/packaging/installer/methods/macos"
98 - os="Install on macOS"
89 + os="Install on macOS"
90 svg="macos" />
100 - <InstallBox
101 - to="/docs/agent/packaging/installer/methods/packages"
102 - os="Linux with .deb/.rpm packages"
103 - svg="linux" />
104 - <InstallBox
105 - to="/docs/agent/packaging/installer/methods/kickstart-64"
106 - os="Linux with static 64-bit binary"
107 - svg="linux" />
91 <InstallBox
92 to="/docs/agent/packaging/installer/methods/manual"
110 - os="Linux from Git"
93 + os="Linux from Git"
94 svg="linux" />
95 <InstallBox
96 to="/docs/agent/packaging/installer/methods/source"
@@ -128,7 +111,7 @@ option when you install or update Netdata using the [automatic one-line installa
111 script](#automatic-one-line-installation-script).
112
113 ```bash
131 -bash <(curl -Ss https://my-netdata.io/kickstart.sh) --no-updates
114 +wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --no-updates
115 ```
116
117 With automatic updates disabled, you can choose exactly when and how you [update
@@ -184,9 +167,6 @@ If you're running an older Linux distribution or one that has reached EOL, such
167 versions of OpenSSL cannot perform [hostname validation](https://wiki.openssl.org/index.php/Hostname_validation), which
168 helps securely encrypt SSL connections.
169
187 -We recommend you reinstall Netdata with a [static build](/packaging/installer/methods/kickstart-64.md), which uses an
188 -up-to-date version of OpenSSL with hostname validation enabled.
189 -
170 If you choose to continue using the outdated version of OpenSSL, your node will still connect to Netdata Cloud, albeit
171 with hostname verification disabled. Without verification, your Netdata Cloud connection could be vulnerable to
172 man-in-the-middle attacks.
@@ -230,9 +210,6 @@ We've received reports from the community about issues with running the `kicksta
210 a distribution-installed version of OpenSSL and a manually-installed local version. The Agent's installer cannot handle
211 both.
212
233 -We recommend you install Netdata with the [static binary](/packaging/installer/methods/kickstart-64.md) to avoid the
234 -issue altogether. Or, you can manually remove one version of OpenSSL to remove the conflict.
235 -
213 ### Clang compiler on Linux
214
215 Our current build process has some issues when using certain configurations of the `clang` C compiler on Linux. See [the
packaging/installer/REINSTALL.md
+1 -33
@@ -9,10 +9,6 @@ custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/instal
9 In certain situations, such as needing to enable a feature or troubleshoot an issue, you may need to reinstall the
10 Netdata Agent on your node.
11
12 -Before you try reinstalling Netdata, figure out which [installation method you
13 -used](/packaging/installer/UPDATE.md#determine-which-installation-method-you-used) if you do not already know. This will
14 -determine the reinstallation method.
15 -
12 ## One-line installer script (`kickstart.sh`)
13
14 Run the one-line installer script with the `--reinstall` parameter to reinstall the Netdata Agent. This will preserve
@@ -25,35 +21,7 @@ used, read the contents of the `.environment` file and look for a `REINSTALL_OPT
21 optional parameters.
22
23 ```bash
28 -bash <(curl -Ss https://my-netdata.io/kickstart.sh) --reinstall
29 -```
30 -
31 -## `.deb` or `.rpm` packages
32 -
33 -If you installed Netdata with [`.deb` or `.rpm` packages](/packaging/installer/methods/packages.md), use your
34 -distribution's package manager to reinstall Netdata. Any custom settings present in your Netdata configuration directory
35 -(typically at `/etc/netdata`) persists during this process.
36 -
37 -```bash
38 -apt-get install --reinstall netdata # Ubuntu/Debian
39 -dnf reinstall netdata # Fedora/RHEL
40 -yum reinstall netdata # CentOS
41 -zypper in -f netdata # openSUSE
42 -```
43 -
44 -## Pre-built static binary for 64-bit systems (`kickstart-static64.sh`)
45 -
46 -Run the one-line installer script with the `--reinstall` parameter to reinstall the Netdata Agent. This will preserve
47 -any [user configuration](/docs/configure/nodes.md) in `netdata.conf` or other files.
48 -
49 -If you used any [optional
50 -parameters](/packaging/installer/methods/kickstart-64.md#optional-parameters-to-alter-your-installation) during
51 -initial installation, you need to pass them to the script again during reinstallation. If you cannot remember which
52 -options you used, read the contents of the `.environment` file and look for a `REINSTALL_OPTIONS` line. This line
53 -contains a list of optional parameters.
54 -
55 -```bash
56 -bash <(curl -Ss https://my-netdata.io/kickstart-static64.sh) --reinstall
24 +wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --reinstall
25 ```
26
27 ## Troubleshooting
packaging/installer/UPDATE.md
+18 -51
@@ -23,76 +23,43 @@ icon in the local Agent dashboard's top navigation. This modal informs you wheth
23 If you are not sure where your Netdata config directory is, see the [configuration doc](/docs/configure/nodes.md). In
24 most installations, this is `/etc/netdata`.
25
26 -Use `cd` to navigate to the Netdata config directory, then use `ls -a` to look for a file called `.environment`.
27 -
28 -- If the `.environment` file _does not_ exist, reinstall with your [package manager](#deb-or-rpm-packages).
29 -- If the `.environment` file _does_ exist, check its contents with `less .environment`.
30 - - If `IS_NETDATA_STATIC_BINARY` is `"yes"`, update using the [pre-built static
31 - binary](#pre-built-static-binary-for-64-bit-systems-kickstart-static64sh).
32 - - In all other cases, update using the [one-line installer script](#one-line-installer-script-kickstartsh).
26 +Use `cd` to navigate to the Netdata config directory, then use `ls -a` to look for a file called `.install-type`.
27 +
28 +- If the `.install-type` file doex not exist, look for a file in the same directory called `.environment`.
29 + - If the `.environment` file does not exist, you probably installed Netdata using your system package manager
30 + and should update it the same way you would run updates on the system itself.
31 + - If the `.environment` file does exist, then our [regular update method](#updates-for-most-systems) should
32 + work correctly.
33 +- If the `.install-type` file does exist, check it’s contents with `cat .install-type`.
34 + - If the `INSTALL_TYPE` key has a value of `custom`, you probably installed Netdata using your system
35 + package manager and should update it the same way you would run updates on the system itself.
36 + - If the `INSTALL_TYPE` key has a value of `oci`, the install is from a Docker image.
37 + - Otherwise, the install should work with our [regular update method](#updates-for-most-systems).
38
39 Next, use the appropriate method to update the Netdata Agent:
40
36 -- [One-line installer script (`kickstart.sh`)](#one-line-installer-script-kickstartsh)
37 -- [`.deb` or `.rpm` packages](#deb-or-rpm-packages)
38 -- [Pre-built static binary for 64-bit systems (`kickstart-static64.sh`)](#pre-built-static-binary-for-64-bit-systems-kickstart-static64sh)
41 +- [Updates for most systems](#updates-for-most-systems)
42 - [Docker](#docker)
43 - [macOS](#macos)
44 - [Manual installation from Git](#manual-installation-from-git)
45
43 -## One-line installer script (`kickstart.sh`)
44 -
45 -If you installed Netdata using our one-line automatic installation script, run it again to update Netdata. Any custom
46 -settings present in your Netdata configuration directory (typically at `/etc/netdata`) persists during this process.
46 +## Updates for most systems
47
48 -This script will automatically run the update script that was installed as part of the initial install (even if
49 -you disabled automatic updates) and preserve the existing install options you specified.
48 +In most cases, you can update netdata using our one-line installation script. This script will automatically
49 +run the update script that was installed as part of the initial install (even if you disabled automatic updates)
50 +and preserve the existing install options you specified.
51
52 If you installed Netdata using an installation prefix, you will need to add an `--install` option specifying
53 that prefix to this command to make sure it finds Netdata.
54
55 ```bash
55 -bash <(curl -Ss https://my-netdata.io/kickstart.sh)
56 +wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh
57 ```
58
59 > ❗ If the above command fails, you can [reinstall
60 > Netdata](/packaging/installer/REINSTALL.md#one-line-installer-script-kickstartsh) to get the latest version. This also
61 > preserves your [configuration](/docs/configure/nodes.md) in `netdata.conf` or other files.
62
62 -## `.deb` or `.rpm` packages
63 -
64 -If you installed Netdata with [`.deb` or `.rpm` packages](/packaging/installer/methods/packages.md), use your
65 -distribution's package manager to update Netdata. Any custom settings present in your Netdata configuration directory
66 -(typically at `/etc/netdata`) persists during this process.
67 -
68 -Your package manager grabs a new package from our hosted repository, updates the Netdata Agent, and restarts it.
69 -
70 -```bash
71 -apt-get install netdata # Ubuntu/Debian
72 -dnf install netdata # Fedora/RHEL
73 -yum install netdata # CentOS
74 -zypper in netdata # openSUSE
75 -```
76 -
77 -> You may need to escalate privileges using `sudo`.
78 -
79 -## Pre-built static binary for 64-bit systems (`kickstart-static64.sh`)
80 -
81 -If you installed Netdata using the pre-built static binary, run the `kickstart-static64.sh` script again to update
82 -Netdata. Any custom settings present in your Netdata configuration directory (typically at `/etc/netdata`) persists
83 -during this process.
84 -
85 -This script will automatically run the update script that was installed as part of the initial install (even if
86 -you disabled automatic updates) and preserve the existing install options you specified.
87 -
88 -```bash
89 -bash <(curl -Ss https://my-netdata.io/kickstart-static64.sh)
90 -```
91 -
92 -> ❗ If the above command fails, you can [reinstall
93 -> Netdata](/packaging/installer/REINSTALL.md#pre-built-static-binary-for-64-bit-systems-kickstart-static64sh) to get the
94 -> latest version. This also preserves your [configuration](/docs/configure/nodes.md) in `netdata.conf` or other files.
95 -
63 ## Docker
64
65 Docker-based installations do not update automatically. To update an Netdata Agent running in a Docker container, you
packaging/installer/kickstart-ng.sh deleted
-1362
@@ -1,1362 +0,0 @@
1 -#!/bin/sh
2 -#
3 -# SPDX-License-Identifier: GPL-3.0-or-later
4 -
5 -# ======================================================================
6 -# Constants
7 -
8 -KICKSTART_OPTIONS="${*}"
9 -PACKAGES_SCRIPT="https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/install-required-packages.sh"
10 -PATH="${PATH}:/usr/local/bin:/usr/local/sbin"
11 -REPOCONFIG_URL_PREFIX="https://packagecloud.io/netdata/netdata-repoconfig/packages"
12 -REPOCONFIG_VERSION="1-1"
13 -TELEMETRY_URL="https://posthog.netdata.cloud/capture/"
14 -START_TIME="$(date +%s)"
15 -
16 -# ======================================================================
17 -# Defaults for environment variables
18 -
19 -SELECTED_INSTALL_METHOD="none"
20 -INSTALL_TYPE="unknown"
21 -INSTALL_PREFIX=""
22 -NETDATA_AUTO_UPDATES="1"
23 -NETDATA_CLAIM_ONLY=0
24 -NETDATA_CLAIM_URL="https://app.netdata.cloud"
25 -NETDATA_DISABLE_CLOUD=0
26 -NETDATA_ONLY_BUILD=0
27 -NETDATA_ONLY_NATIVE=0
28 -NETDATA_ONLY_STATIC=0
29 -NETDATA_REQUIRE_CLOUD=1
30 -RELEASE_CHANNEL="nightly"
31 -
32 -NETDATA_DISABLE_TELEMETRY="${DO_NOT_TRACK:-0}"
33 -NETDATA_TARBALL_BASEURL="${NETDATA_TARBALL_BASEURL:-https://storage.googleapis.com/netdata-nightlies}"
34 -NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS:-""}"
35 -TELEMETRY_API_KEY="${NETDATA_POSTHOG_API_KEY:-mqkwGT0JNFqO-zX2t0mW6Tec9yooaVu7xCBlXtHnt5Y}"
36 -
37 -if [ ! -t 1 ]; then
38 - INTERACTIVE=0
39 -else
40 - INTERACTIVE=1
41 -fi
42 -
43 -# ======================================================================
44 -# Usage info
45 -
46 -usage() {
47 - cat << HEREDOC
48 -USAGE: kickstart.sh [options]
49 - where options include:
50 -
51 - --non-interactive Do not prompt for user input. (default: prompt if there is a controlling terminal)
52 - --interactive Prompt for user input even if there is no controlling terminal.
53 - --dont-start-it Do not start the agent by default (only for static installs or local builds)
54 - --stable-channel Install a stable version instead of a nightly build (default: install a nightly build)
55 - --nightly-channel Install a nightly build instead of a stable version
56 - --no-updates Do not enable automatic updates (default: enable automatic updates)
57 - --auto-update Enable automatic updates.
58 - --disable-telemetry Opt-out of anonymous statistics.
59 - --native-only Only install if native binary packages are available.
60 - --static-only Only install if a static build is available.
61 - --build-only Only install using a local build.
62 - --reinstall Explicitly reinstall instead of updating any existing install.
63 - --reinstall-even-if-unsafe Even try to reinstall if we don't think we can do so safely (implies --reinstall).
64 - --disable-cloud Disable support for Netdata Cloud (default: detect)
65 - --require-cloud Only install if Netdata Cloud can be enabled. Overrides --disable-cloud.
66 - --install <path> Specify an installation prefix for local builds (default: autodetect based on system type).
67 - --claim-token Use a specified token for claiming to Netdata Cloud.
68 - --claim-rooms When claiming, add the node to the specified rooms.
69 - --claim-only If there is an existing install, only try to claim it, not update it.
70 - --claim-* Specify other options for the claiming script.
71 - --no-cleanup Don't do any cleanup steps. This is intended to help with debugging the installer.
72 -
73 -Additionally, this script may use the following environment variables:
74 -
75 - TMPDIR: Used to specify where to put temporary files. On most systems, the default we select
76 - automatically should be fine. The user running the script needs to both be able to
77 - write files to the temporary directory, and run files from that location.
78 - ROOTCMD: Used to specify a command to use to run another command with root privileges if needed. By
79 - default we try to use sudo, doas, or pkexec (in that order of preference), but if
80 - you need special options for one of those to work, or have a different tool to do
81 - the same thing on your system, you can specify it here.
82 - DO_NOT_TRACK If set to a value other than 0, behave as if \`--disable-telemetry\` was specified.
83 - NETDATA_INSTALLER_OPTIONS: Specifies extra options to pass to the static installer or local build script.
84 -
85 -HEREDOC
86 -}
87 -
88 -# ======================================================================
89 -# Telemetry functions
90 -
91 -telemetry_event() {
92 - if [ "${NETDATA_DISABLE_TELEMETRY}" -eq 1 ]; then
93 - return 0
94 - fi
95 -
96 - now="$(date +%s)"
97 - total_duration="$((now - START_TIME))"
98 -
99 - if [ -e "/etc/os-release" ]; then
100 - eval "$(grep -E "^(NAME|ID|ID_LIKE|VERSION|VERSION_ID)=" < /etc/os-release | sed 's/^/HOST_/')"
101 - fi
102 -
103 - if [ -z "${HOST_NAME}" ] || [ -z "${HOST_VERSION}" ] || [ -z "${HOST_ID}" ]; then
104 - if [ -f "/etc/lsb-release" ]; then
105 - DISTRIB_ID="unknown"
106 - DISTRIB_RELEASE="unknown"
107 - DISTRIB_CODENAME="unknown"
108 - eval "$(grep -E "^(DISTRIB_ID|DISTRIB_RELEASE|DISTRIB_CODENAME)=" < /etc/lsb-release)"
109 - if [ -z "${HOST_NAME}" ]; then HOST_NAME="${DISTRIB_ID}"; fi
110 - if [ -z "${HOST_VERSION}" ]; then HOST_VERSION="${DISTRIB_RELEASE}"; fi
111 - if [ -z "${HOST_ID}" ]; then HOST_ID="${DISTRIB_CODENAME}"; fi
112 - fi
113 - fi
114 -
115 - KERNEL_NAME="$(uname -s)"
116 -
117 - if [ "${KERNEL_NAME}" = FreeBSD ]; then
118 - TOTAL_RAM="$(sysctl -n hw.physmem)"
119 - elif [ "${KERNEL_NAME}" = Darwin ]; then
120 - TOTAL_RAM="$(sysctl -n hw.memsize)"
121 - elif [ -r /proc/meminfo ]; then
122 - TOTAL_RAM="$(grep -F MemTotal /proc/meminfo | cut -f 2 -d ':' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | cut -f 1 -d ' ')"
123 - TOTAL_RAM="$((TOTAL_RAM * 1024))"
124 - fi
125 -
126 - if [ -f /etc/machine-id ]; then
127 - DISTINCT_ID="$(cat /etc/machine-id)"
128 - elif command -v uuidgen > /dev/null 2>&1; then
129 - DISTINCT_ID="$(uuidgen)"
130 - else
131 - DISTINCT_ID="null"
132 - fi
133 -
134 - REQ_BODY="$(cat << EOF
135 -{
136 - "api_key": "${TELEMETRY_API_KEY}",
137 - "event": "${1}",
138 - "properties": {
139 - "distinct_id": "${DISTINCT_ID}",
140 - "event_source": "agent installer",
141 - "\$current_url": "agent installer",
142 - "\$pathname": "netdata-installer",
143 - "\$host": "installer.netdata.io",
144 - "\$ip": "127.0.0.1",
145 - "script_variant": "kickstart-ng",
146 - "error_code": "${3}",
147 - "error_message": "${2}",
148 - "install_options": "${KICKSTART_OPTIONS}",
149 - "total_runtime": "${total_duration}",
150 - "selected_install_method": "${SELECTED_INSTALL_METHOD}",
151 - "netdata_release_channel": "${RELEASE_CHANNEL:-null}",
152 - "netdata_install_type": "${INSTALL_TYPE}",
153 - "host_os_name": "${HOST_NAME:-unknown}",
154 - "host_os_id": "${HOST_ID:-unknown}",
155 - "host_os_id_like": "${HOST_ID_LIKE:-unknown}",
156 - "host_os_version": "${HOST_VERSION:-unknown}",
157 - "host_os_version_id": "${HOST_VERSION_ID:-unknown}",
158 - "system_kernel_name": "${KERNEL_NAME}",
159 - "system_kernel_version": "$(uname -r)",
160 - "system_architecture": "$(uname -m)",
161 - "system_total_ram": "${TOTAL_RAM:-unknown}"
162 - }
163 -}
164 -EOF
165 -)"
166 -
167 - if [ -n "$(command -v curl 2> /dev/null)" ]; then
168 - curl --silent -o /dev/null -X POST --max-time 2 --header "Content-Type: application/json" -d "${REQ_BODY}" "${TELEMETRY_URL}" > /dev/null
169 - else
170 - wget -q -O - --no-check-certificate \
171 - --method POST \
172 - --timeout=1 \
173 - --header 'Content-Type: application/json' \
174 - --body-data "${REQ_BODY}" \
175 - "${TELEMETRY_URL}" > /dev/null
176 - fi
177 -}
178 -
179 -trap_handler() {
180 - code="${1}"
181 - lineno="${2}"
182 -
183 - printf >&2 "%s\n\n" "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} ERROR ${TPUT_RESET} Installer exited unexpectedly (${code}-${lineno})"
184 -
185 - telemetry_event INSTALL_CRASH "Installer exited unexpectedly (${code}-${lineno})" "E${code}-${lineno}"
186 -
187 - trap - EXIT
188 -
189 - cleanup
190 -
191 - exit 1
192 -}
193 -
194 -trap 'trap_handler 0 ${LINENO}' EXIT
195 -trap 'trap_handler 1 0' HUP
196 -trap 'trap_handler 2 0' INT
197 -trap 'trap_handler 3 0' QUIT
198 -trap 'trap_handler 13 0' PIPE
199 -trap 'trap_handler 15 0' TERM
200 -
201 -# ======================================================================
202 -# Utility functions
203 -
204 -setup_terminal() {
205 - TPUT_RESET=""
206 - TPUT_WHITE=""
207 - TPUT_BGRED=""
208 - TPUT_BGGREEN=""
209 - TPUT_BOLD=""
210 - TPUT_DIM=""
211 -
212 - # Is stderr on the terminal? If not, then fail
213 - test -t 2 || return 1
214 -
215 - if command -v tput > /dev/null 2>&1; then
216 - if [ $(($(tput colors 2> /dev/null))) -ge 8 ]; then
217 - # Enable colors
218 - TPUT_RESET="$(tput sgr 0)"
219 - TPUT_WHITE="$(tput setaf 7)"
220 - TPUT_BGRED="$(tput setab 1)"
221 - TPUT_BGGREEN="$(tput setab 2)"
222 - TPUT_BOLD="$(tput bold)"
223 - TPUT_DIM="$(tput dim)"
224 - fi
225 - fi
226 -
227 - echo "${TPUT_RESET}"
228 -
229 - return 0
230 -}
231 -
232 -cleanup() {
233 - if [ -z "${NO_CLEANUP}" ]; then
234 - ${ROOTCMD} rm -rf "${tmpdir}"
235 - fi
236 -}
237 -
238 -fatal() {
239 - printf >&2 "%s\n\n" "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} ABORTED ${TPUT_RESET} ${*}"
240 - telemetry_event "INSTALL_FAILED" "${1}" "${2}"
241 - cleanup
242 - trap - EXIT
243 - exit 1
244 -}
245 -
246 -run_ok() {
247 - printf >&2 "%s\n\n" "${TPUT_BGGREEN}${TPUT_WHITE}${TPUT_BOLD} OK ${TPUT_RESET}"
248 -}
249 -
250 -run_failed() {
251 - printf >&2 "%s\n\n" "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} FAILED ${TPUT_RESET}"
252 -}
253 -
254 -ESCAPED_PRINT_METHOD=
255 -# shellcheck disable=SC3050
256 -if printf "%q " test > /dev/null 2>&1; then
257 - ESCAPED_PRINT_METHOD="printfq"
258 -fi
259 -
260 -escaped_print() {
261 - if [ "${ESCAPED_PRINT_METHOD}" = "printfq" ]; then
262 - # shellcheck disable=SC3050
263 - printf "%q " "${@}"
264 - else
265 - printf "%s" "${*}"
266 - fi
267 - return 0
268 -}
269 -
270 -progress() {
271 - echo >&2 " --- ${TPUT_BOLD}${*}${TPUT_RESET} --- "
272 -}
273 -
274 -run_logfile="/dev/null"
275 -run() {
276 - user="${USER--}"
277 - dir="${PWD}"
278 -
279 - if [ "$(id -u)" = "0" ]; then
280 - info="[root ${dir}]# "
281 - info_console="[${TPUT_DIM}${dir}${TPUT_RESET}]# "
282 - else
283 - info="[${user} ${dir}]$ "
284 - info_console="[${TPUT_DIM}${dir}${TPUT_RESET}]$ "
285 - fi
286 -
287 - {
288 - printf "%s" "${info}"
289 - escaped_print "${@}"
290 - printf " ... "
291 - } >> "${run_logfile}"
292 -
293 - printf >&2 "%s" "${info_console}${TPUT_BOLD}"
294 - escaped_print >&2 "${@}"
295 - printf >&2 "%s\n" "${TPUT_RESET}"
296 -
297 - "${@}"
298 -
299 - ret=$?
300 - if [ ${ret} -ne 0 ]; then
301 - run_failed
302 - printf "%s\n" "FAILED with exit code ${ret}" >> "${run_logfile}"
303 - else
304 - run_ok
305 - printf "OK\n" >> "${run_logfile}"
306 - fi
307 -
308 - return ${ret}
309 -}
310 -
311 -warning() {
312 - printf >&2 "%s\n\n" "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} WARNING ${TPUT_RESET} ${*}"
313 -}
314 -
315 -_cannot_use_tmpdir() {
316 - testfile="$(TMPDIR="${1}" mktemp -q -t netdata-test.XXXXXXXXXX)"
317 - ret=0
318 -
319 - if [ -z "${testfile}" ]; then
320 - return "${ret}"
321 - fi
322 -
323 - if printf '#!/bin/sh\necho SUCCESS\n' > "${testfile}"; then
324 - if chmod +x "${testfile}"; then
325 - if [ "$("${testfile}")" = "SUCCESS" ]; then
326 - ret=1
327 - fi
328 - fi
329 - fi
330 -
331 - rm -f "${testfile}"
332 - return "${ret}"
333 -}
334 -
335 -create_tmp_directory() {
336 - if [ -z "${TMPDIR}" ] || _cannot_use_tmpdir "${TMPDIR}"; then
337 - if _cannot_use_tmpdir /tmp; then
338 - if _cannot_use_tmpdir "${PWD}"; then
339 - fatal "Unable to find a usable temporary directory. Please set \$TMPDIR to a path that is both writable and allows execution of files and try again." F0400
340 - else
341 - TMPDIR="${PWD}"
342 - fi
343 - else
344 - TMPDIR="/tmp"
345 - fi
346 - fi
347 -
348 - mktemp -d -t netdata-kickstart-XXXXXXXXXX
349 -}
350 -
351 -download() {
352 - url="${1}"
353 - dest="${2}"
354 - if command -v curl > /dev/null 2>&1; then
355 - run curl -q -sSL --connect-timeout 10 --retry 3 --output "${dest}" "${url}" || return 1
356 - elif command -v wget > /dev/null 2>&1; then
357 - run wget -T 15 -O "${dest}" "${url}" || return 1
358 - else
359 - fatal "I need curl or wget to proceed, but neither of them are available on this system." F0003
360 - fi
361 -}
362 -
363 -get_redirect() {
364 - url="${1}"
365 -
366 - if command -v curl > /dev/null 2>&1; then
367 - run sh -c "curl ${url} -s -L -I -o /dev/null -w '%{url_effective}' | grep -o '[^/]*$'" || return 1
368 - elif command -v wget > /dev/null 2>&1; then
369 - run sh -c "wget --max-redirect=0 ${url} 2>&1 | grep Location | cut -d ' ' -f2 | grep -o '[^/]*$'" || return 1
370 - else
371 - fatal "I need curl or wget to proceed, but neither of them are available on this system." F0003
372 - fi
373 -}
374 -
375 -safe_sha256sum() {
376 - # Within the context of the installer, we only use -c option that is common between the two commands
377 - # We will have to reconsider if we start using non-common options
378 - if command -v sha256sum > /dev/null 2>&1; then
379 - sha256sum "$@"
380 - elif command -v shasum > /dev/null 2>&1; then
381 - shasum -a 256 "$@"
382 - else
383 - fatal "I could not find a suitable checksum binary to use" F0004
384 - fi
385 -}
386 -
387 -get_system_info() {
388 - case "$(uname -s)" in
389 - Linux)
390 - SYSTYPE="Linux"
391 -
392 - os_release_file=
393 - if [ -s "/etc/os-release" ] && [ -r "/etc/os-release" ]; then
394 - os_release_file="/etc/os-release"
395 - elif [ -s "/usr/lib/os-release" ] && [ -r "/usr/lib/os-release" ]; then
396 - os_release_file="/usr/lib/os-release"
397 - else
398 - fatal "Cannot find an os-release file ..." F0401
399 - fi
400 -
401 - # shellcheck disable=SC1090
402 - . "${os_release_file}"
403 -
404 - DISTRO="${ID}"
405 - SYSVERSION="${VERSION_ID}"
406 - SYSCODENAME="${VERSION_CODENAME}"
407 - SYSARCH="$(uname -m)"
408 -
409 - supported_compat_names="debian ubuntu centos fedora opensuse"
410 -
411 - if str_in_list "${DISTRO}" "${supported_compat_names}"; then
412 - DISTRO_COMPAT_NAME="${DISTRO}"
413 - else
414 - case "${DISTRO}" in
415 - opensuse-leap)
416 - DISTRO_COMPAT_NAME="opensuse"
417 - ;;
418 - rhel)
419 - DISTRO_COMPAT_NAME="centos"
420 - ;;
421 - *)
422 - DISTRO_COMPAT_NAME="unknown"
423 - ;;
424 - esac
425 - fi
426 - ;;
427 - Darwin)
428 - SYSTYPE="Darwin"
429 - SYSVERSION="$(sw_vers -buildVersion)"
430 - SYSARCH="$(uname -m)"
431 - ;;
432 - FreeBSD)
433 - SYSTYPE="FreeBSD"
434 - SYSVERSION="$(uname -K)"
435 - SYSARCH="$(uname -m)"
436 - ;;
437 - *)
438 - fatal "Unsupported system type detected. Netdata cannot be installed on this system using this script." F0200
439 - ;;
440 - esac
441 -}
442 -
443 -str_in_list() {
444 - printf "%s\n" "${2}" | tr ' ' "\n" | grep -qE "^${1}\$"
445 - return $?
446 -}
447 -
448 -confirm_root_support() {
449 - if [ "$(id -u)" -ne "0" ]; then
450 - if [ -z "${ROOTCMD}" ] && command -v sudo > /dev/null; then
451 - ROOTCMD="sudo"
452 - fi
453 -
454 - if [ -z "${ROOTCMD}" ] && command -v doas > /dev/null; then
455 - ROOTCMD="doas"
456 - fi
457 -
458 - if [ -z "${ROOTCMD}" ] && command -v pkexec > /dev/null; then
459 - ROOTCMD="pkexec"
460 - fi
461 -
462 - if [ -z "${ROOTCMD}" ]; then
463 - fatal "We need root privileges to continue, but cannot find a way to gain them. Either re-run this script as root, or set \$ROOTCMD to a command that can be used to gain root privileges" F0201
464 - fi
465 - fi
466 -}
467 -
468 -confirm() {
469 - prompt="${1} [y/n]"
470 -
471 - while true; do
472 - echo "${prompt}"
473 - read -r yn
474 -
475 - case "$yn" in
476 - [Yy]*) return 0;;
477 - [Nn]*) return 1;;
478 - *) echo "Please answer yes or no.";;
479 - esac
480 - done
481 -}
482 -
483 -# ======================================================================
484 -# Existing install handling code
485 -
486 -update() {
487 - updater="${ndprefix}/usr/libexec/netdata/netdata-updater.sh"
488 -
489 - if [ -x "${updater}" ]; then
490 - if run ${ROOTCMD} "${updater}" --not-running-from-cron; then
491 - progress "Updated existing install at ${ndprefix}"
492 - return 0
493 - else
494 - fatal "Failed to update existing Netdata install at ${ndprefix}" F0100
495 - fi
496 - else
497 - return 1
498 - fi
499 -}
500 -
501 -handle_existing_install() {
502 - if pkg_installed netdata; then
503 - ndprefix="/"
504 - else
505 - if [ -n "${INSTALL_PREFIX}" ]; then
506 - searchpath="${INSTALL_PREFIX}/bin:${INSTALL_PREFIX}/sbin:${INSTALL_PREFIX}/usr/bin:${INSTALL_PREFIX}/usr/sbin:${PATH}"
507 - searchpath="${INSTALL_PREFIX}/netdata/bin:${INSTALL_PREFIX}/netdata/sbin:${INSTALL_PREFIX}/netdata/usr/bin:${INSTALL_PREFIX}/netdata/usr/sbin:${searchpath}"
508 - else
509 - searchpath="${PATH}"
510 - fi
511 -
512 - ndpath="$(PATH="${searchpath}" command -v netdata 2>/dev/null)"
513 -
514 - if [ -z "$ndpath" ] && [ -x /opt/netdata/bin/netdata ]; then
515 - ndpath="/opt/netdata/bin/netdata"
516 - fi
517 -
518 - if [ -n "${ndpath}" ]; then
519 - ndprefix="$(dirname "$(dirname "${ndpath}")")"
520 - fi
521 -
522 - if echo "${ndprefix}" | grep -Eq '/usr$'; then
523 - ndprefix="$(dirname "${ndprefix}")"
524 - fi
525 - fi
526 -
527 - if [ -n "${ndprefix}" ]; then
528 - typefile="${ndprefix}/etc/netdata/.install-type"
529 - if [ -r "${typefile}" ]; then
530 - ${ROOTCMD} sh -c "cat \"${typefile}\" > \"${tmpdir}/install-type\""
531 - # shellcheck disable=SC1091
532 - . "${tmpdir}/install-type"
533 - else
534 - INSTALL_TYPE="unknown"
535 - fi
536 - fi
537 -
538 - if [ -z "${ndprefix}" ]; then
539 - progress "No existing installations of netdata found, assuming this is a fresh install."
540 - return 0
541 - fi
542 -
543 - case "${INSTALL_TYPE}" in
544 - kickstart-*|legacy-*|binpkg-*|manual-static|unknown)
545 - if [ "${INSTALL_TYPE}" = "unknown" ]; then
546 - warning "Found an existing netdata install at ${ndprefix}, but could not determine the install type."
547 - else
548 - progress "Found an existing netdata install at ${ndprefix}, with installation type '${INSTALL_TYPE}'."
549 - fi
550 -
551 - if [ -n "${NETDATA_REINSTALL}" ] || [ -n "${NETDATA_UNSAFE_REINSTALL}" ]; then
552 - progress "Found an existing netdata install at ${ndprefix}, but user requested reinstall, continuing."
553 -
554 - case "${INSTALL_TYPE}" in
555 - binpkg-*) NETDATA_ONLY_NATIVE=1 ;;
556 - *-build) NETDATA_ONLY_BUILD=1 ;;
557 - *-static) NETDATA_ONLY_STATIC=1 ;;
558 - *)
559 - if [ -n "${NETDATA_UNSAFE_REINSTALL}" ]; then
560 - warning "Reinstalling over top of a ${INSTALL_TYPE} installation may be unsafe, but the user has requested we proceed."
561 - elif [ "${INTERACTIVE}" -eq 0 ]; then
562 - fatal "User requested reinstall, but we cannot safely reinstall over top of a ${INSTALL_TYPE} installation, exiting." F0104
563 - else
564 - if confirm "Reinstalling over top of a ${INSTALL_TYPE} installation may be unsafe, do you want to continue?"; then
565 - progress "OK, continuing."
566 - else
567 - fatal "Cancelling reinstallation at user request." F0105
568 - fi
569 - fi
570 - ;;
571 - esac
572 -
573 - return 0
574 - fi
575 -
576 - ret=0
577 -
578 - if [ "${NETDATA_CLAIM_ONLY}" -eq 0 ] && echo "${INSTALL_TYPE}" | grep -vq "binpkg-*"; then
579 - if ! update; then
580 - warning "Unable to find usable updater script, not updating existing install at ${ndprefix}."
581 - fi
582 - else
583 - warning "Not updating existing install at ${ndprefix}."
584 - fi
585 -
586 - if [ -n "${NETDATA_CLAIM_TOKEN}" ]; then
587 - progress "Attempting to claim existing install at ${ndprefix}."
588 - INSTALL_PREFIX="${ndprefix}"
589 - claim
590 - ret=$?
591 - elif [ "${NETDATA_CLAIM_ONLY}" -eq 1 ]; then
592 - fatal "User asked to claim, but did not proide a claiming token." F0202
593 - else
594 - progress "Not attempting to claim existing install at ${ndprefix} (no claiming token provided)."
595 - fi
596 -
597 - cleanup
598 - trap - EXIT
599 - exit $ret
600 - ;;
601 - oci)
602 - fatal "This is an OCI container, use the regular image lifecycle management commands in your container instead of this script for managing it." F0203
603 - ;;
604 - *)
605 - if [ -n "${NETDATA_REINSTALL}" ] || [ -n "${NETDATA_UNSAFE_REINSTALL}" ]; then
606 - if [ -n "${NETDATA_UNSAFE_REINSTALL}" ]; then
607 - warning "Reinstalling over top of a ${INSTALL_TYPE} installation may be unsafe, but the user has requested we proceed."
608 - elif [ "${INTERACTIVE}" -eq 0 ]; then
609 - fatal "User requested reinstall, but we cannot safely reinstall over top of a ${INSTALL_TYPE} installation, exiting." F0104
610 - else
611 - if confirm "Reinstalling over top of a ${INSTALL_TYPE} installation may be unsafe, do you want to continue?"; then
612 - progress "OK, continuing."
613 - else
614 - fatal "Cancelling reinstallation at user request." F0105
615 - fi
616 - fi
617 - else
618 - fatal "Found an existing netdata install at ${ndprefix}, but the install type is '${INSTALL_TYPE}', which is not supported, refusing to proceed." F0103
619 - fi
620 - ;;
621 - esac
622 -}
623 -
624 -soft_disable_cloud() {
625 - cloud_prefix="${INSTALL_PREFIX}/var/lib/netdata/cloud.d"
626 -
627 - run ${ROOTCMD} mkdir -p "${cloud_prefix}"
628 -
629 - cat > "${tmpdir}/cloud.conf" << EOF
630 -[global]
631 - enabled = no
632 -EOF
633 -
634 - run ${ROOTCMD} cp "${tmpdir}/cloud.conf" "${cloud_prefix}/cloud.conf"
635 -
636 - if [ -z "${NETDATA_NO_START}" ]; then
637 - case "${SYSTYPE}" in
638 - Darwin) run ${ROOTCMD} launchctl kickstart -k com.github.netdata ;;
639 - FreeBSD) run ${ROOTCMD} service netdata restart ;;
640 - Linux)
641 - initpath="$(${ROOTCMD} readlink /proc/1/exe)"
642 -
643 - if command -v service > /dev/null 2>&1; then
644 - run ${ROOTCMD} service netdata restart
645 - elif command -v rc-service > /dev/null 2>&1; then
646 - run ${ROOTCMD} rc-service netdata restart
647 - elif [ "$(basename "${initpath}" 2> /dev/null)" = "systemd" ]; then
648 - run ${ROOTCMD} systemctl restart netdata
649 - elif [ -f /etc/init.d/netdata ]; then
650 - run ${ROOTCMD} /etc/init.d/netdata restart
651 - fi
652 - ;;
653 - esac
654 - fi
655 -}
656 -
657 -confirm_install_prefix() {
658 - if [ -n "${INSTALL_PREFIX}" ] && [ "${NETDATA_ONLY_BUILD}" -ne 1 ]; then
659 - fatal "The \`--install\` option is only supported together with the \`--only-build\` option." F0204
660 - fi
661 -
662 - if [ -n "${INSTALL_PREFIX}" ]; then
663 - NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS} --install ${INSTALL_PREFIX}"
664 - else
665 - case "${SYSTYPE}" in
666 - Darwin)
667 - INSTALL_PREFIX="/usr/local/netdata"
668 - NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS} --install-no-prefix ${INSTALL_PREFIX}"
669 - ;;
670 - FreeBSD)
671 - INSTALL_PREFIX="/usr/local"
672 - NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS} --install-no-prefix ${INSTALL_PREFIX}"
673 - ;;
674 - esac
675 - fi
676 -}
677 -
678 -# ======================================================================
679 -# Claiming support code
680 -
681 -check_claim_opts() {
682 -# shellcheck disable=SC2235,SC2030
683 - if [ -z "${NETDATA_CLAIM_TOKEN}" ] && [ -n "${NETDATA_CLAIM_ROOMS}" ]; then
684 - fatal "Invalid claiming options, claim rooms may only be specified when a token and URL are specified." F0204
685 - elif [ -z "${NETDATA_CLAIM_TOKEN}" ] && [ -n "${NETDATA_CLAIM_EXTRA}" ]; then
686 - fatal "Invalid claiming options, a claiming token must be specified." F0204
687 - elif [ "${NETDATA_DISABLE_CLOUD}" -eq 1 ] && [ -n "${NETDATA_CLAIM_TOKEN}" ]; then
688 - fatal "Cloud explicitly disabled, but automatic claiming requested. Either enable Netdata Cloud, or remove the --claim-* options." F0204
689 - fi
690 -}
691 -
692 -claim() {
693 - progress "Attempting to claim agent to ${NETDATA_CLAIM_URL}"
694 - if [ -z "${INSTALL_PREFIX}" ]; then
695 - NETDATA_CLAIM_PATH=/usr/sbin/netdata-claim.sh
696 - elif [ "${INSTALL_PREFIX}" = "/opt/netdata" ]; then
697 - NETDATA_CLAIM_PATH="/opt/netdata/bin/netdata-claim.sh"
698 - else
699 - NETDATA_CLAIM_PATH="${INSTALL_PREFIX}/netdata/usr/sbin/netdata-claim.sh"
700 - fi
701 -
702 - if ! pgrep netdata > /dev/null; then
703 - NETDATA_CLAIM_EXTRA="${NETDATA_CLAIM_EXTRA} -daemon-not-running"
704 - fi
705 -
706 - # shellcheck disable=SC2086
707 - if ${ROOTCMD} "${NETDATA_CLAIM_PATH}" -token="${NETDATA_CLAIM_TOKEN}" -rooms="${NETDATA_CLAIM_ROOMS}" -url="${NETDATA_CLAIM_URL}" ${NETDATA_CLAIM_EXTRA}; then
708 - progress "Successfully claimed node"
709 - else
710 - warning "Unable to claim node, you must do so manually."
711 - if [ -z "${NETDATA_NEW_INSTALL}" ]; then
712 - cleanup
713 - trap - EXIT
714 - exit 1
715 - fi
716 - fi
717 -}
718 -
719 -# ======================================================================
720 -# Native package install code.
721 -
722 -# Check for an already installed package with a given name.
723 -pkg_installed() {
724 - case "${DISTRO_COMPAT_NAME}" in
725 - debian|ubuntu)
726 - dpkg -l "${1}" > /dev/null 2>&1
727 - return $?
728 - ;;
729 - centos|fedora|opensuse)
730 - rpm -q "${1}" > /dev/null 2>&1
731 - return $?
732 - ;;
733 - *)
734 - return 1
735 - ;;
736 - esac
737 -}
738 -
739 -# Check for the existence of a usable netdata package in the repo.
740 -netdata_avail_check() {
741 - case "${DISTRO_COMPAT_NAME}" in
742 - debian|ubuntu)
743 - env DEBIAN_FRONTEND=noninteractive apt-cache policy netdata | grep -q packagecloud.io/netdata/netdata;
744 - return $?
745 - ;;
746 - centos|fedora)
747 - # shellcheck disable=SC2086
748 - ${pm_cmd} search -v netdata | grep -qE 'Repo *: netdata(-edge)?$'
749 - return $?
750 - ;;
751 - opensuse)
752 - zypper packages -r "$(zypper repos | grep -E 'netdata |netdata-edge ' | cut -f 1 -d '|' | tr -d ' ')" | grep -E 'netdata '
753 - return $?
754 - ;;
755 - *)
756 - return 1
757 - ;;
758 - esac
759 -}
760 -
761 -# Check for any distro-specific dependencies we know we need.
762 -check_special_native_deps() {
763 - if [ "${DISTRO_COMPAT_NAME}" = "centos" ] && [ "${SYSVERSION}" = "7" ]; then
764 - progress "Checking for libuv availability."
765 - # shellcheck disable=SC2086
766 - if ${pm_cmd} search ${interactive_opts} -v libuv | grep -q "No matches found"; then
767 - progress "libv not found, checking for EPEL availability."
768 - # shellcheck disable=SC2086
769 - if ${pm_cmd} search ${interactive_opts} -v epel-release | grep -q "No matches found"; then
770 - warning "Unable to find a suitable source for libuv, cannot install on this system."
771 - return 1
772 - else
773 - progress "EPEL is available, attempting to install so that required dependencies are available."
774 -
775 - # shellcheck disable=SC2086
776 - if ! run ${ROOTCMD} env ${env} ${pm_cmd} install ${pkg_install_opts} epel-release; then
777 - warning "Failed to install EPEL."
778 - return 1
779 - fi
780 - fi
781 - else
782 - return 0
783 - fi
784 - fi
785 -}
786 -
787 -try_package_install() {
788 - if [ -z "${DISTRO}" ]; then
789 - warning "Unable to determine Linux distribution for native packages."
790 - return 1
791 - fi
792 -
793 - progress "Attempting to install using native packages..."
794 -
795 - if [ "${RELEASE_CHANNEL}" = "nightly" ]; then
796 - release="-edge"
797 - else
798 - release=""
799 - fi
800 -
801 - if [ "${INTERACTIVE}" = "0" ]; then
802 - interactive_opts="-y"
803 - env="DEBIAN_FRONTEND=noninteractive"
804 - else
805 - interactive_opts=""
806 - env=""
807 - fi
808 -
809 - case "${DISTRO_COMPAT_NAME}" in
810 - debian)
811 - needs_early_refresh=1
812 - pm_cmd="apt-get"
813 - repo_subcmd="update"
814 - repo_prefix="debian/${SYSCODENAME}"
815 - pkg_type="deb"
816 - pkg_suffix="_all"
817 - pkg_vsep="_"
818 - pkg_install_opts="${interactive_opts}"
819 - repo_update_opts="${interactive_opts}"
820 - uninstall_subcmd="uninstall"
821 - INSTALL_TYPE="binpkg-deb"
822 - ;;
823 - ubuntu)
824 - needs_early_refresh=1
825 - pm_cmd="apt-get"
826 - repo_subcmd="update"
827 - repo_prefix="ubuntu/${SYSCODENAME}"
828 - pkg_type="deb"
829 - pkg_suffix="_all"
830 - pkg_vsep="_"
831 - pkg_install_opts="${interactive_opts}"
832 - repo_update_opts="${interactive_opts}"
833 - uninstall_subcmd="uninstall"
834 - INSTALL_TYPE="binpkg-deb"
835 - ;;
836 - centos)
837 - if command -v dnf > /dev/null; then
838 - pm_cmd="dnf"
839 - repo_subcmd="makecache"
840 - else
841 - pm_cmd="yum"
842 - fi
843 - repo_prefix="el/${SYSVERSION}"
844 - pkg_type="rpm"
845 - pkg_suffix=".noarch"
846 - pkg_vsep="-"
847 - pkg_install_opts="${interactive_opts}"
848 - repo_update_opts="${interactive_opts}"
849 - uninstall_subcmd="remove"
850 - INSTALL_TYPE="binpkg-rpm"
851 - ;;
852 - fedora)
853 - if command -v dnf > /dev/null; then
854 - pm_cmd="dnf"
855 - repo_subcmd="makecache"
856 - else
857 - pm_cmd="yum"
858 - fi
859 - repo_prefix="fedora/${SYSVERSION}"
860 - pkg_type="rpm"
861 - pkg_suffix=".noarch"
862 - pkg_vsep="-"
863 - pkg_install_opts="${interactive_opts}"
864 - repo_update_opts="${interactive_opts}"
865 - uninstall_subcmd="remove"
866 - INSTALL_TYPE="binpkg-rpm"
867 - ;;
868 - opensuse)
869 - pm_cmd="zypper"
870 - repo_subcmd="--gpg-auto-import-keys refresh"
871 - repo_prefix="opensuse/${SYSVERSION}"
872 - pkg_type="rpm"
873 - pkg_suffix=".noarch"
874 - pkg_vsep="-"
875 - pkg_install_opts="${interactive_opts} --allow-unsigned-rpm"
876 - repo_update_opts=""
877 - uninstall_subcmd="remove"
878 - INSTALL_TYPE="binpkg-rpm"
879 - ;;
880 - *)
881 - warning "We do not provide native packages for ${DISTRO}."
882 - return 2
883 - ;;
884 - esac
885 -
886 - repoconfig_name="netdata-repo${release}"
887 - repoconfig_file="${repoconfig_name}${pkg_vsep}${REPOCONFIG_VERSION}${pkg_suffix}.${pkg_type}"
888 - repoconfig_url="${REPOCONFIG_URL_PREFIX}/${repo_prefix}/${repoconfig_file}/download.${pkg_type}"
889 -
890 - if ! pkg_installed "${repoconfig_name}"; then
891 - progress "Downloading repository configuration package."
892 - if ! download "${repoconfig_url}" "${tmpdir}/${repoconfig_file}"; then
893 - warning "Failed to download repository configuration package."
894 - return 2
895 - fi
896 -
897 - if [ -n "${needs_early_refresh}" ]; then
898 - progress "Updating repository metadata."
899 - # shellcheck disable=SC2086
900 - if ! run ${ROOTCMD} env ${env} ${pm_cmd} ${repo_subcmd} ${repo_update_opts}; then
901 - warning "Failed to refresh repository metadata."
902 - return 2
903 - fi
904 - fi
905 -
906 - progress "Installing repository configuration package."
907 - # shellcheck disable=SC2086
908 - if ! run ${ROOTCMD} env ${env} ${pm_cmd} install ${pkg_install_opts} "${tmpdir}/${repoconfig_file}"; then
909 - warning "Failed to install repository configuration package."
910 - return 2
911 - fi
912 -
913 - if [ -n "${repo_subcmd}" ]; then
914 - progress "Updating repository metadata."
915 - # shellcheck disable=SC2086
916 - if ! run ${ROOTCMD} env ${env} ${pm_cmd} ${repo_subcmd} ${repo_update_opts}; then
917 - fatal "Failed to update repository metadata." F0205
918 - fi
919 - fi
920 - else
921 - progress "Repository configuration is already present, attempting to install netdata."
922 - fi
923 -
924 - if ! check_special_native_deps; then
925 - warning "Could not find secondary dependencies ${DISTRO} on ${SYSARCH}."
926 - if [ -z "${NO_CLEANUP}" ]; then
927 - progress "Attempting to uninstall repository configuration package."
928 - # shellcheck disable=SC2086
929 - run ${ROOTCMD} env ${env} ${pm_cmd} ${uninstall_subcmd} ${pkg_install_opts} "${repoconfig_name}"
930 - fi
931 - return 2
932 - fi
933 -
934 - progress "Checking for usable Netdata package."
935 - if ! netdata_avail_check "${DISTRO_COMPAT_NAME}"; then
936 - warning "Could not find a usable native package for ${DISTRO} on ${SYSARCH}."
937 - if [ -z "${NO_CLEANUP}" ]; then
938 - progress "Attempting to uninstall repository configuration package."
939 - # shellcheck disable=SC2086
940 - run ${ROOTCMD} env ${env} ${pm_cmd} ${uninstall_subcmd} ${pkg_install_opts} "${repoconfig_name}"
941 - fi
942 - return 2
943 - fi
944 -
945 - if [ "${NETDATA_DISABLE_TELEMETRY}" -eq 1 ]; then
946 - run ${ROOTCMD} mkdir -p "/etc/netdata"
947 - run ${ROOTCMD} touch "/etc/netdata/.opt-out-from-anonymous-statistics"
948 - fi
949 -
950 - progress "Installing Netdata package."
951 - # shellcheck disable=SC2086
952 - if ! run ${ROOTCMD} env ${env} ${pm_cmd} install ${pkg_install_opts} netdata; then
953 - warning "Failed to install Netdata package."
954 - if [ -z "${NO_CLEANUP}" ]; then
955 - progress "Attempting to uninstall repository configuration package."
956 - # shellcheck disable=SC2086
957 - run ${ROOTCMD} env ${env} ${pm_cmd} ${uninstall_subcmd} ${pkg_install_opts} "${repoconfig_name}"
958 - fi
959 - return 2
960 - fi
961 -}
962 -
963 -# ======================================================================
964 -# Static build install code
965 -
966 -set_static_archive_urls() {
967 - if [ "${RELEASE_CHANNEL}" = "stable" ]; then
968 - latest="$(get_redirect "https://github.com/netdata/netdata/releases/latest")"
969 - export NETDATA_STATIC_ARCHIVE_URL="https://github.com/netdata/netdata/releases/download/${latest}/netdata-${SYSARCH}-${latest}.gz.run"
970 - export NETDATA_STATIC_ARCHIVE_CHECKSUM_URL="https://github.com/netdata/netdata/releases/download/${latest}/sha256sums.txt"
971 - else
972 - export NETDATA_STATIC_ARCHIVE_URL="${NETDATA_TARBALL_BASEURL}/netdata-latest.gz.run"
973 - export NETDATA_STATIC_ARCHIVE_CHECKSUM_URL="${NETDATA_TARBALL_BASEURL}/sha256sums.txt"
974 - fi
975 -}
976 -
977 -try_static_install() {
978 - set_static_archive_urls "${RELEASE_CHANNEL}"
979 - progress "Downloading static netdata binary: ${NETDATA_STATIC_ARCHIVE_URL}"
980 -
981 - if ! download "${NETDATA_STATIC_ARCHIVE_URL}" "${tmpdir}/netdata-${SYSARCH}-latest.gz.run"; then
982 - warning "Unable to download static build archive for ${SYSARCH}."
983 - return 2
984 - fi
985 -
986 - if ! download "${NETDATA_STATIC_ARCHIVE_CHECKSUM_URL}" "${tmpdir}/sha256sum.txt"; then
987 - fatal "Unable to fetch checksums to verify static build archive." F0206
988 - fi
989 -
990 - if ! grep "netdata-${SYSARCH}-latest.gz.run" "${tmpdir}/sha256sum.txt" | safe_sha256sum -c - > /dev/null 2>&1; then
991 - fatal "Static binary checksum validation failed. Usually this is a result of an older copy of the file being cached somewhere upstream and can be resolved by retrying in an hour." F0207
992 - fi
993 -
994 - if [ "${INTERACTIVE}" -eq 0 ]; then
995 - opts="${opts} --accept"
996 - fi
997 -
998 - progress "Installing netdata"
999 - # shellcheck disable=SC2086
1000 - if ! run ${ROOTCMD} sh "${tmpdir}/netdata-${SYSARCH}-latest.gz.run" ${opts} -- ${NETDATA_AUTO_UPDATES:+--auto-update} ${NETDATA_INSTALLER_OPTIONS}; then
1001 - warning "Failed to install static build of Netdata on ${SYSARCH}."
1002 - run rm -rf /opt/netdata
1003 - return 2
1004 - fi
1005 -
1006 - install_type_file="/opt/netdata/etc/netdata/.install-type"
1007 - if [ -f "${install_type_file}" ]; then
1008 - ${ROOTCMD} sh -c "cat \"${install_type_file}\" > \"${tmpdir}/install-type\""
1009 - ${ROOTCMD} chown "$(id -u)":"$(id -g)" "${tmpdir}/install-type"
1010 - # shellcheck disable=SC1091
1011 - . "${tmpdir}/install-type"
1012 - cat > "${tmpdir}/install-type" <<- EOF
1013 - INSTALL_TYPE='kickstart-static'
1014 - PREBUILT_ARCH='${PREBUILT_ARCH}'
1015 - EOF
1016 - ${ROOTCMD} chown netdata:netdata "${tmpdir}/install-type"
1017 - ${ROOTCMD} cp "${tmpdir}/install-type" "${install_type_file}"
1018 - fi
1019 -}
1020 -
1021 -# ======================================================================
1022 -# Local build install code
1023 -
1024 -set_source_archive_urls() {
1025 - if [ "$1" = "stable" ]; then
1026 - latest="$(get_redirect "https://github.com/netdata/netdata/releases/latest")"
1027 - export NETDATA_SOURCE_ARCHIVE_URL="https://github.com/netdata/netdata/releases/download/${latest}/netdata-${latest}.tar.gz"
1028 - export NETDATA_SOURCE_ARCHIVE_CHECKSUM_URL="https://github.com/netdata/netdata/releases/download/${latest}/sha256sums.txt"
1029 - else
1030 - export NETDATA_SOURCE_ARCHIVE_URL="${NETDATA_TARBALL_BASEURL}/netdata-latest.tar.gz"
1031 - export NETDATA_SOURCE_ARCHIVE_CHECKSUM_URL="${NETDATA_TARBALL_BASEURL}/sha256sums.txt"
1032 - fi
1033 -}
1034 -
1035 -install_local_build_dependencies() {
1036 - bash="$(command -v bash 2> /dev/null)"
1037 -
1038 - if [ -z "${bash}" ] || [ ! -x "${bash}" ]; then
1039 - warning "Unable to find a usable version of \`bash\` (required for local build)."
1040 - return 1
1041 - fi
1042 -
1043 - progress "Fetching script to detect required packages..."
1044 - download "${PACKAGES_SCRIPT}" "${tmpdir}/install-required-packages.sh"
1045 -
1046 - if [ ! -s "${tmpdir}/install-required-packages.sh" ]; then
1047 - warning "Downloaded dependency installation script is empty."
1048 - else
1049 - progress "Running downloaded script to detect required packages..."
1050 -
1051 - if [ "${INTERACTIVE}" -eq 0 ]; then
1052 - opts="--dont-wait --non-interactive"
1053 - fi
1054 -
1055 - if [ "${SYSTYPE}" = "Darwin" ]; then
1056 - sudo=""
1057 - else
1058 - sudo="${ROOTCMD}"
1059 - fi
1060 -
1061 - # shellcheck disable=SC2086
1062 - if ! run ${sudo} "${bash}" "${tmpdir}/install-required-packages.sh" ${opts} netdata; then
1063 - warning "It failed to install all the required packages, but installation might still be possible."
1064 - fi
1065 - fi
1066 -}
1067 -
1068 -build_and_install() {
1069 - progress "Building netdata"
1070 -
1071 - echo "INSTALL_TYPE='kickstart-build'" > system/.install-type
1072 -
1073 - opts="${NETDATA_INSTALLER_OPTIONS}"
1074 -
1075 - if [ "${INTERACTIVE}" -eq 0 ]; then
1076 - opts="${opts} --dont-wait"
1077 - fi
1078 -
1079 - if [ "${NETDATA_AUTO_UPDATES}" -eq 1 ]; then
1080 - opts="${opts} --auto-update"
1081 - fi
1082 -
1083 - if [ "${RELEASE_CHANNEL}" = "stable" ]; then
1084 - opts="${opts} --stable-channel"
1085 - fi
1086 -
1087 - if [ "${NETDATA_REQUIRE_CLOUD}" -eq 1 ]; then
1088 - opts="${opts} --require-cloud"
1089 - elif [ "${NETDATA_DISABLE_CLOUD}" -eq 1 ]; then
1090 - opts="${opts} --disable-cloud"
1091 - fi
1092 -
1093 - # shellcheck disable=SC2086
1094 - run ${ROOTCMD} ./netdata-installer.sh ${opts}
1095 -
1096 - case $? in
1097 - 1)
1098 - fatal "netdata-installer.sh exited with error" F0007
1099 - ;;
1100 - 2)
1101 - fatal "Insufficient RAM to install netdata" F0008
1102 - ;;
1103 - esac
1104 -}
1105 -
1106 -try_build_install() {
1107 - if ! install_local_build_dependencies; then
1108 - return 1
1109 - fi
1110 -
1111 - set_source_archive_urls "${RELEASE_CHANNEL}"
1112 -
1113 - download "${NETDATA_SOURCE_ARCHIVE_CHECKSUM_URL}" "${tmpdir}/sha256sum.txt"
1114 - download "${NETDATA_SOURCE_ARCHIVE_URL}" "${tmpdir}/netdata-latest.tar.gz"
1115 -
1116 - if ! grep netdata-latest.tar.gz "${tmpdir}/sha256sum.txt" | safe_sha256sum -c - > /dev/null 2>&1; then
1117 - fatal "Tarball checksum validation failed. Usually this is a result of an older copy of the file being cached somewhere upstream and can be resolved by retrying in an hour." F0005
1118 - fi
1119 -
1120 - run tar -xf "${tmpdir}/netdata-latest.tar.gz" -C "${tmpdir}"
1121 - rm -rf "${tmpdir}/netdata-latest.tar.gz" > /dev/null 2>&1
1122 - cd "$(find "${tmpdir}" -mindepth 1 -maxdepth 1 -type d -name netdata-)" || fatal "Cannot cd to netdata source tree" F0006
1123 -
1124 - if [ -x netdata-installer.sh ]; then
1125 - build_and_install || return 1
1126 - else
1127 - # This case is needed because some platforms produce an extra directory on the source tarball extraction.
1128 - if [ "$(find . -mindepth 1 -maxdepth 1 -type d | wc -l)" -eq 1 ] && [ -x "$(find . -mindepth 1 -maxdepth 1 -type d)/netdata-installer.sh" ]; then
1129 - cd "$(find . -mindepth 1 -maxdepth 1 -type d)" && build_and_install || return 1
1130 - else
1131 - fatal "Cannot install netdata from source (the source directory does not include netdata-installer.sh). Leaving all files in ${tmpdir}" F0009
1132 - fi
1133 - fi
1134 -}
1135 -
1136 -# ======================================================================
1137 -# Per system-type install logic
1138 -
1139 -install_on_linux() {
1140 - if [ "${NETDATA_ONLY_STATIC}" -ne 1 ] && [ "${NETDATA_ONLY_BUILD}" -ne 1 ]; then
1141 - SELECTED_INSTALL_METHOD="native"
1142 - try_package_install
1143 -
1144 - case "$?" in
1145 - 0)
1146 - NETDATA_INSTALL_SUCCESSFUL=1
1147 - ;;
1148 - 1)
1149 - fatal "Unable to install on this system." F0300
1150 - ;;
1151 - 2)
1152 - if [ "${NETDATA_ONLY_NATIVE}" -eq 1 ]; then
1153 - fatal "Could not install native binary packages." F0301
1154 - else
1155 - warning "Could not install native binary packages, falling back to alternative installation method."
1156 - fi
1157 - ;;
1158 - esac
1159 - fi
1160 -
1161 - if [ "${NETDATA_ONLY_NATIVE}" -ne 1 ] && [ "${NETDATA_ONLY_BUILD}" -ne 1 ] && [ -z "${NETDATA_INSTALL_SUCCESSFUL}" ]; then
1162 - SELECTED_INSTALL_METHOD="static"
1163 - INSTALL_TYPE="kickstart-static"
1164 - try_static_install
1165 -
1166 - case "$?" in
1167 - 0)
1168 - NETDATA_INSTALL_SUCCESSFUL=1
1169 - INSTALL_PREFIX="/opt/netdata"
1170 - ;;
1171 - 1)
1172 - fatal "Unable to install on this system." F0302
1173 - ;;
1174 - 2)
1175 - if [ "${NETDATA_ONLY_STATIC}" -eq 1 ]; then
1176 - fatal "Could not install static build." F0303
1177 - else
1178 - warning "Could not install static build, falling back to alternative installation method."
1179 - fi
1180 - ;;
1181 - esac
1182 - fi
1183 -
1184 - if [ "${NETDATA_ONLY_NATIVE}" -ne 1 ] && [ "${NETDATA_ONLY_STATIC}" -ne 1 ] && [ -z "${NETDATA_INSTALL_SUCCESSFUL}" ]; then
1185 - SELECTED_INSTALL_METHOD="build"
1186 - INSTALL_TYPE="kickstart-build"
1187 - try_build_install
1188 -
1189 - case "$?" in
1190 - 0)
1191 - NETDATA_INSTALL_SUCCESSFUL=1
1192 - ;;
1193 - *)
1194 - fatal "Unable to install on this system." F0304
1195 - ;;
1196 - esac
1197 - fi
1198 -}
1199 -
1200 -install_on_macos() {
1201 - if [ "${NETDATA_ONLY_NATIVE}" -eq 1 ]; then
1202 - fatal "User requested native package, but native packages are not available for macOS. Try installing without \`--only-native\` option." F0305
1203 - elif [ "${NETDATA_ONLY_STATIC}" -eq 1 ]; then
1204 - fatal "User requested static build, but static builds are not available for macOS. Try installing without \`--only-static\` option." F0306
1205 - else
1206 - SELECTED_INSTALL_METHOD="build"
1207 - INSTALL_TYPE="kickstart-build"
1208 - try_build_install
1209 -
1210 - case "$?" in
1211 - 0)
1212 - NETDATA_INSTALL_SUCCESSFUL=1
1213 - ;;
1214 - *)
1215 - fatal "Unable to install on this system." F0307
1216 - ;;
1217 - esac
1218 - fi
1219 -}
1220 -
1221 -install_on_freebsd() {
1222 - if [ "${NETDATA_ONLY_NATIVE}" -eq 1 ]; then
1223 - fatal "User requested native package, but native packages are not available for FreeBSD. Try installing without \`--only-native\` option." F0308
1224 - elif [ "${NETDATA_ONLY_STATIC}" -eq 1 ]; then
1225 - fatal "User requested static build, but static builds are not available for FreeBSD. Try installing without \`--only-static\` option." F0309
1226 - else
1227 - SELECTED_INSTALL_METHOD="build"
1228 - INSTALL_TYPE="kickstart-build"
1229 - try_build_install
1230 -
1231 - case "$?" in
1232 - 0)
1233 - NETDATA_INSTALL_SUCCESSFUL=1
1234 - ;;
1235 - *)
1236 - fatal "Unable to install on this system." F030A
1237 - ;;
1238 - esac
1239 - fi
1240 -}
1241 -
1242 -# ======================================================================
1243 -# Main program
1244 -
1245 -setup_terminal || echo > /dev/null
1246 -
1247 -while [ -n "${1}" ]; do
1248 - case "${1}" in
1249 - "--help")
1250 - usage
1251 - cleanup
1252 - trap - EXIT
1253 - exit 0
1254 - ;;
1255 - "--no-cleanup") NO_CLEANUP=1 ;;
1256 - "--dont-wait"|"--non-interactive") INTERACTIVE=0 ;;
1257 - "--interactive") INTERACTIVE=1 ;;
1258 - "--stable-channel") RELEASE_CHANNEL="stable" ;;
1259 - "--no-updates") NETDATA_AUTO_UPDATES=0 ;;
1260 - "--auto-update") NETDATA_AUTO_UPDATES="1" ;;
1261 - "--reinstall") NETDATA_REINSTALL=1 ;;
1262 - "--reinstall-even-if-unsafe") NETDATA_UNSAFE_REINSTALL=1 ;;
1263 - "--claim-only") NETDATA_CLAIM_ONLY=1 ;;
1264 - "--disable-cloud")
1265 - NETDATA_DISABLE_CLOUD=1
1266 - NETDATA_REQUIRE_CLOUD=0
1267 - ;;
1268 - "--require-cloud")
1269 - NETDATA_DISABLE_CLOUD=0
1270 - NETDATA_REQUIRE_CLOUD=1
1271 - ;;
1272 - "--dont-start-it")
1273 - NETDATA_NO_START=1
1274 - NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS} --dont-start-it"
1275 - ;;
1276 - "--disable-telemetry")
1277 - NETDATA_DISABLE_TELEMETRY="1"
1278 - NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS} --disable-telemetry"
1279 - ;;
1280 - "--install")
1281 - INSTALL_PREFIX="${2}"
1282 - shift 1
1283 - ;;
1284 - "--native-only")
1285 - NETDATA_ONLY_NATIVE=1
1286 - NETDATA_ONLY_STATIC=0
1287 - NETDATA_ONLY_BUILD=0
1288 - SELECTED_INSTALL_METHOD="native"
1289 - ;;
1290 - "--static-only")
1291 - NETDATA_ONLY_STATIC=1
1292 - NETDATA_ONLY_NATIVE=0
1293 - NETDATA_ONLY_BUILD=0
1294 - SELECTED_INSTALL_METHOD="static"
1295 - ;;
1296 - "--build-only")
1297 - NETDATA_ONLY_BUILD=1
1298 - NETDATA_ONLY_NATIVE=0
1299 - NETDATA_ONLY_STATIC=0
1300 - SELECTED_INSTALL_METHOD="build"
1301 - ;;
1302 - "--claim-token")
1303 - NETDATA_CLAIM_TOKEN="${2}"
1304 - shift 1
1305 - ;;
1306 - "--claim-rooms")
1307 - NETDATA_CLAIM_ROOMS="${2}"
1308 - shift 1
1309 - ;;
1310 - "--claim-url")
1311 - NETDATA_CLAIM_URL="${2}"
1312 - shift 1
1313 - ;;
1314 - "--claim-*")
1315 - optname="$(echo "${1}" | cut -d '-' -f 4-)"
1316 - case "${optname}" in
1317 - id|proxy|user|hostname)
1318 - NETDATA_CLAIM_EXTRA="${NETDATA_CLAIM_EXTRA} -${optname} ${2}"
1319 - shift 1
1320 - ;;
1321 - verbose|insecure|noproxy|noreload|daemon-not-running)
1322 - NETDATA_CLAIM_EXTRA="${NETDATA_CLAIM_EXTRA} -${optname}"
1323 - ;;
1324 - *)
1325 - warning "Ignoring unrecognized claiming option ${optname}"
1326 - ;;
1327 - esac
1328 - ;;
1329 - *)
1330 - warning "Passing unrecognized option '${1}' to installer script. If this is intended, please add it to \$NETDATA_INSTALLER_OPTIONS instead."
1331 - NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS} ${1}"
1332 - ;;
1333 - esac
1334 - shift 1
1335 -done
1336 -
1337 -check_claim_opts
1338 -confirm_root_support
1339 -get_system_info
1340 -confirm_install_prefix
1341 -
1342 -tmpdir="$(create_tmp_directory)"
1343 -progress "Using ${tmpdir} as a temporary directory."
1344 -cd "${tmpdir}" || exit 1
1345 -
1346 -handle_existing_install
1347 -
1348 -case "${SYSTYPE}" in
1349 - Linux) install_on_linux ;;
1350 - Darwin) install_on_macos ;;
1351 - FreeBSD) install_on_freebsd ;;
1352 -esac
1353 -
1354 -if [ -n "${NETDATA_CLAIM_TOKEN}" ]; then
1355 - claim
1356 -elif [ "${NETDATA_DISABLE_CLOUD}" -eq 1 ]; then
1357 - soft_disable_cloud
1358 -fi
1359 -
1360 -telemetry_event INSTALL_SUCCESS "" ""
1361 -cleanup
1362 -trap - EXIT
packaging/installer/kickstart-ng.sh new
+1
@@ -0,0 +1 @@
1 +kickstart.sh
\ No newline at end of file
packaging/installer/kickstart-static64.sh deleted
-439
@@ -1,439 +0,0 @@
1 -#!/usr/bin/env sh
2 -
3 -# SPDX-License-Identifier: GPL-3.0-or-later
4 -# shellcheck disable=SC1117,SC2039,SC2059,SC2086
5 -#
6 -# Options to run
7 -# --dont-wait do not wait for input
8 -# --non-interactive do not wait for input
9 -# --dont-start-it do not start netdata after install
10 -# --stable-channel Use the stable release channel, rather than the nightly to fetch sources
11 -# --disable-telemetry Opt-out of anonymous telemetry program (DO_NOT_TRACK=1)
12 -# --local-files Use a manually provided tarball for the installation
13 -# --allow-duplicate-install do not bail if we detect a duplicate install
14 -# --reinstall if an existing install would be updated, reinstall instead
15 -# --claim-token specify a token to use for claiming the newly installed instance
16 -# --claim-url specify a URL to use for claiming the newly installed isntance
17 -# --claim-rooms specify a list of rooms to claim the newly installed instance to
18 -# --claim-proxy specify a proxy to use while claiming the newly installed instance
19 -#
20 -# Environment options:
21 -#
22 -# NETDATA_TARBALL_BASEURL set the base url for downloading the dist tarball
23 -#
24 -# ----------------------------------------------------------------------------
25 -# library functions copied from packaging/installer/functions.sh
26 -
27 -setup_terminal() {
28 - TPUT_RESET=""
29 - TPUT_YELLOW=""
30 - TPUT_WHITE=""
31 - TPUT_BGRED=""
32 - TPUT_BGGREEN=""
33 - TPUT_BOLD=""
34 - TPUT_DIM=""
35 -
36 - # Is stderr on the terminal? If not, then fail
37 - test -t 2 || return 1
38 -
39 - if command -v tput > /dev/null 2>&1; then
40 - if [ $(($(tput colors 2> /dev/null))) -ge 8 ]; then
41 - # Enable colors
42 - TPUT_RESET="$(tput sgr 0)"
43 - TPUT_YELLOW="$(tput setaf 3)"
44 - TPUT_WHITE="$(tput setaf 7)"
45 - TPUT_BGRED="$(tput setab 1)"
46 - TPUT_BGGREEN="$(tput setab 2)"
47 - TPUT_BOLD="$(tput bold)"
48 - TPUT_DIM="$(tput dim)"
49 - fi
50 - fi
51 -
52 - return 0
53 -}
54 -setup_terminal || echo > /dev/null
55 -
56 -# ----------------------------------------------------------------------------
57 -fatal() {
58 - printf >&2 "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} ABORTED ${TPUT_RESET} ${*} \n\n"
59 - exit 1
60 -}
61 -
62 -run_ok() {
63 - printf >&2 "${TPUT_BGGREEN}${TPUT_WHITE}${TPUT_BOLD} OK ${TPUT_RESET} \n\n"
64 -}
65 -
66 -run_failed() {
67 - printf >&2 "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} FAILED ${TPUT_RESET} \n\n"
68 -}
69 -
70 -ESCAPED_PRINT_METHOD=
71 -if printf "%q " test > /dev/null 2>&1; then
72 - ESCAPED_PRINT_METHOD="printfq"
73 -fi
74 -escaped_print() {
75 - if [ "${ESCAPED_PRINT_METHOD}" = "printfq" ]; then
76 - printf "%q " "${@}"
77 - else
78 - printf "%s" "${*}"
79 - fi
80 - return 0
81 -}
82 -
83 -progress() {
84 - echo >&2 " --- ${TPUT_DIM}${TPUT_BOLD}${*}${TPUT_RESET} --- "
85 -}
86 -
87 -run_logfile="/dev/null"
88 -run() {
89 - local user="${USER--}" dir="${PWD}" info info_console
90 -
91 - if [ "${UID}" = "0" ]; then
92 - info="[root ${dir}]# "
93 - info_console="[${TPUT_DIM}${dir}${TPUT_RESET}]# "
94 - else
95 - info="[${user} ${dir}]$ "
96 - info_console="[${TPUT_DIM}${dir}${TPUT_RESET}]$ "
97 - fi
98 -
99 - {
100 - printf "${info}"
101 - escaped_print "${@}"
102 - printf " ... "
103 - } >> "${run_logfile}"
104 -
105 - printf >&2 "${info_console}${TPUT_BOLD}${TPUT_YELLOW}"
106 - escaped_print >&2 "${@}"
107 - printf >&2 "${TPUT_RESET}\n"
108 -
109 - "${@}"
110 -
111 - local ret=$?
112 - if [ ${ret} -ne 0 ]; then
113 - run_failed
114 - printf >> "${run_logfile}" "FAILED with exit code ${ret}\n"
115 - else
116 - run_ok
117 - printf >> "${run_logfile}" "OK\n"
118 - fi
119 -
120 - return ${ret}
121 -}
122 -
123 -fatal() {
124 - printf >&2 "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} ABORTED ${TPUT_RESET} ${*} \n\n"
125 - exit 1
126 -}
127 -
128 -_cannot_use_tmpdir() {
129 - local testfile ret
130 - testfile="$(TMPDIR="${1}" mktemp -q -t netdata-test.XXXXXXXXXX)"
131 - ret=0
132 -
133 - if [ -z "${testfile}" ] ; then
134 - return "${ret}"
135 - fi
136 -
137 - if printf '#!/bin/sh\necho SUCCESS\n' > "${testfile}" ; then
138 - if chmod +x "${testfile}" ; then
139 - if [ "$("${testfile}")" = "SUCCESS" ] ; then
140 - ret=1
141 - fi
142 - fi
143 - fi
144 -
145 - rm -f "${testfile}"
146 - return "${ret}"
147 -}
148 -
149 -create_tmp_directory() {
150 - if [ -z "${TMPDIR}" ] || _cannot_use_tmpdir "${TMPDIR}" ; then
151 - if _cannot_use_tmpdir /tmp ; then
152 - if _cannot_use_tmpdir "${PWD}" ; then
153 - echo >&2
154 - echo >&2 "Unable to find a usable temporary directory. Please set \$TMPDIR to a path that is both writable and allows execution of files and try again."
155 - exit 1
156 - else
157 - TMPDIR="${PWD}"
158 - fi
159 - else
160 - TMPDIR="/tmp"
161 - fi
162 - fi
163 -
164 - mktemp -d -t netdata-kickstart-XXXXXXXXXX
165 -}
166 -
167 -download() {
168 - url="${1}"
169 - dest="${2}"
170 - if command -v curl > /dev/null 2>&1; then
171 - run curl -q -sSL --connect-timeout 10 --retry 3 --output "${dest}" "${url}"
172 - elif command -v wget > /dev/null 2>&1; then
173 - run wget -T 15 -O "${dest}" "${url}" || fatal "Cannot download ${url}"
174 - else
175 - fatal "I need curl or wget to proceed, but neither is available on this system."
176 - fi
177 -}
178 -
179 -set_tarball_urls() {
180 - if [ -n "${NETDATA_LOCAL_TARBALL_OVERRIDE}" ]; then
181 - progress "Not fetching remote tarballs, local override was given"
182 - return
183 - fi
184 -
185 - if [ "$1" = "stable" ]; then
186 - local latest
187 - # Simple version
188 - latest="$(download "https://api.github.com/repos/netdata/netdata/releases/latest" /dev/stdout | grep tag_name | cut -d'"' -f4)"
189 - export NETDATA_TARBALL_URL="https://github.com/netdata/netdata/releases/download/$latest/netdata-latest.gz.run"
190 - export NETDATA_TARBALL_CHECKSUM_URL="https://github.com/netdata/netdata/releases/download/$latest/sha256sums.txt"
191 - else
192 - export NETDATA_TARBALL_URL="$NETDATA_TARBALL_BASEURL/netdata-latest.gz.run"
193 - export NETDATA_TARBALL_CHECKSUM_URL="$NETDATA_TARBALL_BASEURL/sha256sums.txt"
194 - fi
195 -}
196 -
197 -safe_sha256sum() {
198 - # Within the context of the installer, we only use -c option that is common between the two commands
199 - # We will have to reconsider if we start using non-common options
200 - if command -v sha256sum > /dev/null 2>&1; then
201 - sha256sum "$@"
202 - elif command -v shasum > /dev/null 2>&1; then
203 - shasum -a 256 "$@"
204 - else
205 - fatal "I could not find a suitable checksum binary to use"
206 - fi
207 -}
208 -
209 -mark_install_type() {
210 - install_type_file="/opt/netdata/etc/netdata/.install-type"
211 - if [ -f "${install_type_file}" ]; then
212 - # shellcheck disable=SC1090
213 - . "${install_type_file}"
214 - cat > "${TMPDIR}/install-type" <<- EOF
215 - INSTALL_TYPE='kickstart-static'
216 - PREBUILT_ARCH='${PREBUILT_ARCH}'
217 - EOF
218 - ${sudo} chown netdata:netdata "${TMPDIR}/install-type"
219 - ${sudo} cp "${TMPDIR}/install-type" "${install_type_file}"
220 - fi
221 -}
222 -
223 -claim() {
224 - progress "Attempting to claim agent to ${NETDATA_CLAIM_URL}"
225 - NETDATA_CLAIM_PATH=/opt/netdata/bin/netdata-claim.sh
226 -
227 - if ${sudo} "${NETDATA_CLAIM_PATH}" -token=${NETDATA_CLAIM_TOKEN} -rooms=${NETDATA_CLAIM_ROOMS} -url=${NETDATA_CLAIM_URL} ${NETDATA_CLAIM_EXTRA}; then
228 - progress "Successfully claimed node"
229 - return 0
230 - else
231 - run_failed "Unable to claim node, you must do so manually."
232 - return 1
233 - fi
234 -}
235 -
236 -# ----------------------------------------------------------------------------
237 -umask 022
238 -
239 -sudo=""
240 -[ -z "${UID}" ] && UID="$(id -u)"
241 -[ "${UID}" -ne "0" ] && sudo="sudo"
242 -
243 -# ----------------------------------------------------------------------------
244 -if [ "$(uname -m)" != "x86_64" ]; then
245 - fatal "Static binary versions of netdata are available only for 64bit Intel/AMD CPUs (x86_64), but yours is: $(uname -m)."
246 -fi
247 -
248 -if [ "$(uname -s)" != "Linux" ]; then
249 - fatal "Static binary versions of netdata are available only for Linux, but this system is $(uname -s)"
250 -fi
251 -
252 -# ----------------------------------------------------------------------------
253 -opts=
254 -NETDATA_INSTALLER_OPTIONS=""
255 -NETDATA_UPDATES="--auto-update"
256 -RELEASE_CHANNEL="nightly"
257 -while [ -n "${1}" ]; do
258 - case "${1}" in
259 - "--dont-wait") opts="${opts} --accept" ;;
260 - "--non-interactive") opts="${opts} --accept" ;;
261 - "--accept") opts="${opts} --accept" ;;
262 - "--dont-start-it")
263 - NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS:+${NETDATA_INSTALLER_OPTIONS} }${1}"
264 - NETDATA_CLAIM_EXTRA="${NETDATA_CLAIM_EXTRA} -daemon-not-running"
265 - ;;
266 - "--no-updates") NETDATA_UPDATES="" ;;
267 - "--stable-channel")
268 - RELEASE_CHANNEL="stable"
269 - NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS:+${NETDATA_INSTALLER_OPTIONS} }${1}"
270 - ;;
271 - "--disable-telemetry") NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS:+${NETDATA_INSTALLER_OPTIONS} }${1}";;
272 - "--local-files")
273 - NETDATA_UPDATES="" # Disable autoupdates if using pre-downloaded files.
274 - if [ -z "${2}" ]; then
275 - fatal "Option --local-files requires extra information. The desired tarball full filename is needed"
276 - fi
277 -
278 - NETDATA_LOCAL_TARBALL_OVERRIDE="${2}"
279 -
280 - if [ -z "${3}" ]; then
281 - fatal "Option --local-files requires a pair of the tarball source and the checksum file"
282 - fi
283 -
284 - NETDATA_LOCAL_TARBALL_OVERRIDE_CHECKSUM="${3}"
285 - shift 2
286 - ;;
287 - "--allow-duplicate-install") NETDATA_ALLOW_DUPLICATE_INSTALL=1 ;;
288 - "--reinstall") NETDATA_REINSTALL=1 ;;
289 - "--claim-token")
290 - NETDATA_CLAIM_TOKEN="${2}"
291 - shift 1
292 - ;;
293 - "--claim-rooms")
294 - NETDATA_CLAIM_ROOMS="${2}"
295 - shift 1
296 - ;;
297 - "--claim-url")
298 - NETDATA_CLAIM_URL="${2}"
299 - shift 1
300 - ;;
301 - "--claim-proxy")
302 - NETDATA_CLAIM_EXTRA="${NETDATA_CLAIM_EXTRA} -proxy ${2}"
303 - shift 1
304 - ;;
305 - *)
306 - echo >&2 "Unknown option '${1}' or invalid number of arguments. Please check the README for the available arguments of ${0} and try again"
307 - exit 1
308 - esac
309 - shift 1
310 -done
311 -
312 -if [ ! "${DO_NOT_TRACK:-0}" -eq 0 ] || [ -n "$DO_NOT_TRACK" ]; then
313 - NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS:+${NETDATA_INSTALLER_OPTIONS} }--disable-telemetry"
314 -fi
315 -
316 -if [ -n "${NETDATA_DISABLE_CLOUD}" ]; then
317 - if [ -n "${NETDATA_CLAIM_TOKEN}" ] || [ -n "${NETDATA_CLAIM_ROOMS}" ] || [ -n "${NETDATA_CLAIM_URL}" ]; then
318 - run_failed "Cloud explicitly disabled but automatic claiming requested."
319 - run_failed "Either enable Netdata Cloud, or remove the --claim-* options."
320 - exit 1
321 - fi
322 -fi
323 -
324 -# shellcheck disable=SC2235,SC2030
325 -if ( [ -z "${NETDATA_CLAIM_TOKEN}" ] && [ -n "${NETDATA_CLAIM_URL}" ] ) || ( [ -n "${NETDATA_CLAIM_TOKEN}" ] && [ -z "${NETDATA_CLAIM_URL}" ] ); then
326 - run_failed "Invalid claiming options, both a claiming token and URL must be specified."
327 - exit 1
328 -elif [ -z "${NETDATA_CLAIM_TOKEN}" ] && [ -n "${NETDATA_CLAIM_ROOMS}" ]; then
329 - run_failed "Invalid claiming options, claim rooms may only be specified when a token and URL are specified."
330 - exit 1
331 -fi
332 -
333 -# Netdata Tarball Base URL (defaults to our Google Storage Bucket)
334 -[ -z "$NETDATA_TARBALL_BASEURL" ] && NETDATA_TARBALL_BASEURL=https://storage.googleapis.com/netdata-nightlies
335 -
336 -# ---------------------------------------------------------------------------------------------------------------------
337 -# look for an existing install and try to update that instead if it exists
338 -
339 -ndpath="$(command -v netdata 2>/dev/null)"
340 -if [ -z "$ndpath" ] && [ -x /opt/netdata/bin/netdata ] ; then
341 - ndpath="/opt/netdata/bin/netdata"
342 -fi
343 -
344 -if [ -n "$ndpath" ] ; then
345 - ndprefix="$(dirname "$(dirname "${ndpath}")")"
346 -
347 - if [ "${ndprefix}" = /usr ] ; then
348 - ndprefix="/"
349 - fi
350 -
351 - progress "Found existing install of Netdata under: ${ndprefix}"
352 -
353 - if [ -r "${ndprefix}/etc/netdata/.environment" ] ; then
354 - ndstatic="$(grep IS_NETDATA_STATIC_BINARY "${ndprefix}/etc/netdata/.environment" | cut -d "=" -f 2 | tr -d \")"
355 - if [ -z "${NETDATA_REINSTALL}" ] && [ -z "${NETDATA_LOCAL_TARBALL_OVERRIDE}" ] ; then
356 - if [ -n "${NETDATA_CLAIM_TOKEN}" ] ; then
357 - claim
358 - exit $?
359 - elif [ -x "${ndprefix}/usr/libexec/netdata/netdata-updater.sh" ] ; then
360 - progress "Attempting to update existing install instead of creating a new one"
361 - if run ${sudo} "${ndprefix}/usr/libexec/netdata/netdata-updater.sh" --not-running-from-cron ; then
362 - progress "Updated existing install at ${ndpath}"
363 - exit 0
364 - else
365 - fatal "Failed to update existing Netdata install"
366 - exit 1
367 - fi
368 - else
369 - if [ -z "${NETDATA_ALLOW_DUPLICATE_INSTALL}" ] || [ "${ndstatic}" = "no" ] ; then
370 - fatal "Existing installation detected which cannot be safely updated by this script, refusing to continue."
371 - exit 1
372 - else
373 - progress "User explicitly requested duplicate install, proceeding."
374 - fi
375 - fi
376 - else
377 - if [ "${ndstatic}" = "yes" ] ; then
378 - progress "User requested reinstall instead of update, proceeding."
379 - else
380 - fatal "Existing install is not a static install, please use kickstart.sh instead."
381 - exit 1
382 - fi
383 - fi
384 - else
385 - progress "Existing install appears to be handled manually or through the system package manager."
386 - if [ -n "${NETDATA_CLAIM_TOKEN}" ] ; then
387 - claim
388 - exit $?
389 - elif [ -z "${NETDATA_ALLOW_DUPLICATE_INSTALL}" ] ; then
390 - fatal "Existing installation detected which cannot be safely updated by this script, refusing to continue."
391 - exit 1
392 - else
393 - progress "User explicitly requested duplicate install, proceeding."
394 - fi
395 - fi
396 -fi
397 -
398 -# ----------------------------------------------------------------------------
399 -TMPDIR=$(create_tmp_directory)
400 -cd "${TMPDIR}" || exit 1
401 -
402 -if [ -z "${NETDATA_LOCAL_TARBALL_OVERRIDE}" ]; then
403 - set_tarball_urls "${RELEASE_CHANNEL}"
404 - progress "Downloading static netdata binary: ${NETDATA_TARBALL_URL}"
405 -
406 - download "${NETDATA_TARBALL_CHECKSUM_URL}" "${TMPDIR}/sha256sum.txt"
407 - download "${NETDATA_TARBALL_URL}" "${TMPDIR}/netdata-latest.gz.run"
408 -else
409 - progress "Installation sources were given as input, running installation using \"${NETDATA_LOCAL_TARBALL_OVERRIDE}\""
410 - run cp "${NETDATA_LOCAL_TARBALL_OVERRIDE}" "${TMPDIR}/netdata-latest.gz.run"
411 - run cp "${NETDATA_LOCAL_TARBALL_OVERRIDE_CHECKSUM}" "${TMPDIR}/sha256sum.txt"
412 -fi
413 -
414 -if ! grep netdata-latest.gz.run "${TMPDIR}/sha256sum.txt" | safe_sha256sum -c - > /dev/null 2>&1; then
415 - fatal "Static binary checksum validation failed. Stopping Netdata Agent installation and leaving binary in ${TMPDIR}\nUsually this is a result of an older copy of the file being cached somewhere upstream and can be resolved by retrying in an hour."
416 -fi
417 -
418 -# ----------------------------------------------------------------------------
419 -progress "Installing netdata"
420 -run ${sudo} sh "${TMPDIR}/netdata-latest.gz.run" ${opts} -- ${NETDATA_UPDATES} ${NETDATA_INSTALLER_OPTIONS}
421 -
422 -mark_install_type
423 -
424 -#shellcheck disable=SC2181
425 -if [ $? -eq 0 ]; then
426 - run ${sudo} rm "${TMPDIR}/netdata-latest.gz.run"
427 - if [ ! "${TMPDIR}" = "/" ] && [ -d "${TMPDIR}" ]; then
428 - run ${sudo} rm -rf "${TMPDIR}"
429 - fi
430 -else
431 - echo >&2 "NOTE: did not remove: ${TMPDIR}/netdata-latest.gz.run"
432 - exit 1
433 -fi
434 -
435 -# --------------------------------------------------------------------------------------------------------------------
436 -
437 -if [ -n "${NETDATA_CLAIM_TOKEN}" ]; then
438 - claim
439 -fi
packaging/installer/kickstart-static64.sh new
+1
@@ -0,0 +1 @@
1 +kickstart.sh
\ No newline at end of file
packaging/installer/kickstart.sh
+1114 -381
@@ -1,91 +1,105 @@
1 -#!/usr/bin/env bash
2 -# SPDX-License-Identifier: GPL-3.0-or-later
3 -#
4 -# Run me with:
5 -#
6 -# bash <(curl -Ss https://my-netdata.io/kickstart.sh)
7 -#
8 -# or (to install all netdata dependencies):
9 -#
10 -# bash <(curl -Ss https://my-netdata.io/kickstart.sh) all
11 -#
12 -# Other options:
13 -# --dont-wait do not prompt for user input
14 -# --non-interactive do not prompt for user input
15 -# --no-updates do not install script for daily updates
16 -# --local-files set the full path of the desired tarball to run install with
17 -# --allow-duplicate-install do not bail if we detect a duplicate install
18 -# --reinstall if an existing install would be updated, reinstall instead
19 -# --disable-telemetry opt out of anonymous statistics
20 -# --claim-token specify a token to use for claiming the newly installed instance
21 -# --claim-url specify a URL to use for claiming the newly installed isntance
22 -# --claim-rooms specify a list of rooms to claim the newly installed instance to
23 -# --claim-proxy specify a proxy to use while claiming the newly installed instance
24 -#
25 -# Environment options:
1 +#!/bin/sh
2 #
27 -# TMPDIR specify where to save temporary files
28 -# NETDATA_TARBALL_BASEURL set the base url for downloading the dist tarball
29 -#
30 -# This script will:
31 -#
32 -# 1. install all netdata compilation dependencies
33 -# using the package manager of the system
34 -#
35 -# 2. download netdata nightly package to temporary directory
36 -#
37 -# 3. install netdata
3 +# SPDX-License-Identifier: GPL-3.0-or-later
4
39 -# shellcheck disable=SC2039,SC2059,SC2086
5 +# ======================================================================
6 +# Constants
7
41 -# External files
8 +KICKSTART_OPTIONS="${*}"
9 PACKAGES_SCRIPT="https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/install-required-packages.sh"
43 -
44 -# Netdata Tarball Base URL (defaults to our Google Storage Bucket)
45 -[ -z "$NETDATA_TARBALL_BASEURL" ] && NETDATA_TARBALL_BASEURL=https://storage.googleapis.com/netdata-nightlies
46 -
10 +PATH="${PATH}:/usr/local/bin:/usr/local/sbin"
11 +REPOCONFIG_URL_PREFIX="https://packagecloud.io/netdata/netdata-repoconfig/packages"
12 +REPOCONFIG_VERSION="1-1"
13 TELEMETRY_URL="https://posthog.netdata.cloud/capture/"
48 -TELEMETRY_API_KEY="${NETDATA_POSTHOG_API_KEY:-mqkwGT0JNFqO-zX2t0mW6Tec9yooaVu7xCBlXtHnt5Y}"
49 -KICKSTART_OPTIONS="${*}"
50 -
51 -# ---------------------------------------------------------------------------------------------------------------------
52 -# library functions copied from packaging/installer/functions.sh
14 +START_TIME="$(date +%s)"
15 +
16 +# ======================================================================
17 +# Defaults for environment variables
18 +
19 +SELECTED_INSTALL_METHOD="none"
20 +INSTALL_TYPE="unknown"
21 +INSTALL_PREFIX=""
22 +NETDATA_AUTO_UPDATES="1"
23 +NETDATA_CLAIM_ONLY=0
24 +NETDATA_CLAIM_URL="https://app.netdata.cloud"
25 +NETDATA_DISABLE_CLOUD=0
26 +NETDATA_ONLY_BUILD=0
27 +NETDATA_ONLY_NATIVE=0
28 +NETDATA_ONLY_STATIC=0
29 +NETDATA_REQUIRE_CLOUD=1
30 +RELEASE_CHANNEL="nightly"
31
54 -setup_terminal() {
55 - TPUT_RESET=""
56 - TPUT_YELLOW=""
57 - TPUT_WHITE=""
58 - TPUT_BGRED=""
59 - TPUT_BGGREEN=""
60 - TPUT_BOLD=""
61 - TPUT_DIM=""
32 +NETDATA_DISABLE_TELEMETRY="${DO_NOT_TRACK:-0}"
33 +NETDATA_TARBALL_BASEURL="${NETDATA_TARBALL_BASEURL:-https://storage.googleapis.com/netdata-nightlies}"
34 +NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS:-""}"
35 +TELEMETRY_API_KEY="${NETDATA_POSTHOG_API_KEY:-mqkwGT0JNFqO-zX2t0mW6Tec9yooaVu7xCBlXtHnt5Y}"
36
63 - # Is stderr on the terminal? If not, then fail
64 - test -t 2 || return 1
37 +if echo "${0}" | grep -q 'kickstart-static64'; then
38 + NETDATA_ONLY_STATIC=1
39 +fi
40
66 - if command -v tput > /dev/null 2>&1; then
67 - if [ $(($(tput colors 2> /dev/null))) -ge 8 ]; then
68 - # Enable colors
69 - TPUT_RESET="$(tput sgr 0)"
70 - TPUT_YELLOW="$(tput setaf 3)"
71 - TPUT_WHITE="$(tput setaf 7)"
72 - TPUT_BGRED="$(tput setab 1)"
73 - TPUT_BGGREEN="$(tput setab 2)"
74 - TPUT_BOLD="$(tput bold)"
75 - TPUT_DIM="$(tput dim)"
76 - fi
77 - fi
41 +if [ ! -t 1 ]; then
42 + INTERACTIVE=0
43 +else
44 + INTERACTIVE=1
45 +fi
46
79 - return 0
47 +# ======================================================================
48 +# Usage info
49 +
50 +usage() {
51 + cat << HEREDOC
52 +USAGE: kickstart.sh [options]
53 + where options include:
54 +
55 + --non-interactive Do not prompt for user input. (default: prompt if there is a controlling terminal)
56 + --interactive Prompt for user input even if there is no controlling terminal.
57 + --dont-start-it Do not start the agent by default (only for static installs or local builds)
58 + --stable-channel Install a stable version instead of a nightly build (default: install a nightly build)
59 + --nightly-channel Install a nightly build instead of a stable version
60 + --no-updates Do not enable automatic updates (default: enable automatic updates)
61 + --auto-update Enable automatic updates.
62 + --disable-telemetry Opt-out of anonymous statistics.
63 + --native-only Only install if native binary packages are available.
64 + --static-only Only install if a static build is available.
65 + --build-only Only install using a local build.
66 + --reinstall Explicitly reinstall instead of updating any existing install.
67 + --reinstall-even-if-unsafe Even try to reinstall if we don't think we can do so safely (implies --reinstall).
68 + --disable-cloud Disable support for Netdata Cloud (default: detect)
69 + --require-cloud Only install if Netdata Cloud can be enabled. Overrides --disable-cloud.
70 + --install <path> Specify an installation prefix for local builds (default: autodetect based on system type).
71 + --claim-token Use a specified token for claiming to Netdata Cloud.
72 + --claim-rooms When claiming, add the node to the specified rooms.
73 + --claim-only If there is an existing install, only try to claim it, not update it.
74 + --claim-* Specify other options for the claiming script.
75 + --no-cleanup Don't do any cleanup steps. This is intended to help with debugging the installer.
76 +
77 +Additionally, this script may use the following environment variables:
78 +
79 + TMPDIR: Used to specify where to put temporary files. On most systems, the default we select
80 + automatically should be fine. The user running the script needs to both be able to
81 + write files to the temporary directory, and run files from that location.
82 + ROOTCMD: Used to specify a command to use to run another command with root privileges if needed. By
83 + default we try to use sudo, doas, or pkexec (in that order of preference), but if
84 + you need special options for one of those to work, or have a different tool to do
85 + the same thing on your system, you can specify it here.
86 + DO_NOT_TRACK If set to a value other than 0, behave as if \`--disable-telemetry\` was specified.
87 + NETDATA_INSTALLER_OPTIONS: Specifies extra options to pass to the static installer or local build script.
88 +
89 +HEREDOC
90 }
81 -setup_terminal || echo > /dev/null
91
83 -# -----------------------------------------------------------------------------
92 +# ======================================================================
93 +# Telemetry functions
94 +
95 telemetry_event() {
85 - if [ -n "${NETDATA_DISABLE_TELEMETRY}" ]; then
96 + if [ "${NETDATA_DISABLE_TELEMETRY}" -eq 1 ]; then
97 return 0
98 fi
99
100 + now="$(date +%s)"
101 + total_duration="$((now - START_TIME))"
102 +
103 if [ -e "/etc/os-release" ]; then
104 eval "$(grep -E "^(NAME|ID|ID_LIKE|VERSION|VERSION_ID)=" < /etc/os-release | sed 's/^/HOST_/')"
105 fi
@@ -115,7 +129,7 @@ telemetry_event() {
129
130 if [ -f /etc/machine-id ]; then
131 DISTINCT_ID="$(cat /etc/machine-id)"
118 - elif command -v uuidgen 2> /dev/null; then
132 + elif command -v uuidgen > /dev/null 2>&1; then
133 DISTINCT_ID="$(uuidgen)"
134 else
135 DISTINCT_ID="null"
@@ -132,12 +146,14 @@ telemetry_event() {
146 "\$pathname": "netdata-installer",
147 "\$host": "installer.netdata.io",
148 "\$ip": "127.0.0.1",
135 - "script_variant": "legacy-kickstart",
136 - "error_code": "${2}",
137 - "error_message": "${3}",
149 + "script_variant": "kickstart-ng",
150 + "error_code": "${3}",
151 + "error_message": "${2}",
152 "install_options": "${KICKSTART_OPTIONS}",
153 + "total_runtime": "${total_duration}",
154 + "selected_install_method": "${SELECTED_INSTALL_METHOD}",
155 "netdata_release_channel": "${RELEASE_CHANNEL:-null}",
140 - "netdata_install_type": "kickstart-build",
156 + "netdata_install_type": "${INSTALL_TYPE}",
157 "host_os_name": "${HOST_NAME:-unknown}",
158 "host_os_id": "${HOST_ID:-unknown}",
159 "host_os_id_like": "${HOST_ID_LIKE:-unknown}",
@@ -152,39 +168,102 @@ telemetry_event() {
168 EOF
169 )"
170
155 -if [ -n "$(command -v curl 2> /dev/null)" ]; then
156 - curl --silent -o /dev/null --write-out '%{http_code}' -X POST --max-time 2 --header "Content-Type: application/json" -d "${REQ_BODY}" "${TELEMETRY_URL}"
157 -else
158 - wget -q -O - --no-check-certificate \
159 - --server-response \
160 - --method POST \
161 - --timeout=1 \
162 - --header 'Content-Type: application/json' \
163 - --body-data "${REQ_BODY}" \
164 - "${TELEMETRY_URL}" 2>&1 | awk '/^ HTTP/{print $2}'
165 -fi
171 + if command -v curl > /dev/null 2>&1; then
172 + curl --silent -o /dev/null -X POST --max-time 2 --header "Content-Type: application/json" -d "${REQ_BODY}" "${TELEMETRY_URL}" > /dev/null
173 + elif command -v wget > /dev/null 2>&1; then
174 + wget -q -O - --no-check-certificate \
175 + --method POST \
176 + --timeout=1 \
177 + --header 'Content-Type: application/json' \
178 + --body-data "${REQ_BODY}" \
179 + "${TELEMETRY_URL}" > /dev/null
180 + fi
181 +}
182 +
183 +trap_handler() {
184 + code="${1}"
185 + lineno="${2}"
186 +
187 + printf >&2 "%s\n\n" "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} ERROR ${TPUT_RESET} Installer exited unexpectedly (${code}-${lineno})"
188 +
189 + telemetry_event INSTALL_CRASH "Installer exited unexpectedly (${code}-${lineno})" "E${code}-${lineno}"
190 +
191 + trap - EXIT
192 +
193 + cleanup
194 +
195 + exit 1
196 +}
197 +
198 +trap 'trap_handler 0 ${LINENO}' EXIT
199 +trap 'trap_handler 1 0' HUP
200 +trap 'trap_handler 2 0' INT
201 +trap 'trap_handler 3 0' QUIT
202 +trap 'trap_handler 13 0' PIPE
203 +trap 'trap_handler 15 0' TERM
204 +
205 +# ======================================================================
206 +# Utility functions
207 +
208 +setup_terminal() {
209 + TPUT_RESET=""
210 + TPUT_WHITE=""
211 + TPUT_BGRED=""
212 + TPUT_BGGREEN=""
213 + TPUT_BOLD=""
214 + TPUT_DIM=""
215 +
216 + # Is stderr on the terminal? If not, then fail
217 + test -t 2 || return 1
218 +
219 + if command -v tput > /dev/null 2>&1; then
220 + if [ $(($(tput colors 2> /dev/null))) -ge 8 ]; then
221 + # Enable colors
222 + TPUT_RESET="$(tput sgr 0)"
223 + TPUT_WHITE="$(tput setaf 7)"
224 + TPUT_BGRED="$(tput setab 1)"
225 + TPUT_BGGREEN="$(tput setab 2)"
226 + TPUT_BOLD="$(tput bold)"
227 + TPUT_DIM="$(tput dim)"
228 + fi
229 + fi
230 +
231 + echo "${TPUT_RESET}"
232 +
233 + return 0
234 +}
235 +
236 +cleanup() {
237 + if [ -z "${NO_CLEANUP}" ]; then
238 + ${ROOTCMD} rm -rf "${tmpdir}"
239 + fi
240 }
241
242 fatal() {
169 - printf >&2 "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} ABORTED ${TPUT_RESET} ${1} \n\n"
243 + printf >&2 "%s\n\n" "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} ABORTED ${TPUT_RESET} ${1}"
244 telemetry_event "INSTALL_FAILED" "${1}" "${2}"
245 + cleanup
246 + trap - EXIT
247 exit 1
248 }
249
250 run_ok() {
175 - printf >&2 "${TPUT_BGGREEN}${TPUT_WHITE}${TPUT_BOLD} OK ${TPUT_RESET} \n\n"
251 + printf >&2 "%s\n\n" "${TPUT_BGGREEN}${TPUT_WHITE}${TPUT_BOLD} OK ${TPUT_RESET}"
252 }
253
254 run_failed() {
179 - printf >&2 "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} FAILED ${TPUT_RESET} \n\n"
255 + printf >&2 "%s\n\n" "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} FAILED ${TPUT_RESET}"
256 }
257
258 ESCAPED_PRINT_METHOD=
259 +# shellcheck disable=SC3050
260 if printf "%q " test > /dev/null 2>&1; then
261 ESCAPED_PRINT_METHOD="printfq"
262 fi
263 +
264 escaped_print() {
265 if [ "${ESCAPED_PRINT_METHOD}" = "printfq" ]; then
266 + # shellcheck disable=SC3050
267 printf "%q " "${@}"
268 else
269 printf "%s" "${*}"
@@ -193,14 +272,15 @@ escaped_print() {
272 }
273
274 progress() {
196 - echo >&2 " --- ${TPUT_DIM}${TPUT_BOLD}${*}${TPUT_RESET} --- "
275 + echo >&2 " --- ${TPUT_BOLD}${*}${TPUT_RESET} --- "
276 }
277
278 run_logfile="/dev/null"
279 run() {
201 - local user="${USER--}" dir="${PWD}" info info_console
280 + user="${USER--}"
281 + dir="${PWD}"
282
203 - if [ "${UID}" = "0" ]; then
283 + if [ "$(id -u)" = "0" ]; then
284 info="[root ${dir}]# "
285 info_console="[${TPUT_DIM}${dir}${TPUT_RESET}]# "
286 else
@@ -209,51 +289,44 @@ run() {
289 fi
290
291 {
212 - printf "${info}"
292 + printf "%s" "${info}"
293 escaped_print "${@}"
294 printf " ... "
295 } >> "${run_logfile}"
296
217 - printf >&2 "${info_console}${TPUT_BOLD}${TPUT_YELLOW}"
297 + printf >&2 "%s" "${info_console}${TPUT_BOLD}"
298 escaped_print >&2 "${@}"
219 - printf >&2 "${TPUT_RESET}"
299 + printf >&2 "%s\n" "${TPUT_RESET}"
300
301 "${@}"
302
223 - local ret=$?
303 + ret=$?
304 if [ ${ret} -ne 0 ]; then
305 run_failed
226 - printf >> "${run_logfile}" "FAILED with exit code ${ret}\n"
306 + printf "%s\n" "FAILED with exit code ${ret}" >> "${run_logfile}"
307 else
308 run_ok
229 - printf >> "${run_logfile}" "OK\n"
309 + printf "OK\n" >> "${run_logfile}"
310 fi
311
312 return ${ret}
313 }
314
315 warning() {
236 - printf >&2 "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} WARNING ${TPUT_RESET} ${*} \n\n"
237 - if [ "${INTERACTIVE}" = "0" ]; then
238 - fatal "Stopping due to non-interactive mode. Fix the issue or retry installation in an interactive mode." F0001
239 - else
240 - read -r -p "Press ENTER to attempt netdata installation > "
241 - progress "OK, let's give it a try..."
242 - fi
316 + printf >&2 "%s\n\n" "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} WARNING ${TPUT_RESET} ${*}"
317 }
318
319 _cannot_use_tmpdir() {
246 - local testfile ret
320 testfile="$(TMPDIR="${1}" mktemp -q -t netdata-test.XXXXXXXXXX)"
321 ret=0
322
250 - if [ -z "${testfile}" ] ; then
323 + if [ -z "${testfile}" ]; then
324 return "${ret}"
325 fi
326
254 - if printf '#!/bin/sh\necho SUCCESS\n' > "${testfile}" ; then
255 - if chmod +x "${testfile}" ; then
256 - if [ "$("${testfile}")" = "SUCCESS" ] ; then
327 + if printf '#!/bin/sh\necho SUCCESS\n' > "${testfile}"; then
328 + if chmod +x "${testfile}"; then
329 + if [ "$("${testfile}")" = "SUCCESS" ]; then
330 ret=1
331 fi
332 fi
@@ -264,12 +337,10 @@ _cannot_use_tmpdir() {
337 }
338
339 create_tmp_directory() {
267 - if [ -z "${TMPDIR}" ] || _cannot_use_tmpdir "${TMPDIR}" ; then
268 - if _cannot_use_tmpdir /tmp ; then
269 - if _cannot_use_tmpdir "${PWD}" ; then
270 - echo >&2
271 - echo >&2 "Unable to find a usable temporary directory. Please set \$TMPDIR to a path that is both writable and allows execution of files and try again."
272 - exit 1
340 + if [ -z "${TMPDIR}" ] || _cannot_use_tmpdir "${TMPDIR}"; then
341 + if _cannot_use_tmpdir /tmp; then
342 + if _cannot_use_tmpdir "${PWD}"; then
343 + fatal "Unable to find a usable temporary directory. Please set \$TMPDIR to a path that is both writable and allows execution of files and try again." F0400
344 else
345 TMPDIR="${PWD}"
346 fi
@@ -285,346 +356,771 @@ download() {
356 url="${1}"
357 dest="${2}"
358 if command -v curl > /dev/null 2>&1; then
288 - run curl -q -sSL --connect-timeout 10 --retry 3 --output "${dest}" "${url}" || fatal "Cannot download ${url}" F0002
359 + run curl -q -sSL --connect-timeout 10 --retry 3 --output "${dest}" "${url}" || return 1
360 elif command -v wget > /dev/null 2>&1; then
290 - run wget -T 15 -O "${dest}" "${url}" || fatal "Cannot download ${url}" F0002
361 + run wget -T 15 -O "${dest}" "${url}" || return 1
362 else
292 - fatal "I need curl or wget to proceed, but neither is available on this system." F0003
363 + fatal "I need curl or wget to proceed, but neither of them are available on this system." F0003
364 fi
365 }
366
296 -set_tarball_urls() {
297 - if [ -n "${NETDATA_LOCAL_TARBALL_OVERRIDE}" ]; then
298 - progress "Not fetching remote tarballs, local override was given"
299 - return
300 - fi
367 +get_redirect() {
368 + url="${1}"
369
302 - if [ "$1" = "stable" ]; then
303 - local latest
304 - # Simple version
305 - latest="$(download "https://api.github.com/repos/netdata/netdata/releases/latest" /dev/stdout | grep tag_name | cut -d'"' -f4)"
306 - export NETDATA_TARBALL_URL="https://github.com/netdata/netdata/releases/download/$latest/netdata-latest.tar.gz"
307 - export NETDATA_TARBALL_CHECKSUM_URL="https://github.com/netdata/netdata/releases/download/$latest/sha256sums.txt"
370 + if command -v curl > /dev/null 2>&1; then
371 + run sh -c "curl ${url} -s -L -I -o /dev/null -w '%{url_effective}' | grep -o '[^/]*$'" || return 1
372 + elif command -v wget > /dev/null 2>&1; then
373 + run sh -c "wget --max-redirect=0 ${url} 2>&1 | grep Location | cut -d ' ' -f2 | grep -o '[^/]*$'" || return 1
374 else
309 - export NETDATA_TARBALL_URL="$NETDATA_TARBALL_BASEURL/netdata-latest.tar.gz"
310 - export NETDATA_TARBALL_CHECKSUM_URL="$NETDATA_TARBALL_BASEURL/sha256sums.txt"
375 + fatal "I need curl or wget to proceed, but neither of them are available on this system." F0003
376 fi
377 }
378
314 -detect_bash4() {
315 - bash="${1}"
316 - if [ -z "${BASH_VERSION}" ]; then
317 - # we don't run under bash
318 - if [ -n "${bash}" ] && [ -x "${bash}" ]; then
319 - # shellcheck disable=SC2016
320 - BASH_MAJOR_VERSION=$(${bash} -c 'echo "${BASH_VERSINFO[0]}"')
321 - fi
379 +safe_sha256sum() {
380 + # Within the context of the installer, we only use -c option that is common between the two commands
381 + # We will have to reconsider if we start using non-common options
382 + if command -v sha256sum > /dev/null 2>&1; then
383 + sha256sum "$@"
384 + elif command -v shasum > /dev/null 2>&1; then
385 + shasum -a 256 "$@"
386 else
323 - # we run under bash
324 - BASH_MAJOR_VERSION="${BASH_VERSINFO[0]}"
387 + fatal "I could not find a suitable checksum binary to use" F0004
388 fi
389 +}
390
327 - if [ -z "${BASH_MAJOR_VERSION}" ]; then
328 - echo >&2 "No BASH is available on this system"
329 - return 1
330 - elif [ $((BASH_MAJOR_VERSION)) -lt 4 ]; then
331 - echo >&2 "No BASH v4+ is available on this system (installed bash is v${BASH_MAJOR_VERSION})"
332 - return 1
391 +get_system_info() {
392 + case "$(uname -s)" in
393 + Linux)
394 + SYSTYPE="Linux"
395 +
396 + os_release_file=
397 + if [ -s "/etc/os-release" ] && [ -r "/etc/os-release" ]; then
398 + os_release_file="/etc/os-release"
399 + elif [ -s "/usr/lib/os-release" ] && [ -r "/usr/lib/os-release" ]; then
400 + os_release_file="/usr/lib/os-release"
401 + else
402 + fatal "Cannot find an os-release file ..." F0401
403 + fi
404 +
405 + # shellcheck disable=SC1090
406 + . "${os_release_file}"
407 +
408 + DISTRO="${ID}"
409 + SYSVERSION="${VERSION_ID}"
410 + SYSCODENAME="${VERSION_CODENAME}"
411 + SYSARCH="$(uname -m)"
412 +
413 + supported_compat_names="debian ubuntu centos fedora opensuse"
414 +
415 + if str_in_list "${DISTRO}" "${supported_compat_names}"; then
416 + DISTRO_COMPAT_NAME="${DISTRO}"
417 + else
418 + case "${DISTRO}" in
419 + opensuse-leap)
420 + DISTRO_COMPAT_NAME="opensuse"
421 + ;;
422 + rhel)
423 + DISTRO_COMPAT_NAME="centos"
424 + ;;
425 + *)
426 + DISTRO_COMPAT_NAME="unknown"
427 + ;;
428 + esac
429 + fi
430 + ;;
431 + Darwin)
432 + SYSTYPE="Darwin"
433 + SYSVERSION="$(sw_vers -buildVersion)"
434 + SYSARCH="$(uname -m)"
435 + ;;
436 + FreeBSD)
437 + SYSTYPE="FreeBSD"
438 + SYSVERSION="$(uname -K)"
439 + SYSARCH="$(uname -m)"
440 + ;;
441 + *)
442 + fatal "Unsupported system type detected. Netdata cannot be installed on this system using this script." F0200
443 + ;;
444 + esac
445 +}
446 +
447 +str_in_list() {
448 + printf "%s\n" "${2}" | tr ' ' "\n" | grep -qE "^${1}\$"
449 + return $?
450 +}
451 +
452 +confirm_root_support() {
453 + if [ "$(id -u)" -ne "0" ]; then
454 + if [ -z "${ROOTCMD}" ] && command -v sudo > /dev/null; then
455 + ROOTCMD="sudo"
456 + fi
457 +
458 + if [ -z "${ROOTCMD}" ] && command -v doas > /dev/null; then
459 + ROOTCMD="doas"
460 + fi
461 +
462 + if [ -z "${ROOTCMD}" ] && command -v pkexec > /dev/null; then
463 + ROOTCMD="pkexec"
464 + fi
465 +
466 + if [ -z "${ROOTCMD}" ]; then
467 + fatal "We need root privileges to continue, but cannot find a way to gain them. Either re-run this script as root, or set \$ROOTCMD to a command that can be used to gain root privileges" F0201
468 + fi
469 fi
334 - return 0
470 }
471
337 -dependencies() {
338 - SYSTEM="$(uname -s 2> /dev/null || uname -v)"
339 - OS="$(uname -o 2> /dev/null || uname -rs)"
340 - MACHINE="$(uname -m 2> /dev/null)"
472 +confirm() {
473 + prompt="${1} [y/n]"
474
342 - echo "System : ${SYSTEM}"
343 - echo "Operating System : ${OS}"
344 - echo "Machine : ${MACHINE}"
345 - echo "BASH major version: ${BASH_MAJOR_VERSION}"
475 + while true; do
476 + echo "${prompt}"
477 + read -r yn
478
347 - bash="$(command -v bash 2> /dev/null)"
348 - if ! detect_bash4 "${bash}"; then
349 - warning "Cannot detect packages to be installed in this system, without BASH v4+."
479 + case "$yn" in
480 + [Yy]*) return 0;;
481 + [Nn]*) return 1;;
482 + *) echo "Please answer yes or no.";;
483 + esac
484 + done
485 +}
486 +
487 +# ======================================================================
488 +# Existing install handling code
489 +
490 +update() {
491 + updater="${ndprefix}/usr/libexec/netdata/netdata-updater.sh"
492 +
493 + if [ -x "${updater}" ]; then
494 + if run ${ROOTCMD} "${updater}" --not-running-from-cron; then
495 + progress "Updated existing install at ${ndprefix}"
496 + return 0
497 + else
498 + fatal "Failed to update existing Netdata install at ${ndprefix}" F0100
499 + fi
500 else
351 - progress "Fetching script to detect required packages..."
352 - if [ -n "${NETDATA_LOCAL_TARBALL_OVERRIDE_DEPS_SCRIPT}" ]; then
353 - if [ -f "${NETDATA_LOCAL_TARBALL_OVERRIDE_DEPS_SCRIPT}" ]; then
354 - run cp "${NETDATA_LOCAL_TARBALL_OVERRIDE_DEPS_SCRIPT}" "${ndtmpdir}/install-required-packages.sh"
355 - else
356 - fatal "Invalid given dependency file, please check your --local-files parameter options and try again" F1001
357 - fi
501 + return 1
502 + fi
503 +}
504 +
505 +handle_existing_install() {
506 + if pkg_installed netdata; then
507 + ndprefix="/"
508 + else
509 + if [ -n "${INSTALL_PREFIX}" ]; then
510 + searchpath="${INSTALL_PREFIX}/bin:${INSTALL_PREFIX}/sbin:${INSTALL_PREFIX}/usr/bin:${INSTALL_PREFIX}/usr/sbin:${PATH}"
511 + searchpath="${INSTALL_PREFIX}/netdata/bin:${INSTALL_PREFIX}/netdata/sbin:${INSTALL_PREFIX}/netdata/usr/bin:${INSTALL_PREFIX}/netdata/usr/sbin:${searchpath}"
512 else
359 - download "${PACKAGES_SCRIPT}" "${ndtmpdir}/install-required-packages.sh"
513 + searchpath="${PATH}"
514 + fi
515 +
516 + ndpath="$(PATH="${searchpath}" command -v netdata 2>/dev/null)"
517 +
518 + if [ -z "$ndpath" ] && [ -x /opt/netdata/bin/netdata ]; then
519 + ndpath="/opt/netdata/bin/netdata"
520 + fi
521 +
522 + if [ -n "${ndpath}" ]; then
523 + ndprefix="$(dirname "$(dirname "${ndpath}")")"
524 + fi
525 +
526 + if echo "${ndprefix}" | grep -Eq '/usr$'; then
527 + ndprefix="$(dirname "${ndprefix}")"
528 fi
529 + fi
530
362 - if [ ! -s "${ndtmpdir}/install-required-packages.sh" ]; then
363 - warning "Downloaded dependency installation script is empty."
531 + if [ -n "${ndprefix}" ]; then
532 + typefile="${ndprefix}/etc/netdata/.install-type"
533 + if [ -r "${typefile}" ]; then
534 + ${ROOTCMD} sh -c "cat \"${typefile}\" > \"${tmpdir}/install-type\""
535 + # shellcheck disable=SC1091
536 + . "${tmpdir}/install-type"
537 else
365 - progress "Running downloaded script to detect required packages..."
366 - run ${sudo} "${bash}" "${ndtmpdir}/install-required-packages.sh" ${PACKAGES_INSTALLER_OPTIONS}
367 - # shellcheck disable=SC2181
368 - if [ $? -ne 0 ]; then
369 - warning "It failed to install all the required packages, but installation might still be possible."
370 - fi
538 + INSTALL_TYPE="unknown"
539 fi
540 + fi
541
542 + if [ -z "${ndprefix}" ]; then
543 + progress "No existing installations of netdata found, assuming this is a fresh install."
544 + return 0
545 fi
546 +
547 + case "${INSTALL_TYPE}" in
548 + kickstart-*|legacy-*|binpkg-*|manual-static|unknown)
549 + if [ "${INSTALL_TYPE}" = "unknown" ]; then
550 + warning "Found an existing netdata install at ${ndprefix}, but could not determine the install type."
551 + else
552 + progress "Found an existing netdata install at ${ndprefix}, with installation type '${INSTALL_TYPE}'."
553 + fi
554 +
555 + if [ -n "${NETDATA_REINSTALL}" ] || [ -n "${NETDATA_UNSAFE_REINSTALL}" ]; then
556 + progress "Found an existing netdata install at ${ndprefix}, but user requested reinstall, continuing."
557 +
558 + case "${INSTALL_TYPE}" in
559 + binpkg-*) NETDATA_ONLY_NATIVE=1 ;;
560 + *-build) NETDATA_ONLY_BUILD=1 ;;
561 + *-static) NETDATA_ONLY_STATIC=1 ;;
562 + *)
563 + if [ -n "${NETDATA_UNSAFE_REINSTALL}" ]; then
564 + warning "Reinstalling over top of a ${INSTALL_TYPE} installation may be unsafe, but the user has requested we proceed."
565 + elif [ "${INTERACTIVE}" -eq 0 ]; then
566 + fatal "User requested reinstall, but we cannot safely reinstall over top of a ${INSTALL_TYPE} installation, exiting." F0104
567 + else
568 + if confirm "Reinstalling over top of a ${INSTALL_TYPE} installation may be unsafe, do you want to continue?"; then
569 + progress "OK, continuing."
570 + else
571 + fatal "Cancelling reinstallation at user request." F0105
572 + fi
573 + fi
574 + ;;
575 + esac
576 +
577 + return 0
578 + fi
579 +
580 + ret=0
581 +
582 + if [ "${NETDATA_CLAIM_ONLY}" -eq 0 ] && echo "${INSTALL_TYPE}" | grep -vq "binpkg-*"; then
583 + if ! update; then
584 + warning "Unable to find usable updater script, not updating existing install at ${ndprefix}."
585 + fi
586 + else
587 + warning "Not updating existing install at ${ndprefix}."
588 + fi
589 +
590 + if [ -n "${NETDATA_CLAIM_TOKEN}" ]; then
591 + progress "Attempting to claim existing install at ${ndprefix}."
592 + INSTALL_PREFIX="${ndprefix}"
593 + claim
594 + ret=$?
595 + elif [ "${NETDATA_CLAIM_ONLY}" -eq 1 ]; then
596 + fatal "User asked to claim, but did not proide a claiming token." F0202
597 + else
598 + progress "Not attempting to claim existing install at ${ndprefix} (no claiming token provided)."
599 + fi
600 +
601 + cleanup
602 + trap - EXIT
603 + exit $ret
604 + ;;
605 + oci)
606 + fatal "This is an OCI container, use the regular image lifecycle management commands in your container instead of this script for managing it." F0203
607 + ;;
608 + *)
609 + if [ -n "${NETDATA_REINSTALL}" ] || [ -n "${NETDATA_UNSAFE_REINSTALL}" ]; then
610 + if [ -n "${NETDATA_UNSAFE_REINSTALL}" ]; then
611 + warning "Reinstalling over top of a ${INSTALL_TYPE} installation may be unsafe, but the user has requested we proceed."
612 + elif [ "${INTERACTIVE}" -eq 0 ]; then
613 + fatal "User requested reinstall, but we cannot safely reinstall over top of a ${INSTALL_TYPE} installation, exiting." F0104
614 + else
615 + if confirm "Reinstalling over top of a ${INSTALL_TYPE} installation may be unsafe, do you want to continue?"; then
616 + progress "OK, continuing."
617 + else
618 + fatal "Cancelling reinstallation at user request." F0105
619 + fi
620 + fi
621 + else
622 + fatal "Found an existing netdata install at ${ndprefix}, but the install type is '${INSTALL_TYPE}', which is not supported, refusing to proceed." F0103
623 + fi
624 + ;;
625 + esac
626 }
627
376 -safe_sha256sum() {
377 - # Within the context of the installer, we only use -c option that is common between the two commands
378 - # We will have to reconsider if we start non-common options
379 - if command -v sha256sum > /dev/null 2>&1; then
380 - sha256sum "$@"
381 - elif command -v shasum > /dev/null 2>&1; then
382 - shasum -a 256 "$@"
628 +soft_disable_cloud() {
629 + cloud_prefix="${INSTALL_PREFIX}/var/lib/netdata/cloud.d"
630 +
631 + run ${ROOTCMD} mkdir -p "${cloud_prefix}"
632 +
633 + cat > "${tmpdir}/cloud.conf" << EOF
634 +[global]
635 + enabled = no
636 +EOF
637 +
638 + run ${ROOTCMD} cp "${tmpdir}/cloud.conf" "${cloud_prefix}/cloud.conf"
639 +
640 + if [ -z "${NETDATA_NO_START}" ]; then
641 + case "${SYSTYPE}" in
642 + Darwin) run ${ROOTCMD} launchctl kickstart -k com.github.netdata ;;
643 + FreeBSD) run ${ROOTCMD} service netdata restart ;;
644 + Linux)
645 + initpath="$(${ROOTCMD} readlink /proc/1/exe)"
646 +
647 + if command -v service > /dev/null 2>&1; then
648 + run ${ROOTCMD} service netdata restart
649 + elif command -v rc-service > /dev/null 2>&1; then
650 + run ${ROOTCMD} rc-service netdata restart
651 + elif [ "$(basename "${initpath}" 2> /dev/null)" = "systemd" ]; then
652 + run ${ROOTCMD} systemctl restart netdata
653 + elif [ -f /etc/init.d/netdata ]; then
654 + run ${ROOTCMD} /etc/init.d/netdata restart
655 + fi
656 + ;;
657 + esac
658 + fi
659 +}
660 +
661 +confirm_install_prefix() {
662 + if [ -n "${INSTALL_PREFIX}" ] && [ "${NETDATA_ONLY_BUILD}" -ne 1 ]; then
663 + fatal "The \`--install\` option is only supported together with the \`--only-build\` option." F0204
664 + fi
665 +
666 + if [ -n "${INSTALL_PREFIX}" ]; then
667 + NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS} --install ${INSTALL_PREFIX}"
668 else
384 - fatal "I could not find a suitable checksum binary to use" F0004
669 + case "${SYSTYPE}" in
670 + Darwin)
671 + INSTALL_PREFIX="/usr/local/netdata"
672 + NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS} --install-no-prefix ${INSTALL_PREFIX}"
673 + ;;
674 + FreeBSD)
675 + INSTALL_PREFIX="/usr/local"
676 + NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS} --install-no-prefix ${INSTALL_PREFIX}"
677 + ;;
678 + esac
679 + fi
680 +}
681 +
682 +# ======================================================================
683 +# Claiming support code
684 +
685 +check_claim_opts() {
686 +# shellcheck disable=SC2235,SC2030
687 + if [ -z "${NETDATA_CLAIM_TOKEN}" ] && [ -n "${NETDATA_CLAIM_ROOMS}" ]; then
688 + fatal "Invalid claiming options, claim rooms may only be specified when a token and URL are specified." F0204
689 + elif [ -z "${NETDATA_CLAIM_TOKEN}" ] && [ -n "${NETDATA_CLAIM_EXTRA}" ]; then
690 + fatal "Invalid claiming options, a claiming token must be specified." F0204
691 + elif [ "${NETDATA_DISABLE_CLOUD}" -eq 1 ] && [ -n "${NETDATA_CLAIM_TOKEN}" ]; then
692 + fatal "Cloud explicitly disabled, but automatic claiming requested. Either enable Netdata Cloud, or remove the --claim-* options." F0204
693 + fi
694 +}
695 +
696 +is_netdata_running() {
697 + if command -v pgrep > /dev/null 2>&1; then
698 + if pgrep netdata; then
699 + return 0
700 + else
701 + return 1
702 + fi
703 + else
704 + if [ -z "${INSTALL_PREFIX}" ]; then
705 + NETDATACLI_PATH=/usr/sbin/netdatacli
706 + elif [ "${INSTALL_PREFIX}" = "/opt/netdata" ]; then
707 + NETDATACLI_PATH="/opt/netdata/bin/netdatacli"
708 + else
709 + NETDATACLI_PATH="${INSTALL_PREFIX}/netdata/usr/sbin/netdatacli"
710 + fi
711 +
712 + if "${NETDATACLI_PATH}" ping > /dev/null 2>&1; then
713 + return 0
714 + else
715 + return 1
716 + fi
717 fi
718 }
719
720 claim() {
721 progress "Attempting to claim agent to ${NETDATA_CLAIM_URL}"
390 - if [ -z "${NETDATA_PREFIX}" ] ; then
722 + if [ -z "${INSTALL_PREFIX}" ]; then
723 NETDATA_CLAIM_PATH=/usr/sbin/netdata-claim.sh
724 + elif [ "${INSTALL_PREFIX}" = "/opt/netdata" ]; then
725 + NETDATA_CLAIM_PATH="/opt/netdata/bin/netdata-claim.sh"
726 else
393 - NETDATA_CLAIM_PATH="${NETDATA_PREFIX}/netdata/usr/sbin/netdata-claim.sh"
727 + NETDATA_CLAIM_PATH="${INSTALL_PREFIX}/netdata/usr/sbin/netdata-claim.sh"
728 + fi
729 +
730 + if ! is_netdata_running; then
731 + NETDATA_CLAIM_EXTRA="${NETDATA_CLAIM_EXTRA} -daemon-not-running"
732 fi
733
396 - if ${sudo} "${NETDATA_CLAIM_PATH}" -token=${NETDATA_CLAIM_TOKEN} -rooms=${NETDATA_CLAIM_ROOMS} -url=${NETDATA_CLAIM_URL} ${NETDATA_CLAIM_EXTRA}; then
734 + # shellcheck disable=SC2086
735 + if ${ROOTCMD} "${NETDATA_CLAIM_PATH}" -token="${NETDATA_CLAIM_TOKEN}" -rooms="${NETDATA_CLAIM_ROOMS}" -url="${NETDATA_CLAIM_URL}" ${NETDATA_CLAIM_EXTRA}; then
736 progress "Successfully claimed node"
398 - return 0
737 else
400 - run_failed "Unable to claim node, you must do so manually."
401 - return 1
738 + warning "Unable to claim node, you must do so manually."
739 + if [ -z "${NETDATA_NEW_INSTALL}" ]; then
740 + cleanup
741 + trap - EXIT
742 + exit 1
743 + fi
744 fi
745 }
746
405 -# ---------------------------------------------------------------------------------------------------------------------
406 -umask 022
407 -
408 -sudo=""
409 -[ -z "${UID}" ] && UID="$(id -u)"
410 -[ "${UID}" -ne "0" ] && sudo="sudo"
411 -export PATH="${PATH}:/usr/local/bin:/usr/local/sbin"
747 +# ======================================================================
748 +# Native package install code.
749
413 -
414 -# ---------------------------------------------------------------------------------------------------------------------
415 -
416 -INTERACTIVE=1
417 -PACKAGES_INSTALLER_OPTIONS="netdata"
418 -NETDATA_INSTALLER_OPTIONS=""
419 -NETDATA_UPDATES="--auto-update"
420 -RELEASE_CHANNEL="nightly"
421 -while [ -n "${1}" ]; do
422 - case "${1}" in
423 - "all") PACKAGES_INSTALLER_OPTIONS="netdata-all" ;;
424 - "--dont-wait") INTERACTIVE=0 ;;
425 - "--non-interactive") INTERACTIVE=0 ;;
426 - "--no-updates") NETDATA_UPDATES= ;;
427 - "--stable-channel")
428 - RELEASE_CHANNEL="stable"
429 - NETDATA_INSTALLER_OPTIONS="$NETDATA_INSTALLER_OPTIONS --stable-channel"
430 - ;;
431 - "--allow-duplicate-install") NETDATA_ALLOW_DUPLICATE_INSTALL=1 ;;
432 - "--reinstall") NETDATA_REINSTALL=1 ;;
433 - "--claim-token")
434 - NETDATA_CLAIM_TOKEN="${2}"
435 - shift 1
436 - ;;
437 - "--claim-rooms")
438 - NETDATA_CLAIM_ROOMS="${2}"
439 - shift 1
750 +# Check for an already installed package with a given name.
751 +pkg_installed() {
752 + case "${DISTRO_COMPAT_NAME}" in
753 + debian|ubuntu)
754 + dpkg -l "${1}" > /dev/null 2>&1
755 + return $?
756 ;;
441 - "--claim-url")
442 - NETDATA_CLAIM_URL="${2}"
443 - shift 1
757 + centos|fedora|opensuse)
758 + rpm -q "${1}" > /dev/null 2>&1
759 + return $?
760 ;;
445 - "--claim-proxy")
446 - NETDATA_CLAIM_EXTRA="${NETDATA_CLAIM_EXTRA} -proxy ${2}"
447 - shift 1
761 + *)
762 + return 1
763 ;;
449 - "--dont-start-it")
450 - NETDATA_CLAIM_EXTRA="${NETDATA_CLAIM_EXTRA} -daemon-not-running"
451 - NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS} --dont-start-it"
764 + esac
765 +}
766 +
767 +# Check for the existence of a usable netdata package in the repo.
768 +netdata_avail_check() {
769 + case "${DISTRO_COMPAT_NAME}" in
770 + debian|ubuntu)
771 + env DEBIAN_FRONTEND=noninteractive apt-cache policy netdata | grep -q packagecloud.io/netdata/netdata;
772 + return $?
773 ;;
453 - "--install")
454 - NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS} --install ${2}"
455 - NETDATA_PREFIX="${2}"
456 - shift 1
774 + centos|fedora)
775 + # shellcheck disable=SC2086
776 + ${pm_cmd} search -v netdata | grep -qE 'Repo *: netdata(-edge)?$'
777 + return $?
778 ;;
458 - "--disable-cloud")
459 - NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS} --disable-cloud"
460 - NETDATA_DISABLE_CLOUD=1
779 + opensuse)
780 + zypper packages -r "$(zypper repos | grep -E 'netdata |netdata-edge ' | cut -f 1 -d '|' | tr -d ' ')" | grep -E 'netdata '
781 + return $?
782 ;;
462 - "--disable-telemetry")
463 - NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS} --disable-telemetry"
464 - NETDATA_DISABLE_TELEMETRY=1
783 + *)
784 + return 1
785 ;;
466 - "--local-files")
467 - if [ -z "${2}" ]; then
468 - 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" F1002
469 - fi
786 + esac
787 +}
788
471 - export NETDATA_LOCAL_TARBALL_OVERRIDE="${2}"
789 +# Check for any distro-specific dependencies we know we need.
790 +check_special_native_deps() {
791 + if [ "${DISTRO_COMPAT_NAME}" = "centos" ] && [ "${SYSVERSION}" = "7" ]; then
792 + progress "Checking for libuv availability."
793 + # shellcheck disable=SC2086
794 + if ${pm_cmd} search ${interactive_opts} -v libuv | grep -q "No matches found"; then
795 + progress "libv not found, checking for EPEL availability."
796 + # shellcheck disable=SC2086
797 + if ${pm_cmd} search ${interactive_opts} -v epel-release | grep -q "No matches found"; then
798 + warning "Unable to find a suitable source for libuv, cannot install on this system."
799 + return 1
800 + else
801 + progress "EPEL is available, attempting to install so that required dependencies are available."
802
473 - if [ -z "${3}" ]; then
474 - 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" F1003
803 + # shellcheck disable=SC2086
804 + if ! run ${ROOTCMD} env ${env} ${pm_cmd} install ${pkg_install_opts} epel-release; then
805 + warning "Failed to install EPEL."
806 + return 1
807 + fi
808 fi
809 + else
810 + return 0
811 + fi
812 + fi
813 +}
814
477 - export NETDATA_LOCAL_TARBALL_OVERRIDE_CHECKSUM="${3}"
478 -
479 - if [ -z "${4}" ]; then
480 - 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" F1004
481 - fi
815 +try_package_install() {
816 + if [ -z "${DISTRO}" ]; then
817 + warning "Unable to determine Linux distribution for native packages."
818 + return 1
819 + fi
820
483 - export NETDATA_LOCAL_TARBALL_OVERRIDE_GO_PLUGIN="${4}"
821 + progress "Attempting to install using native packages..."
822
485 - if [ -z "${5}" ]; then
486 - 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" F1005
487 - fi
823 + if [ "${RELEASE_CHANNEL}" = "nightly" ]; then
824 + release="-edge"
825 + else
826 + release=""
827 + fi
828
489 - export NETDATA_LOCAL_TARBALL_OVERRIDE_GO_PLUGIN_CONFIG="${5}"
829 + if [ "${INTERACTIVE}" = "0" ]; then
830 + interactive_opts="-y"
831 + env="DEBIAN_FRONTEND=noninteractive"
832 + else
833 + interactive_opts=""
834 + env=""
835 + fi
836
491 - if [ -z "${6}" ]; then
492 - 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" F1006
837 + case "${DISTRO_COMPAT_NAME}" in
838 + debian)
839 + needs_early_refresh=1
840 + pm_cmd="apt-get"
841 + repo_subcmd="update"
842 + repo_prefix="debian/${SYSCODENAME}"
843 + pkg_type="deb"
844 + pkg_suffix="_all"
845 + pkg_vsep="_"
846 + pkg_install_opts="${interactive_opts}"
847 + repo_update_opts="${interactive_opts}"
848 + uninstall_subcmd="uninstall"
849 + INSTALL_TYPE="binpkg-deb"
850 + ;;
851 + ubuntu)
852 + needs_early_refresh=1
853 + pm_cmd="apt-get"
854 + repo_subcmd="update"
855 + repo_prefix="ubuntu/${SYSCODENAME}"
856 + pkg_type="deb"
857 + pkg_suffix="_all"
858 + pkg_vsep="_"
859 + pkg_install_opts="${interactive_opts}"
860 + repo_update_opts="${interactive_opts}"
861 + uninstall_subcmd="uninstall"
862 + INSTALL_TYPE="binpkg-deb"
863 + ;;
864 + centos)
865 + if command -v dnf > /dev/null; then
866 + pm_cmd="dnf"
867 + repo_subcmd="makecache"
868 + else
869 + pm_cmd="yum"
870 fi
494 -
495 - export NETDATA_LOCAL_TARBALL_OVERRIDE_DEPS_SCRIPT="${6}"
496 - shift 5
871 + repo_prefix="el/${SYSVERSION}"
872 + pkg_type="rpm"
873 + pkg_suffix=".noarch"
874 + pkg_vsep="-"
875 + pkg_install_opts="${interactive_opts}"
876 + repo_update_opts="${interactive_opts}"
877 + uninstall_subcmd="remove"
878 + INSTALL_TYPE="binpkg-rpm"
879 + ;;
880 + fedora)
881 + if command -v dnf > /dev/null; then
882 + pm_cmd="dnf"
883 + repo_subcmd="makecache"
884 + else
885 + pm_cmd="yum"
886 + fi
887 + repo_prefix="fedora/${SYSVERSION}"
888 + pkg_type="rpm"
889 + pkg_suffix=".noarch"
890 + pkg_vsep="-"
891 + pkg_install_opts="${interactive_opts}"
892 + repo_update_opts="${interactive_opts}"
893 + uninstall_subcmd="remove"
894 + INSTALL_TYPE="binpkg-rpm"
895 + ;;
896 + opensuse)
897 + pm_cmd="zypper"
898 + repo_subcmd="--gpg-auto-import-keys refresh"
899 + repo_prefix="opensuse/${SYSVERSION}"
900 + pkg_type="rpm"
901 + pkg_suffix=".noarch"
902 + pkg_vsep="-"
903 + pkg_install_opts="${interactive_opts} --allow-unsigned-rpm"
904 + repo_update_opts=""
905 + uninstall_subcmd="remove"
906 + INSTALL_TYPE="binpkg-rpm"
907 ;;
908 *)
499 - NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS} ${1}"
909 + warning "We do not provide native packages for ${DISTRO}."
910 + return 2
911 ;;
912 esac
502 - shift 1
503 -done
913
505 -if [ "${INTERACTIVE}" = "0" ]; then
506 - PACKAGES_INSTALLER_OPTIONS="--dont-wait --non-interactive ${PACKAGES_INSTALLER_OPTIONS}"
507 - NETDATA_INSTALLER_OPTIONS="$NETDATA_INSTALLER_OPTIONS --dont-wait"
508 -fi
914 + repoconfig_name="netdata-repo${release}"
915 + repoconfig_file="${repoconfig_name}${pkg_vsep}${REPOCONFIG_VERSION}${pkg_suffix}.${pkg_type}"
916 + repoconfig_url="${REPOCONFIG_URL_PREFIX}/${repo_prefix}/${repoconfig_file}/download.${pkg_type}"
917 +
918 + if ! pkg_installed "${repoconfig_name}"; then
919 + progress "Downloading repository configuration package."
920 + if ! download "${repoconfig_url}" "${tmpdir}/${repoconfig_file}"; then
921 + warning "Failed to download repository configuration package."
922 + return 2
923 + fi
924 +
925 + if [ -n "${needs_early_refresh}" ]; then
926 + progress "Updating repository metadata."
927 + # shellcheck disable=SC2086
928 + if ! run ${ROOTCMD} env ${env} ${pm_cmd} ${repo_subcmd} ${repo_update_opts}; then
929 + warning "Failed to refresh repository metadata."
930 + return 2
931 + fi
932 + fi
933
510 -if [ -n "${NETDATA_DISABLE_CLOUD}" ]; then
511 - if [ -n "${NETDATA_CLAIM_TOKEN}" ] || [ -n "${NETDATA_CLAIM_ROOMS}" ] || [ -n "${NETDATA_CLAIM_URL}" ]; then
512 - run_failed "Cloud explicitly disabled but automatic claiming requested."
513 - run_failed "Either enable Netdata Cloud, or remove the --claim-* options."
514 - exit 1
934 + progress "Installing repository configuration package."
935 + # shellcheck disable=SC2086
936 + if ! run ${ROOTCMD} env ${env} ${pm_cmd} install ${pkg_install_opts} "${tmpdir}/${repoconfig_file}"; then
937 + warning "Failed to install repository configuration package."
938 + return 2
939 + fi
940 +
941 + if [ -n "${repo_subcmd}" ]; then
942 + progress "Updating repository metadata."
943 + # shellcheck disable=SC2086
944 + if ! run ${ROOTCMD} env ${env} ${pm_cmd} ${repo_subcmd} ${repo_update_opts}; then
945 + fatal "Failed to update repository metadata." F0205
946 + fi
947 + fi
948 + else
949 + progress "Repository configuration is already present, attempting to install netdata."
950 fi
516 -fi
951
518 -# shellcheck disable=SC2235,SC2030,SC2031
519 -if ( [ -z "${NETDATA_CLAIM_TOKEN}" ] && [ -n "${NETDATA_CLAIM_URL}" ] ) || ( [ -n "${NETDATA_CLAIM_TOKEN}" ] && [ -z "${NETDATA_CLAIM_URL}" ] ); then
520 - run_failed "Invalid claiming options, both a claiming token and URL must be specified."
521 - exit 1
522 -elif [ -z "${NETDATA_CLAIM_TOKEN}" ] && [ -n "${NETDATA_CLAIM_ROOMS}" ]; then
523 - run_failed "Invalid claiming options, claim rooms may only be specified when a token and URL are specified."
524 - exit 1
525 -fi
952 + if ! check_special_native_deps; then
953 + warning "Could not find secondary dependencies ${DISTRO} on ${SYSARCH}."
954 + if [ -z "${NO_CLEANUP}" ]; then
955 + progress "Attempting to uninstall repository configuration package."
956 + # shellcheck disable=SC2086
957 + run ${ROOTCMD} env ${env} ${pm_cmd} ${uninstall_subcmd} ${pkg_install_opts} "${repoconfig_name}"
958 + fi
959 + return 2
960 + fi
961
527 -# ---------------------------------------------------------------------------------------------------------------------
528 -# look for an existing install and try to update that instead if it exists
962 + progress "Checking for usable Netdata package."
963 + if ! netdata_avail_check "${DISTRO_COMPAT_NAME}"; then
964 + warning "Could not find a usable native package for ${DISTRO} on ${SYSARCH}."
965 + if [ -z "${NO_CLEANUP}" ]; then
966 + progress "Attempting to uninstall repository configuration package."
967 + # shellcheck disable=SC2086
968 + run ${ROOTCMD} env ${env} ${pm_cmd} ${uninstall_subcmd} ${pkg_install_opts} "${repoconfig_name}"
969 + fi
970 + return 2
971 + fi
972
530 -ndpath="$(command -v netdata 2>/dev/null)"
531 -if [ -z "$ndpath" ] && [ -x /opt/netdata/bin/netdata ] ; then
532 - ndpath="/opt/netdata/bin/netdata"
533 -fi
973 + if [ "${NETDATA_DISABLE_TELEMETRY}" -eq 1 ]; then
974 + run ${ROOTCMD} mkdir -p "/etc/netdata"
975 + run ${ROOTCMD} touch "/etc/netdata/.opt-out-from-anonymous-statistics"
976 + fi
977
535 -if [ -n "$ndpath" ] ; then
536 - ndprefix="$(dirname "$(dirname "${ndpath}")")"
978 + progress "Installing Netdata package."
979 + # shellcheck disable=SC2086
980 + if ! run ${ROOTCMD} env ${env} ${pm_cmd} install ${pkg_install_opts} netdata; then
981 + warning "Failed to install Netdata package."
982 + if [ -z "${NO_CLEANUP}" ]; then
983 + progress "Attempting to uninstall repository configuration package."
984 + # shellcheck disable=SC2086
985 + run ${ROOTCMD} env ${env} ${pm_cmd} ${uninstall_subcmd} ${pkg_install_opts} "${repoconfig_name}"
986 + fi
987 + return 2
988 + fi
989 +}
990
538 - if [ "${ndprefix}" = /usr ] ; then
539 - ndprefix="/"
991 +# ======================================================================
992 +# Static build install code
993 +
994 +set_static_archive_urls() {
995 + if [ "${RELEASE_CHANNEL}" = "stable" ]; then
996 + latest="$(get_redirect "https://github.com/netdata/netdata/releases/latest")"
997 + export NETDATA_STATIC_ARCHIVE_URL="https://github.com/netdata/netdata/releases/download/${latest}/netdata-${SYSARCH}-${latest}.gz.run"
998 + export NETDATA_STATIC_ARCHIVE_CHECKSUM_URL="https://github.com/netdata/netdata/releases/download/${latest}/sha256sums.txt"
999 + else
1000 + export NETDATA_STATIC_ARCHIVE_URL="${NETDATA_TARBALL_BASEURL}/netdata-latest.gz.run"
1001 + export NETDATA_STATIC_ARCHIVE_CHECKSUM_URL="${NETDATA_TARBALL_BASEURL}/sha256sums.txt"
1002 fi
1003 +}
1004
542 - progress "Found existing install of Netdata under: ${ndprefix}"
1005 +try_static_install() {
1006 + set_static_archive_urls "${RELEASE_CHANNEL}"
1007 + progress "Downloading static netdata binary: ${NETDATA_STATIC_ARCHIVE_URL}"
1008
544 - if [ -r "${ndprefix}/etc/netdata/.environment" ] ; then
545 - ndstatic="$(grep IS_NETDATA_STATIC_BINARY "${ndprefix}/etc/netdata/.environment" | cut -d "=" -f 2 | tr -d \")"
546 - if [ -z "${NETDATA_REINSTALL}" ] && [ -z "${NETDATA_LOCAL_TARBALL_OVERRIDE}" ] ; then
547 - if [ -n "${NETDATA_CLAIM_TOKEN}" ] ; then
548 - if [ "${ndprefix}" != '/' ] ; then
549 - NETDATA_PREFIX="${ndprefix}"
550 - fi
1009 + if ! download "${NETDATA_STATIC_ARCHIVE_URL}" "${tmpdir}/netdata-${SYSARCH}-latest.gz.run"; then
1010 + warning "Unable to download static build archive for ${SYSARCH}."
1011 + return 2
1012 + fi
1013
552 - claim
553 - exit $?
554 - elif [ -x "${ndprefix}/usr/libexec/netdata/netdata-updater.sh" ] ; then
555 - progress "Attempting to update existing install instead of creating a new one"
556 - if run ${sudo} "${ndprefix}/usr/libexec/netdata/netdata-updater.sh" --not-running-from-cron ; then
557 - progress "Updated existing install at ${ndpath}"
558 - exit 0
559 - else
560 - fatal "Failed to update existing Netdata install" F0100
561 - fi
562 - else
563 - if [ -z "${NETDATA_ALLOW_DUPLICATE_INSTALL}" ] || [ "${ndstatic}" = "yes" ] ; then
564 - fatal "Existing installation detected which cannot be safely updated by this script. Refusing to continue." F0101
565 - else
566 - progress "User explicitly requested duplicate install, proceeding."
567 - fi
568 - fi
569 - else
570 - if [ "${ndstatic}" = "no" ] ; then
571 - progress "User requested reinstall instead of update, proceeding."
572 - else
573 - fatal "Existing install is a static install. Please use kickstart-static64.sh instead." F0102
574 - fi
575 - fi
1014 + if ! download "${NETDATA_STATIC_ARCHIVE_CHECKSUM_URL}" "${tmpdir}/sha256sum.txt"; then
1015 + fatal "Unable to fetch checksums to verify static build archive." F0206
1016 + fi
1017 +
1018 + if ! grep "netdata-${SYSARCH}-latest.gz.run" "${tmpdir}/sha256sum.txt" | safe_sha256sum -c - > /dev/null 2>&1; then
1019 + fatal "Static binary checksum validation failed. Usually this is a result of an older copy of the file being cached somewhere upstream and can be resolved by retrying in an hour." F0207
1020 + fi
1021 +
1022 + if [ "${INTERACTIVE}" -eq 0 ]; then
1023 + opts="${opts} --accept"
1024 + fi
1025 +
1026 + progress "Installing netdata"
1027 + # shellcheck disable=SC2086
1028 + if ! run ${ROOTCMD} sh "${tmpdir}/netdata-${SYSARCH}-latest.gz.run" ${opts} -- ${NETDATA_AUTO_UPDATES:+--auto-update} ${NETDATA_INSTALLER_OPTIONS}; then
1029 + warning "Failed to install static build of Netdata on ${SYSARCH}."
1030 + run rm -rf /opt/netdata
1031 + return 2
1032 + fi
1033 +
1034 + install_type_file="/opt/netdata/etc/netdata/.install-type"
1035 + if [ -f "${install_type_file}" ]; then
1036 + ${ROOTCMD} sh -c "cat \"${install_type_file}\" > \"${tmpdir}/install-type\""
1037 + ${ROOTCMD} chown "$(id -u)":"$(id -g)" "${tmpdir}/install-type"
1038 + # shellcheck disable=SC1091
1039 + . "${tmpdir}/install-type"
1040 + cat > "${tmpdir}/install-type" <<- EOF
1041 + INSTALL_TYPE='kickstart-static'
1042 + PREBUILT_ARCH='${PREBUILT_ARCH}'
1043 + EOF
1044 + ${ROOTCMD} chown netdata:netdata "${tmpdir}/install-type"
1045 + ${ROOTCMD} cp "${tmpdir}/install-type" "${install_type_file}"
1046 + fi
1047 +}
1048 +
1049 +# ======================================================================
1050 +# Local build install code
1051 +
1052 +set_source_archive_urls() {
1053 + if [ "$1" = "stable" ]; then
1054 + latest="$(get_redirect "https://github.com/netdata/netdata/releases/latest")"
1055 + export NETDATA_SOURCE_ARCHIVE_URL="https://github.com/netdata/netdata/releases/download/${latest}/netdata-${latest}.tar.gz"
1056 + export NETDATA_SOURCE_ARCHIVE_CHECKSUM_URL="https://github.com/netdata/netdata/releases/download/${latest}/sha256sums.txt"
1057 else
577 - progress "Existing install appears to be handled manually or through the system package manager."
578 - if [ -n "${NETDATA_CLAIM_TOKEN}" ] ; then
579 - if [ "${ndprefix}" != '/' ] ; then
580 - NETDATA_PREFIX="${ndprefix}"
581 - fi
1058 + export NETDATA_SOURCE_ARCHIVE_URL="${NETDATA_TARBALL_BASEURL}/netdata-latest.tar.gz"
1059 + export NETDATA_SOURCE_ARCHIVE_CHECKSUM_URL="${NETDATA_TARBALL_BASEURL}/sha256sums.txt"
1060 + fi
1061 +}
1062 +
1063 +install_local_build_dependencies() {
1064 + bash="$(command -v bash 2> /dev/null)"
1065 +
1066 + if [ -z "${bash}" ] || [ ! -x "${bash}" ]; then
1067 + warning "Unable to find a usable version of \`bash\` (required for local build)."
1068 + return 1
1069 + fi
1070 +
1071 + progress "Fetching script to detect required packages..."
1072 + download "${PACKAGES_SCRIPT}" "${tmpdir}/install-required-packages.sh"
1073 +
1074 + if [ ! -s "${tmpdir}/install-required-packages.sh" ]; then
1075 + warning "Downloaded dependency installation script is empty."
1076 + else
1077 + progress "Running downloaded script to detect required packages..."
1078
583 - claim
584 - exit $?
585 - elif [ -z "${NETDATA_ALLOW_DUPLICATE_INSTALL}" ] ; then
586 - fatal "Existing installation detected which cannot be safely updated by this script. Refusing to continue." F0103
1079 + if [ "${INTERACTIVE}" -eq 0 ]; then
1080 + opts="--dont-wait --non-interactive"
1081 + fi
1082 +
1083 + if [ "${SYSTYPE}" = "Darwin" ]; then
1084 + sudo=""
1085 else
588 - progress "User explicitly requested duplicate install, proceeding."
1086 + sudo="${ROOTCMD}"
1087 + fi
1088 +
1089 + # shellcheck disable=SC2086
1090 + if ! run ${sudo} "${bash}" "${tmpdir}/install-required-packages.sh" ${opts} netdata; then
1091 + warning "It failed to install all the required packages, but installation might still be possible."
1092 fi
1093 fi
591 -fi
1094 +}
1095
593 -# ---------------------------------------------------------------------------------------------------------------------
594 -# install required system packages
1096 +build_and_install() {
1097 + progress "Building netdata"
1098
596 -ndtmpdir=$(create_tmp_directory)
597 -cd "${ndtmpdir}" || exit 1
1099 + echo "INSTALL_TYPE='kickstart-build'" > system/.install-type
1100
599 -dependencies
1101 + opts="${NETDATA_INSTALLER_OPTIONS}"
1102
601 -# ---------------------------------------------------------------------------------------------------------------------
602 -# download netdata package
1103 + if [ "${INTERACTIVE}" -eq 0 ]; then
1104 + opts="${opts} --dont-wait"
1105 + fi
1106
604 -if [ -z "${NETDATA_LOCAL_TARBALL_OVERRIDE}" ]; then
605 - set_tarball_urls "${RELEASE_CHANNEL}"
1107 + if [ "${NETDATA_AUTO_UPDATES}" -eq 1 ]; then
1108 + opts="${opts} --auto-update"
1109 + fi
1110
607 - download "${NETDATA_TARBALL_CHECKSUM_URL}" "${ndtmpdir}/sha256sum.txt"
608 - download "${NETDATA_TARBALL_URL}" "${ndtmpdir}/netdata-latest.tar.gz"
609 -else
610 - progress "Installation sources were given as input, running installation using \"${NETDATA_LOCAL_TARBALL_OVERRIDE}\""
611 - run cp "${NETDATA_LOCAL_TARBALL_OVERRIDE_CHECKSUM}" "${ndtmpdir}/sha256sum.txt"
612 - run cp "${NETDATA_LOCAL_TARBALL_OVERRIDE}" "${ndtmpdir}/netdata-latest.tar.gz"
613 -fi
1111 + if [ "${RELEASE_CHANNEL}" = "stable" ]; then
1112 + opts="${opts} --stable-channel"
1113 + fi
1114
615 -if ! grep netdata-latest.tar.gz "${ndtmpdir}/sha256sum.txt" | safe_sha256sum -c - > /dev/null 2>&1; then
616 - fatal "Tarball checksum validation failed. Stopping Netdata Agent installation and leaving tarball in ${ndtmpdir}.\nUsually this is a result of an older copy of the file being cached somewhere upstream and can be resolved by retrying in an hour." F0005
617 -fi
618 -run tar -xf netdata-latest.tar.gz
619 -rm -rf netdata-latest.tar.gz > /dev/null 2>&1
620 -cd netdata-* || fatal "Cannot cd to netdata source tree" F0006
1115 + if [ "${NETDATA_REQUIRE_CLOUD}" -eq 1 ]; then
1116 + opts="${opts} --require-cloud"
1117 + elif [ "${NETDATA_DISABLE_CLOUD}" -eq 1 ]; then
1118 + opts="${opts} --disable-cloud"
1119 + fi
1120
622 -# ---------------------------------------------------------------------------------------------------------------------
623 -# install netdata from source
1121 + # shellcheck disable=SC2086
1122 + run ${ROOTCMD} ./netdata-installer.sh ${opts}
1123
625 -install() {
626 - progress "Installing netdata..."
627 - run ${sudo} ./netdata-installer.sh ${NETDATA_UPDATES} ${NETDATA_INSTALLER_OPTIONS}
1124 case $? in
1125 1)
1126 fatal "netdata-installer.sh exited with error" F0007
@@ -633,25 +1129,262 @@ install() {
1129 fatal "Insufficient RAM to install netdata" F0008
1130 ;;
1131 esac
636 - if [ -d "${ndtmpdir}" ] && [ ! "${ndtmpdir}" = "/" ]; then
637 - run ${sudo} rm -rf "${ndtmpdir}" > /dev/null 2>&1
1132 +}
1133 +
1134 +try_build_install() {
1135 + if ! install_local_build_dependencies; then
1136 + return 1
1137 + fi
1138 +
1139 + set_source_archive_urls "${RELEASE_CHANNEL}"
1140 +
1141 + download "${NETDATA_SOURCE_ARCHIVE_CHECKSUM_URL}" "${tmpdir}/sha256sum.txt"
1142 + download "${NETDATA_SOURCE_ARCHIVE_URL}" "${tmpdir}/netdata-latest.tar.gz"
1143 +
1144 + if ! grep netdata-latest.tar.gz "${tmpdir}/sha256sum.txt" | safe_sha256sum -c - > /dev/null 2>&1; then
1145 + fatal "Tarball checksum validation failed. Usually this is a result of an older copy of the file being cached somewhere upstream and can be resolved by retrying in an hour." F0005
1146 + fi
1147 +
1148 + run tar -xf "${tmpdir}/netdata-latest.tar.gz" -C "${tmpdir}"
1149 + rm -rf "${tmpdir}/netdata-latest.tar.gz" > /dev/null 2>&1
1150 + cd "$(find "${tmpdir}" -mindepth 1 -maxdepth 1 -type d -name netdata-)" || fatal "Cannot cd to netdata source tree" F0006
1151 +
1152 + if [ -x netdata-installer.sh ]; then
1153 + build_and_install || return 1
1154 + else
1155 + # This case is needed because some platforms produce an extra directory on the source tarball extraction.
1156 + if [ "$(find . -mindepth 1 -maxdepth 1 -type d | wc -l)" -eq 1 ] && [ -x "$(find . -mindepth 1 -maxdepth 1 -type d)/netdata-installer.sh" ]; then
1157 + cd "$(find . -mindepth 1 -maxdepth 1 -type d)" && build_and_install || return 1
1158 + else
1159 + fatal "Cannot install netdata from source (the source directory does not include netdata-installer.sh). Leaving all files in ${tmpdir}" F0009
1160 + fi
1161 fi
1162 }
1163
641 -if [ -x netdata-installer.sh ]; then
642 - echo "INSTALL_TYPE='kickstart-build'" > system/.install-type
643 - install "$@"
644 -else
645 - if [ "$(find . -mindepth 1 -maxdepth 1 -type d | wc -l)" -eq 1 ] && [ -x "$(find . -mindepth 1 -maxdepth 1 -type d)/netdata-installer.sh" ]; then
646 - cd "$(find . -mindepth 1 -maxdepth 1 -type d)" && install "$@"
1164 +# ======================================================================
1165 +# Per system-type install logic
1166 +
1167 +install_on_linux() {
1168 + if [ "${NETDATA_ONLY_STATIC}" -ne 1 ] && [ "${NETDATA_ONLY_BUILD}" -ne 1 ]; then
1169 + SELECTED_INSTALL_METHOD="native"
1170 + try_package_install
1171 +
1172 + case "$?" in
1173 + 0)
1174 + NETDATA_INSTALL_SUCCESSFUL=1
1175 + ;;
1176 + 1)
1177 + fatal "Unable to install on this system." F0300
1178 + ;;
1179 + 2)
1180 + if [ "${NETDATA_ONLY_NATIVE}" -eq 1 ]; then
1181 + fatal "Could not install native binary packages." F0301
1182 + else
1183 + warning "Could not install native binary packages, falling back to alternative installation method."
1184 + fi
1185 + ;;
1186 + esac
1187 + fi
1188 +
1189 + if [ "${NETDATA_ONLY_NATIVE}" -ne 1 ] && [ "${NETDATA_ONLY_BUILD}" -ne 1 ] && [ -z "${NETDATA_INSTALL_SUCCESSFUL}" ]; then
1190 + SELECTED_INSTALL_METHOD="static"
1191 + INSTALL_TYPE="kickstart-static"
1192 + try_static_install
1193 +
1194 + case "$?" in
1195 + 0)
1196 + NETDATA_INSTALL_SUCCESSFUL=1
1197 + INSTALL_PREFIX="/opt/netdata"
1198 + ;;
1199 + 1)
1200 + fatal "Unable to install on this system." F0302
1201 + ;;
1202 + 2)
1203 + if [ "${NETDATA_ONLY_STATIC}" -eq 1 ]; then
1204 + fatal "Could not install static build." F0303
1205 + else
1206 + warning "Could not install static build, falling back to alternative installation method."
1207 + fi
1208 + ;;
1209 + esac
1210 + fi
1211 +
1212 + if [ "${NETDATA_ONLY_NATIVE}" -ne 1 ] && [ "${NETDATA_ONLY_STATIC}" -ne 1 ] && [ -z "${NETDATA_INSTALL_SUCCESSFUL}" ]; then
1213 + SELECTED_INSTALL_METHOD="build"
1214 + INSTALL_TYPE="kickstart-build"
1215 + try_build_install
1216 +
1217 + case "$?" in
1218 + 0)
1219 + NETDATA_INSTALL_SUCCESSFUL=1
1220 + ;;
1221 + *)
1222 + fatal "Unable to install on this system." F0304
1223 + ;;
1224 + esac
1225 + fi
1226 +}
1227 +
1228 +install_on_macos() {
1229 + if [ "${NETDATA_ONLY_NATIVE}" -eq 1 ]; then
1230 + fatal "User requested native package, but native packages are not available for macOS. Try installing without \`--only-native\` option." F0305
1231 + elif [ "${NETDATA_ONLY_STATIC}" -eq 1 ]; then
1232 + fatal "User requested static build, but static builds are not available for macOS. Try installing without \`--only-static\` option." F0306
1233 else
648 - fatal "Cannot install netdata from source (the source directory does not include netdata-installer.sh). Leaving all files in ${ndtmpdir}" F0009
649 - exit 1
1234 + SELECTED_INSTALL_METHOD="build"
1235 + INSTALL_TYPE="kickstart-build"
1236 + try_build_install
1237 +
1238 + case "$?" in
1239 + 0)
1240 + NETDATA_INSTALL_SUCCESSFUL=1
1241 + ;;
1242 + *)
1243 + fatal "Unable to install on this system." F0307
1244 + ;;
1245 + esac
1246 fi
651 -fi
1247 +}
1248 +
1249 +install_on_freebsd() {
1250 + if [ "${NETDATA_ONLY_NATIVE}" -eq 1 ]; then
1251 + fatal "User requested native package, but native packages are not available for FreeBSD. Try installing without \`--only-native\` option." F0308
1252 + elif [ "${NETDATA_ONLY_STATIC}" -eq 1 ]; then
1253 + fatal "User requested static build, but static builds are not available for FreeBSD. Try installing without \`--only-static\` option." F0309
1254 + else
1255 + SELECTED_INSTALL_METHOD="build"
1256 + INSTALL_TYPE="kickstart-build"
1257 + try_build_install
1258 +
1259 + case "$?" in
1260 + 0)
1261 + NETDATA_INSTALL_SUCCESSFUL=1
1262 + ;;
1263 + *)
1264 + fatal "Unable to install on this system." F030A
1265 + ;;
1266 + esac
1267 + fi
1268 +}
1269 +
1270 +# ======================================================================
1271 +# Main program
1272
653 -# --------------------------------------------------------------------------------------------------------------------
1273 +setup_terminal || echo > /dev/null
1274 +
1275 +while [ -n "${1}" ]; do
1276 + case "${1}" in
1277 + "--help")
1278 + usage
1279 + cleanup
1280 + trap - EXIT
1281 + exit 0
1282 + ;;
1283 + "--no-cleanup") NO_CLEANUP=1 ;;
1284 + "--dont-wait"|"--non-interactive") INTERACTIVE=0 ;;
1285 + "--interactive") INTERACTIVE=1 ;;
1286 + "--stable-channel") RELEASE_CHANNEL="stable" ;;
1287 + "--no-updates") NETDATA_AUTO_UPDATES=0 ;;
1288 + "--auto-update") NETDATA_AUTO_UPDATES="1" ;;
1289 + "--reinstall") NETDATA_REINSTALL=1 ;;
1290 + "--reinstall-even-if-unsafe") NETDATA_UNSAFE_REINSTALL=1 ;;
1291 + "--claim-only") NETDATA_CLAIM_ONLY=1 ;;
1292 + "--disable-cloud")
1293 + NETDATA_DISABLE_CLOUD=1
1294 + NETDATA_REQUIRE_CLOUD=0
1295 + ;;
1296 + "--require-cloud")
1297 + NETDATA_DISABLE_CLOUD=0
1298 + NETDATA_REQUIRE_CLOUD=1
1299 + ;;
1300 + "--dont-start-it")
1301 + NETDATA_NO_START=1
1302 + NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS} --dont-start-it"
1303 + ;;
1304 + "--disable-telemetry")
1305 + NETDATA_DISABLE_TELEMETRY="1"
1306 + NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS} --disable-telemetry"
1307 + ;;
1308 + "--install")
1309 + INSTALL_PREFIX="${2}"
1310 + shift 1
1311 + ;;
1312 + "--native-only")
1313 + NETDATA_ONLY_NATIVE=1
1314 + NETDATA_ONLY_STATIC=0
1315 + NETDATA_ONLY_BUILD=0
1316 + SELECTED_INSTALL_METHOD="native"
1317 + ;;
1318 + "--static-only")
1319 + NETDATA_ONLY_STATIC=1
1320 + NETDATA_ONLY_NATIVE=0
1321 + NETDATA_ONLY_BUILD=0
1322 + SELECTED_INSTALL_METHOD="static"
1323 + ;;
1324 + "--build-only")
1325 + NETDATA_ONLY_BUILD=1
1326 + NETDATA_ONLY_NATIVE=0
1327 + NETDATA_ONLY_STATIC=0
1328 + SELECTED_INSTALL_METHOD="build"
1329 + ;;
1330 + "--claim-token")
1331 + NETDATA_CLAIM_TOKEN="${2}"
1332 + shift 1
1333 + ;;
1334 + "--claim-rooms")
1335 + NETDATA_CLAIM_ROOMS="${2}"
1336 + shift 1
1337 + ;;
1338 + "--claim-url")
1339 + NETDATA_CLAIM_URL="${2}"
1340 + shift 1
1341 + ;;
1342 + "--claim-*")
1343 + optname="$(echo "${1}" | cut -d '-' -f 4-)"
1344 + case "${optname}" in
1345 + id|proxy|user|hostname)
1346 + NETDATA_CLAIM_EXTRA="${NETDATA_CLAIM_EXTRA} -${optname} ${2}"
1347 + shift 1
1348 + ;;
1349 + verbose|insecure|noproxy|noreload|daemon-not-running)
1350 + NETDATA_CLAIM_EXTRA="${NETDATA_CLAIM_EXTRA} -${optname}"
1351 + ;;
1352 + *)
1353 + warning "Ignoring unrecognized claiming option ${optname}"
1354 + ;;
1355 + esac
1356 + ;;
1357 + *)
1358 + warning "Passing unrecognized option '${1}' to installer script. If this is intended, please add it to \$NETDATA_INSTALLER_OPTIONS instead."
1359 + NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS} ${1}"
1360 + ;;
1361 + esac
1362 + shift 1
1363 +done
1364 +
1365 +check_claim_opts
1366 +confirm_root_support
1367 +get_system_info
1368 +confirm_install_prefix
1369 +
1370 +tmpdir="$(create_tmp_directory)"
1371 +progress "Using ${tmpdir} as a temporary directory."
1372 +cd "${tmpdir}" || exit 1
1373 +
1374 +handle_existing_install
1375 +
1376 +case "${SYSTYPE}" in
1377 + Linux) install_on_linux ;;
1378 + Darwin) install_on_macos ;;
1379 + FreeBSD) install_on_freebsd ;;
1380 +esac
1381
1382 if [ -n "${NETDATA_CLAIM_TOKEN}" ]; then
1383 claim
1384 +elif [ "${NETDATA_DISABLE_CLOUD}" -eq 1 ]; then
1385 + soft_disable_cloud
1386 fi
1387 +
1388 +telemetry_event INSTALL_SUCCESS "" ""
1389 +cleanup
1390 +trap - EXIT
packaging/installer/methods/alpine.md deleted
-40
@@ -1,40 +0,0 @@
1 -<!--
2 -title: "Install Netdata on Alpine 3.x"
3 -custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/installer/methods/alpine.md
4 --->
5 -
6 -# Install Netdata on Alpine 3.x
7 -
8 -Execute these commands to install Netdata in Alpine Linux 3.x:
9 -
10 -```sh
11 -# install required packages
12 -apk add alpine-sdk bash curl libuv-dev zlib-dev util-linux-dev libmnl-dev gcc make git autoconf automake pkgconfig python3 logrotate
13 -
14 -# if you plan to run node.js Netdata plugins
15 -apk add nodejs
16 -
17 -# download Netdata - the directory 'netdata' will be created
18 -git clone https://github.com/netdata/netdata.git --depth=100 --recursive
19 -cd netdata
20 -
21 -# build it, install it, start it
22 -./netdata-installer.sh
23 -
24 -# make Netdata start at boot and stop at shutdown
25 -cat > /etc/init.d/netdata << EOF
26 -#!/sbin/openrc-run
27 -
28 -name="netdata"
29 -command="/usr/sbin/$SVCNAME"
30 -
31 -depend() {
32 - need net localmount
33 - after firewall
34 -}
35 -EOF
36 -```
37 -
38 -If you have installed Netdata in another directory, you have to change the content of the `command` variable in that script.
39 -
40 -[![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%2Falpine&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)](<>)
packaging/installer/methods/cloud-providers.md
+1 -5
@@ -25,11 +25,7 @@ aims to document some of those steps for popular cloud providers.
25 ## Recommended installation methods for cloud providers
26
27 The best installation method depends on the instance's operating system, distribution, and version. For Linux instances,
28 -we recommend either the [`kickstart.sh` automatic installation script](kickstart.md) or [.deb/.rpm
29 -packages](packages.md).
30 -
31 -To see the full list of approved methods for each operating system/version we support, see our [distribution
32 -matrix](/packaging/DISTRIBUTIONS.md). That table will guide you to the various supported methods for your cloud instance.
28 +we recommend the [`kickstart.sh` automatic installation script](kickstart.md).
29
30 If you have issues with Netdata after installation, look to the sections below to find the issue you're experiencing,
31 followed by the solution for your provider.
packaging/installer/methods/kickstart-64.md deleted
-116
@@ -1,116 +0,0 @@
1 -<!--
2 -title: "Install Netdata with kickstart-static64.sh"
3 -description: "The kickstart-static64.sh script installs a pre-compiled static binary, including all dependencies required to connect to Netdata Cloud, with one command."
4 -custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/installer/methods/kickstart-64.md
5 --->
6 -
7 -# Install Netdata with kickstart-static64.sh
8 -
9 -![](https://registry.my-netdata.io/api/v1/badge.svg?chart=web_log_nginx.requests_per_url&options=unaligned&dimensions=kickstart64&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=kickstart64&group=sum&after=-86400&label=today&units=installations&precision=0)
10 -
11 -This page covers detailed instructions on using and configuring the installation script named `kickstart-static64.sh`.
12 -
13 -This method uses a pre-compiled static binary to install Netdata on any Intel/AMD 64bit Linux system and on any Linux
14 -distribution, even those with a broken or unsupported package manager.
15 -
16 -To install Netdata from a static binary package, including all dependencies required to connect to Netdata Cloud, and
17 -get _automatic nightly updates_, run the following as your normal user:
18 -
19 -```bash
20 -bash <(curl -Ss https://my-netdata.io/kickstart-static64.sh)
21 -```
22 -
23 -> This script installs Netdata at `/opt/netdata`.
24 -
25 -> See our [installation guide](/packaging/installer/README.md) for details about [automatic
26 -> updates](/packaging/installer/README.md#automatic-updates) or [nightly vs. stable
27 -> releases](/packaging/installer/README.md#nightly-vs-stable-releases).
28 -
29 -## What does `kickstart-static64.sh` do?
30 -
31 -The `kickstart.sh` script does the following after being downloaded and run:
32 -
33 -- Checks to see if there is an existing installation, and if there is updates that in preference to reinstalling.
34 -- Downloads the latest Netdata binary from the [binary-packages](https://github.com/netdata/binary-packages)
35 - repository. You can also run any of these `.run` files with [makeself](https://github.com/megastep/makeself).
36 -- Installs Netdata by running `./netdata-installer.sh` from the source tree, including any options you might have
37 - added.
38 -- Installs `netdata-updater.sh` to `cron.daily` to enable automatic updates, unless you added the `--no-updates`
39 - option.
40 -- Prints a message about whether the installation succeeded for failed for QA purposes.
41 -
42 -If your shell fails to handle the above one-liner, you can download and run the `kickstart-static64.sh` script manually.
43 -
44 -```sh
45 -# download the script with curl
46 -curl https://my-netdata.io/kickstart-static64.sh >/tmp/kickstart-static64.sh
47 -
48 -# or, download the script with wget
49 -wget -O /tmp/kickstart-static64.sh https://my-netdata.io/kickstart-static64.sh
50 -
51 -# run the downloaded script (any sh is fine, no need for bash)
52 -sh /tmp/kickstart-static64.sh
53 -```
54 -
55 -## Optional parameters to alter your installation
56 -
57 -The `kickstart-static64.sh` script passes all its parameters to `netdata-installer.sh`, which you can use to customize
58 -your installation. Here are a few important parameters:
59 -
60 -- `--dont-wait`: Enable automated installs by not prompting for permission to install any required packages.
61 -- `--dont-start-it`: Prevent the installer from starting Netdata automatically.
62 -- `--stable-channel`: Automatically update only on the release of new major versions.
63 -- `--nightly-channel`: Automatically update on every new nightly build.
64 -- `--disable-telemetry`: Opt-out of [anonymous statistics](/docs/anonymous-statistics.md) we use to make
65 - Netdata better.
66 -- `--no-updates`: Prevent automatic updates of any kind.
67 -- `--reinstall`: If an existing installation is detected, reinstall instead of attempting to update it. Note
68 - that this cannot be used to switch between installation types.
69 -- `--local-files`: Used for [offline installations](/packaging/installer/methods/offline.md). Pass four file paths:
70 - the Netdata tarball, the checksum file, the go.d plugin tarball, and the go.d plugin config tarball, to force
71 - kickstart run the process using those files. This option conflicts with the `--stable-channel` option. If you set
72 - this _and_ `--stable-channel`, Netdata will use the local files.
73 -
74 -### Connect node to Netdata Cloud during installation
75 -
76 -The `kickstart.sh` script accepts additional parameters to automatically [connect](/claim/README.md) your node to Netdata
77 -Cloud immediately after installation. Find the `token` and `rooms` strings by [signing in to Netdata
78 -Cloud](https://app.netdata.cloud/sign-in?cloudRoute=/spaces), then clicking on **Connect Nodes** in the [Spaces management
79 -area](https://learn.netdata.cloud/docs/cloud/spaces#manage-spaces).
80 -
81 -- `--claim-token`: The unique token associated with your Space in Netdata Cloud.
82 -- `--claim-rooms`: A comma-separated list of tokens for each War Room this node should appear in.
83 -- `--claim-proxy`: Should take the form of `socks5[h]://[user:pass@]host:ip` for a SOCKS5 proxy, or
84 - `http://[user:pass@]host:ip` for an HTTP(S) proxy.See [connecting through a
85 - proxy](/claim/README.md#connect-through-a-proxy) for details.
86 -- `--claim-url`: Defaults to `https://app.netdata.cloud`.
87 -
88 -For example:
89 -
90 -```bash
91 -bash <(curl -Ss https://my-netdata.io/kickstart-static64.sh) --claim-token TOKEN --claim-rooms ROOM1,ROOM2 --claim-url https://app.netdata.cloud
92 -```
93 -
94 -## Verify script integrity
95 -
96 -To use `md5sum` to verify the integrity of the `kickstart-static64.sh` script you will download using the one-line
97 -command above, run the following:
98 -
99 -```bash
100 -[ "508e16775bfe8aaf6bc2d0f7b91c323e" = "$(curl -Ss https://my-netdata.io/kickstart-static64.sh | md5sum | cut -d ' ' -f 1)" ] && echo "OK, VALID" || echo "FAILED, INVALID"
101 -```
102 -
103 -If the script is valid, this command will return `OK, VALID`.
104 -
105 -## What's next?
106 -
107 -When you're finished with installation, check out our [single-node](/docs/quickstart/single-node.md) or
108 -[infrastructure](/docs/quickstart/infrastructure.md) monitoring quickstart guides based on your use case.
109 -
110 -Or, skip straight to [configuring the Netdata Agent](/docs/configure/nodes.md).
111 -
112 -Read through Netdata's [documentation](https://learn.netdata.cloud/docs), which is structured based on actions and
113 -solutions, to enable features like health monitoring, alarm notifications, long-term metrics storage, exporting to
114 -external databases, and more.
115 -
116 -[![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%2Fkickstart-64&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)](<>)
packaging/installer/methods/kickstart.md
+80 -42
@@ -11,62 +11,68 @@ custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/instal
11 This page covers detailed instructions on using and configuring the automatic one-line installation script named
12 `kickstart.sh`.
13
14 -This method is fully automatic on all Linux distributions and macOS environments. To install Netdata from source, including all dependencies
15 -required to connect to Netdata Cloud, and get _automatic nightly updates_, run the following as your normal user:
14 +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.
15
17 -**Linux**
16 +> If you are unsure whether you want nightly or stable releases, read the [installation guide](/packaging/installer/README.md#nightly-vs-stable-releases).
17 +> 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.
18
19 -```bash
20 -bash <(curl -Ss https://my-netdata.io/kickstart.sh)
21 -```
22 -
23 -**macOS**
19 +To install Netdata, run the following as your normal user:
20
21 ```bash
26 -bash <(curl -Ss https://my-netdata.io/kickstart.sh) --install /usr/local/
22 +wget -O ./kickstart.sh https://my-netdata.io/kickstart.sh && sh ./kickstart.sh
23 ```
24
29 -> See our [installation guide](/packaging/installer/README.md) for details about [automatic updates](/packaging/installer/README.md#automatic-updates) or
30 -> [nightly vs. stable releases](/packaging/installer/README.md#nightly-vs-stable-releases).
25
26 ## What does `kickstart.sh` do?
27
34 -The `kickstart.sh` script does the following after being downloaded and run using `bash`:
28 +The `kickstart.sh` script does the following after being downloaded and run using `sh`:
29
36 -- Detects the Linux distribution and **installs the required system packages** for building Netdata. Unless you added
37 - the `--dont-wait` option, it will ask for your permission first.
38 -- Checks for an existing installation, and if found updates that instead of creating a new install.
39 -- Downloads the latest Netdata source tree to `/usr/src/netdata.git`.
40 -- Installs Netdata by running `./netdata-installer.sh` from the source tree, using any [optional
41 - parameters](#optional-parameters-to-alter-your-installation) you have specified.
42 -- Installs `netdata-updater.sh` to `cron.daily`, so your Netdata installation will be updated with new nightly
43 - versions, unless you override that with an [optional parameter](#optional-parameters-to-alter-your-installation).
44 -- Prints a message whether installation succeeded or failed for QA purposes.
30 +- Determines what platform you are running on.
31 +- Checks for an existing installation, and if found updates that instead of creating a new install.
32 +- Attempts to install Netdata using our [official native binary packages](#native-packages).
33 +- If there are no official native binary packages for your system (or installing that way failed), tries to install
34 + using a [static build of Netdata](#static-builds) if one is available.
35 +- If no static build is available, installs required dependencies and then attempts to install by
36 + [building Netdata locally](#local-builds) (by downloading the sources and building them directly).
37 +- Installs `netdata-updater.sh` to `cron.daily`, so your Netdata installation will be updated with new nightly
38 + versions, unless you override that with an [optional parameter](#optional-parameters-to-alter-your-installation).
39 +- Prints a message whether installation succeeded or failed for QA purposes.
40
41 ## Optional parameters to alter your installation
42
48 -The `kickstart.sh` script passes all its parameters to `netdata-installer.sh`, which you can use to customize your
49 -installation. Here are a few important parameters:
43 +The `kickstart.sh` script accepts a number of optional parameters to control how the installation process works:
44
45 +- `--non-interactive`: Don’t prompt for anything and assume yes whenever possible, overriding any automatic detection of an interactive run.
46 +- `--interactive`: Act as if running interactively, even if automatic detection indicates a run is non-interactive.
47 - `--dont-wait`: Synonym for `--non-interactive`
52 -- `--non-interactive`: Don’t prompt for anything and assume yes whenever possible.
48 +- `--dont-start-it`: Don’t auto-start the daemon after installing. This parameter is not gauranteed to work.
49 +- `--nightly-channel`: Use a nightly build instead of a stable release (this is the default).
50 +- `--stable-channel`: Use a stable release instead of a nightly build.
51 +- `--auto-update`: Enable automatic updates (this is the default).
52 - `--no-updates`: Disable automatic updates.
54 -- `--stable-channel`: Use a stable build instead of a nightly build.
53 +- `--disable-telemetry`: Disable anonymous statistics.
54 +- `--native-only`: Only install if native binary packages are available.
55 +- `--static-only`: Only install if a static build is available.
56 +- `--build-only`: Only install using a local build.
57 - `--reinstall`: If an existing install is found, reinstall instead of trying to update it in place.
56 -- `--dont-start-it`: Don’t auto-start the daemon after installing. This parameter is not guaranteed to work.
57 -- `--install`: Specify an alternative install prefix.
58 -- `--disable-cloud`: For local builds, don’t build any of the cloud code at all. For native packages and static builds,
58 +- `--reinstall-even-if-unsafe`: Even try to reinstall if we don't think we can do so safely (implies `--reinstall`).
59 +- `--disable-cloud`: For local builds, don’t build any of the cloud code at all. For native packages and static builds,
60 use runtime configuration to disable cloud support.
60 -- `--auto-update-type`: Specify how auto-updates are to be scheduled, overriding auto-detection.
61 -- `--disable-telemetry`: Disable anonymous statistics.
62 -- `--local-files`: Used for [offline installations](offline.md). Pass four file paths: the Netdata
63 - tarball, the checksum file, the go.d plugin tarball, and the go.d plugin config tarball, to force kickstart run the
64 - process using those files. This option conflicts with the `--stable-channel` option. If you set this _and_
65 - `--stable-channel`, Netdata will use the local files.
66 -- `all`: Ask for all dependencies in the dependency handling script.
67 -
68 - > Note: The `all` and `--local-files` parameters are scheduled to be removed in a forthcoming update.
69 -
61 +- `--require-cloud`: Only install if Netdata Cloud can be enabled. Overrides `--disable-cloud`.
62 +- `--install`: Specify an installation prefix for local builds (by default, we use a sane prefix based on the type of system).
63 +
64 +Additionally, the following environment variables may be used to further customize how the script runs (most users
65 +should not need to use special values for any of these):
66 +
67 +- `TMPDIR`: Used to specify where to put temporary files. On most systems, the default we select automatically
68 + should be fine. The user running the script needs to both be able to write files to the temporary directory,
69 + and run files from that location.
70 +- `ROOTCMD`: Used to specify a command to use to run another command with root privileges if needed. By default
71 + we try to use sudo, doas, or pkexec (in that order of preference), but if you need special options for one of
72 + those to work, or have a different tool to do the same thing on your system, you can specify it here.
73 +- `DO_NOT_TRACK`: If set to a value other than 0, behave as if `--disable-telemetry` was specified.
74 +- `NETDATA_INSTALLER_OPTIONS`: Specifies extra options to pass to the static installer or local build script.
75 +
76 ### Connect node to Netdata Cloud during installation
77
78 The `kickstart.sh` script accepts additional parameters to automatically [connect](/claim/README.md) your node to Netdata
@@ -74,10 +80,10 @@ Cloud immediately after installation. Find the `token` and `rooms` strings by [s
80 Cloud](https://app.netdata.cloud/sign-in?cloudRoute=/spaces), then clicking on **Connect Nodes** in the [Spaces management
81 area](https://learn.netdata.cloud/docs/cloud/spaces#manage-spaces).
82
77 -- `--claim-token`: Specify a unique claiming token associated with your Space in Netdata Cloud to be used to connect to the node
83 +- `--claim-token`: Specify a unique claiming token associated with your Space in Netdata Cloud to be used to connect to the node
84 after the install.
85 - `--claim-rooms`: Specify a comma-separated list of tokens for each War Room this node should appear in.
80 -- `--claim-proxy`: Specify a proxy to use when connecting to the cloud in the form of
86 +- `--claim-proxy`: Specify a proxy to use when connecting to the cloud in the form of
87 `socks5[h]://[user:pass@]host:ip` for a SOCKS5 proxy, or `http://[user:pass@]host:ip` for an HTTP(S) proxy.
88 See [connecting through a proxy](/claim/README.md#connect-through-a-proxy) for details.
89 - `--claim-url`: Specify a URL to use when connecting to the cloud. Defaults to `https://app.netdata.cloud`.
@@ -85,18 +91,50 @@ area](https://learn.netdata.cloud/docs/cloud/spaces#manage-spaces).
91 For example:
92
93 ```bash
88 -bash <(curl -Ss https://my-netdata.io/kickstart.sh) --claim-token TOKEN --claim-rooms ROOM1,ROOM2 --claim-url https://app.netdata.cloud
94 +wget -O ./kickstart.sh https://my-netdata.io/kickstart.sh && sh ./kickstart.sh --claim-token=TOKEN --claim-rooms=ROOM1,ROOM2
95 ```
96
97 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.
98
99 +### Native packages
100 +
101 +We publish official DEB/RPM packages for a number of common Linux distributions as part of our releases and nightly
102 +builds. These packages are available for 64-bit x86 systems. Depending on the distribution and release they may
103 +also be available for 32-bit x86, ARMv7, and AArch64 systems. If a native package is available, it will be used as the
104 +default installation method. This allows you to handle Netdata updates as part of your usual system update procedure.
105 +
106 +If you want to enforce the usage of native packages and have the installer return a failure if they are not available,
107 +you can do so by adding `--native-only` to the options you pass to the installer.
108 +
109 +### Static builds
110 +
111 +We publish pre-built static builds of Netdata for Linux systems. Currently, these are published for 64-bit x86, ARMv7,
112 +AArch64, and POWER8+ hardware. These static builds are able to operate in a mostly self-contained manner and only
113 +require a POSIX compliant shell and a supported init system. These static builds install under `/opt/netdata`. If
114 +you are on a platform which we provide static builds for but do not provide native packages for, a static build
115 +will be used by default for installation.
116 +
117 +If you want to enforce the usage of a static build and have the installer return a failure if one is not available,
118 +you can do so by adding `--static-only` to the options you pass to the installer.
119 +
120 +### Local builds
121 +
122 +For systems which do not have available native packages or static builds, we support building Netdata locally on
123 +the system it will be installed on. When using this approach, the installer will attempt to install any required
124 +dependencies for building Netdata, though this may not always work correctly.
125 +
126 +If you want to enforce the usage of a local build (perhaps because you require a custom installation prefix,
127 +which is not supported with native packages or static builds), you can do so by adding `--build-only` to the
128 +options you pass to the installer.
129 +
130 +
131 ## Verify script integrity
132
133 To use `md5sum` to verify the integrity of the `kickstart.sh` script you will download using the one-line command above,
134 run the following:
135
136 ```bash
99 -[ "1e09c4908ee5a2b0afff92b380e72c27" = "$(curl -Ss https://my-netdata.io/kickstart.sh | md5sum | cut -d ' ' -f 1)" ] && echo "OK, VALID" || echo "FAILED, INVALID"
137 +[ "ae8ba2e88a3239280b5e4a53ed792a71" = "$(curl -Ss https://my-netdata.io/kickstart.sh | md5sum | cut -d ' ' -f 1)" ] && echo "OK, VALID" || echo "FAILED, INVALID"
138 ```
139
140 If the script is valid, this command will return `OK, VALID`.
packaging/installer/methods/macos.md
+7 -3
@@ -16,8 +16,8 @@ We recommend you to **[install Netdata with the our automatic one-line installat
16 As an alternative you also have community-created and -maintained [**Homebrew
17 package**](#install-netdata-with-the-homebrew-package).
18
19 -- [Install Netdata via the Homebrew package](#install-netdata-with-the-homebrew-package)
20 -- [Install Netdata from source](#install-netdata-from-source)
19 +- [Install Netdata via the Homebrew package](#install-netdata-with-the-homebrew-package)
20 +- [Install Netdata from source](#install-netdata-from-source)
21
22 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.
23
@@ -26,11 +26,15 @@ Being community-created and -maintained we don't guarantee that the features mad
26 To install Netdata using our automatic [kickstart](/packaging/installer/README.md#automatic-one-line-installation-script) script you will just need to run:
27
28 ```bash
29 -bash <(curl -Ss https://my-netdata.io/kickstart.sh) --install /usr/local/
29 +wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh
30 ```
31
32 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)
33
34 +This currently only supports building Netdata locally, and requires dependencies to be handled either via Homebrew
35 +or MacPorts (we preferentially use Homebrew if both are found). By default, this will install Netdata under
36 +`/usr/local/netdata`.
37 +
38 ## Install Netdata with the Homebrew package
39
40 If you don't have [Homebrew](https://brew.sh/) installed already, begin with their installation script:
packaging/installer/methods/packages.md deleted
-46
@@ -1,46 +0,0 @@
1 -<!--
2 -title: "Install Netdata with .deb/.rpm packages"
3 -description: "Install the Netdata Agent with Linux packages that support Ubuntu, Debian, Fedora, RHEL, CentOS, openSUSE, and more."
4 -custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/installer/methods/packages.md
5 --->
6 -
7 -# Install Netdata with .deb/.rpm packages
8 -
9 -Netdata provides our own flavour of binary packages for the most common operating systems that use with `.deb` and
10 -`.rpm` packaging formats.
11 -
12 -We provide two separate repositories, one for our stable releases and one for our nightly releases. Visit the repository
13 -pages and follow the quick set-up instructions to get started.
14 -
15 -1. Stable releases: Our stable production releases are hosted in the
16 - [netdata/netdata](https://packagecloud.io/netdata/netdata) repository on packagecloud
17 -2. Nightly releases: Our latest releases are hosted in the
18 - [netdata/netdata-edge](https://packagecloud.io/netdata/netdata-edge) repository on packagecloud
19 -
20 -## Using caching proxies with packagecloud repositories
21 -
22 -packagecloud only provides HTTPS access to repositories they host, which means in turn that Netdata's package
23 -repositories are only accessible via HTTPS. This is known to cause issues with some setups that use a caching proxy for
24 -package downloads.
25 -
26 -If you are using such a setup, there are a couple of ways to work around this:
27 -
28 -- Configure your proxy to automatically pass through HTTPS connections without caching them. This is the simplest
29 - solution, but means that downloads of Netdata packages will not be cached.
30 -- Mirror the repository locally on your proxy system, and use that mirror when installing on other systems. This
31 - requires more setup and more disk space on the caching host, but it lets you cache the packages locally.
32 -- Some specific caching proxies may have alternative configuration options to deal with these issues. Find
33 - such options in their documentation.
34 -
35 -## What's next?
36 -
37 -When you're finished with installation, check out our [single-node](/docs/quickstart/single-node.md) or
38 -[infrastructure](/docs/quickstart/infrastructure.md) monitoring quickstart guides based on your use case.
39 -
40 -Or, skip straight to [configuring the Netdata Agent](/docs/configure/nodes.md).
41 -
42 -Read through Netdata's [documentation](https://learn.netdata.cloud/docs), which is structured based on actions and
43 -solutions, to enable features like health monitoring, alarm notifications, long-term metrics storage, exporting to
44 -external databases, and more.
45 -
46 -[![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%2Fpackages%2Finstaller%2Fmethods%2Fpackages&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
tests/installer/checksums.sh
-1
@@ -49,6 +49,5 @@ check_file() {
49 }
50
51 check_file kickstart.sh packaging/installer/methods/kickstart.md
52 -check_file kickstart-static64.sh packaging/installer/methods/kickstart-64.md
52
53 echo "No problems found, exiting successfully!"