A comprehensive collection of Bash scripts for automating system administration, development environment setup, and server management tasks on Linux/Ubuntu/WSL2 systems.
cd ~
mkdir -p mybash
cd mybash
git clone git@github.com:khaizinam/devop-tools.git .sudo bash app_ui.shNote: Scripts require root privileges. If you're already logged in as root, you can run without sudo:
bash app_ui.shDescription: Setup Ubuntu development environment with essential tools
A comprehensive menu-driven installer that provides the following options:
- Install All - Install all packages in one go
- Install Nginx (Remove Apache2) - Install Nginx web server and remove Apache2 if present
- Install and Configure UFW - Install UFW firewall and configure default ports (SSH, HTTP, HTTPS) with option to add custom ports
- Install OpenSSH - Install and enable OpenSSH server
- Install Zsh and Oh My Zsh - Install Zsh shell with Oh My Zsh framework (bira theme)
- Install Essential Packages - Install curl, wget, nano
- Install Docker - Install Docker Engine and Docker Compose with automatic OS detection (Debian/Ubuntu)
- Install Snakeoil SSL Certificate - Install self-signed SSL certificate for local development
- Install Certbot (Let's Encrypt) - Install Certbot for managing SSL certificates from Let's Encrypt
- Install Git - Install Git with optional global configuration (username, email, pull.rebase)
- Install Node.js (NVM) - Install Node.js using NVM with option to install yarn and pm2
Features:
- Interactive menu with arrow key navigation
- Reinstall prompts for already installed packages
- Automatic repository fixes (removes broken Cloudflare repo)
- Color-coded output for better readability
Description: Configure and setup Nginx web server with PHP support
Manages Nginx site configurations with the following features:
-
Create New Project - Create a new Nginx site configuration
- Supports PHP projects (with version selection, default 8.2)
- Supports static HTML projects
- Optional Git repository cloning
- Custom root directory configuration (/public_html or /public for Laravel)
-
List Projects - Display all saved project configurations
-
Rebuild from Config - Recreate Nginx site from existing configuration file
-
Delete Project - Remove project directory, Nginx config, and clean up
Configuration:
- Configurations are stored in
./storage/config/directory - Each project has its own
.conffile with all settings - Automatic SSL certificate setup (snakeoil)
- Automatic
/etc/hostsentry creation
Description: Connect to remote server via SSH with saved configurations
Interactive SSH connection manager with scrollable menu:
-
Connection Management:
- List all saved SSH configurations
- Connect to server with saved credentials
- Edit configuration files (nano/vi)
- Delete configurations with confirmation
-
Features:
- Scrollable menu with up to 50 visible items
- Arrow key navigation + number input for quick selection
- Password-based authentication with
sshpass - Auto-install
sshpassif not available - Edit config files with your preferred editor
Storage:
- Configurations stored in
./ssh_config/directory - Format:
USER-HOST.confcontaining USER, HOST, PORT, PASS
Description: Add SSH public key to remote server for passwordless login
Manages SSH key distribution to remote servers:
-
Key Management:
- Select from saved SSH public keys
- Create new SSH public key
- Upload selected key to remote server
-
Configuration Actions:
- Add to Server - Upload SSH key to selected server
- Edit - Edit server configuration (nano/vi)
- Delete - Remove server configuration
- Back to Menu - Return to main menu
Features:
- Connection testing before key upload
- Automatic
~/.ssh/authorized_keysmanagement - Duplicate key detection
- Clear success/error messages
Storage:
- SSH keys stored in
./ssh_rsa/directory - Configurations stored in
./ssh_config/directory
Description: Configure SSH settings and keys for Windows Subsystem for Linux
Sets up SSH environment for WSL:
-
SSH Agent Management:
- Check if SSH agent is running
- Start SSH agent if not running
- Persist agent settings in
.bashrcand.zshrc
-
Key Management:
- Copy SSH keys from
./ssh/to~/.ssh/ - Set correct file permissions (700 for
.ssh, 600 for private keys) - Add private key to SSH agent
- Clear existing keys before adding new ones
- Copy SSH keys from
Usage:
- Run from directory containing
.ssh/folder - Automatically handles agent lifecycle
- Ensures proper permissions for SSH files
Description: Clear temporary files and system logs to free up disk space
Comprehensive cleanup tool:
-
Temporary Files:
- Cleans all files in
/tmpdirectory - Shows before/after file count
- Safe removal with error handling
- Cleans all files in
-
System Logs:
- Removes log files older than 7 days from
/var/log - Shows total space occupied before cleanup
- Displays space recovered after cleanup
- Lists all deleted files with sizes
- Removes log files older than 7 days from
Features:
- Color-coded progress indicators
- Detailed statistics
- Safe operation (only old logs removed)
Description: Create and configure swap file for system memory
Creates swap files to extend available memory:
- Prompts for swap file size
- Creates swap file at
/swapfile - Sets correct permissions (600)
- Formats as swap
- Enables swap immediately
- Adds to
/etc/fstabfor persistence
Note: Requires root privileges for swap operations.
Description: Reset Navicat trial period to extend usage time
Resets Navicat Premium trial period by removing registry entries:
- Removes Navicat registry keys
- Clears application data
- Extends trial period
Platform: Windows/WSL (uses Windows registry commands)
The toolkit features a modern, interactive UI system:
- Arrow Keys (ββ) - Navigate through menu options
- Enter - Select highlighted option
- Number Keys (0-9) - Quick jump to option by number
- Q - Quit/Exit
- Ctrl+C - Graceful exit with cleanup
- Color-coded output for better readability
- Scrollable menus (up to 50 visible items)
- Input buffering for numeric selection
- Real-time menu updates
- Graceful error handling
mybash/
βββ app_ui.sh # Main interactive script manager
βββ README.md # This file
βββ run/ # Executable scripts
β βββ clean-temporary.sh
β βββ install-ubuntu-environment.sh
β βββ nginx-setup.sh
β βββ ssh-add-idrsa-key.sh
β βββ ssh-remote-server.sh
β βββ ssh-setting-wsl.sh
β βββ system-make-swapfile.sh
β βββ system-reset-trial-navicat.sh
βββ src/
β βββ services/ # Modular service functions
β β βββ common.sh
β β βββ install-nginx.sh
β β βββ install-ufw.sh
β β βββ install-openssh.sh
β β βββ install-zsh.sh
β β βββ install-essential-packages.sh
β β βββ install-docker.sh
β β βββ install-snakeoil-cert.sh
β β βββ install-certbot.sh
β β βββ install-git.sh
β β βββ install-node.sh
β β βββ clean-tmp.sh
β β βββ clean-log.sh
β β βββ init-nginx.sh
β βββ ui/ # UI components
β βββ ui_common.sh # Common UI functions and colors
β βββ scroll_menu.sh # Scrollable menu component
βββ config/ # Nginx site configurations
βββ ssh_config/ # SSH server configurations
βββ ssh_rsa/ # SSH public keys
- Operating System: Linux (Debian/Ubuntu recommended), WSL2
- Privileges: Root/sudo access
- Package Manager: apt-get (Debian/Ubuntu), yum/dnf/pacman (other distros)
- Dependencies:
nanoorvi(auto-installed by app_ui.sh)sshpass(auto-installed when needed)curl,wget(installed via Ubuntu Environment script)
All scripts support metadata variables:
NAME- Display name for the scriptDESC- Description shown in menu
Example:
NAME="My Script"
DESC="This script does amazing things"If metadata is not present, the script filename (without extension) is used as the name.
- Scripts require root privileges for system modifications
- SSH passwords are stored in plain text configuration files (use with caution)
- Always review scripts before execution
- SSH keys should have proper permissions (600 for private, 644 for public)
- UFW firewall rules should be configured carefully to avoid locking yourself out
- Ensure you're running from the project root directory
- Check that scripts in
run/have execute permissions:chmod +x run/*.sh
- Run with sudo:
sudo bash app_ui.sh - Ensure you have root/sudo privileges
- Check internet connection
- Verify package manager is working:
apt-get update - Some scripts auto-fix broken repositories (e.g., Cloudflare 404 errors)
- Verify SSH agent is running:
ssh-add -l - Check SSH key permissions:
ls -la ~/.ssh/ - Test connection manually:
ssh user@host
This project is for personal use and system administration automation.
Khaizinam - DevOps Automation Toolkit
Last Updated: 2024
