diff --git a/Init-Server.sh b/Init-Server.sh index 70d9f7e..adae5ed 100644 --- a/Init-Server.sh +++ b/Init-Server.sh @@ -111,9 +111,16 @@ install_nodejs() { else log_info "Node.js wird installiert..." apt install -y curl - curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - + # Using the latest LTS version (20.x as of now) + curl -fsSL https://deb.nodesource.com/setup_20.x | bash - apt install -y nodejs + + # Install latest npm version + npm install -g npm@latest + log_success "Node.js wurde erfolgreich installiert." + log_info "Installed Node.js version: $(node --version)" + log_info "Installed npm version: $(npm --version)" fi else log_skip "Node.js-Installation übersprungen." @@ -138,14 +145,51 @@ setup_basic_system() { log_skip "Basic tools und UFW Installation übersprungen." fi } +# Function to display system overview +display_system_overview() { + log_info "=== System Overview ===" + echo -e "\n${BLUE}[Network Information]${NC}" + echo "IP Addresses:" + ip -4 addr show | grep inet | awk '{print $2}' | cut -d/ -f1 + + echo -e "\n${BLUE}[Disk Usage]${NC}" + df -h / | tail -n 1 | awk '{print "Root partition: " $4 " free of " $2}' + + echo -e "\n${BLUE}[Memory Usage]${NC}" + free -h | awk '/^Mem:/ {print "RAM: " $3 " used of " $2 " total"}' + + echo -e "\n${BLUE}[CPU Information]${NC}" + lscpu | grep "Model name" | cut -d: -f2- | sed 's/^[ \t]*//' + echo "CPU Usage: $(top -bn1 | grep "Cpu(s)" | awk '{print $2}')%" + + echo -e "\n${BLUE}[Installed Components]${NC}" + if command_exists docker; then + echo "✓ Docker $(docker --version | cut -d' ' -f3 | tr -d ',')" + if docker ps | grep -q dockge; then + echo "✓ Dockge (running on port 5001)" + fi + fi + if command_exists node; then + echo "✓ Node.js $(node --version)" + fi + if command_exists ufw; then + echo "✓ UFW ($(ufw status | grep Status | cut -d' ' -f2))" + fi + + echo -e "\n${BLUE}[Open Ports]${NC}" + netstat -tuln | grep LISTEN | awk '{print $4}' | sed 's/.*://' + + echo -e "\n${GREEN}Setup completed! System is ready to use.${NC}\n" +} # Main execution main() { setup_ssh update_system - setup_basic_system # Replace both previous functions + setup_basic_system install_docker install_nodejs + display_system_overview } # Run main function diff --git a/README.md b/README.md index 9e5c4b4..17771cc 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,42 @@ curl -o /tmp/Init-Server.sh https://git.lucidtime.de/Hikyu/linux-server-tools/-/ mein public zum testen: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCx49TcvDhhqzhNSUvpMVJdkO6v/U55L69/cJjNT1eYgwKuIUEOb2wsFjrfe13QXo/npGwNQOFCXDoHSm8r0rcIbR74P0lTabHVwUOEQIzrNsLUSbXTYqcukUzlKu2Lg9ywPL7jEytFEFnUQMomgWuEze25EfuHk52K7P6rPAqZ6MUhop+WTq+cQ59beh6sMpriR3j1507gDpzAv0bwGm/QpgAtxPQQYZkOQefzOF+biRn4oY18IEDxWKWhkKBe6lzvDAlRbqwcHl+mRPf75t0CiuuCKAYx7qjL7fOdMCTaK8TPHJvmZFhrU9Dqk4g2TfZSr1wEpHqG4DygRO/6i/Gw0u62XYVJ7U0fmTDzvYhTIj0oF3HKo8Bv11U83hQFlemkHI2UEgc1YJ3FQdtesjsVUPbZwdWyo28cRxx10vdApoWAuqJnlBGC60UFdiIsCVWU/9/NLY1VNd8mOqYkAURZaCUdg413zvoQB3+/saoExxGsg82eazr0ExrHIfVApM0= deck@steamdeck + +## What this script does + +The script performs the following setup tasks: + +1. SSH Setup + - Creates .ssh directory if needed + - Adds provided SSH public key to authorized_keys + +2. System Updates + - Updates package lists + - Upgrades installed packages + +3. Basic Tools Installation + - htop (Process monitoring) + - zip/unzip + - UFW (Firewall) + - screen (Terminal multiplexer) + - vim, nano (Text editors) + - git (Version control) + - curl, wget (Download tools) + - tree (Directory visualization) + - ncdu (Disk usage analyzer) + +4. Security Configuration + - Enables UFW firewall + - Configures SSH access + +5. Docker Installation (Optional) + - Installs Docker Engine + - Sets up Docker repository + - Configures Docker to start on boot + +6. Dockge Installation (Optional) + - Installs Dockge container management + - Runs on port 5001 + +7. Node.js Installation (Optional) + - Installs Node.js LTS version