Skip to content

Instantly share code, notes, and snippets.

@chappy84
Created June 5, 2020 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chappy84/69534ff564c7a830d8b33a2c38b53fd0 to your computer and use it in GitHub Desktop.
Save chappy84/69534ff564c7a830d8b33a2c38b53fd0 to your computer and use it in GitHub Desktop.
Install script for Linode's Longview on CentOS 8 .... until they stop supporting it completely
#!/bin/sh
####################################################################################################
#
# Install Linode's LongView on CentOS 8
#
# Copyright (c) 2020, Tom Chapman (http://tom-chapman.uk)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are
# permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions
# and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list of
# conditions and the following disclaimer in the documentation and/or other materials provided with
# the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used to
# endorse or promote products derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
# WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
####################################################################################################
LONGVIEW_API_KEY="<Longview API Key goes here>"
dnf -y install perl openssl-devel gcc make patch tar
mkdir /etc/linode/
echo "$LONGVIEW_API_KEY" > /etc/linode/longview.key
cd /usr/local/src
curl --location-trusted -o longview-1.1.5.tar.gz https://github.com/linode/longview/archive/v1.1.5.tar.gz
curl -O http://www.cpan.org/authors/id/N/NA/NANIS/Crypt-SSLeay-0.72.tar.gz
mkdir /opt/linode
tar xfz longview-1.1.5.tar.gz
# Crypt-SSLeay doesn't compile on CentOS 8, as it's broken with OpenSSL 1.1.0+, so lets patch it
# Bug detailed here: https://rt.cpan.org/Public/Bug/Display.html?id=118343
# Patch installer to use local version we're going to patch
cd longview-1.1.5/Extras
patch -p0 <<< '--- install-dependencies.sh.orig 2020-06-05 19:43:05.444000000 +0000
+++ install-dependencies.sh 2020-06-05 19:44:19.835000000 +0000
@@ -33,8 +33,10 @@
http_fetch http://cpanmin.us /tmp/cpanm
chmod +x /tmp/cpanm
-echo "==== Installing Longview core dependencies ===="
-/tmp/cpanm -q -L $BASE_DIR LWP::UserAgent Crypt::SSLeay IO::Socket::INET6 Linux::Distribution JSON::PP JSON Log::LogLite Try::Tiny DBI
+echo "==== Installing Crypt::SSLeay & dependencies for Longview ===="
+/tmp/cpanm -q -L $BASE_DIR /usr/local/src/Crypt-SSLeay-0.72
+echo "==== Installing other Longview core dependencies ===="
+/tmp/cpanm -q -L $BASE_DIR LWP::UserAgent IO::Socket::INET6 Linux::Distribution JSON::PP JSON Log::LogLite Try::Tiny DBI
echo "==== Installing Longview-MySQL dependencies ===="
/tmp/cpanm -q -L $BASE_DIR DBD::mysql
rm /tmp/cpanm'
cd /usr/local/src
mv longview-1.1.5 /opt/linode/longview
# Patch the local version of Crypt::SSLeay@0.72
tar xfz Crypt-SSLeay-0.72.tar.gz
cd Crypt-SSLeay-0.72
# Patch from here: https://rt.cpan.org/Ticket/Attachment/1676102/899515/0001-Do-not-use-SSLv2_client_method-with-OpenSSL-1.1.0.patch
patch -p0 <<< '--- SSLeay.xs.orig 2020-06-05 19:03:57.169000000 +0000
+++ SSLeay.xs 2020-06-05 19:04:34.595000000 +0000
@@ -152,7 +152,7 @@
ctx = SSL_CTX_new(SSLv3_client_method());
}
else {
-#ifndef OPENSSL_NO_SSL2
+#if !defined OPENSSL_NO_SSL2 && OPENSSL_VERSION_NUMBER < 0x10100000L
/* v2 is the default */
ctx = SSL_CTX_new(SSLv2_client_method());
#else'
# Install the required perl dependencies
cd /opt/linode/longview/Extras
./install-dependencies.sh
# Install the SystemD service file
ln -s /opt/linode/longview/Extras/init/longview.service /usr/lib/systemd/system/
# Start and make
systemctl daemon-reload
systemctl enable --now longview
systemctl start longview
@chappy84
Copy link
Author

chappy84 commented Jun 11, 2020

Ironically, a week after I published this ...... Longview is now officially available for CentOS 8!
You can see the yum repo's contents here, and Linode responding to the community here.
I'd recommend using the official install method over this for anyone that finds it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment