Merge branch 'master' of https://og.codes/oliver/install-scripts
This commit is contained in:
commit
15aa8ad934
102
grafana-stack/install.sh
Normal file
102
grafana-stack/install.sh
Normal file
@ -0,0 +1,102 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Function to install Loki and Promtail
|
||||
install_loki_promtail() {
|
||||
echo "Installing Loki and Promtail..."
|
||||
|
||||
# Install Loki
|
||||
echo "Installing Loki..."
|
||||
wget -q -O - https://repo.thanos.io/thanos.key | apt-key add -
|
||||
echo "deb [arch=amd64] https://repo.thanos.io/deb all main" | tee /etc/apt/sources.list.d/thanos.list
|
||||
apt-get update -y
|
||||
apt-get install -y loki
|
||||
|
||||
# Install Promtail
|
||||
echo "Installing Promtail..."
|
||||
wget -q -O - https://repo.thanos.io/thanos.key | apt-key add -
|
||||
echo "deb [arch=amd64] https://repo.thanos.io/deb all main" | tee /etc/apt/sources.list.d/thanos.list
|
||||
apt-get update -y
|
||||
apt-get install -y promtail
|
||||
|
||||
# Enable and start Loki and Promtail services
|
||||
echo "Enabling and starting Loki and Promtail services..."
|
||||
systemctl enable loki
|
||||
systemctl start loki
|
||||
systemctl enable promtail
|
||||
systemctl start promtail
|
||||
|
||||
echo "Loki and Promtail installed and services started."
|
||||
}
|
||||
|
||||
# Check for sudo/root privileges
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
echo "Script must be run as root. Please enter your sudo password."
|
||||
exec sudo bash "$0" "$@"
|
||||
fi
|
||||
|
||||
echo "Starting script as root."
|
||||
|
||||
# Step 2: Install software-properties-common, apt-transport-https, wget
|
||||
echo "Step 2: Installing software-properties-common, apt-transport-https, wget..."
|
||||
apt-get update -y
|
||||
apt-get install -y software-properties-common apt-transport-https wget
|
||||
|
||||
# Step 3: Add the official Grafana GPG key
|
||||
echo "Step 3: Adding the official Grafana GPG key..."
|
||||
wget -q -O - https://packages.grafana.com/gpg.key | apt-key add -
|
||||
|
||||
# Step 4: Add the official Grafana repository for Debian
|
||||
echo "Step 4: Adding the official Grafana repository..."
|
||||
add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
|
||||
|
||||
# Step 5: Run apt update
|
||||
echo "Step 5: Updating package list..."
|
||||
apt-get update -y
|
||||
|
||||
# Step 6: Install both Grafana & Prometheus
|
||||
echo "Step 6: Installing Grafana and Prometheus..."
|
||||
apt-get install -y grafana prometheus
|
||||
|
||||
# Step 7: Edit the Grafana config file to change the default port
|
||||
echo "Step 7: Changing Grafana port from 3000 to 3100..."
|
||||
sed -i 's/;http_port = 3000/http_port = 3100/' /etc/grafana/grafana.ini
|
||||
|
||||
# Step 8: Install and enable both Grafana and Prometheus as systemctl services
|
||||
echo "Step 8: Enabling and starting Grafana and Prometheus services..."
|
||||
systemctl daemon-reload
|
||||
systemctl enable grafana-server
|
||||
systemctl start grafana-server
|
||||
systemctl enable prometheus
|
||||
systemctl start prometheus
|
||||
|
||||
# Step 9: Wait 2 minutes, then check both services are running successfully
|
||||
echo "Step 9: Waiting 2 minutes to check service statuses..."
|
||||
sleep 120
|
||||
|
||||
GRAFANA_STATUS=$(systemctl is-active grafana-server)
|
||||
PROMETHEUS_STATUS=$(systemctl is-active prometheus)
|
||||
|
||||
if [ "$GRAFANA_STATUS" != "active" ] || [ "$PROMETHEUS_STATUS" != "active" ]; then
|
||||
echo "One or both services failed to start. Retrying in 2 minutes..."
|
||||
sleep 120
|
||||
systemctl restart grafana-server
|
||||
systemctl restart prometheus
|
||||
fi
|
||||
|
||||
GRAFANA_STATUS=$(systemctl is-active grafana-server)
|
||||
PROMETHEUS_STATUS=$(systemctl is-active prometheus)
|
||||
|
||||
if [ "$GRAFANA_STATUS" == "active" ] && [ "$PROMETHEUS_STATUS" == "active" ]; then
|
||||
echo "Both Grafana and Prometheus are running successfully."
|
||||
echo "Grafana can be accessed on port 3100."
|
||||
|
||||
# Prompt to install Loki and Promtail
|
||||
read -p "Would you like to install Loki and Promtail as well? (yes/no): " INSTALL_LOKI_PROMTAIL
|
||||
if [ "$INSTALL_LOKI_PROMTAIL" == "yes" ] || [ "$INSTALL_LOKI_PROMTAIL" == "y" ]; then
|
||||
install_loki_promtail
|
||||
else
|
||||
echo "Skipping installation of Loki and Promtail."
|
||||
fi
|
||||
else
|
||||
echo "Failed to start one or both services. Please check the logs for more information."
|
||||
fi
|
60
proxmox-scripts/install.sh
Normal file
60
proxmox-scripts/install.sh
Normal file
@ -0,0 +1,60 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Function to display the main menu
|
||||
function show_menu() {
|
||||
clear
|
||||
echo "======================================"
|
||||
echo " Proxmox Helper Script Installer"
|
||||
echo "======================================"
|
||||
echo "1. Install PVE-No-Subscription-Warning"
|
||||
echo "2. Install PVE Kernel Module Patcher"
|
||||
echo "3. Install PVE VM Backup Script"
|
||||
echo "4. Exit"
|
||||
echo "======================================"
|
||||
}
|
||||
|
||||
# Function to install the PVE No Subscription Warning script
|
||||
function install_pve_no_subscription_warning() {
|
||||
clear
|
||||
echo "Installing PVE-No-Subscription-Warning..."
|
||||
# Add your installation command here, for example:
|
||||
wget https://raw.githubusercontent.com/proxmox/pve-no-subscription-warning/master/pve-no-subscription-warning -O /usr/local/bin/pve-no-subscription-warning
|
||||
chmod +x /usr/local/bin/pve-no-subscription-warning
|
||||
echo "PVE-No-Subscription-Warning installed successfully!"
|
||||
read -n 1 -s -r -p "Press any key to continue..."
|
||||
}
|
||||
|
||||
# Function to install the PVE Kernel Module Patcher script
|
||||
function install_pve_kernel_module_patcher() {
|
||||
clear
|
||||
echo "Installing PVE Kernel Module Patcher..."
|
||||
# Add your installation command here, for example:
|
||||
wget https://raw.githubusercontent.com/olafm/proxmox-no-subscription-patch/master/pve-no-subscription-patch -O /usr/local/bin/pve-kernel-module-patcher
|
||||
chmod +x /usr/local/bin/pve-kernel-module-patcher
|
||||
echo "PVE Kernel Module Patcher installed successfully!"
|
||||
read -n 1 -s -r -p "Press any key to continue..."
|
||||
}
|
||||
|
||||
# Function to install the PVE VM Backup Script
|
||||
function install_pve_vm_backup_script() {
|
||||
clear
|
||||
echo "Installing PVE VM Backup Script..."
|
||||
# Add your installation command here, for example:
|
||||
wget https://raw.githubusercontent.com/erikng/proxmox-scripts/master/backup-vm.sh -O /usr/local/bin/pve-vm-backup
|
||||
chmod +x /usr/local/bin/pve-vm-backup
|
||||
echo "PVE VM Backup Script installed successfully!"
|
||||
read -n 1 -s -r -p "Press any key to continue..."
|
||||
}
|
||||
|
||||
# Main loop
|
||||
while true; do
|
||||
show_menu
|
||||
read -p "Please enter your choice: " choice
|
||||
case $choice in
|
||||
1) install_pve_no_subscription_warning ;;
|
||||
2) install_pve_kernel_module_patcher ;;
|
||||
3) install_pve_vm_backup_script ;;
|
||||
4) exit 0 ;;
|
||||
*) echo "Invalid option. Please enter a number between 1 and 4." ;;
|
||||
esac
|
||||
done
|
Loading…
Reference in New Issue
Block a user