Last active
June 22, 2025 21:31
-
-
Save davaymne/3ef968256fc52351da11dc2f114c8f4e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| apt update && apt upgrade -y | |
| apt install htop git httpie jq tmux bc net-tools smartmontools -y | |
| useradd -rs /bin/false monitor | |
| cd /opt | |
| wget https://github.com/prometheus/node_exporter/releases/download/v1.3.1/node_exporter-1.3.1.linux-amd64.tar.gz | |
| tar xvfz node_exporter-*.*-amd64.tar.gz && cp node_exporter-*.*-amd64/node_exporter . && chown monitor:monitor node_exporter | |
| tee /etc/systemd/system/node_exporter.service <<"EOF" | |
| [Unit] | |
| Description=Node Exporter | |
| After=network.target | |
| StartLimitIntervalSec=0 | |
| [Service] | |
| Type=simple | |
| Restart=always | |
| RestartSec=1 | |
| User=monitor | |
| ExecStart=/opt/node_exporter | |
| [Install] | |
| WantedBy=multi-user.target | |
| EOF | |
| sudo systemctl enable --now node_exporter | |
| sleep 2 | |
| curl http://localhost:9100/metrics | |
| # CPU Performance | |
| sudo apt-get install cpufrequtils moreutils -y | |
| sudo bash -c "cat >> /etc/default/cpufrequtils <<EOF | |
| ENABLE="true" | |
| GOVERNOR="performance" | |
| EOF" | |
| sudo systemctl restart cpufrequtils.service | |
| # Disable upgrade | |
| sudo bash -c "cat >> /etc/apt/apt.conf.d/20auto-upgrades <<EOF | |
| APT::Periodic::Update-Package-Lists "0"; | |
| APT::Periodic::Download-Upgradeable-Packages "0"; | |
| APT::Periodic::AutocleanInterval "0"; | |
| APT::Periodic::Unattended-Upgrade "0"; | |
| EOF" | |
| # SSH multiplexing | |
| sudo bash -c "cat >> ~/.ssh/config <<EOF | |
| Host * | |
| ControlMaster auto | |
| ControlPath ~/.ssh/mux-%r@%h:%p | |
| ControlPersist 10m | |
| EOF" | |
| # Disk util | |
| sudo apt install smartmontools | |
| udisksctl status |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
wget -q -O init-ubuntu.sh https://gist.githubusercontent.com/davaymne/3ef968256fc52351da11dc2f114c8f4e/raw/init-ubuntu.sh && chmod 777 init-ubuntu.sh && sudo /bin/bash init-ubuntu.sh