VPS Reinstallation Script: A powerful one-click script for reinstalling systems

When it comes to reinstalling the VPS host system, usually we can use the system provided by the host.

However, there are some special cases where the host may not provide the desired operating system, or the host’s operating system might be too complicated, and we want to install a clean operating system ourselves.

In such cases, we need some tools to help us reinstall the VPS host system with just one click.

Today, let’s share the VPS host system reinstallation script Linux reinstall.

This script supports fully automated unattended installation and is compatible with major VPS providers.

The author claims that it avoids entering low-memory mode during installation (specific to Debian).

Even if a model with 256MB or more of memory enters low-memory mode during installation, it can still be automated.

In short, having more scripts like this gives us more options. If other scripts fail to install the system, you can try this one.

I. Linux reinstall download

Website:

https://github.com/leitbogioro/Tools

Script download:

wget --no-check-certificate -qO InstallNET.sh 'https://raw.githubusercontent.com/leitbogioro/Tools/master/Linux_reinstall/InstallNET.sh' && chmod a+x InstallNET.sh

Related instructions:

  1. Supports RAID 0, limited to Debian. To use RAID 0, please add the parameter -raid “0”. Do not add this parameter for single hard drives. Effectiveness still needs to be tested.
  2. The DD Windows method is the same as the original Mengka function. Use it as you need. If the DD package has no extension, the script will default to using the gz decompression method. It supports compressed packages with xz extension. If you want to decompress xz compressed packages, please add the parameter -filetype “xz”.
  3. Supports new RedHat-based systems, including CentOS 9 Stream, RockyLinux 8+, AlmaLinux 8+, Fedora 34+, and also supports installing from OracleLinux/VzLinux to the systems supported by the script.
  4. Debian 9+ supports XFS, which is also the default file system for RedHat-based systems, abandoning the old default ext2.
  5. If you want to specify other parameters, such as the mirror address, the version must be added after the system name, such as: -debian 11, otherwise an error will occur.
  6. By default, DHCP is used to configure the network. If you are sure it is a static address, please include the –dhcp-static parameter. However, the script will still detect it automatically and switch back to DHCP if it is DHCP.
  7. Since RedHat 7, firewalld has been used as the default firewall, and ports that are not allowed by the firewall cannot be used. Therefore, the script modifies the firewalld configuration file to support customizing the s-s-h port number for RedHat-based systems. The old version only supports port 22 and does not support customization.
  8. The script automatically determines the hardware architecture of the current running system and converts the hardware architecture name of the system to be installed. The -v parameter has been deprecated, replaced by -version. If you don’t understand, please don’t use this parameter anymore.
  9. For machines in China, there is no need to specify the installation source. The script will automatically detect and switch to domestic sources.

Notes:

  1. The script has improved the handling of grub2, allowing Debian and Redhat-based systems to be installed interchangeably without interference.
  2. The boot options handling parameters for AMD64 legacy boot, AMD64 UEFI boot, and ARM64 UEFI boot are completely different. Handling them incorrectly can cause problems. Only when they are handled properly can they support mainstream CPU architectures and motherboard firmware booting.
  3. Extensive testing has been conducted to confirm that it works fine on Oracle machines.
  4. Multiple network cards and multiple IPs require manual configuration in the new system. Automatic IPv6 configuration is only available for single network card dual-stack machines in Debian.
  5. Due to the completely different syntax between CentOS 6’s grub1 script and the grub1/grub2 of other systems, support for reinstalling CentOS 6 or converting CentOS 6 to other systems is no longer available.
  6. Redhat 8 requires 2.5GB of memory, andRed Hat 9 requires 2GB of memory.

II.Linux reinstall Usage

First, install dependencies:
For Debian-based systems (Debian / Ubuntu):

apt update -y

apt install wget -y

Redhat series(CentOS / AlmaLinux / RockyLinux / OracleLinux / Fedora / VzLinux):

yum update --allowerasing -y

yum install wget -y

Quick System Installation:

Debian 11 system

bash InstallNET.sh -debian

CentOS 9 Stream system

bash InstallNET.sh -centos

AlmaLinux 9 system

bash InstallNET.sh -almalinux

RockyLinux 9 system

bash InstallNET.sh -rockylinux

Fedora 37 system

bash InstallNET.sh -fedora

Ubuntu 20.04 system

bash InstallNET.sh –ubuntu

III.Linux Reinstallation Parameters

Here is a detailed example of using the Linux Reinstallation script:

bash InstallNET.sh -debian/ubuntu/centos/almalinux/rockylinux/fedora(os type) 11(os version) -version 64(os bit) -port "your server port" -pwd "your server password" -mirror "a valid url for linux image source" -dd/--image "dd image url" -filetype "gz or xz" -timezone "like Asia/Tokyo etc" --dhcp-static/--ip-addr 'x.x.x.x'(ip address) --ip-mask 'x.x.x.x'(subnet mask) --ip-gate 'x.x.x.x'(gateway) -firmware(Debian with hardware drivers)

If you want to install a specific operating system, modify the parameters as follows:

-debian 9/10/11 : Debian 9 and later

-centos 7/8/9-stream: CentOS 7 and later

-almalinux/alma 8/9: AlmaLinux 8 and later

-rockylinux/rocky 8/9: RockyLinux 8 and later

-fedora 34/35/36/37: Fedora 34 and later

-ubuntu 16.04/18.04/20.04: Ubuntu from 16.04 to 20.04

Specify the operating system source: -mirror “a valid DIST mirror URL”. The following official mirrors are available:

For Debian, official recommend mirror lists are here:

https://www.debian.org/mirror/list.html

For CentOS, official recommend mirror lists are here:

https://www.centos.org/download/mirrors/

For AlmaLinux, official recommend mirror lists are here:

https://mirrors.almalinux.org/

For RockyLinux, official recommend mirror lists are here:

https://mirrors.rockylinux.org/mirrormanager/mirrors

For Fedora, official recommend mirror lists are here:

https://admin.fedoraproject.org/mirrormanager/mirrors/Fedora

For Ubuntu, official recommend mirror lists are here:

https://launchpad.net/ubuntu/+cdmirrors

Specify the port:

-port “”: you can pre-specify s-s-h port of system, range is 1~65535, both Redhat series or Debian series could be supported, Default Port is’22’.

Specify the password:

-pwd “”: you can pre-specify ssh password of system, both Redhat series or Debian series could be supported, Default Password:’LeitboGi0ro’.

DD system mode:

-dd/–image “DD image from a valid url”: This parameter is for DD mode in KVM or XEN virtualization platform, current os must be Debian series, for example, if you want to DD windows,。

-filetype “gz/xz”: To determine DD file type, not only “.gz”(default) but also “.xz” can be supported.

Specify the timezone:

-timezone “like Asia/Tokyo etc”.

Support RAID 0, only for Debian:

-raid “0”: Only for raid 0 disk partition, if your machine has only one hard drive, don’t assign it!

Here is an example of installing Debian 11 (default password: LeitboGi0ro):

bash InstallNET.sh -debian 11 -mirror "http://ftp.riken.jp/Linux/debian/debian/"

IV.Installing Windows System

The script does not provide any Windows systems. You need to find pre-DD’ed Windows system images on the internet.

Usage example:

For KVM or XEN virtualization, Debian series only:

bash InstallNET.sh -dd "DD image download URL"

For physical hardware, Intel network adapter, kimsufi, etc.:

Change netboot to rescue mode, receive mail, get temporary username and password, log into Linux, execute:

wget -O- "DD download URL" | xzcat | dd of=/dev/sda

You can find free Windows DD images online at:

Windows Server 2022 Datacenter

Chinese: https://dl.lamp.sh/vhd/zh-cn_win2022.xz
English: https://dl.lamp.sh/vhd/en-us_win2022.xz
Japanese: https://dl.lamp.sh/vhd/ja-jp_win2022.xz

Windows Server 2019 Datacenter

Chinese: https://dl.lamp.sh/vhd/cn_win2019.xz
English: https://dl.lamp.sh/vhd/en_win2019.xz
Japanese: https://dl.lamp.sh/vhd/ja_win2019.xz

Windows Server 2012 R2 Datacenter

Chinese: https://dl.lamp.sh/vhd/cn_win2012r2.xz
English: https://dl.lamp.sh/vhd/en_win2012r2.xz
Japanese: https://dl.lamp.sh/vhd/ja_win2012r2.xz

V.Summary

The Linux Reinstallation script for VPS hosts has high compatibility and can be used as an option for reinstalling the VPS system.

Leave a Comment