mirror of
https://github.com/LPJon/cwpfixes.git
synced 2026-09-10 22:20:47 -05:00
Update install_netdata
Added support for NVM setup on first installation.
This commit is contained in:
@@ -7,24 +7,25 @@
|
|||||||
# ToDo:
|
# ToDo:
|
||||||
# Automatic activate on boot
|
# Automatic activate on boot
|
||||||
|
|
||||||
# NEW CODE
|
# NEW CODE------------
|
||||||
# Check if NVM and Node.JS is already installed and if it is skip it's installation
|
# Use NVM for node.js installation management. Options are "y" or "n" DEFAULT = n
|
||||||
# ToDo:
|
usenvm=n
|
||||||
# Add NVM support
|
# Version of Node.js to install. DEFAULT = 16.18.1
|
||||||
if [ -e "$HOME/.nvm" ]; then
|
nodeversion=16.18.1
|
||||||
echo "NVM for Node.JS is installed...Skipping RPM Package Installation!"
|
|
||||||
nodejs=""
|
|
||||||
else
|
|
||||||
nodejs="nodejs"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
function getsystemnodeversion {
|
||||||
|
if [ -e "/usr/bin/node" ]; then
|
||||||
|
/usr/bin/node -v
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
# ---------------------
|
||||||
# Check centos version
|
# Check centos version
|
||||||
centosversion=$(rpm -qa \*-release | grep -Ei "oracle|redhat|centos|cloudlinux" | cut -d"-" -f3 | cut -d"." -f 1 | head -n 1)
|
centosversion=$(rpm -qa \*-release | grep -Ei "oracle|redhat|centos|cloudlinux" | cut -d"-" -f3 | cut -d"." -f 1 | head -n 1)
|
||||||
if [[ "$centosversion" -eq "8" ]];then
|
if [[ "$centosversion" -eq "8" ]];then
|
||||||
yum -y install 'dnf-command(config-manager)'
|
yum -y install 'dnf-command(config-manager)'
|
||||||
yum -y install http://repo.okay.com.mx/centos/8/x86_64/release/okay-release-1-3.el8.noarch.rpm
|
yum -y install http://repo.okay.com.mx/centos/8/x86_64/release/okay-release-1-3.el8.noarch.rpm
|
||||||
yum -y install curl gcc make autoconf autoconf-archive autogen automake --enablerepo=epel --enablerepo=powertools
|
yum -y install curl gcc make autoconf autoconf-archive autogen automake --enablerepo=epel --enablerepo=powertools
|
||||||
yum -y install MySQL-python python python-yaml python-psycopg2 $nodejs lm_sensors --enablerepo=epel --enablerepo=powertools
|
yum -y install MySQL-python python python-yaml python-psycopg2 nodejs lm_sensors --enablerepo=epel --enablerepo=powertools
|
||||||
yum -y install nmap-ncat git zlib-devel libuuid-devel --enablerepo=epel --enablerepo=powertools
|
yum -y install nmap-ncat git zlib-devel libuuid-devel --enablerepo=epel --enablerepo=powertools
|
||||||
yum -y install libmnl-devel libuv-devel --enablerepo=epel --enablerepo=powertools
|
yum -y install libmnl-devel libuv-devel --enablerepo=epel --enablerepo=powertools
|
||||||
yum -y install json-c-devel libatomic libyaml-devel lz4-devel systemd-devel
|
yum -y install json-c-devel libatomic libyaml-devel lz4-devel systemd-devel
|
||||||
@@ -43,6 +44,33 @@ if [[ "$centosversion" -eq "8" ]];then
|
|||||||
make
|
make
|
||||||
make install
|
make install
|
||||||
else
|
else
|
||||||
|
# NEW CODE--------
|
||||||
|
if [ "$usenvm" == "n" ]; then
|
||||||
|
if [ -e "$HOME/.nvm" ]; then
|
||||||
|
echo "NVM for Node.JS is installed...Skipping RPM Package Installation!"
|
||||||
|
nodejs=""
|
||||||
|
else
|
||||||
|
nodejs="nodejs"
|
||||||
|
fi
|
||||||
|
elif [ "$usenvm" == "y" ]; then
|
||||||
|
if [ -e "$HOME/.nvm" ];then
|
||||||
|
source $HOME/.bashrc
|
||||||
|
nvm install $nodeversion
|
||||||
|
nvm use $nodeversion
|
||||||
|
if [ "$(getsystemnodeversion)" != "v$nodeversion" ]; then
|
||||||
|
ln -sf /root/.nvm/versions/node/v"$nodeversion"/bin/node /usr/bin/node
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ ! -e "$HOME/.nvm" ]; then
|
||||||
|
yum -y install curl
|
||||||
|
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
|
||||||
|
source $HOME/.bashrc
|
||||||
|
nvm install "$nodeversion"
|
||||||
|
nvm use "$nodeversion"
|
||||||
|
ln -sf /root/.nvm/versions/node/v"$nodeversion"/bin/node /usr/bin/node
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# ------------
|
||||||
yum -y install curl gcc make autoconf autoconf-archive autogen automake --enablerepo=epel
|
yum -y install curl gcc make autoconf autoconf-archive autogen automake --enablerepo=epel
|
||||||
yum -y install MySQL-python python python-yaml python-psycopg2 $nodejs lm_sensors --enablerepo=epel
|
yum -y install MySQL-python python python-yaml python-psycopg2 $nodejs lm_sensors --enablerepo=epel
|
||||||
yum -y install nmap-ncat git zlib-devel libuuid-devel --enablerepo=epel
|
yum -y install nmap-ncat git zlib-devel libuuid-devel --enablerepo=epel
|
||||||
|
|||||||
Reference in New Issue
Block a user