Code Monkey home page Code Monkey logo

tools's Introduction

Tools

Something about scripts

Linux reinstall useage

If you are not a root user, try to execute the following commands to switch to get root user permission:

sudo -s

Switch to the default direction of the root user

cd ~

And then continue to download and execute this script.

Dependences and OSs are supporting at the following list to install to the OS that script supported:

Debian series(Debian / Ubuntu / Kali):

apt update -y
apt install wget -y

RedHat series, only based on RedHat 7+, grub2(CentOS / AlmaLinux / CloudLinux / RockyLinux / OracleLinux / Fedora / VzLinux / ScientificOS / RedHat Enterprise Linux / Tencent OpenCloudOS / AWS AmazonLinux / AlibabaCloudLinux or AliyunLinux / OpenAnolis):

yum install wget -y

or (for Redhat 8+):

dnf install wget -y

Alpine Linux:

apk update
apk add bash wget
sed -i 's/root:\/bin\/ash/root:\/bin\/bash/g' /etc/passwd

Download:

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

Servers in mainland of China:

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

Quickly start

If you need to add other parameters, a certain name of distributions must be assigned!

Debian 12

bash InstallNET.sh -debian

Kali Rolling

bash InstallNET.sh -kali

Alpine Linux Edge

bash InstallNET.sh -alpine

Alpine Linux is a kind of light Linux release and it's friendly to those machines that have lower performance, system memory at least 256MB is necessary.

CentOS 9 stream

bash InstallNET.sh -centos

AlmaLinux 9

bash InstallNET.sh -almalinux

RockyLinux 9

bash InstallNET.sh -rockylinux

Fedora 39

bash InstallNET.sh -fedora

Ubuntu 22.04

bash InstallNET.sh -ubuntu

Windows 11 Pro for Workstations

bash InstallNET.sh -windows

Default configurations of SSH or RDP service

Recommended desktop terminal client is Xshell or Putty.

Default user name

For Linux: root

For Windows: Administrator

Default password

For Linux: LeitboGi0ro

For Windows: Teddysun.com

Default port

For Linux: The same as the former system which you were connected by terminal.

If you didn't assign any other ssh password or port, after system installation, you must change the default password immediately or switch to ssh key login to prevent unauthorized access!

For Windows: 3389

Parameters detail descriptions

-debian 7-12 : Debian 7 and later

-kali rolling/dev/experimental : Kali Rolling, Development and Experimental, "Kali Rolling" is most recommend obviously.

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

-alpine 3.16-3.18/edge: Alpine Linux 3.16 and later, to keep updating to newest version, "edge" is most recommend obviously.

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

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

-fedora 38/39: Fedora 38 and later

-ubuntu 20.04/22.04/24.04(testing, not stable, do not install it in the production environment!): Ubuntu from 20.04 and later

-windows 10/11/2012/2016/2019/2022:

Optional list of distributions:

  • Windows 10 Enterprise LTSC 22H2 for simplified Chinese and Japanese, 23H2 for English
  • Windows 11 Pro for Workstation 22H2 for simplified Chinese and Japanese, 23H2 for English
  • Windows Server 2012 R2
  • Windows Server 2016
  • Windows Server 2019
  • Windows Server 2022

Note: Windows 10 and 11 23H2 for English preferred to use base images of tiny10 and tiny11 which were developed and optimized by ntdev .

Installing Windows by using "bash InstallNET.sh -windows distribution number" supports IPv4/IPv6 dhcp or static, expanding current OS disk partition from default 15GB dd image to the actual capacity of the drive. Automatic setting steps of above must be executed after Administrator user login. For example, you can login to the newly installed system via VNC first if the router of upstream network supports only static configure method so that accessing server via RDP is unable yet.

All Windows dd images were re-packaged with incepted drivers which are necessary for cloud virtualizations and provided by Teddy Sun and hosting on https://dl.lamp.sh/vhd/ . Thanks and appreciates for his contributions, here are the github and blog pages of him:
https://github.com/teddysun/
https://teddysun.net/
https://teddysun.com/


-lang/-language "cn, en or jp": This option is to set language of dd images of Windows like: -windows 10 -lang "en", cn is simplified Chinese, en is English, jp is Japanese, default is en. It's not valid for Linux distributions.

-port "": you can pre-specify ssh port of system, range is 1~65535, this option is not valid for installing Windows, default is depended on the original system, if getting this value is failed, the value will fall back to '22'.

-pwd/-password '': you can pre-specify ssh password for target installing system. Native installation methods for Redhat series, Debian/Kali could be supported, not suitable for AlpineLinux and those OS which will be installed by "Overwriting Packaged Image Mode"(dd) method like Ubuntu, Windows and Redhat installations(only in environments of low memory capacity). A couple of apostrophe includes between the whole password is recommend, if there is one and more apostrophes in the password, you should use " '\ " to replace the original apostrophe to prevent it's could not be expressed and handled correctly in the shell! default is 'LeitboGi0ro'.

-hostname "": you can pre-specify hostname for the newly installing Linux system, the value with empty or includes special symbols except hyphens is not recommend. If the hostname of your original system is "localhost", empty or you want to assign it randomly(-hostname "random"), the expect format of the value is "instance-year, month, day of the server time-hour, minute of the server time. default is depended on the original system.

-dd/--image "DD image from a valid url": This parameter is for dd mode in KVM or XEN virtualization platform. This option is applicable for "Overwriting Packaged Image Mode".

For installing Ubuntu in any memory capacties, installing RockyLinux 8+ and AlmaLinux 9+ in low memory mode, installing Windows by using "bash InstallNET.sh -ubuntu/rocky/alma/windows", the middle handler is AlpineLinux, dd installation method of RockyLinux 8+, AlmaLinux 9+ and Windows may take a long time even up to 40 minutes or more if hard drive I/O of system is too low, wait patiently until installation finished.

Steps of DD any system that you want to:

The middle handling Linux system is Debian 12 with the following steps without any OS assignment:

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

Servers based on physical hardware, Intel network adapter, kimsufi etc. : Change netboot to rescue mode, receive temporary username and password from mailbox, login rescue linux, execute:

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

Wait until downloading and unpackaging are all finished, change netboot to formal mode, exit from rescue Linux to the newly installed system:

reboot

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

-timezone "like Asia/Tokyo etc": It means assign timezone manually, if the format of the input parameter is incorrect or it's not supported by current operating system, the value will fall back to "Asia/Tokyo". If the parameter is not assigned, the value depends on the geo-location of guest's IP address, if you are using a proxy to connect to the server with ssh service, automatic timezone configuration may not suitable for you in this situation. This option is not valid for Windows.

-raid "0, 1, 5, 6 or 10": Test succeed on Debian 12, Kali rolling, CentOS 9-stream, AlmaLinux 9, RockyLinux 9, Fedora 38 with native installation method, raid 0, 1, 5, 6 or 10 disks raid partition recipes, not suitable for dd installation, raid 0 or 1 needs at least 2 disks, raid 5 needs at least 3 disks, raid 6 or 10 needs at least 4 disks, if your machine has only one hard drive or capacity of all drives are not the same or in a virtual environment, don't assign it!

-setdisk "a name of one disk or all": If your machine has 2 or more hard drives, and every hard drive want to format during the installation, you can assign -setdisk "all" to enable it, data is invaluable, you should deal with them carefully! or you can allow system to be installed on one disk like "vdc" or "/dev/sdb", This parameter is only suitable for Debian/Redhat series and conflicts with "-raid".

-swap/-virtualmemory/-virtualram "number, the unit is MB": Default is "0" which means no swap is allowanced, you can pre-specify a certain capacity of space on hard drive to enable swap for target system, for example " -swap '1024' " to distribute 1GB swap, not suitable for Raid, AlpineLinux, dd Mode.

-filesystem "ext4 or xfs": Default is "ext4", you can pre-specify a kind of file system for target system, only suitable for Debian/Kali.

-partition "mbr" or "gpt": Default is "mbr", you can assign "gpt" to format hard drive with GUID Partition Table, if the capacity of current hard drive is above 2TB, "gpt" partition recipe will be activated automatically, This is only valid for Debian/Kali, single hard drive formatting environment, not suitable for Raid.

--nomemcheck: Disable memory check by force so that you can install any OS on any size of the memory in target machine, whether installation will succeed is not guaranteed, this option is only for trouble shotting.

--cloudkernel: Replace formal Linux kernel to cloud kernel because numerous hardware drivers like printers, scanners, sound cards, usb controllers etc. which are not necessary in environment of virtual machines of Cloud Computing Platforms and these will be eliminated in the latter aims to help reducing space occupation of memory and hard drive. In situation of raid or dd(Windows) mode, installing cloud kernel will be disabled. --cloudkernel "0" is to disable installing Linux cloud kernel by force, --cloudkernel "1" is to enable installing cloud kernel by force. This option is only valid for installing to Debian 11+/Kali/AlpineLinux. Cloud kernel executing on some hardwares like Oracle Cloud arm64 servers will cause guest display in VNC be disabled, to avoid this, you may assign --cloudkernel "0" to switch to installing traditional Linux kernel by force. For virtualization of VMware and VirtualBox, installing cloud kernel will cause booting failed.

--motd: Enable to insert a set of modified MOTD(message of the day) scripts for a convenience to check executing status of a server when connecting by ssh shell, default is disabled, only available for Debian/Kali/AlpineLinux.

--bbr: Enable BBR(Bottleneck Bandwidth and Round-trip propagation time) for current kernel by adding parameters and values to "/etc/sysctl.d/99-sysctl.conf" including:

net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
net.ipv4.tcp_rmem = 8192 262144 536870912
net.ipv4.tcp_wmem = 4096 16384 536870912
net.ipv4.tcp_adv_win_scale = -2
net.ipv4.tcp_collapse_max_bytes = 6291456
net.ipv4.tcp_notsent_lowat = 131072
net.ipv4.ip_local_port_range = 1024 65535
net.core.rmem_max = 536870912
net.core.wmem_max = 536870912
net.core.somaxconn = 32768
net.core.netdev_max_backlog = 32768
net.ipv4.tcp_max_tw_buckets = 65536
net.ipv4.tcp_abort_on_overflow = 1
net.ipv4.tcp_slow_start_after_idle = 0
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_syncookies = 0
net.ipv4.tcp_syn_retries = 3
net.ipv4.tcp_synack_retries = 3
net.ipv4.tcp_max_syn_backlog = 32768
net.ipv4.tcp_fin_timeout = 15
net.ipv4.tcp_keepalive_intvl = 3
net.ipv4.tcp_keepalive_probes = 5
net.ipv4.tcp_keepalive_time = 600
net.ipv4.tcp_retries1 = 3
net.ipv4.tcp_retries2 = 5
net.ipv4.tcp_no_metrics_save = 1
net.ipv4.ip_forward = 1
fs.file-max = 104857600
fs.inotify.max_user_instances = 8192
fs.nr_open = 1048576

to optimize the network environments of high latency and low bandwidth, only valid for Debian 11 and later.
Note: Module "tcp_collapse_max_bytes" is a self completion of Cloudflare, you need to download and apply patches by yourself otherwise this module will not be in effect: https://github.com/cloudflare/linux/tree/master/patches

Little tutorial: Installing XanMod on Debian

Introduce: XanMod series is an excellent third part mod for Linux kernel to improve network connectivity including applicating the patches of Cloudflare which we known on above, enhanced hardware compatibility etc. only for amd64 architecture CPUs .

Install gpg utility:

apt install gpg -y

Download, import and transform gpg key to binary file:

wget -qO - https://dl.xanmod.org/archive.key | sudo gpg --dearmor -o /usr/share/keyrings/xanmod-archive-keyring.gpg

Apply additional repository of "dl.xanmod.org" for apt:

echo 'deb [signed-by=/usr/share/keyrings/xanmod-archive-keyring.gpg] http://deb.xanmod.org releases main' | sudo tee /etc/apt/sources.list.d/xanmod-release.list

Refresh package dependencies:

apt update

Install xanmod Linux kernel, the differences from "v1" "v2" "v3" "v4" is the different optimizations for ISA (Instruction Set Architecture) of CPUs from each periods, you can visit https://xanmod.org/, title "x86-64 psABI level reference" to inquire or execute this script to confirm it: https://dl.xanmod.org/check_x86-64_psabi.sh .

apt install linux-xanmod-lts-x64v3 -y

Reboot the system:

reboot

To confirm the new kernel that we installed:

uname -a


--setdns: Only for Debian/Kali to change name server for Debian permanently is provided by "resolvconf", related configuration files has been written. you just need to logging in new installed system, and install "resolvconf":

echo "O" | apt install resolvconf -y
restart

to make changes validating!

--network "dhcp/auto" or "static/manual": Default to use DHCP to finish network configuration. If your cloud provider is a small or middle merchant, the network of your machine may be static so you need to add it. it is equal with add --ip-addr "" --ip-mask "" --ip-gate "", if you add this, don't distribute the following three items again! It must be added in the last of the command.

--networkstack "ipv4", "ipv6" or "dual": To specify one supported IP stack manually by reading related configurations instead of checking connectivity of IP stacks, "ipv4" is for IPv4 stack, "ipv6" is for IPv6 stack, "dual" is for IPv4 and IPv6 bi-stack. To make sure the parameter of corresponded stack must has specify configurations in system before assign it.

--ip-addr "IPv4 address": It must be added with --ip-gate and --ip-mask together, in this situation, --network "static/manual" is automatically assigned.

--ip-gate "IPv4 gateway": It must be added with --ip-addr and --ip-mask together, in this situation, --network "static/manual" is automatically assigned.

--ip-mask "IPv4 subnet musk": It must be added with --ip-addr and --ip-gate together, in this situation, --network "static/manual" is automatically assigned, can only accept prefix number transmit. IPv4 CIDR Calculator: https://www.vultr.com/resources/subnet-calculator/

--ip-dns "IPv4 DNS server": This one is only for static network configuration and default is 1.0.0.1 and 8.8.4.4, you can also change other IPv4 dns server like 8.8.8.8, 9.9.9.9, 4.4.2.2 etc to replace it. If the network of your machine is DHCP, don't assign it!

--ip6-addr "IPv6 address": It must be added with --ip6-gate and --ip6-mask together, in this situation, --network "static/manual" is automatically assigned.

--ip6-gate "IPv6 gateway": It must be added with --ip6-addr and --ip6-mask together, in this situation, --network "static/manual" is automatically assigned.

--ip6-mask "IPv6 subnet musk": It must be added with --ip6-addr and --ip6-gate together, in this situation, --network "static/manual" is automatically assigned, can only accept prefix number transmit. IPv6 CIDR Calculator: https://en.rakko.tools/tools/27/

--ip6-dns "IPv6 DNS server": This one is only for static network configuration and default is 2606:4700:4700::1001 and 2001:4860:4860::8844, you can also change other IPv6 dns server to replace it. If the network of your machine is DHCP, don't assign it!

--setipv6 "0 is disabled": Default will enable IPv6, if your machine is IPv4 stack and provided by Racknerd and Virmach etc. they will give IPv6 DNS for IPv4 stack server, the server will access to invalid IPv6 network for priority, not IPv4 first, you can remove all IPv6 modules force in new os by adding --setipv6 "0" to avoid the situation of above. This option is not valid for Windows.

--adapter "real network adapter interface name of the machine, like ens3, enp6s0 etc.": If the kernel is added parameter "net.ifnames=0" or "biosdevname=0", all different network adapters' name will be directed to the same like "eth0", "eth1" etc. If you know the the real name of the network adapter and want let them to replace "eth0", please input the correct value, if you are not sure the real name of it, don't assign it!

--netdevice-unite: This function has an opposite effect of --adapter "real interface name", it will add "net.ifnames=0 biosdevname=0" to the kernel to redirect all different network adapters' interface name to united "eth0", this one don't need to assign any value, I suggest you that before input it and start OS installation, you should backup the real name of the network adapter carefully!

--autoplugadapter: Only valid for Debian/Kali, the connection method of network adapter will be replaced from "allow-hotplug" to "auto" in /etc/network/interfaces. --autoplugadapter "0" is disabled by force, --autoplugadapter "1" is enabled, it's enabled by default. When add this, for multiple interfaces environment, if the interface which is configurated by "auto", regardless of it is plugged by internet cable, Debian/Kali will continuously try to wake and start up it contains with dhcp even timeout. Set up with "allow-hotplug(default setting by Debian/Kali installer)" will skip this problem, but if one interface has more than 1 IP or it will connect to another network bridge, when system restarted, the interfaces' initialization will be failed, in most of VPS environments, the interfaces of machine should be stable, so replace the default from "allow-hotplug" to "auto" for interfaces config method is a better idea, but it causes some server spending a long time to boot up(try to activate all internet adapters and waiting dhcp fatal time). Because the default configure method "allow-hotplug" will cause network adapter disconnected to the host permanently unless rebooting the system when executing "systemctl restart networking" so in order to avoid this situation, all configure method of valid network adapters will use "auto" instead of "allow-hotplug".

--fail2ban: Install and configure fail2ban to prevent from suspicious ssh port blastings. To reduce occupation of the memory, those servers which memory are less than 2GB will disabled automatically. --fail2ban "0" is disabled by force, --fail2ban "1" is enabled by force. This option is not valid for Windows.

-netbootxyz: Using netbootXYZ to install the OS that it's supported manually, VNC access for manipulation is necessary, make sure the memory capacity of the server is enough to accommodate the whole iso image for installing the target system. Only for AMD64/x86_64 architecture with BIOS firmware. ARM64/aarch64 architecture, UEFI firmware with any architecture could not be supported!

--allbymyself: Install OS supported by this script manually, must have VNC, this option is not valid for Redhat series.

-mirror "a valid DIST mirror url": OS install files resource, you can select one which nearest for actual location of your server to upspeed installation.

For Debian, official recommend mirror lists are here:

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

For Kali, official recommend mirror lists are here:

https://http.kali.org/README.mirrorlist

For Alpine Linux, official recommend mirror lists are here:

https://mirrors.alpinelinux.org/

For CentOS 7 and 8-stream, official recommend mirror lists are here:

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

For CentOS 9-stream and later, official recommend mirror lists are here:

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

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

-firmware: Specify drivers for Debian and Kali to support old hardwares, if your server location is in mainland China, program will switch to mirror of 'University of Science and Technology of China(https://mirrors.ustc.edu.cn/debian-cdimage/)' for downloading more quickly, default mirror is from http://cdimage.debian.org/cdimage/.

-architecture "32/i386 or 64/amd64 or arm/arm64": OS bit. Program will automatically detect and redirect the CPU architecture from your machine to new system which would be installed, if you aren't known it well, don't assign it!

Advanced usage, for example Debian 12 (recommend for servers which are locating outside of mainland China)

Japan:

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

HongKong:

bash InstallNET.sh -debian 12 -mirror "http://ftp.hk.debian.org/debian/"

Singapore:

bash InstallNET.sh -debian 12 -mirror "http://ftp.sg.debian.org/debian/"

South Korea:

bash InstallNET.sh -debian 12 -mirror "http://ftp.kaist.ac.kr/debian/"

Taiwan:

bash InstallNET.sh -debian 12 -mirror "http://ftp.tw.debian.org/debian/"

America:

bash InstallNET.sh -debian 12 -mirror "https://mirrors.ocf.berkeley.edu/debian/"

Canada:

bash InstallNET.sh -debian 12 -mirror "http://ftp.ca.debian.org/debian/"

Britain:

bash InstallNET.sh -debian 12 -mirror "http://ftp.uk.debian.org/debian/"

Germany:

bash InstallNET.sh -debian 12 -mirror "http://ftp.de.debian.org/debian/"

France:

bash InstallNET.sh -debian 12 -mirror "http://ftp.fr.debian.org/debian/"

Netherlands:

bash InstallNET.sh -debian 12 -mirror "http://ftp.nl.debian.org/debian/"

Switzerland:

bash InstallNET.sh -debian 12 -mirror "http://ftp.ch.debian.org/debian/"

Russia:

bash InstallNET.sh -debian 12 -mirror "http://ftp.ru.debian.org/debian/"

Australia:

bash InstallNET.sh -debian 12 -mirror "http://ftp.au.debian.org/debian/"

Errors and solutions:

In some versions of CentOS 8 which are not subsumed into CentOS-stream are end of supporting by CentOS official, so the source is failure:

Failed to synchronize cache for repo 'baseos', ignoring this repo.
Failed to synchronize cache for repo 'appstream', ignoring this repo.

You first need to fix the source available and then execute this script.

cd /etc/yum.repos.d/
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

If script notices any error like in "# Check Dependence", please execute it again!

If you have enabled and assigned IPv6 address after server had been created in the website panel of some cloud providers like Oracle etc. but IPv6 is still invalid in the original system, you can try "dhclient" command to enable IPv6, the same as IPv4:

dhclient -6 "network adapter name"
dhclient -4 "network adapter name"

Fully useage sample

bash InstallNET.sh -debian/kali/ubuntu/centos/almalinux/rockylinux/fedora(os type) 11(os version) -architecture 64(os bit, not necessary) -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" --network "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)

The Unlicense and Legal notice:

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to http://unlicense.org/

Microsoft products and services—including images, text, and software downloads (the "content")—are owned either by Microsoft Corporation or by third parties who have granted Microsoft permission to use the content. Microsoft cannot grant you permission for content that is owned by third parties. You may only copy, modify, distribute, display, license, or sell the content if you are granted explicit permission within the End-User License Agreement (EULA) or license terms that accompany the content or are provided in the following guidelines. For more information, consult your copyright attorney.

"InstallNET.sh" doesn't provide any third-part activation service for Windows, this function is only aim to assist you with researching, evaluating related features of Windows. "InstallNET.sh" only supports your server to install from Linux to Windows but it can't work well in Windows so that you have no more chance to use "InstallNET.sh" to install from Windows to Linux again.

"InstallNET.sh" is not responsible or liable if someone cause any illegal circumstance. You should assume any consequences by your own after executing this program includes: causing data corruptions without any backups, causing irredeemable operation failure of the server.

Features and updates:

  • "InstallNET.sh" will give you a clean, safe, official Linux system, and help you escape of your server providers' monitoring.
  • The operation is easy, several minutes installation will be complated.
  • Support install to Debian series, Redhat series.
  • Can also run in mainline version of other Redhat series(Oracle Linux 7+, VzLinux 8+) to install supported system.
  • Support major cloud providers, especially support Oracle Cloud ARM machine.
  • Detect the CPU architecture of current os and exchange correct architecture to new system automatically, you need not to add parameter '-version' at all to comfirm architecture manually.
  • Can handle boot menuentry items automatically of grub2 in different hardware platforms(AMD64 legacy / AMD64 UEFI / ARM64 UEFI) to make sure all supported boot file can be loaded correctly.
  • Support install from Linux(Debian series only) to Windows. details refer to "How to install Windows?" section.
  • Support IPv6 single-stack(have only IPv6 public address and IPv4 intranet routing) server like Vultr 2.5$ monthly plan, only for DHCP.
  • Support network auto configurations in bio-stack(have both IPv4 and IPv6 public address), after log into new system, you don't have to config IPv6 address manually, only for Debian, DHCP.
  • You can modify architecture, mirror, firmware, ssh port, password etc.
  • Friendly to low memory device, for Debian series, recommend RAM is above 512MB, for Redhat series, recommend RAM is above 2GB.
  • Ubuntu 22.04 has cancelled net boot start features, so this program don't support Ubuntu 22.04 and above reinstallation, source: http://archive.ubuntu.com/ubuntu/dists/jammy/main/installer-amd64/current/legacy-images/: The Legacy Ubuntu Server Installer is no longer available, initrd.gz and linux netboot file for arm64 architecture as also.
  • The Debian official mirror of South Korea http://ftp.kr.debian.org/debian/ is usually crashed down, so I changed recommend mirror as Jaist University https://www.jaist.ac.jp/index.html, for Japan is from https://www.riken.jp/, a science research organization, for America is from University of California, Berkeley: https://www.berkeley.edu/.
  • Completely modified Debian, such as support terminal files colorful displaying, permanently change dns server, disable expired certificates, add on a cute welcome introduction, pre-install many complements in preseeding progress, now enjoy a newly, comfortable, graceful debian experience!
  • Support grub2 boot file modify, it can switch Debian series to Redhat series or switch Redhat series to Debian series smoothly, in old version if you installed from Debian series to Redhat series, you can never switch to Debian series again.
  • Support xfs file system(only for Debian 9 and later), it's better than the old ext2 and it's the default option of Redhat series, the file system of raid 0 disk partition mode is ext4.
  • Detect if the machine is operating in mainland of China or outside and switch mirror automatically.
  • Support the parameter of '-port' to modify ssh port of Redhat series.
  • Detect the network of device is DHCP or static automatically.
  • For windows DD package, default compression method is "gz", if your package is ".xz", you can add parameter -filetype "xz" to decompress it.
  • Support Raid 0, to add parameter -raid "0", the validation need to be certificated.
  • Disable ntp clock setup for static network in Debian/Ubuntu installation otherwise it may cause static network failed.
  • Fix if input --ip-addr "" --ip-mask "" --ip-gate "", static network configuration may not valid.
  • Support config timezone automatically according to the geo-location of the guest's IP or determine an existed timezone parameter to config it manually is also be supported.
  • Concentrate all needed installation of dependences to inner command except "wget" because you need to download "InstallNET.sh" first.
  • Support Debian 12.
  • Update pre-install components, python2 to python3, vim-gtk2 to vim-gtk3 for support Debian 12.
  • Creat a new algorithm for checking effectiveness about IPv6, it's applied in 10-sysinfo for motd file in Debian and the main program "InstallNET.sh".
  • Because of boot menuentry configuration in grub file "grub.cfg" from RockyLinux 9 of official template of Oracle Cloud is different from other standard Redhat like os(version 7+) compeletely, so I creat a new algorithm for handle this and all of similar situation in future.
  • Update vim file modification for Debian 12.
  • Because of github.com and githubusercontent.com etc are banned by China, so I switich external files download sources which are necessary for Debian or Redhat like os example files for motd, firewall configurations etc. If your server is in mainland of China, the external files will be downloaded from https://gitee.com/mb9e8j2/Tools/, the other country/area will also be downloaded in this depository.
  • Try to enable IPv4 and IPv6 dhcp if possible.
  • Add necessary annotates
  • Set default installation os as Debian 12 and the value of architecture is empty instead of AMD64 because program will check architecture automatically.

Defects:

  • Not support for Ubuntu 20.04 and further versions for native installation method and replaced by dd cloud images because Canonical has deprecated the traditions which were also applied together with Debian by forcing users to download a huge several gigabytes iso image and then load it in its' fuckin Cloud-init instead of just two simply a hundred megabytes total network boot files by PXE boot, it runs in QEMU environment and CPU hardware virtualization must be demanded but most of VPS can't handle it well at all. Canonical has developed into a mature commercial company which intends to earn more money from major partners so they discrimes their personal users intentionally who are low-end clients in their conceptions certainly despite these users were their devoted fans since always and helped Canonical to make great achieves today step by step. According to the behavior of discarding a large amount of former precious Debian installer preseed heritances, Canonical would play a role as a guilty dictator like Apple.Inc in more areas and then violate the spirit of the universal free software finally.
  • For Redhat series 8, the minimum memory requirement is 2.5GB, for Redhat series 9, the minimum memory requirement is 2GB.
  • Because the syntax of grub1 in Redhat series 6 is different from other Linux version of grub1 or grub2 completely, so I removed support to CentOS 6 and Oracle Linux 6.
  • All system templates of GCP are not supported.

.bashrc

.bashrc is a script file system which contains a series of configurations for the terminal session. when the user logs in. The file itself includes highlight settingup for different files. how to use?

Delete default .bashrc

rm -rf ~/.bashrc

Download .bashrc and reboot your system

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


reboot

GroupPolicy import and export

This ".bat" script can only run in Windows. Although only one group-policy rule in Windows can be exported at a time and not support a global one and also have no GUI entrance to import another backuped group policy which exported from another computer. It can help you import or export GroupPolicy conveniently.

Attentions

  • Compatible with all versions of Windows.
  • Only support the group-policy rules which exported by this script.
  • If you want to export group-policy rules. Folder which included group-policy files corresponds to current OS version strictly. Not support export rules which is different from current OS version.
  • Export operation is irreversible, be cautious to run it!
  • I provided a suggested rules file about Windows Server 2016.
  • You should run it on desktop.

tools's People

Contributors

leitbogioro avatar lycs-d avatar phoenixemik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tools's Issues

今天重装不了

Ubuntu Server 20.04 LTS "Focal Fossa"重装为centos 8-stream
昨天能成功,今天提示Error: boot firmware of your system could not be confirmed!
Ubuntu 环境和硬盘分区都和昨天一样。

用过以下都一样
bash InstallNET.sh -centos 8-stream -raid "0" -firmware
bash InstallNET.sh -centos 8-stream -raid "0"

Google Cloud Platform dd失联

bash InstallNET.sh -debian 12 -version 64 -port 22 -pwd Ryan1995 -timezone Asia/Shanghai --network static/manual

Google Cloud Platform 用这个命令失联了,请告诉我怎么更改 ,是不是必须指定ip掩码这些,我看说明 可以通过 --network static/manual 自动获取。

双栈多ip指定公网ip

抛砖引玉,双栈的示例写法好像还没人提过。特来请教。如果有192.168.0.100,10.0.0.200,2606:4700:4700::/48,2001:4860:4860::/48。脚本能直接填写吗?怎么填写?谢谢(网关都设为*::1)

内存大小检测错误

运行脚本提示[Error] Minimum system memory requirement is 384MB!
图片
实际内存大小满足需求

甲骨文 centos 7 执行命令 重启后 没有安装成功

现在的系统是centos7,执行的安装命令是
bash InstallNET.sh -debian
命令执行后,提示reboot
输入reboot之后,系统还是之前的系统,而且硬盘占用增加了,不知道缓存文件在哪里?
现在不仅没有安装成功,硬盘也不知道如何清空了。。。

建议可以给预置组件设置一个参数开关

预置的常用组件、彩色显示、欢迎画面,建议能在 DD 的时候添加一个参数来决定是否预装或者是原版纯净系统。
因为有的机型配置实在比较低,也用不到一些组件,希望会有一个参数开关比较好。
例如:
bash InstallNET.sh -debian -pure

默认打开或者默认关闭都没所谓,应该有人和我一样需求?(我认为

修改网卡参数导致有些情况小鸡失联,建议加个参数

使用DD脚本时候遇到修改网卡参数导致有些情况小鸡失联,研究了好久才发现是脚本配置的interfaces未加开启自动网卡参数,导致 一修改网络配置随机性就就直接失联,自己手动加个参数 auto 网卡就没有遇到了,希望作者改进下

纯IPV6服务器不能用,希望加入IPV6支持

我有一台纯IPV6的vps,脚本提示:Error: Invalid network config
现在网上都没看到支持自动检测并配置好网络的纯IPV6服务器的一键DD脚本,希望作者可以添加这个功能

为什么2g内存的vps重装后还有swap

2g内存的vps重装debian 11之后,还是有swap
说实话1g内存都足够dd了。增加swap的这个内存标准有点太高了。
我用debi的脚本重装debian系统从来没有增加过swap

Unexpected bad I/O performance

How to reproduce

  1. I use Vultr AMD NVME $6/m server to test.
  2. Install these systems and run yabs.sh I/O testing script: Vultr built-in Debian 11, leitbogioro/Tools Debian 11, Moeclub Debian 11.
  3. 4k block I/O test is unexpectedly bad in this tool. Typically moeclub Debian 11: 200M~300M read/write, Vultr build-in Debian 11 200M~300M read/write, leitbogioro/Tools Debian 11 30M~70M read/write.

I use this command to install the new system:
bash InstallNET.sh -d 11 -v 64 -a -firmware

在非空目录执行会卡住

在/root文件夹内 执行命令bash InstallNET.sh -debian ,发现会卡在 grep -wrl 'iface'命令。
只能把脚本移动到空文件夹执行。

-pwd 参数无效

bash InstallNET.sh -ubuntu 22.04 -pwd 'password'

我使用了上述命令,但密码总是默认的,不是我设定的

添加系统建议

ubuntu18.04
Arch Linux、Gentoo Linux、Slackware Linux
FreeBSD、OpenBSD

GCP DD 失败。

根据这两个issues,已关闭vtpm和安全启动。
#34
#24

以下是创建机器的命令已经相关截图
gcloud compute instances create instance-2
--project=wide-hulling-397305
--zone=asia-east2-c
--machine-type=e2-medium
--network-interface=network-tier=PREMIUM,stack-type=IPV4_ONLY,subnet=default
--maintenance-policy=MIGRATE
--provisioning-model=STANDARD
--service-account=[email protected]
--scopes=https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapis.com/auth/logging.write,https://www.googleapis.com/auth/monitoring.write,https://www.googleapis.com/auth/servicecontrol,https://www.googleapis.com/auth/service.management.readonly,https://www.googleapis.com/auth/trace.append
--enable-display-device
--tags=http-server,https-server
--create-disk=auto-delete=yes,boot=yes,device-name=instance-2,image=projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20230817,mode=rw,size=30,type=projects/wide-hulling-397305/zones/us-west4-b/diskTypes/pd-balanced
--no-shielded-secure-boot
--no-shielded-vtpm
--no-shielded-integrity-monitoring
--labels=goog-ec-src=vm_add-gcloud
--reservation-affinity=any

ND1~AM J F{A_X`{YL7R0(5
$0%I}KAG88BACSGKF78_G9F

具体操作:
sudo -i
wget --no-check-certificate -qO InstallNET.sh 'https://raw.githubusercontent.com/leitbogioro/Tools/master/Linux_reinstall/InstallNET.sh' && chmod a+x InstallNET.sh
bash InstallNET.sh -debian
reboot

失败后的screenshot

3%AHO$ZOM$3%O`}AOT%@D7U

ipv6网关无法识别

idcwiki的机器,ipv6地址是公网,网关是fe80::1那样的,dd默认配置进live cd直接报错gateway unreachable,有没有办法解决?

Vultr无法使用 自动 Raid0吗

bash InstallNET.sh -debian 11 -pwd '密码' -raid "0"

这是我用的参数 到达切raid那边 会报错

这算是bug还是不支援呀 哥~

InstallNET.sh: 系统语言为中文导致内存大小检测失效

主要是TotalMem2的第二行:

TotalMem1=$(cat /proc/meminfo | grep "^MemTotal:" | sed 's/kb//i' | grep -o "[0-9]*" | awk -F' ' '{print $NF}')
TotalMem2=$(free -k | grep -wi "mem*" | awk '{printf $2}')

在语言设置成中文的debian系统上的输出:

              总计         已用        空闲      共享    缓冲/缓存    可用
内存:      989304      150584      313072         504      525648      670956
交换:     2097148       33660     2063488

这样第二行grep -wi "mem*"就失效了

修复建议:脚本内手动设置语言到英文,例如export LANG="en_US.UTF-8"

DD Debian10和11每隔1小时准时关机或者重启

23.6月DD完系统后debian10 11 开机后1小时准时关机【其他系统没有测试】,并且必须通过vps面板重启才能正常使用。如果增加一个定时任务,比如定时55分钟自动重启下,那么重启5分钟后会再次自动重启一次,这次重启过后可以正常使用到下次定时任务执行前。换了其他DD系统的脚本后,每隔1小时自动重启的问题没有在发生。

用的DD命令是:bash InstallNET.sh -debian 10 -pwd '密码' -port "端口"
用的是AWS的机器DD的

5月份用这个命令DD的系统一切正常,没有发生1小时自动关机或者重启的问题。

Feature Request: Adding LUKS Disk Encryption

Currently, this project does not support LUKS disk encryption, and we would like to propose adding this feature to your project. LUKS disk encryption is an essential security feature to safeguard user data and privacy, and we believe it would be a valuable addition to the project.

Reasoning

  • Data Security: LUKS disk encryption helps protect data on the hard drive from unauthorized access.
  • Compliance Requirements: In some cases, disk encryption can be a compliance or security standard requirement.

Usage Confirmation
I want to highlight that I have successfully used this script to deploy and configure numerous servers that I own, and it has performed exceptionally well. This feature would further enhance its capabilities.

Expected Features

  • LUKS Hard Disk Encryption
  • Remote Unlock via SSH

References
https://gist.github.com/daymien/6e365de58ab37b54a96e8a6a41a79e6c
https://mazzo.li/posts/hetzner-zfs.html

Assignees
We would appreciate it if the project's author or key members could review this request and consider implementing the feature.

We are looking forward to seeing the LUKS disk encryption feature in your project and are ready to assist in its development. Thank you!

cannot reinstall debian 10

After starting the installation process, the VPS shut down and I haven't been able to connect to it via SSH for over an hour now.My VPS provider is DigitalOcean. This is the details

Specs:
1 CPU
512MB

Nothing came up on the recovery console whereas usually there is a graphical installation of the distro as I have tested for Debian 11

oracle linux8 命令开始后有3行说命令没发现.. 有没有影响?倒也能dd成功

[root@forko1 ~]# bash <(curl -sSL https://raw.githubusercontent.com/leitbogioro/Tools/master/Linux_reinstall/InstallNET.sh) -ubuntu 20.04
Setting up swapspace version 1, size = 512 MiB (536866816 bytes)
no label, UUID=ffa4f9a5-c1ef-4d83-9e56-cd9613df28a0
sed: can't read /etc/apt/sources.list: No such file or directory
/dev/fd/63: line 1091: apt: command not found
/dev/fd/63: line 1094: apt: command not found
/dev/fd/63: line 1110: apt: command not found
Ksplice for Oracle Linux 8 (x86_64) 7.8 MB/s | 3.7 MB 00:00
MySQL 8.0 for Oracle Linux 8 (x86_64) 9.8 MB/s | 3.0 MB 00:00
MySQL 8.0 Tools Community for Oracle Linux 8 (x86_64) 1.3 MB/s | 491 kB 00:00
MySQL 8.0 Connectors Community for Oracle Linux 8 (x86_64)

脚本需要768M内存才能运行

emmm,但是我dd alpine的原因就是因为内存不够(只有200M)。。。所以就陷入了一个死循环。有办法降低内存需求吗?谢谢

关于系统重装的问题

Socket error Event: 32 Error: 10053.
Connection closing...Socket close.

Connection closed by foreign host.

Disconnected from remote host at 12:58:38.

Type `help' to learn how to use Xshell prompt.
[E:~]$
您好,我在使用脚本安装时,ssh中断后就失联了,中断提示这个,怎么处理呢

how to support to install xfs system debian 11, now is ext4 /dev/sda1 ext4 959318096 1031228 909482468 1% /

root@device-6615:# df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on
udev devtmpfs 8158240 0 8158240 0% /dev
tmpfs tmpfs 1635220 608 1634612 1% /run
/dev/sda1 ext4 959318096 1031228 909482468 1% /
tmpfs tmpfs 8176092 0 8176092 0% /dev/shm
tmpfs tmpfs 5120 0 5120 0% /run/lock
tmpfs tmpfs 1635216 0 1635216 0% /run/user/0
root@device-6615:
# df -h
Filesystem Size Used Avail Use% Mounted on
udev 7.8G 0 7.8G 0% /dev
tmpfs 1.6G 608K 1.6G 1% /run
/dev/sda1 915G 1008M 868G 1% /
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 1.6G 0 1.6G 0% /run/user/0

ovh杜甫raid 0好像无效

机器是ovh ksle1 ( 2ssd)
命令
bash InstallNET.sh -debian 11 -raid "0"
命令行中还出现yum错误之类的(不应该啊,debian的dd脚本咋会出现centos的,因为一闪而过后就进入check depend环节了)
然后下载后重启过一个小时都没反应

后来我还是用这个项目https://github.com/airium/Linux-Reinstall 安装的debian10,再升级11的

wget --no-check-certificate -qO install-raid0.sh 'https://github.com/airium/Linux-Reinstall/raw/master/install-raid0.sh'
chmod a+x install-raid0.sh
bash install-raid0.sh -d 10 -v 64 -a

Cannot install on oracle cloud

I have 4 orcacle cloud vps, 3 installed successfully. Only 1 vps failed, the file finished running, rebooted, but the operating system remained the same. I tried again several times, changing the Debian version
How can I report a bug to you? If you have a private communication channel or email, I will send you the vps login information

SSH欢迎页sys info

没找到修改日志。部分机器重装后会出现sys info部分不会。不知道是项目修改还是别的原因导致。如有可能的话给个参数选项。不安装并信任第三方面板的情况下SSH直接显示sys info还是有用的

Only accept prefix format of IPv4 address, length from 1 to 32.

我想用cxthhhhh的centos7的dd包,并指定ipv4网卡信息
我尝试这样执行出现了报错

bash InstallNET.sh --image https://file.1323123.xyz/dd/centos/cxthhhhh/CentOS_7.X_x64_Legacy_NetInstallation_Final_v9.8.vhd.gz --ip-addr 128.199.221.15 --ip-mask 255.255.192.0 --ip-gate 128.199.192.1
[Warning] Only accept prefix format of IPv4 address, length from 1 to 32.
IPv4 CIDR Calculator: https://www.vultr.com/resources/subnet-calculator/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.