add IPPA
This commit is contained in:
parent
9bac2e79ca
commit
2e91ff6630
149
mybashrc
149
mybashrc
|
@ -3,8 +3,8 @@
|
|||
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
IS_SUDOERS=$(groups | grep sudo)
|
||||
if [ -x /usr/bin/sudo ] && [ -n "$IS_SUDOERS" ]; then
|
||||
NEED_SUDO="/usr/bin/sudo"
|
||||
if [ -n "$(command -v sudo)" ] && [ -n "$IS_SUDOERS" ]; then
|
||||
NEED_SUDO="$(command -v sudo)"
|
||||
else
|
||||
NEED_SUDO=""
|
||||
fi
|
||||
|
@ -138,7 +138,6 @@ MAINTENANCE_APT() {
|
|||
# Colors
|
||||
CSI='\033['
|
||||
CEND="${CSI}0m"
|
||||
CRED="${CSI}1;31m"
|
||||
CGREEN="${CSI}1;32m"
|
||||
|
||||
if [ "$(id -u)" = "0" ] || [ -n "$IS_SUDOERS" ]; then
|
||||
|
@ -323,64 +322,104 @@ _UPDATE_NPM() {
|
|||
$NEED_SUDO npm install -g npm
|
||||
}
|
||||
|
||||
alias transfer=transfer_vtbox_net
|
||||
alias magento-upgrade=MAGENTO_UPGRADE
|
||||
alias cheat=CHEAT_CHECK
|
||||
#alias wp='/usr/bin/wp --allow-root'
|
||||
|
||||
alias gpigz=compress_pigz
|
||||
alias gunpigz=decompress_pigz
|
||||
alias setfileperm=_PERM_FILES
|
||||
alias setdirperm=_PERM_FOLDER
|
||||
alias ee-bashrc-update=update_git_mybashrc
|
||||
|
||||
alias arsync='rsync -avz -h --progress'
|
||||
alias arsync_hard='rsync -rLptgoD --human-readable --progress'
|
||||
|
||||
alias ee-syslog='tail -n 250 /var/log/syslog | ccze -A'
|
||||
|
||||
alias ee-mysql-optimize=EE_MYSQL_OPTIMIZATION
|
||||
alias showlog=EE_SHOW_LOG
|
||||
alias dd-benchmark=DD_BENCHMARK_DISK
|
||||
alias vb-virtualenv=_PYTHON_VIRTUALENV
|
||||
_PPA_INSTALL() {
|
||||
if [ "$#" -eq 0 ]; then
|
||||
echo "Usage : IPPA <ppa-name>"
|
||||
echo " PPA : "
|
||||
echo " - ubuntu backports : --backports"
|
||||
echo " - ondrej php : --php"
|
||||
echo " - ondrej nginx : --nginx"
|
||||
echo " - ondrej apache : --apache"
|
||||
echo " - redis-server : --redis"
|
||||
echo " - ffmpeg4 : --ffmpeg"
|
||||
echo " - gcc8 : --gcc"
|
||||
else
|
||||
PPA=""
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "$1" in
|
||||
--backports)
|
||||
PPA="ppa:jonathonf/backports"
|
||||
;;
|
||||
--php)
|
||||
PPA="ppa:ondrej/php"
|
||||
;;
|
||||
--nginx)
|
||||
PPA="ppa:ondrej/nginx-mainline"
|
||||
;;
|
||||
--apache)
|
||||
PPA="ppa:ondrej/apache2"
|
||||
;;
|
||||
--redis)
|
||||
PPA="ppa:chris-lea/redis-server"
|
||||
;;
|
||||
--ffmpeg)
|
||||
PPA="ppa:jonathonf/ffmpeg-4"
|
||||
;;
|
||||
--gcc)
|
||||
PPA="ppa:jonathonf/gcc"
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
if [ -n "$PPA" ]; then
|
||||
$NEED_SUDO add-apt-repository "$PPA" -y
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# enable color support of ls and also add handy aliases
|
||||
alias ls='ls --color=auto'
|
||||
alias dir='dir --color=auto'
|
||||
alias vdir='vdir --color=auto'
|
||||
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
|
||||
# some more ls aliases
|
||||
alias ll='ls -alhF'
|
||||
alias la='ls -A'
|
||||
alias l='ls -CF'
|
||||
alias lh="stat -c '%A %a %n' ./*"
|
||||
alias ld='du -sh ./* | sort -h'
|
||||
alias ..="cd .."
|
||||
alias ...="cd ../.."
|
||||
alias ....="cd ../../.."
|
||||
#alias wp='/usr/bin/wp --allow-root'
|
||||
alias .....="cd ../../../.."
|
||||
alias maintenance=MAINTENANCE_APT
|
||||
alias ....="cd ../../.."
|
||||
alias ...="cd ../.."
|
||||
alias ..="cd .."
|
||||
alias allservices='service --status-all'
|
||||
alias aptremove='apt-get autoremove -y --purge'
|
||||
alias arsync_hard='rsync -rLptgoD --human-readable --progress'
|
||||
alias arsync='rsync -avz -h --progress'
|
||||
alias cheat=CHEAT_CHECK
|
||||
alias commit=GIT_COMMIT
|
||||
alias dd-benchmark=DD_BENCHMARK_DISK
|
||||
alias dir='dir --color=auto'
|
||||
alias docker-setup=EE_DOCKER_SETUP
|
||||
alias duplicate-finder=_find_duplicates
|
||||
alias ee-bashrc-update=update_git_mybashrc
|
||||
alias ee-ls=LIST_BY_SIZE
|
||||
alias ee-mysql-optimize=EE_MYSQL_OPTIMIZATION
|
||||
alias ee-syslog='tail -n 250 /var/log/syslog | ccze -A'
|
||||
alias egrep='egrep --color=auto'
|
||||
alias ffmpeg-cut-start=ffmpeg_start_time
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias gg="ping google.fr"
|
||||
alias gpg-crypt=encrypt_gpg
|
||||
alias gpg-decrypt=decrypt_gpg
|
||||
alias show-fpm-process=EE_SHOW_FPM
|
||||
alias docker-setup=EE_DOCKER_SETUP
|
||||
alias ee-ls=LIST_BY_SIZE
|
||||
alias tinc-up=SET_TINC_UP
|
||||
alias tinc-down=SET_TINC_DOWN
|
||||
alias ffmpeg-cut-start=ffmpeg_start_time
|
||||
alias commit=GIT_COMMIT
|
||||
alias random-commit=RANDOM_GIT_COMMIT
|
||||
alias wp-fix-perms=_WP_PERMISSIONS
|
||||
alias aptremove='apt-get autoremove -y --purge'
|
||||
alias allservices='service --status-all'
|
||||
alias gg="ping google.fr"
|
||||
alias wo-virtualenv=_PYTHON_VIRTUALENV
|
||||
alias gpigz=compress_pigz
|
||||
alias grep='grep --color=auto'
|
||||
alias gunpigz=decompress_pigz
|
||||
alias l='ls -CF'
|
||||
alias la='ls -A'
|
||||
alias ld='du -sh ./* | sort -h'
|
||||
alias lh="stat -c '%A %a %n' ./*"
|
||||
alias ll='ls -alhF'
|
||||
alias ls='ls --color=auto'
|
||||
alias magento-upgrade=MAGENTO_UPGRADE
|
||||
alias maintenance=MAINTENANCE_APT
|
||||
alias netdata-fix=_FIX_NETDATA
|
||||
alias nginx-ee=_NGINX_EE
|
||||
alias duplicate-finder=_find_duplicates
|
||||
alias npm-update=_UPDATE_NPM
|
||||
alias random-commit=RANDOM_GIT_COMMIT
|
||||
alias setdirperm=_PERM_FOLDER
|
||||
alias setfileperm=_PERM_FILES
|
||||
alias setup-nodejs=_INSTALL_NODEJS
|
||||
alias npm-update=_UPDATE_NPM
|
||||
alias show-fpm-process=EE_SHOW_FPM
|
||||
alias showlog=EE_SHOW_LOG
|
||||
alias tinc-down=SET_TINC_DOWN
|
||||
alias tinc-up=SET_TINC_UP
|
||||
alias transfer=transfer_vtbox_net
|
||||
alias vb-virtualenv=_PYTHON_VIRTUALENV
|
||||
alias vdir='vdir --color=auto'
|
||||
alias wo-virtualenv=_PYTHON_VIRTUALENV
|
||||
alias wp-fix-perms=_WP_PERMISSIONS
|
||||
alias IPPA=_PPA_INSTALL
|
||||
|
|
49
netdata.sh
49
netdata.sh
|
@ -1,27 +1,54 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# -------------------------------------------------------------------------
|
||||
# Netdata installer for Ubuntu/Debian
|
||||
# -------------------------------------------------------------------------
|
||||
# Website: https://virtubox.net
|
||||
# GitHub: https://github.com/VirtuBox
|
||||
# Copyright (c) 2019 VirtuBox <contact@virtubox.net>
|
||||
# This script is licensed under M.I.T
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
# Check if user is root
|
||||
[ "$(id -u)" != "0" ] && {
|
||||
echo "Error: You must be root or use sudo to run this script"
|
||||
exit 1
|
||||
}
|
||||
|
||||
## optimize netdata resources usage
|
||||
echo 1 > /sys/kernel/mm/ksm/run
|
||||
echo 1000 > /sys/kernel/mm/ksm/sleep_millisecs
|
||||
|
||||
## install nedata
|
||||
wget -O kickstart.sh https://my-netdata.io/kickstart.sh
|
||||
wget -qO kickstart.sh https://my-netdata.io/kickstart.sh
|
||||
chmod +x kickstart.sh
|
||||
echo "Installing Netdata"
|
||||
./kickstart.sh all --dont-wait --no-updates >> /dev/null 2>&1
|
||||
echo "Installation finished"
|
||||
echo "Installing Netdata [OK]"
|
||||
rm kickstart.sh
|
||||
|
||||
# If MySQL installed, create netdata user for MySQL monitoring
|
||||
if [ -n "$(command -v mysqladmin)" ]; then
|
||||
MYSQL_CHECK="$(mysqladmin ping | grep alive)"
|
||||
if [ -n "$MYSQL_CHECK" ]; then
|
||||
mysql -e "create user 'netdata'@'localhost';"
|
||||
mysql -e "grant usage on *.* to 'netdata'@'localhost';"
|
||||
mysql -e "flush privileges;"
|
||||
fi
|
||||
apt-get install python3-mysqldb -y
|
||||
MYSQL_CHECK="$(mysqladmin ping | grep alive)"
|
||||
if [ -n "$MYSQL_CHECK" ]; then
|
||||
if [ -f $HOME/.my.cnf ] || [ -f /etc/mysql/conf.d/my.cnf ]; then
|
||||
echo "Adding netdata user for MySQL monitoring"
|
||||
mysql -e "create user 'netdata'@'localhost';"
|
||||
mysql -e "grant usage on *.* to 'netdata'@'localhost';"
|
||||
mysql -e "flush privileges;"
|
||||
elif [ -f /etc/psa/.psa.shadow ]; then
|
||||
echo "Adding netdata user for MySQL monitoring"
|
||||
MYSQL_PWD=$(cat /etc/psa/.psa.shadow) mysql -uadmin -e "create user 'netdata'@'localhost';"
|
||||
MYSQL_PWD=$(cat /etc/psa/.psa.shadow) mysql -uadmin -e "grant usage on *.* to 'netdata'@'localhost';"
|
||||
MYSQL_PWD=$(cat /etc/psa/.psa.shadow) mysql -uadmin -e "flush privileges;"
|
||||
echo "Updating Netdata configuration for Apache monitoring"
|
||||
sed -i 's/http:\/\/localhost\/server-status?auto/http:\/\/localhost:7080\/server-status?auto/' /usr/lib/netdata/conf.d/python.d/apache.conf
|
||||
fi
|
||||
# installing required python package for mysql monitoring
|
||||
apt-get update -qq &&
|
||||
apt-get install python3-mysqldb -y -qq
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# disable mail notifications
|
||||
sed -i 's/SEND_EMAIL="YES"/SEND_EMAIL="NO"/' /usr/lib/netdata/conf.d/health_alarm_notify.conf
|
||||
service netdata restart
|
||||
|
|
Loading…
Reference in New Issue