A robust, modular Bash script to automate setting up a Linux development environment across multiple distributions. Features include enhanced error handling, interactive package selection, and support for custom configurations—all in a single, portable file.
- Multi-Distro Support: Works seamlessly on:
- Ubuntu/Debian (
apt-get) - Fedora/CentOS/RHEL (
dnf) - Arch/Manjaro (
pacman) - OpenSUSE (
zypper)
- Ubuntu/Debian (
- Modular Design: Organized with reusable functions (e.g.,
install_package,rollback) for easy maintenance. - Error Handling: Exits on failure (
set -e), logs to~/devsetup_*.log, and supports rollback of failed installs. - Interactive UI: Uses
dialogfor a menu-driven experience; falls back to defaults in non-TTY environments (e.g., CI/CD, SSH). - Package Management: Smart detection of installed packages and AUR helper support (
yaywith fallback toparu). - Customization: Loads user preferences from
~/.config/devsetup/config.sh(e.g.,AUR_HELPER).
The script offers flexible installation categories via an interactive menu. Default non-TTY installs include:
- Git
- Curl
- Visual Studio Code (distro-specific:
codeorvisual-studio-code-bin)
- Wget
- Htop
- Neofetch
- Vim
- Neovim
More categories (e.g., Docker, Go, Node.js) can be added by extending the script.
- Bash 4.0+
- Internet connection
sudoprivileges- Supported Linux distribution
Download and run:
curl -sSL https://raw.githubusercontent.com/vinitparekh17/linux-setup-for-developers/refs/heads/main/devsetup.sh -o devsetup.sh
chmod +x devsetup.sh
./devsetup.shTip
Review the script before running (less devsetup.sh) for security.
./devsetup.sh [-n] [-d] [-v] [-h]
-n Dry run: Simulate without changes
-d Developer mode: Enable extra tools (TBD)
-v Verbose: Detailed output
-h Help: Show usage- Detects your Linux distribution and package manager.
- Installs dialog if missing (for interactive menus).
- Prompts for category selection (or installs defaults in non-TTY mode).
- Logs progress to ~/devsetup_YYYYMMDD_HHMMSS.log.
- Rolls back on failure (if packages were installed).
Edit ~/.config/devsetup/config.sh to override defaults:
AUR_HELPER="paru" # Default: yayFound a bug or want to add a feature? Fork the repo, make changes, and submit a pull request! See the script’s inline comments for guidance.
- Log file: Check
~/devsetup_*.logfor errors. - Permission denied: Run with
sudoif needed, but avoid running as root directly. - Dialog fails: Ensure a TTY is available or use defaults in non-TTY mode.
MIT License - feel free to use, modify, and share!