{"id":13468047,"url":"https://github.com/bohanyang/debi","last_synced_at":"2025-05-14T12:12:55.071Z","repository":{"id":40440633,"uuid":"147204689","full_name":"bohanyang/debi","owner":"bohanyang","description":"Reinstall your VPS to minimal Debian","archived":false,"fork":false,"pushed_at":"2025-02-22T12:54:04.000Z","size":214,"stargazers_count":1468,"open_issues_count":2,"forks_count":326,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-12T03:44:45.975Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bohanyang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-03T12:52:24.000Z","updated_at":"2025-04-10T09:07:28.000Z","dependencies_parsed_at":"2023-10-20T18:30:40.551Z","dependency_job_id":"2a7dbf26-2249-466c-ab71-4d948746a54a","html_url":"https://github.com/bohanyang/debi","commit_stats":{"total_commits":305,"total_committers":7,"mean_commits":43.57142857142857,"dds":0.03934426229508192,"last_synced_commit":"8e779c7999c0065339c9efad86078d8a0c05fb06"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bohanyang%2Fdebi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bohanyang%2Fdebi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bohanyang%2Fdebi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bohanyang%2Fdebi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bohanyang","download_url":"https://codeload.github.com/bohanyang/debi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254140769,"owners_count":22021220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest"],"created_at":"2024-07-31T15:01:04.712Z","updated_at":"2025-05-14T12:12:50.061Z","avatar_url":"https://github.com/bohanyang.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# Debian Network Reinstall Script\n\n[中文说明 ↓](#中文说明)\n\n## Introduction\n\nThis script is written to reinstall VPS/VMs to minimal Debian.\n\n## Platforms\n\n- ✔ KVM or physical machines ❌ Containers\n- ✔ Debian or Ubuntu or Red Hat Linux as original OS with GRUB 2 bootloader\n- ✔ MBR or GPT partition table\n- ✔ Multiple disks or LVM\n- ✔ IPv4 or IPv6\n- ✔ Legacy BIOS or UEFI boot\n- ✔ Most VPS or cloud providers\n- ⚠️ Google Compute Engine - **MUST** manually specify IP/CIDR and gateway of VPC\n- ⚠️ AWS EC2 or Lightsail - Does **NOT** work with UEFI boot\n\n## How It Works\n\n1. Generate a preseed file to automate installation\n2. Download the 'Debian-Installer' to the `/boot` directory\n3. Append a menu entry of the installer to the GRUB2 configuration file\n\n## Usage\n\n### 1. Download\n\nDownload the script with curl:\n\n    curl -fLO https://raw.githubusercontent.com/bohanyang/debi/master/debi.sh\n\nor wget:\n\n    wget -O debi.sh https://raw.githubusercontent.com/bohanyang/debi/master/debi.sh\n\n### 2. Run\n\nRun the script under root or using sudo:\n\n    chmod a+rx debi.sh\n    sudo ./debi.sh\n\nBy default, an admin user `debian` with sudo privilege will be created during the installation. Use `--user root` if you prefer.\n\n### 3. Reboot\n\nIf everything looks good, reboot the machine:\n\n    sudo shutdown -r now\n\nOtherwise, you can run this command to revert all changes made by the script:\n\n    sudo rm -rf debi.sh /etc/default/grub.d/zz-debi.cfg /boot/debian-* \u0026\u0026 { sudo update-grub || sudo grub2-mkconfig -o /boot/grub2/grub.cfg; }\n\n## Available Options\n\n### Presets\n\n| Region | Alias          | Mirror                               | DNS        | NTP                 |\n|--------|----------------|--------------------------------------|------------|---------------------|\n| Global | Default        | https://deb.debian.org               | Google     | time.google.com     |\n| Global | `--cloudflare` | https://deb.debian.org               | Cloudflare | time.cloudflare.com |\n| Global | `--aws`        | https://cdn-aws.deb.debian.org       | Google     | time.aws.com        |\n| China  | `--ustc`       | https://mirrors.ustc.edu.cn          | DNSPod     | time.amazonaws.cn   |\n| China  | `--tuna`       | https://mirrors.tuna.tsinghua.edu.cn | DNSPod     | time.amazonaws.cn   |\n| China  | `--aliyun`     | https://mirrors.aliyun.com           | AliDNS     | time.amazonaws.cn   |\n\n * `--interface \u003cstring\u003e` Manually select a network interface, e.g. eth1\n * `--ethx` Disable *Consistent Network Device Naming* to get interface names like *ethX* back\n * `--ip \u003cstring\u003e` Disable the auto network config (DHCP) and configure a static IP address, e.g. `10.0.0.2`, `1.2.3.4/24`, `2001:2345:6789:abcd::ef/48`\n * `--static-ipv4` Disable the auto network config (DHCP) and configure with the current IPv4 address and gateway detected automatically\n * `--netmask \u003cstring\u003e` e.g. `255.255.255.0`, `ffff:ffff:ffff:ffff::`\n * `--gateway \u003cstring\u003e` e.g. `10.0.0.1`, `none` if no gateway\n * `--dns '8.8.8.8 8.8.4.4'`\n * `--dns6 '2001:4860:4860::8888 2001:4860:4860::8844'` (effective only if IPv6 is specified)\n * `--hostname \u003cstring\u003e` FQDN hostname (includes the domain name), e.g. `server1.example.com`\n * `--network-console` Enable the network console of the installer. `ssh installer@ip` to connect\n * `--version 12` Supports: `10`, `11`, `12`, `13`\n * `--suite bullseye` **Please use `--version` instead if you don't have special needs.** e.g. `stable`, `testing`, `sid`\n * `--release-d-i` d-i (Debian Installer) for the released versions: 12 (bookworm), 11 (bullseye) and 10 (buster)\n * `--daily-d-i` Use latest daily build of d-i (Debian Installer) for the unreleased version: 13 (trixie), sid (unstable)\n * `--mirror-protocol http` or `https` or `ftp`\n * `--https` alias to `--mirror-protocol https`\n * `--reuse-proxy` Reuse the value of `http(s)_proxy` environment variable as the mirror proxy\n * `--proxy, --mirror-proxy` Set an HTTP proxy for APT and downloads\n * `--mirror-host deb.debian.org`\n * `--mirror-directory /debian`\n * `--security-repository http://security.debian.org/debian-security` Magic value: `'mirror' = \u003cmirror-protocol\u003e://\u003cmirror-host\u003e/\u003cmirror-directory\u003e/../debian-security`\n * `--no-account-setup, --no-user` **(Manual installation)** Proceed account setup manually in VNC or remote console.\n * `--username, --user debian` New user with `sudo` privilege or `root`\n * `--password \u003cstring\u003e` Password of the new user. **You'll be prompted if you choose to not specify it here**\n * `--authorized-keys-url \u003cstring\u003e` URL to your authorized keys for SSH authentication. e.g. `https://github.com/torvalds.keys`\n * `--sudo-with-password` Require password when the user invokes `sudo` command\n * `--timezone UTC` e.g. `Asia/Shanghai` for China (UTC+8) https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List\n * `--ntp time.google.com`\n * `--no-disk-partitioning, --no-part` **(Manual installation)** Proceed disk partitioning manually in VNC or remote console\n * `--disk \u003cstring\u003e` Manually select a disk for installation. **Please remember to specify this when more than one disk is available!** e.g. `/dev/sda`\n * `--no-force-gpt` By default, GPT rather than MBR partition table will be created. This option disables it.\n * `--bios` Don't create *EFI system partition*. If GPT is being used, create a *BIOS boot partition* (`bios_grub` partition). Default if `/sys/firmware/efi` is absent. [See](https://askubuntu.com/a/501360)\n * `--efi` Create an *EFI system partition*. Default if `/sys/firmware/efi` exists\n * `--esp 106` Size of the *EFI system partition*. e.g. `106`, `538` and `1075` result to 100 MiB, 512 MiB, 1 GiB respectively\n * `--filesystem ext4`\n * `--kernel \u003cstring\u003e` Choose an package for the kernel image\n * `--cloud-kernel` Choose `linux-image-cloud-amd64` or `...arm64` as the kernel image\n * `--bpo-kernel` Choose the kernel image from Debian Backports (newer version from the next Debian release)\n * `--no-install-recommends`\n * `--apt-non-free-firmware`, `--apt-non-free`, `--apt-contrib`, `--apt-src`, `--apt-backports`\n * `--no-apt-non-free-firmware`, `--no-apt-non-free`, `--no-apt-contrib`, `--no-apt-src`, `--no-apt-backports`\n * `--install 'ca-certificates libpam-systemd'` Install additional APT packages. Space-separated and quoted.\n * `--safe-upgrade` **(Default)** `apt upgrade --with-new-pkgs`. [See](https://salsa.debian.org/installer-team/pkgsel/-/blob/master/debian/postinst)\n * `--full-upgrade` `apt dist-upgrade`\n * `--no-upgrade`\n * `--bbr` Enable TCP BBR congestion control\n * `--ssh-port \u003cinteger\u003e` SSH port\n * `--hold` Don't reboot or power off after installation\n * `--power-off` Power off after installation rather than reboot\n * `--architecture \u003cstring\u003e` e.g. `amd64`, `i386`, `arm64`, `armhf`, etc.\n * `--firmware` Load additional [non-free firmwares](https://wiki.debian.org/Firmware#Firmware_during_the_installation)\n * `--no-force-efi-extra-removable` [See](https://wiki.debian.org/UEFI#Force_grub-efi_installation_to_the_removable_media_path)\n * `--grub-timeout 5` How many seconds the GRUB menu shows before entering the installer\n * `--force-lowmem \u003cinteger\u003e` Valid values: 0, 1, 2. Force [low memory level](https://salsa.debian.org/installer-team/lowmem). Useful if your machine has memory less than 500M where level 2 is set (see issue #45). `--force-lowmem 1` may solve it. \n * `--dry-run` Print generated preseed and GRUB entry without downloading the installer and actually saving them\n * `--cidata ./cidata-example` Custom data for cloud-init. **VM provider's data source will be IGNORED.** See example.\n\n## 中文说明\n\n下载脚本：\n\n```\ncurl -fLO https://raw.githubusercontent.com/bohanyang/debi/master/debi.sh \u0026\u0026 chmod a+rx debi.sh\n```\n\n运行脚本：\n\n```\nsudo ./debi.sh --cdn --network-console --ethx --bbr --user root --password \u003c新系统用户密码\u003e\n```\n\n* `--bbr` 开启 BBR\n* `--ethx` 网卡名称使用传统形式，如 `eth0` 而不是 `ens3`\n* `--cloud-kernel` 安装占用空间较小的 `cloud` 内核，但可能会导致 UEFI 启动的机器（如 Oracle、Azure 及 Hyper-V、Google Cloud 等）VNC 黑屏。BIOS 启动的普通 VPS 则没有此问题。\n* 默认时区为 UTC，添加 `--timezone Asia/Shanghai` 可使用中国时区。\n* 默认使用 Debian 官方 CDN 镜像源（deb.debian.org），添加 `--ustc` 可使用中科大镜像源。\n\n如果没有报错可以重启：\n\n```\nsudo shutdown -r now\n```\n\n约 30 秒后可以尝试 SSH 登录 `installer` 用户，密码与之前设置的相同。如果成功连接，可以按 Ctrl-A 然后再按 4 监控安装日志。安装完成后会自动重启进入新系统。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbohanyang%2Fdebi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbohanyang%2Fdebi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbohanyang%2Fdebi/lists"}