/Tools

Something about tools

Primary LanguageShell

Tools

Something about scripts

Linux reinstall useage

Features:

  • "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 Debian 8+, Ubuntu 14.04+, CentOS 6.
  • Support major cloud providers, especially support Oracle Cloud ARM machine.
  • Support install from Linux to Windows. details refer to "How to install Windows?" section.
  • Support single-stack(only have IPv6 public address) server like Vultr 2.5$/mo model, only for DHCP.
  • Support network auto configurations in bio-stack(have both IPv4 and IPv6 public address), after log into 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 machine(recommend RAM above 256MB), If your machine RAM is less than 768MB, before Debian 11 and above version installation, you may should not bash it with "-firmware" or "-firmware --cdimage" parameters because it won't let machine installation go into low memory mode and causes installation failed!
  • Ubuntu 22.04 has cancelled net boot start features, so this program don't support Ubuntu 22.04 and above reinstallation(source: https://www.reddit.com/r/Ubuntu/comments/uroape/is_there_a_netbootiso_equivalent_for_2204_jammy/).
  • South Korea debian official mirror(http://ftp.kr.debian.org/debian/) is usually crashed down, so I change mirror of Kyoto University to replace it. Japan debian mirror is from https://www.riken.jp/, a science research organization in Japan. America debian mirror is from Massachusetts Institute of Technology: https://web.mit.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!

1

  • 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

to make changes validating!

Defects:

  • Debian preseeding process can only config one IP address, for bio-stack machine(both have IPv4 and IPv6 address), after loggin to new system, you can realize that only IPv4 address has been configurated, we need to config IPv6 address manually.

edit network interfaces:

vim /etc/network/interfaces
add ipv6 configurations:

iface ens3 inet6 static
        address ::1
        netmask 64
        dns-nameservers 2606:4700:4700:0:0:0:0:6400
In above sample, you just need to change "::1" to your own IPv6 address which assigned by your cloud provider. "netmask" 64 is a typical value, "dns-nameservers" is from Cloudflare.com.

Save files and restart system.

:wq
reboot

  • "InstallNET.sh" doesn't support pure IPv6 stack machine(have no IPv4 address, such as Vultr.com 2.5$/month plan).

Download:

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

Dependences:

Debian series(Debian/Ubuntu):

apt install xz-utils dnsutils wget file efibootmgr -y

Redhat series(CentOS/Almalinux/Rockylinux/Oraclelinux/Fedora):

yum install xz dnsutils wget file efibootmgr -y

Fully useage sample

bash InstallNET.sh -d/u/c(os type) 11(os version) -v 64(os bit) -port "your server port" -pwd "your server password" -a(auto install)/m(manually in VNC) -mirror "a valid url for OS image source" --ip-addr 'x.x.x.x'(ip address) --ip-mask 'x.x.x.x'(subnet mask) --ip-gate 'x.x.x.x'(gateway) -firmware(with hardware drivers) --cdimage "cn"(this option is only for Debian)

Parameters Descriptions

-d : Debian

-u: Ubuntu

-c: CentOS

32/i386 or 64/amd64 or arm64: OS bit

-mirror: 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 Ubuntu, official recommend mirror lists are here:

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

for CentOS, official recommend mirror lists are here:

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

-firmware or -firmware --cdimage "cn": specify hardware drivers for Debian, if your server location is in mainland China, you can prefer it 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/.

-port: you can pre-specify ssh port of system, range is 1~65535, default is '22'.

-pwd: you can pre-specify ssh password of system, default is 'LeitboGi0ro'.

--ip-addr: if your cloud provider is from GCP etc, you should input it manually.

--ip-gate: if your cloud provider is from GCP etc, you should input it manually.

--ip-mask: if your cloud provider is from GCP etc, you should input it manually.

Quickly start

Debian 8

bash InstallNET.sh -d 8 -v 64 -a

Debian 9

bash InstallNET.sh -d 9 -v 64 -a

Debian 10

bash InstallNET.sh -d 10 -v 64 -a

Debian 11 (prefer mirror manually with firmware, recommend for servers which are locating in mainland China)

Tsinghua University:

bash InstallNET.sh -d 11 -v 64 -a -mirror "https://mirrors.tuna.tsinghua.edu.cn/debian/" -firmware --cdimage "cn"

for low memory(less than 768MB) machines, you can bash:

bash InstallNET.sh -d 11 -v 64 -a -mirror "https://mirrors.tuna.tsinghua.edu.cn/debian/" -dnserv "cn"

Netease, Inc:

bash InstallNET.sh -d 11 -v 64 -a -mirror "http://mirrors.163.com/debian/" -firmware --cdimage "cn"

for low memory(less than 768MB) machines, you can bash:

bash InstallNET.sh -d 11 -v 64 -a -mirror "http://mirrors.163.com/debian/" -dnserv "cn"

Tencent Cloud:

bash InstallNET.sh -d 11 -v 64 -a -mirror "http://mirrors.cloud.tencent.com/debian/" -firmware --cdimage "cn"

for low memory(less than 768MB) machines, you can bash:

bash InstallNET.sh -d 11 -v 64 -a -mirror "http://mirrors.cloud.tencent.com/debian/" -dnserv "cn"

Alibaba Cloud:

bash InstallNET.sh -d 11 -v 64 -a -mirror "http://mirrors.aliyun.com/debian/" -firmware --cdimage 'cn'

for low memory(less than 768MB) machines, you can bash:

bash InstallNET.sh -d 11 -v 64 -a -mirror "http://mirrors.aliyun.com/debian/" -dnserv "cn"

Debian 11 (prefer mirror manually with firmware, recommend for servers which are locating outside of mainland China)

Japan:

bash InstallNET.sh -d 11 -v 64 -a -mirror "http://ftp.riken.jp/Linux/debian/debian/" -firmware

for low memory(less than 768MB) machines, you can bash:

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

HongKong:

bash InstallNET.sh -d 11 -v 64 -a -mirror "http://ftp.hk.debian.org/debian/" -firmware

for low memory(less than 768MB) machines, you can bash:

bash InstallNET.sh -d 11 -v 64 -a -mirror "http://ftp.hk.debian.org/debian/"

Singapore:

bash InstallNET.sh -d 11 -v 64 -a -mirror "http://ftp.sg.debian.org/debian/" -firmware

for low memory(less than 768MB) machines, you can bash:

bash InstallNET.sh -d 11 -v 64 -a -mirror "http://ftp.sg.debian.org/debian/"

South Korea:

bash InstallNET.sh -d 11 -v 64 -a -mirror "http://studenno.kugi.kyoto-u.ac.jp/debian/" -firmware

for low memory(less than 768MB) machines, you can bash:

bash InstallNET.sh -d 11 -v 64 -a -mirror "http://studenno.kugi.kyoto-u.ac.jp/debian/"

Taiwan:

bash InstallNET.sh -d 11 -v 64 -a -mirror "http://ftp.tw.debian.org/debian/" -firmware
America:

bash InstallNET.sh -d 11 -v 64 -a -mirror "http://debian.csail.mit.edu/debian/" -firmware

for low memory(less than 768MB) machines, you can bash:

bash InstallNET.sh -d 11 -v 64 -a -mirror "http://debian.csail.mit.edu/debian/"

Canada:

bash InstallNET.sh -d 11 -v 64 -a -mirror "http://ftp.ca.debian.org/debian/" -firmware
British:

bash InstallNET.sh -d 11 -v 64 -a -mirror "http://ftp.uk.debian.org/debian/" -firmware
Germany:

bash InstallNET.sh -d 11 -v 64 -a -mirror "http://ftp.de.debian.org/debian/" -firmware
France:

bash InstallNET.sh -d 11 -v 64 -a -mirror "http://ftp.fr.debian.org/debian/" -firmware
Russia:

bash InstallNET.sh -d 11 -v 64 -a -mirror "http://ftp.ru.debian.org/debian/" -firmware
Australia:

bash InstallNET.sh -d 11 -v 64 -a -mirror "http://ftp.au.debian.org/debian/" -firmware

Ubuntu 16.04

bash InstallNET.sh -u 16.04 -v 64 -a

Ubuntu 18.04

bash InstallNET.sh -u 18.04 -v 64 -a

Ubuntu 20.04

bash InstallNET.sh -u 20.04 -v 64 -a

Cent OS 6

bash InstallNET.sh -c 6.10 -v 64 -a

Default Configurations

Time zone

Asia Tokyo

Default User name

root

Default Password

LeitboGi0ro

Default Port

22

After system installation, you must change passwords immediately if you assigned default password(LeitboGi0ro)!

How to install Windows?

Notice: 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 help you to research, evaluate related features of Windows. "installNET.sh" is not responsible or liable if someone cause any illegal circumstance.

Servers based on KVM or XEN virtualization:

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

Servers based on 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

Available Windows DD images:

Windows Server series from TeddySun(https://teddysun.com/):

Username: Administrator
Password: Teddysun.com

  • 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


.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.