├── InstallNET.sh ├── README.md └── wget_udeb_amd64.tar.gz /InstallNET.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## License: GPL 4 | ## It can reinstall Debian, Ubuntu, CentOS system with network. 5 | ## Default root password: MoeClub.org 6 | ## Blog: https://moeclub.org 7 | ## Written By MoeClub.org 8 | 9 | export tmpVER='' 10 | export tmpDIST='' 11 | export tmpURL='' 12 | export tmpWORD='' 13 | export tmpMirror='' 14 | export ipAddr='' 15 | export ipMask='' 16 | export ipGate='' 17 | export ipDNS='8.8.8.8' 18 | export IncDisk='default' 19 | export interface='' 20 | export interfaceSelect='' 21 | export Relese='' 22 | export sshPORT='22' 23 | export ddMode='0' 24 | export setNet='0' 25 | export setRDP='0' 26 | export setIPv6='0' 27 | export isMirror='0' 28 | export FindDists='0' 29 | export loaderMode='0' 30 | export IncFirmware='0' 31 | export SpikCheckDIST='0' 32 | export setInterfaceName='0' 33 | export UNKNOWHW='0' 34 | export UNVER='6.4' 35 | export GRUBDIR='' 36 | export GRUBFILE='' 37 | export GRUBVER='' 38 | export VER='' 39 | export setCMD='' 40 | export setConsole='' 41 | 42 | while [[ $# -ge 1 ]]; do 43 | case $1 in 44 | -v|--ver) 45 | shift 46 | tmpVER="$1" 47 | shift 48 | ;; 49 | -d|--debian) 50 | shift 51 | Relese='Debian' 52 | tmpDIST="$1" 53 | shift 54 | ;; 55 | -u|--ubuntu) 56 | shift 57 | Relese='Ubuntu' 58 | tmpDIST="$1" 59 | shift 60 | ;; 61 | -c|--centos) 62 | shift 63 | Relese='CentOS' 64 | tmpDIST="$1" 65 | shift 66 | ;; 67 | -dd|--image) 68 | shift 69 | ddMode='1' 70 | tmpURL="$1" 71 | shift 72 | ;; 73 | -p|--password) 74 | shift 75 | tmpWORD="$1" 76 | shift 77 | ;; 78 | -i|--interface) 79 | shift 80 | interfaceSelect="$1" 81 | shift 82 | ;; 83 | --ip-addr) 84 | shift 85 | ipAddr="$1" 86 | shift 87 | ;; 88 | --ip-mask) 89 | shift 90 | ipMask="$1" 91 | shift 92 | ;; 93 | --ip-gate) 94 | shift 95 | ipGate="$1" 96 | shift 97 | ;; 98 | --ip-dns) 99 | shift 100 | ipDNS="$1" 101 | shift 102 | ;; 103 | --dev-net) 104 | shift 105 | setInterfaceName='1' 106 | ;; 107 | --loader) 108 | shift 109 | loaderMode='1' 110 | ;; 111 | -apt|-yum|--mirror) 112 | shift 113 | isMirror='1' 114 | tmpMirror="$1" 115 | shift 116 | ;; 117 | -rdp) 118 | shift 119 | setRDP='1' 120 | WinRemote="$1" 121 | shift 122 | ;; 123 | -cmd) 124 | shift 125 | setCMD="$1" 126 | shift 127 | ;; 128 | -console) 129 | shift 130 | setConsole="$1" 131 | shift 132 | ;; 133 | -firmware) 134 | shift 135 | IncFirmware="1" 136 | ;; 137 | -port) 138 | shift 139 | sshPORT="$1" 140 | shift 141 | ;; 142 | --noipv6) 143 | shift 144 | setIPv6='1' 145 | ;; 146 | -a|--auto|-m|--manual|-ssl) 147 | shift 148 | ;; 149 | *) 150 | if [[ "$1" != 'error' ]]; then echo -ne "\nInvaild option: '$1'\n\n"; fi 151 | echo -ne " Usage:\n\tbash $(basename $0)\t-d/--debian [\033[33m\033[04mdists-name\033[0m]\n\t\t\t\t-u/--ubuntu [\033[04mdists-name\033[0m]\n\t\t\t\t-c/--centos [\033[04mdists-name\033[0m]\n\t\t\t\t-v/--ver [32/i386|64/\033[33m\033[04mamd64\033[0m] [\033[33m\033[04mdists-verison\033[0m]\n\t\t\t\t--ip-addr/--ip-gate/--ip-mask\n\t\t\t\t-apt/-yum/--mirror\n\t\t\t\t-dd/--image\n\t\t\t\t-p [linux password]\n\t\t\t\t-port [linux ssh port]\n" 152 | exit 1; 153 | ;; 154 | esac 155 | done 156 | 157 | [[ "$EUID" -ne '0' ]] && echo "Error:This script must be run as root!" && exit 1; 158 | 159 | function dependence(){ 160 | Full='0'; 161 | for BIN_DEP in `echo "$1" |sed 's/,/\n/g'` 162 | do 163 | if [[ -n "$BIN_DEP" ]]; then 164 | Found='0'; 165 | for BIN_PATH in `echo "$PATH" |sed 's/:/\n/g'` 166 | do 167 | ls $BIN_PATH/$BIN_DEP >/dev/null 2>&1; 168 | if [ $? == '0' ]; then 169 | Found='1'; 170 | break; 171 | fi 172 | done 173 | if [ "$Found" == '1' ]; then 174 | echo -en "[\033[32mok\033[0m]\t"; 175 | else 176 | Full='1'; 177 | echo -en "[\033[31mNot Install\033[0m]"; 178 | fi 179 | echo -en "\t$BIN_DEP\n"; 180 | fi 181 | done 182 | if [ "$Full" == '1' ]; then 183 | echo -ne "\n\033[31mError! \033[0mPlease use '\033[33mapt-get\033[0m' or '\033[33myum\033[0m' install it.\n\n\n" 184 | exit 1; 185 | fi 186 | } 187 | 188 | function selectMirror(){ 189 | [ $# -ge 3 ] || exit 1 190 | Relese=$(echo "$1" |sed -r 's/(.*)/\L\1/') 191 | DIST=$(echo "$2" |sed 's/\ //g' |sed -r 's/(.*)/\L\1/') 192 | VER=$(echo "$3" |sed 's/\ //g' |sed -r 's/(.*)/\L\1/') 193 | New=$(echo "$4" |sed 's/\ //g') 194 | [ -n "$Relese" ] && [ -n "$DIST" ] && [ -n "$VER" ] || exit 1 195 | if [ "$Relese" == "debian" ] || [ "$Relese" == "ubuntu" ]; then 196 | [ "$DIST" == "focal" ] && legacy="legacy-" || legacy="" 197 | TEMP="SUB_MIRROR/dists/${DIST}/main/installer-${VER}/current/${legacy}images/netboot/${Relese}-installer/${VER}/initrd.gz" 198 | elif [ "$Relese" == "centos" ]; then 199 | TEMP="SUB_MIRROR/${DIST}/os/${VER}/isolinux/initrd.img" 200 | fi 201 | [ -n "$TEMP" ] || exit 1 202 | mirrorStatus=0 203 | declare -A MirrorBackup 204 | MirrorBackup=(["debian0"]="" ["debian1"]="http://deb.debian.org/debian" ["debian2"]="http://archive.debian.org/debian" ["ubuntu0"]="" ["ubuntu1"]="http://archive.ubuntu.com/ubuntu" ["ubuntu2"]="http://ports.ubuntu.com" ["centos0"]="" ["centos1"]="http://mirror.centos.org/centos" ["centos2"]="http://vault.centos.org") 205 | echo "$New" |grep -q '^http://\|^https://\|^ftp://' && MirrorBackup[${Relese}0]="$New" 206 | for mirror in $(echo "${!MirrorBackup[@]}" |sed 's/\ /\n/g' |sort -n |grep "^$Relese") 207 | do 208 | Current="${MirrorBackup[$mirror]}" 209 | [ -n "$Current" ] || continue 210 | MirrorURL=`echo "$TEMP" |sed "s#SUB_MIRROR#${Current}#g"` 211 | wget --no-check-certificate --spider --timeout=3 -o /dev/null "$MirrorURL" 212 | [ $? -eq 0 ] && mirrorStatus=1 && break 213 | done 214 | [ $mirrorStatus -eq 1 ] && echo "$Current" || exit 1 215 | } 216 | 217 | function netmask() { 218 | n="${1:-32}" 219 | b="" 220 | m="" 221 | for((i=0;i<32;i++)){ 222 | [ $i -lt $n ] && b="${b}1" || b="${b}0" 223 | } 224 | for((i=0;i<4;i++)){ 225 | s=`echo "$b"|cut -c$[$[$i*8]+1]-$[$[$i+1]*8]` 226 | [ "$m" == "" ] && m="$((2#${s}))" || m="${m}.$((2#${s}))" 227 | } 228 | echo "$m" 229 | } 230 | 231 | function getInterface(){ 232 | interface="" 233 | Interfaces=`cat /proc/net/dev |grep ':' |cut -d':' -f1 |sed 's/\s//g' |grep -iv '^lo\|^sit\|^stf\|^gif\|^dummy\|^vmnet\|^vir\|^gre\|^ipip\|^ppp\|^bond\|^tun\|^tap\|^ip6gre\|^ip6tnl\|^teql\|^ocserv\|^vpn'` 234 | defaultRoute=`ip route show default |grep "^default"` 235 | for item in `echo "$Interfaces"` 236 | do 237 | [ -n "$item" ] || continue 238 | echo "$defaultRoute" |grep -q "$item" 239 | [ $? -eq 0 ] && interface="$item" && break 240 | done 241 | echo "$interface" 242 | } 243 | 244 | function getDisk(){ 245 | disks=`lsblk | sed 's/[[:space:]]*$//g' |grep "disk$" |cut -d' ' -f1 |grep -v "fd[0-9]*\|sr[0-9]*" |head -n1` 246 | [ -n "$disks" ] || echo "" 247 | echo "$disks" |grep -q "/dev" 248 | [ $? -eq 0 ] && echo "$disks" || echo "/dev/$disks" 249 | } 250 | 251 | function diskType(){ 252 | echo `udevadm info --query all "$1" 2>/dev/null |grep 'ID_PART_TABLE_TYPE' |cut -d'=' -f2` 253 | } 254 | 255 | function getGrub(){ 256 | Boot="${1:-/boot}" 257 | folder=`find "$Boot" -type d -name "grub*" 2>/dev/null |head -n1` 258 | [ -n "$folder" ] || return 259 | fileName=`ls -1 "$folder" 2>/dev/null |grep '^grub.conf$\|^grub.cfg$'` 260 | if [ -z "$fileName" ]; then 261 | ls -1 "$folder" 2>/dev/null |grep -q '^grubenv$' 262 | [ $? -eq 0 ] || return 263 | folder=`find "$Boot" -type f -name "grubenv" 2>/dev/null |xargs dirname |grep -v "^$folder" |head -n1` 264 | [ -n "$folder" ] || return 265 | fileName=`ls -1 "$folder" 2>/dev/null |grep '^grub.conf$\|^grub.cfg$'` 266 | fi 267 | [ -n "$fileName" ] || return 268 | [ "$fileName" == "grub.cfg" ] && ver="0" || ver="1" 269 | echo "${folder}:${fileName}:${ver}" 270 | } 271 | 272 | function lowMem(){ 273 | mem=`grep "^MemTotal:" /proc/meminfo 2>/dev/null |grep -o "[0-9]*"` 274 | [ -n "$mem" ] || return 0 275 | [ "$mem" -le "524288" ] && return 1 || return 0 276 | } 277 | 278 | if [[ "$loaderMode" == "0" ]]; then 279 | Grub=`getGrub "/boot"` 280 | [ -z "$Grub" ] && echo -ne "Error! Not Found grub.\n" && exit 1; 281 | GRUBDIR=`echo "$Grub" |cut -d':' -f1` 282 | GRUBFILE=`echo "$Grub" |cut -d':' -f2` 283 | GRUBVER=`echo "$Grub" |cut -d':' -f3` 284 | fi 285 | 286 | [ -n "$Relese" ] || Relese='Debian' 287 | linux_relese=$(echo "$Relese" |sed 's/\ //g' |sed -r 's/(.*)/\L\1/') 288 | clear && echo -e "\n\033[36m# Check Dependence\033[0m\n" 289 | 290 | if [[ "$ddMode" == '1' ]]; then 291 | dependence iconv; 292 | linux_relese='debian'; 293 | tmpDIST='bullseye'; 294 | tmpVER='amd64'; 295 | fi 296 | 297 | [ -n "$ipAddr" ] && [ -n "$ipMask" ] && [ -n "$ipGate" ] && setNet='1'; 298 | if [ "$setNet" == "0" ]; then 299 | dependence ip 300 | [ -n "$interface" ] || interface=`getInterface` 301 | iAddr=`ip addr show dev $interface |grep "inet.*" |head -n1 |grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\/[0-9]\{1,2\}'` 302 | echo "$iAddr" |grep '^10\.' |grep '/32$' >/dev/null && iAddr=`echo "$iAddr" |sed 's/\/32/\/24/'` # Fix GCP 303 | ipAddr=`echo ${iAddr} |cut -d'/' -f1` 304 | ipMask=`netmask $(echo ${iAddr} |cut -d'/' -f2)` 305 | ipGate=`ip route show default |grep "^default" |grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' |head -n1` 306 | fi 307 | if [ -z "$interface" ]; then 308 | dependence ip 309 | [ -n "$interface" ] || interface=`getInterface` 310 | fi 311 | IPv4="$ipAddr"; MASK="$ipMask"; GATE="$ipGate"; 312 | 313 | [ -n "$IPv4" ] && [ -n "$MASK" ] && [ -n "$GATE" ] && [ -n "$ipDNS" ] || { 314 | echo -ne '\nError: Invalid network config\n\n' 315 | bash $0 error; 316 | exit 1; 317 | } 318 | 319 | if [[ "$Relese" == 'Debian' ]] || [[ "$Relese" == 'Ubuntu' ]]; then 320 | dependence wget,awk,grep,sed,cut,cat,lsblk,cpio,gzip,find,dirname,basename; 321 | elif [[ "$Relese" == 'CentOS' ]]; then 322 | dependence wget,awk,grep,sed,cut,cat,lsblk,cpio,gzip,find,dirname,basename,file,xz; 323 | fi 324 | [ -n "$tmpWORD" ] && dependence openssl 325 | [[ -n "$tmpWORD" ]] && myPASSWORD=`openssl passwd -1 "$tmpWORD"`; 326 | [[ -z "$myPASSWORD" ]] && myPASSWORD='$1$4BJZaD0A$y1QykUnJ6mXprENfwpseH0'; 327 | 328 | tempDisk=`getDisk`; [ -n "$tempDisk" ] && IncDisk="$tempDisk" 329 | 330 | case `uname -m` in aarch64|arm64) VER="arm64";; x86|i386|i686) VER="i386";; x86_64|amd64) VER="amd64";; *) VER="";; esac 331 | tmpVER="$(echo "$tmpVER" |sed -r 's/(.*)/\L\1/')"; 332 | if [[ "$VER" != "arm64" ]] && [[ -n "$tmpVER" ]]; then 333 | case "$tmpVER" in i386|i686|x86|32) VER="i386";; amd64|x86_64|x64|64) [[ "$Relese" == 'CentOS' ]] && VER='x86_64' || VER='amd64';; *) VER='';; esac 334 | fi 335 | 336 | if [[ ! -n "$VER" ]]; then 337 | echo "Error! Not Architecture." 338 | bash $0 error; 339 | exit 1; 340 | fi 341 | 342 | if [[ -z "$tmpDIST" ]]; then 343 | [ "$Relese" == 'Debian' ] && tmpDIST='buster'; 344 | [ "$Relese" == 'Ubuntu' ] && tmpDIST='bionic'; 345 | [ "$Relese" == 'CentOS' ] && tmpDIST='6.10'; 346 | fi 347 | 348 | if [[ -n "$tmpDIST" ]]; then 349 | if [[ "$Relese" == 'Debian' ]]; then 350 | SpikCheckDIST='0' 351 | DIST="$(echo "$tmpDIST" |sed -r 's/(.*)/\L\1/')"; 352 | echo "$DIST" |grep -q '[0-9]'; 353 | [[ $? -eq '0' ]] && { 354 | isDigital="$(echo "$DIST" |grep -o '[\.0-9]\{1,\}' |sed -n '1h;1!H;$g;s/\n//g;$p' |cut -d'.' -f1)"; 355 | [[ -n $isDigital ]] && { 356 | [[ "$isDigital" == '7' ]] && DIST='wheezy'; 357 | [[ "$isDigital" == '8' ]] && DIST='jessie'; 358 | [[ "$isDigital" == '9' ]] && DIST='stretch'; 359 | [[ "$isDigital" == '10' ]] && DIST='buster'; 360 | [[ "$isDigital" == '11' ]] && DIST='bullseye'; 361 | [[ "$isDigital" == '12' ]] && DIST='bookworm'; 362 | } 363 | } 364 | LinuxMirror=$(selectMirror "$Relese" "$DIST" "$VER" "$tmpMirror") 365 | fi 366 | if [[ "$Relese" == 'Ubuntu' ]]; then 367 | SpikCheckDIST='0' 368 | DIST="$(echo "$tmpDIST" |sed -r 's/(.*)/\L\1/')"; 369 | echo "$DIST" |grep -q '[0-9]'; 370 | [[ $? -eq '0' ]] && { 371 | isDigital="$(echo "$DIST" |grep -o '[\.0-9]\{1,\}' |sed -n '1h;1!H;$g;s/\n//g;$p')"; 372 | [[ -n $isDigital ]] && { 373 | [[ "$isDigital" == '12.04' ]] && DIST='precise'; 374 | [[ "$isDigital" == '14.04' ]] && DIST='trusty'; 375 | [[ "$isDigital" == '16.04' ]] && DIST='xenial'; 376 | [[ "$isDigital" == '18.04' ]] && DIST='bionic'; 377 | [[ "$isDigital" == '20.04' ]] && DIST='focal'; 378 | # [[ "$isDigital" == '22.04' ]] && DIST='jammy'; 379 | } 380 | } 381 | LinuxMirror=$(selectMirror "$Relese" "$DIST" "$VER" "$tmpMirror") 382 | fi 383 | if [[ "$Relese" == 'CentOS' ]]; then 384 | SpikCheckDIST='1' 385 | DISTCheck="$(echo "$tmpDIST" |grep -o '[\.0-9]\{1,\}' |head -n1)"; 386 | LinuxMirror=$(selectMirror "$Relese" "$DISTCheck" "$VER" "$tmpMirror") 387 | ListDIST="$(wget --no-check-certificate -qO- "$LinuxMirror/dir_sizes" |cut -f2 |grep '^[0-9]')" 388 | DIST="$(echo "$ListDIST" |grep "^$DISTCheck" |head -n1)" 389 | [[ -z "$DIST" ]] && { 390 | echo -ne '\nThe dists version not found in this mirror, Please check it! \n\n' 391 | bash $0 error; 392 | exit 1; 393 | } 394 | wget --no-check-certificate -qO- "$LinuxMirror/$DIST/os/$VER/.treeinfo" |grep -q 'general'; 395 | [[ $? != '0' ]] && { 396 | echo -ne "\nThe version not found in this mirror, Please change mirror try again! \n\n"; 397 | exit 1; 398 | } 399 | fi 400 | fi 401 | 402 | if [[ -z "$LinuxMirror" ]]; then 403 | echo -ne "\033[31mError! \033[0mInvaild mirror! \n" 404 | [ "$Relese" == 'Debian' ] && echo -en "\033[33mexample:\033[0m http://deb.debian.org/debian\n\n"; 405 | [ "$Relese" == 'Ubuntu' ] && echo -en "\033[33mexample:\033[0m http://archive.ubuntu.com/ubuntu\n\n"; 406 | [ "$Relese" == 'CentOS' ] && echo -en "\033[33mexample:\033[0m http://mirror.centos.org/centos\n\n"; 407 | bash $0 error; 408 | exit 1; 409 | fi 410 | 411 | if [[ "$SpikCheckDIST" == '0' ]]; then 412 | DistsList="$(wget --no-check-certificate -qO- "$LinuxMirror/dists/" |grep -o 'href=.*/"' |cut -d'"' -f2 |sed '/-\|old\|Debian\|experimental\|stable\|test\|sid\|devel/d' |grep '^[^/]' |sed -n '1h;1!H;$g;s/\n//g;s/\//\;/g;$p')"; 413 | for CheckDEB in `echo "$DistsList" |sed 's/;/\n/g'` 414 | do 415 | [[ "$CheckDEB" == "$DIST" ]] && FindDists='1' && break; 416 | done 417 | [[ "$FindDists" == '0' ]] && { 418 | echo -ne '\nThe dists version not found, Please check it! \n\n' 419 | bash $0 error; 420 | exit 1; 421 | } 422 | fi 423 | 424 | if [[ "$ddMode" == '1' ]]; then 425 | if [[ -n "$tmpURL" ]]; then 426 | DDURL="$tmpURL" 427 | echo "$DDURL" |grep -q '^http://\|^ftp://\|^https://'; 428 | [[ $? -ne '0' ]] && echo 'Please input vaild URL,Only support http://, ftp:// and https:// !' && exit 1; 429 | else 430 | echo 'Please input vaild image URL! '; 431 | exit 1; 432 | fi 433 | fi 434 | 435 | clear && echo -e "\n\033[36m# Install\033[0m\n" 436 | 437 | [[ "$ddMode" == '1' ]] && echo -ne "\033[34mAuto Mode\033[0m insatll \033[33mWindows\033[0m\n[\033[33m$DDURL\033[0m]\n" 438 | 439 | if [ -z "$interfaceSelect" ]; then 440 | if [[ "$linux_relese" == 'debian' ]] || [[ "$linux_relese" == 'ubuntu' ]]; then 441 | interfaceSelect="auto" 442 | elif [[ "$linux_relese" == 'centos' ]]; then 443 | interfaceSelect="link" 444 | fi 445 | fi 446 | 447 | if [[ "$linux_relese" == 'centos' ]]; then 448 | if [[ "$DIST" != "$UNVER" ]]; then 449 | awk 'BEGIN{print '${UNVER}'-'${DIST}'}' |grep -q '^-' 450 | if [ $? != '0' ]; then 451 | UNKNOWHW='1'; 452 | echo -en "\033[33mThe version lower then \033[31m$UNVER\033[33m may not support in auto mode! \033[0m\n"; 453 | fi 454 | awk 'BEGIN{print '${UNVER}'-'${DIST}'+0.59}' |grep -q '^-' 455 | if [ $? == '0' ]; then 456 | echo -en "\n\033[31mThe version higher then \033[33m6.10 \033[31mis not support in current! \033[0m\n\n" 457 | exit 1; 458 | fi 459 | fi 460 | fi 461 | 462 | echo -e "\n[\033[33m$Relese\033[0m] [\033[33m$DIST\033[0m] [\033[33m$VER\033[0m] Downloading..." 463 | 464 | if [[ "$linux_relese" == 'debian' ]] || [[ "$linux_relese" == 'ubuntu' ]]; then 465 | [ "$DIST" == "focal" ] && legacy="legacy-" || legacy="" 466 | wget --no-check-certificate -qO '/tmp/initrd.img' "${LinuxMirror}/dists/${DIST}/main/installer-${VER}/current/${legacy}images/netboot/${linux_relese}-installer/${VER}/initrd.gz" 467 | [[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'initrd.img' for \033[33m$linux_relese\033[0m failed! \n" && exit 1 468 | wget --no-check-certificate -qO '/tmp/vmlinuz' "${LinuxMirror}/dists/${DIST}${inUpdate}/main/installer-${VER}/current/${legacy}images/netboot/${linux_relese}-installer/${VER}/linux" 469 | [[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'vmlinuz' for \033[33m$linux_relese\033[0m failed! \n" && exit 1 470 | MirrorHost="$(echo "$LinuxMirror" |awk -F'://|/' '{print $2}')"; 471 | MirrorFolder="$(echo "$LinuxMirror" |awk -F''${MirrorHost}'' '{print $2}')"; 472 | [ -n "$MirrorFolder" ] || MirrorFolder="/" 473 | elif [[ "$linux_relese" == 'centos' ]]; then 474 | wget --no-check-certificate -qO '/tmp/initrd.img' "${LinuxMirror}/${DIST}/os/${VER}/isolinux/initrd.img" 475 | [[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'initrd.img' for \033[33m$linux_relese\033[0m failed! \n" && exit 1 476 | wget --no-check-certificate -qO '/tmp/vmlinuz' "${LinuxMirror}/${DIST}/os/${VER}/isolinux/vmlinuz" 477 | [[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'vmlinuz' for \033[33m$linux_relese\033[0m failed! \n" && exit 1 478 | else 479 | bash $0 error; 480 | exit 1; 481 | fi 482 | if [[ "$linux_relese" == 'debian' ]]; then 483 | if [[ "$IncFirmware" == '1' ]]; then 484 | wget --no-check-certificate -qO '/tmp/firmware.cpio.gz' "http://cdimage.debian.org/cdimage/unofficial/non-free/firmware/${DIST}/current/firmware.cpio.gz" 485 | [[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'firmware' for \033[33m$linux_relese\033[0m failed! \n" && exit 1 486 | fi 487 | if [[ "$ddMode" == '1' ]]; then 488 | vKernel_udeb=$(wget --no-check-certificate -qO- "http://$DISTMirror/dists/$DIST/main/installer-$VER/current/images/udeb.list" |grep '^acpi-modules' |head -n1 |grep -o '[0-9]\{1,2\}.[0-9]\{1,2\}.[0-9]\{1,2\}-[0-9]\{1,2\}' |head -n1) 489 | [[ -z "vKernel_udeb" ]] && vKernel_udeb="4.19.0-17" 490 | fi 491 | fi 492 | 493 | if [[ "$loaderMode" == "0" ]]; then 494 | [[ ! -f "${GRUBDIR}/${GRUBFILE}" ]] && echo "Error! Not Found ${GRUBFILE}. " && exit 1; 495 | 496 | [[ ! -f "${GRUBDIR}/${GRUBFILE}.old" ]] && [[ -f "${GRUBDIR}/${GRUBFILE}.bak" ]] && mv -f "${GRUBDIR}/${GRUBFILE}.bak" "${GRUBDIR}/${GRUBFILE}.old"; 497 | mv -f "${GRUBDIR}/${GRUBFILE}" "${GRUBDIR}/${GRUBFILE}.bak"; 498 | [[ -f "${GRUBDIR}/${GRUBFILE}.old" ]] && cat "${GRUBDIR}/${GRUBFILE}.old" >"${GRUBDIR}/${GRUBFILE}" || cat "${GRUBDIR}/${GRUBFILE}.bak" >"${GRUBDIR}/${GRUBFILE}"; 499 | else 500 | GRUBVER='-1' 501 | fi 502 | 503 | [[ "$GRUBVER" == '0' ]] && { 504 | READGRUB='/tmp/grub.read' 505 | cat $GRUBDIR/$GRUBFILE |sed -n '1h;1!H;$g;s/\n/%%%%%%%/g;$p' |grep -om 1 'menuentry\ [^{]*{[^}]*}%%%%%%%' |sed 's/%%%%%%%/\n/g' >$READGRUB 506 | LoadNum="$(cat $READGRUB |grep -c 'menuentry ')" 507 | if [[ "$LoadNum" -eq '1' ]]; then 508 | cat $READGRUB |sed '/^$/d' >/tmp/grub.new; 509 | elif [[ "$LoadNum" -gt '1' ]]; then 510 | CFG0="$(awk '/menuentry /{print NR}' $READGRUB|head -n 1)"; 511 | CFG2="$(awk '/menuentry /{print NR}' $READGRUB|head -n 2 |tail -n 1)"; 512 | CFG1=""; 513 | for tmpCFG in `awk '/}/{print NR}' $READGRUB` 514 | do 515 | [ "$tmpCFG" -gt "$CFG0" -a "$tmpCFG" -lt "$CFG2" ] && CFG1="$tmpCFG"; 516 | done 517 | [[ -z "$CFG1" ]] && { 518 | echo "Error! read $GRUBFILE. "; 519 | exit 1; 520 | } 521 | 522 | sed -n "$CFG0,$CFG1"p $READGRUB >/tmp/grub.new; 523 | [[ -f /tmp/grub.new ]] && [[ "$(grep -c '{' /tmp/grub.new)" -eq "$(grep -c '}' /tmp/grub.new)" ]] || { 524 | echo -ne "\033[31mError! \033[0mNot configure $GRUBFILE. \n"; 525 | exit 1; 526 | } 527 | fi 528 | [ ! -f /tmp/grub.new ] && echo "Error! $GRUBFILE. " && exit 1; 529 | sed -i "/menuentry.*/c\menuentry\ \'Install OS \[$DIST\ $VER\]\'\ --class debian\ --class\ gnu-linux\ --class\ gnu\ --class\ os\ \{" /tmp/grub.new 530 | sed -i "/echo.*Loading/d" /tmp/grub.new; 531 | INSERTGRUB="$(awk '/menuentry /{print NR}' $GRUBDIR/$GRUBFILE|head -n 1)" 532 | } 533 | 534 | [[ "$GRUBVER" == '1' ]] && { 535 | CFG0="$(awk '/title[\ ]|title[\t]/{print NR}' $GRUBDIR/$GRUBFILE|head -n 1)"; 536 | CFG1="$(awk '/title[\ ]|title[\t]/{print NR}' $GRUBDIR/$GRUBFILE|head -n 2 |tail -n 1)"; 537 | [[ -n $CFG0 ]] && [ -z $CFG1 -o $CFG1 == $CFG0 ] && sed -n "$CFG0,$"p $GRUBDIR/$GRUBFILE >/tmp/grub.new; 538 | [[ -n $CFG0 ]] && [ -z $CFG1 -o $CFG1 != $CFG0 ] && sed -n "$CFG0,$[$CFG1-1]"p $GRUBDIR/$GRUBFILE >/tmp/grub.new; 539 | [[ ! -f /tmp/grub.new ]] && echo "Error! configure append $GRUBFILE. " && exit 1; 540 | sed -i "/title.*/c\title\ \'Install OS \[$DIST\ $VER\]\'" /tmp/grub.new; 541 | sed -i '/^#/d' /tmp/grub.new; 542 | INSERTGRUB="$(awk '/title[\ ]|title[\t]/{print NR}' $GRUBDIR/$GRUBFILE|head -n 1)" 543 | } 544 | 545 | if [[ "$loaderMode" == "0" ]]; then 546 | [[ -n "$(grep 'linux.*/\|kernel.*/' /tmp/grub.new |awk '{print $2}' |tail -n 1 |grep '^/boot/')" ]] && Type='InBoot' || Type='NoBoot'; 547 | 548 | LinuxKernel="$(grep 'linux.*/\|kernel.*/' /tmp/grub.new |awk '{print $1}' |head -n 1)"; 549 | [[ -z "$LinuxKernel" ]] && echo "Error! read grub config! " && exit 1; 550 | LinuxIMG="$(grep 'initrd.*/' /tmp/grub.new |awk '{print $1}' |tail -n 1)"; 551 | [ -z "$LinuxIMG" ] && sed -i "/$LinuxKernel.*\//a\\\tinitrd\ \/" /tmp/grub.new && LinuxIMG='initrd'; 552 | 553 | [[ "$setInterfaceName" == "1" ]] && Add_OPTION="net.ifnames=0 biosdevname=0" || Add_OPTION="" 554 | [[ "$setIPv6" == "1" ]] && Add_OPTION="$Add_OPTION ipv6.disable=1" 555 | 556 | lowMem || Add_OPTION="$Add_OPTION lowmem=+2" 557 | 558 | if [[ "$linux_relese" == 'debian' ]] || [[ "$linux_relese" == 'ubuntu' ]]; then 559 | BOOT_OPTION="auto=true $Add_OPTION hostname=$linux_relese domain=$linux_relese quiet" 560 | elif [[ "$linux_relese" == 'centos' ]]; then 561 | BOOT_OPTION="ks=file://ks.cfg $Add_OPTION ksdevice=$interfaceSelect" 562 | fi 563 | 564 | [ -n "$setConsole" ] && BOOT_OPTION="$BOOT_OPTION --- console=$setConsole" 565 | 566 | [[ "$Type" == 'InBoot' ]] && { 567 | sed -i "/$LinuxKernel.*\//c\\\t$LinuxKernel\\t\/boot\/vmlinuz $BOOT_OPTION" /tmp/grub.new; 568 | sed -i "/$LinuxIMG.*\//c\\\t$LinuxIMG\\t\/boot\/initrd.img" /tmp/grub.new; 569 | } 570 | 571 | [[ "$Type" == 'NoBoot' ]] && { 572 | sed -i "/$LinuxKernel.*\//c\\\t$LinuxKernel\\t\/vmlinuz $BOOT_OPTION" /tmp/grub.new; 573 | sed -i "/$LinuxIMG.*\//c\\\t$LinuxIMG\\t\/initrd.img" /tmp/grub.new; 574 | } 575 | 576 | sed -i '$a\\n' /tmp/grub.new; 577 | 578 | sed -i ''${INSERTGRUB}'i\\n' $GRUBDIR/$GRUBFILE; 579 | sed -i ''${INSERTGRUB}'r /tmp/grub.new' $GRUBDIR/$GRUBFILE; 580 | [[ -f $GRUBDIR/grubenv ]] && sed -i 's/saved_entry/#saved_entry/g' $GRUBDIR/grubenv; 581 | fi 582 | 583 | [[ -d /tmp/boot ]] && rm -rf /tmp/boot; 584 | mkdir -p /tmp/boot; 585 | cd /tmp/boot; 586 | 587 | if [[ "$linux_relese" == 'debian' ]] || [[ "$linux_relese" == 'ubuntu' ]]; then 588 | COMPTYPE="gzip"; 589 | elif [[ "$linux_relese" == 'centos' ]]; then 590 | COMPTYPE="$(file ../initrd.img |grep -o ':.*compressed data' |cut -d' ' -f2 |sed -r 's/(.*)/\L\1/' |head -n1)" 591 | [[ -z "$COMPTYPE" ]] && echo "Detect compressed type fail." && exit 1; 592 | fi 593 | CompDected='0' 594 | for COMP in `echo -en 'gzip\nlzma\nxz'` 595 | do 596 | if [[ "$COMPTYPE" == "$COMP" ]]; then 597 | CompDected='1' 598 | if [[ "$COMPTYPE" == 'gzip' ]]; then 599 | NewIMG="initrd.img.gz" 600 | else 601 | NewIMG="initrd.img.$COMPTYPE" 602 | fi 603 | mv -f "/tmp/initrd.img" "/tmp/$NewIMG" 604 | break; 605 | fi 606 | done 607 | [[ "$CompDected" != '1' ]] && echo "Detect compressed type not support." && exit 1; 608 | [[ "$COMPTYPE" == 'lzma' ]] && UNCOMP='xz --format=lzma --decompress'; 609 | [[ "$COMPTYPE" == 'xz' ]] && UNCOMP='xz --decompress'; 610 | [[ "$COMPTYPE" == 'gzip' ]] && UNCOMP='gzip -d'; 611 | 612 | $UNCOMP < /tmp/$NewIMG | cpio --extract --verbose --make-directories --no-absolute-filenames >>/dev/null 2>&1 613 | 614 | if [[ "$linux_relese" == 'debian' ]] || [[ "$linux_relese" == 'ubuntu' ]]; then 615 | CurrentKernelVersion=`ls -1 ./lib/modules 2>/dev/null |head -n1` 616 | [ -n "$CurrentKernelVersion" ] && SelectLowmem="di-utils-exit-installer,driver-injection-disk-detect,fdisk-udeb,netcfg-static,parted-udeb,partman-auto,partman-ext3,ata-modules-${CurrentKernelVersion}-di,efi-modules-${CurrentKernelVersion}-di,sata-modules-${CurrentKernelVersion}-di,scsi-modules-${CurrentKernelVersion}-di,scsi-nic-modules-${CurrentKernelVersion}-di" || SelectLowmem="" 617 | cat >/tmp/boot/preseed.cfg</dev/null |base64 -d >/tmp/run.sh; rm -rf /etc/run.sh; sed -i /^@reboot/d /etc/crontab; bash /tmp/run.sh' >>/target/etc/crontab; \ 701 | echo '' >>/target/etc/crontab; \ 702 | echo '${setCMD}' >/target/etc/run.sh; 703 | EOF 704 | 705 | if [[ "$loaderMode" != "0" ]] && [[ "$setNet" == '0' ]]; then 706 | sed -i '/netcfg\/disable_autoconfig/d' /tmp/boot/preseed.cfg 707 | sed -i '/netcfg\/dhcp_options/d' /tmp/boot/preseed.cfg 708 | sed -i '/netcfg\/get_.*/d' /tmp/boot/preseed.cfg 709 | sed -i '/netcfg\/confirm_static/d' /tmp/boot/preseed.cfg 710 | fi 711 | 712 | if [[ "$linux_relese" == 'debian' ]]; then 713 | sed -i '/user-setup\/allow-password-weak/d' /tmp/boot/preseed.cfg 714 | sed -i '/user-setup\/encrypt-home/d' /tmp/boot/preseed.cfg 715 | sed -i '/pkgsel\/update-policy/d' /tmp/boot/preseed.cfg 716 | sed -i 's/umount\ \/media.*true\;\ //g' /tmp/boot/preseed.cfg 717 | [[ -f '/tmp/firmware.cpio.gz' ]] && gzip -d < /tmp/firmware.cpio.gz | cpio --extract --verbose --make-directories --no-absolute-filenames >>/dev/null 2>&1 718 | else 719 | sed -i '/d-i\ grub-installer\/force-efi-extra-removable/d' /tmp/boot/preseed.cfg 720 | fi 721 | 722 | [[ "$ddMode" == '1' ]] && { 723 | WinNoDHCP(){ 724 | echo -ne "for\0040\0057f\0040\0042tokens\00753\0052\0042\0040\0045\0045i\0040in\0040\0050\0047netsh\0040interface\0040show\0040interface\0040\0136\0174more\0040\00533\0040\0136\0174findstr\0040\0057I\0040\0057R\0040\0042本地\0056\0052\0040以太\0056\0052\0040Local\0056\0052\0040Ethernet\0042\0047\0051\0040do\0040\0050set\0040EthName\0075\0045\0045j\0051\r\nnetsh\0040\0055c\0040interface\0040ip\0040set\0040address\0040name\0075\0042\0045EthName\0045\0042\0040source\0075static\0040address\0075$IPv4\0040mask\0075$MASK\0040gateway\0075$GATE\r\nnetsh\0040\0055c\0040interface\0040ip\0040add\0040dnsservers\0040name\0075\0042\0045EthName\0045\0042\0040address\00758\00568\00568\00568\0040index\00751\0040validate\0075no\r\n\r\n" >>'/tmp/boot/net.tmp'; 725 | } 726 | WinRDP(){ 727 | echo -ne "netsh\0040firewall\0040set\0040portopening\0040protocol\0075ALL\0040port\0075$WinRemote\0040name\0075RDP\0040mode\0075ENABLE\0040scope\0075ALL\0040profile\0075ALL\r\nnetsh\0040firewall\0040set\0040portopening\0040protocol\0075ALL\0040port\0075$WinRemote\0040name\0075RDP\0040mode\0075ENABLE\0040scope\0075ALL\0040profile\0075CURRENT\r\nreg\0040add\0040\0042HKLM\0134SYSTEM\0134CurrentControlSet\0134Control\0134Network\0134NewNetworkWindowOff\0042\0040\0057f\r\nreg\0040add\0040\0042HKLM\0134SYSTEM\0134CurrentControlSet\0134Control\0134Terminal\0040Server\0042\0040\0057v\0040fDenyTSConnections\0040\0057t\0040reg\0137dword\0040\0057d\00400\0040\0057f\r\nreg\0040add\0040\0042HKLM\0134SYSTEM\0134CurrentControlSet\0134Control\0134Terminal\0040Server\0134Wds\0134rdpwd\0134Tds\0134tcp\0042\0040\0057v\0040PortNumber\0040\0057t\0040reg\0137dword\0040\0057d\0040$WinRemote\0040\0057f\r\nreg\0040add\0040\0042HKLM\0134SYSTEM\0134CurrentControlSet\0134Control\0134Terminal\0040Server\0134WinStations\0134RDP\0055Tcp\0042\0040\0057v\0040PortNumber\0040\0057t\0040reg\0137dword\0040\0057d\0040$WinRemote\0040\0057f\r\nreg\0040add\0040\0042HKLM\0134SYSTEM\0134CurrentControlSet\0134Control\0134Terminal\0040Server\0134WinStations\0134RDP\0055Tcp\0042\0040\0057v\0040UserAuthentication\0040\0057t\0040reg\0137dword\0040\0057d\00400\0040\0057f\r\nFOR\0040\0057F\0040\0042tokens\00752\0040delims\0075\0072\0042\0040\0045\0045i\0040in\0040\0050\0047SC\0040QUERYEX\0040TermService\0040\0136\0174FINDSTR\0040\0057I\0040\0042PID\0042\0047\0051\0040do\0040TASKKILL\0040\0057F\0040\0057PID\0040\0045\0045i\r\nFOR\0040\0057F\0040\0042tokens\00752\0040delims\0075\0072\0042\0040\0045\0045i\0040in\0040\0050\0047SC\0040QUERYEX\0040UmRdpService\0040\0136\0174FINDSTR\0040\0057I\0040\0042PID\0042\0047\0051\0040do\0040TASKKILL\0040\0057F\0040\0057PID\0040\0045\0045i\r\nSC\0040START\0040TermService\r\n\r\n" >>'/tmp/boot/net.tmp'; 728 | } 729 | echo -ne "\0100ECHO\0040OFF\r\n\r\ncd\0056\0076\0045WINDIR\0045\0134GetAdmin\r\nif\0040exist\0040\0045WINDIR\0045\0134GetAdmin\0040\0050del\0040\0057f\0040\0057q\0040\0042\0045WINDIR\0045\0134GetAdmin\0042\0051\0040else\0040\0050\r\necho\0040CreateObject\0136\0050\0042Shell\0056Application\0042\0136\0051\0056ShellExecute\0040\0042\0045\0176s0\0042\0054\0040\0042\0045\0052\0042\0054\0040\0042\0042\0054\0040\0042runas\0042\0054\00401\0040\0076\0076\0040\0042\0045temp\0045\0134Admin\0056vbs\0042\r\n\0042\0045temp\0045\0134Admin\0056vbs\0042\r\ndel\0040\0057f\0040\0057q\0040\0042\0045temp\0045\0134Admin\0056vbs\0042\r\nexit\0040\0057b\00402\0051\r\n\r\n" >'/tmp/boot/net.tmp'; 730 | [[ "$setNet" == '1' ]] && WinNoDHCP; 731 | [[ "$setNet" == '0' ]] && [[ "$AutoNet" == '0' ]] && WinNoDHCP; 732 | [[ "$setRDP" == '1' ]] && [[ -n "$WinRemote" ]] && WinRDP 733 | echo -ne "ECHO\0040SELECT\0040VOLUME\0075\0045\0045SystemDrive\0045\0045\0040\0076\0040\0042\0045SystemDrive\0045\0134diskpart\0056extend\0042\r\nECHO\0040EXTEND\0040\0076\0076\0040\0042\0045SystemDrive\0045\0134diskpart\0056extend\0042\r\nSTART\0040/WAIT\0040DISKPART\0040\0057S\0040\0042\0045SystemDrive\0045\0134diskpart\0056extend\0042\r\nDEL\0040\0057f\0040\0057q\0040\0042\0045SystemDrive\0045\0134diskpart\0056extend\0042\r\n\r\n" >>'/tmp/boot/net.tmp'; 734 | echo -ne "cd\0040\0057d\0040\0042\0045ProgramData\0045\0057Microsoft\0057Windows\0057Start\0040Menu\0057Programs\0057Startup\0042\r\ndel\0040\0057f\0040\0057q\0040net\0056bat\r\n\r\n\r\n" >>'/tmp/boot/net.tmp'; 735 | iconv -f 'UTF-8' -t 'GBK' '/tmp/boot/net.tmp' -o '/tmp/boot/net.bat' 736 | rm -rf '/tmp/boot/net.tmp' 737 | } 738 | 739 | [[ "$ddMode" == '0' ]] && { 740 | sed -i '/anna-install/d' /tmp/boot/preseed.cfg 741 | sed -i 's/wget.*\/sbin\/reboot\;\ //g' /tmp/boot/preseed.cfg 742 | } 743 | 744 | elif [[ "$linux_relese" == 'centos' ]]; then 745 | cat >/tmp/boot/ks.cfg< /tmp/initrd.img; 787 | 788 | if [[ "$loaderMode" == "0" ]]; then 789 | cp -f /tmp/initrd.img /boot/initrd.img || sudo cp -f /tmp/initrd.img /boot/initrd.img 790 | cp -f /tmp/vmlinuz /boot/vmlinuz || sudo cp -f /tmp/vmlinuz /boot/vmlinuz 791 | 792 | chown root:root $GRUBDIR/$GRUBFILE 793 | chmod 444 $GRUBDIR/$GRUBFILE 794 | 795 | sleep 3 && reboot || sudo reboot >/dev/null 2>&1 796 | else 797 | rm -rf "$HOME/loader" 798 | mkdir -p "$HOME/loader" 799 | cp -rf "/tmp/initrd.img" "$HOME/loader/initrd.img" 800 | cp -rf "/tmp/vmlinuz" "$HOME/loader/vmlinuz" 801 | rm -rf "/tmp/initrd.img" 802 | rm -rf "/tmp/vmlinuz" 803 | echo && ls -AR1 "$HOME/loader" 804 | fi 805 | 806 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 萌咖大佬的一键DD脚本 2 | Debian/Ubuntu/CentOS 网络安装/网络重装/纯净安装 一键脚本 3 | 4 | 5 | ### 背景: 6 | 适用于由GRUB引导的CentOS,Ubuntu,Debian系统. 7 | 8 | 使用官方发行版去掉模板预装的软件. 9 | 10 | 同时也可以解决内核版本与软件不兼容的问题。 11 | 12 | 只要有root权限,还您一个纯净的系统。 13 | 14 | 注意: 15 | 16 | 全自动安装默认root密码:``` MoeClub.org ```指定密码参数后面加 ```-p 密码``` 17 | 18 | 使用默认密码安装完成后请立即更改密码. 19 | 20 | 能够全自动重装Debian/Ubuntu/CentOS等系统. 21 | 22 | 同时提供dd安装镜像功能,例如: 全自动无救援dd安装windows系统. 23 | 24 | 全自动安装CentOS时默认提供VNC功能,可使用VNC Viewer查看进度, 25 | VNC端口为1或者5901,可自行尝试连接.(成功后VNC功能会消失.) 26 | 目前CentOS系统只支持任意版本重装为 CentOS 6.x 及以下版本. 27 | 28 | 特别注意:OpenVZ构架不适用. 29 | 30 | 确保安装了所需软件: 31 | #### Debian/Ubuntu: 32 | ``` 33 | apt-get install -y xz-utils openssl gawk file 34 | ``` 35 | #### RedHat/CentOS: 36 | ``` 37 | yum install -y xz openssl gawk file 38 | ``` 39 | 如果出现了错误,请运行: 40 | #### Debian/Ubuntu: 41 | ``` 42 | apt-get update 43 | ``` 44 | #### RedHat/CentOS: 45 | ``` 46 | yum update 47 | ``` 48 | ``` 49 | Usage: 50 | bash InstallNET.sh -d/--debian [dist-name] 51 | -u/--ubuntu [dist-name] 52 | -c/--centos [dist-version] 53 | -v/--ver [32/i386|64/amd64] 54 | --ip-addr/--ip-gate/--ip-mask 55 | -apt/-yum/--mirror 56 | -dd/--image 57 | -a/-m 58 | 59 | # dist-name: 发行版本代号 60 | # dist-version: 发行版本号 61 | # -apt/-yum/--mirror : 使用定义镜像 62 | # -a/-m : 询问是否能进入VNC自行操作. -a 为不提示(一般用于全自动安装), -m 为提示. 63 | # --ip-addr :IP Address/IP地址 64 | # --ip-gate :Gateway /网关 65 | # --ip-mask :Netmask /子网掩码 66 | # 以下示例中,将X.X.X.X替换为自己的网络参数. 67 | ``` 68 | 69 | # 快速使用示例: 70 | 71 | ### centos 6: 72 | ``` 73 | bash <(wget --no-check-certificate -qO- 'https://git.io/JeiRm') -c 6.9 -v 64 -a --mirror 'http://mirror.centos.org/centos' 74 | ``` 75 | ### debian 7: 76 | ``` 77 | bash <(wget --no-check-certificate -qO- 'https://git.io/JeiRm') -d 7 -v 64 -a 78 | ``` 79 | ### debian 8: 80 | ``` 81 | bash <(wget --no-check-certificate -qO- 'https://git.io/JeiRm') -d 8 -v 64 -a 82 | ``` 83 | ### debian 9: 84 | ``` 85 | bash <(wget --no-check-certificate -qO- 'https://git.io/JeiRm') -d 9 -v 64 -a 86 | ``` 87 | ### debian 10: 88 | ``` 89 | bash <(wget --no-check-certificate -qO- 'https://git.io/JeiRm') -d 10 -v 64 -a 90 | ``` 91 | ### debian 11: 92 | ``` 93 | bash <(wget --no-check-certificate -qO- 'https://git.io/JeiRm') -d 11 -v 64 -a 94 | ``` 95 | ### debian 12: 96 | ``` 97 | bash <(wget --no-check-certificate -qO- 'https://git.io/JeiRm') -d 12 -v 64 -a 98 | ``` 99 | ### ubuntu 14.04: 100 | ``` 101 | bash <(wget --no-check-certificate -qO- 'https://git.io/JeiRm') -u 14.04 -v 64 -a 102 | ``` 103 | ### ubuntu 16.04: 104 | ``` 105 | bash <(wget --no-check-certificate -qO- 'https://git.io/JeiRm') -u 16.04 -v 64 -a 106 | ``` 107 | ### ubuntu 18.04: 108 | ``` 109 | bash <(wget --no-check-certificate -qO- 'https://git.io/JeiRm') -u 18.04 -v 64 -a 110 | ``` 111 | ### ubuntu 20.04: 112 | ``` 113 | bash <(wget --no-check-certificate -qO- 'https://git.io/JeiRm') -u 20.04 -v 64 -a 114 | ``` 115 | ### ubuntu 22.04: 116 | ``` 117 | bash <(wget --no-check-certificate -qO- 'https://git.io/JeiRm') -u 22.04 -v 64 -a 118 | ``` 119 | ### 甲骨文ARM: 120 | ``` 121 | bash <(wget --no-check-certificate -qO- 'https://git.io/JeiRm') -d 10 -v arm64 -a 122 | ``` 123 | ### CentOS系统用萌咖dd脚本出现Not Found grub.的解决方法 124 | ``` 125 | grub2-mkconfig -o /boot/grub2/grub.cfg 126 | ``` 127 | 128 | ### VPS或者独立服务器有多个网卡. 129 | ##### 例:安装debian9,网卡名称enp0s5和enp0s6,enp0s6可用. 130 | ``` 131 | bash <(wget --no-check-certificate -qO- 'https://git.io/JeiRm') -d 9 -v 64 -a -i enp0s6 132 | ``` 133 | ### VPS安装debian9并且自定义源. 134 | ``` 135 | bash <(wget --no-check-certificate -qO- 'https://git.io/JeiRm') -d 9 -v 64 -a --mirror 'http://archive.ubuntu.com/ubuntu' 136 | ``` 137 | ### VPS安装debian9无法识别IP地址并且自定义源. 138 | ``` 139 | bash <(wget --no-check-certificate -qO- 'https://git.io/JeiRm') -d 9 -v 64 -a --ip-addr x.x.x.x --ip-gate x.x.x.x --ip-mask x.x.x.x --mirror 'http://archive.ubuntu.com/ubuntu' 140 | ``` 141 | ### VPS DD方式安装windwos 7. 142 | ``` 143 | bash <(wget --no-check-certificate -qO- 'https://git.io/JeiRm') --ip-addr x.x.x.x --ip-gate x.x.x.x --ip-mask x.x.x.x -dd 'https://moeclub.org/get-win7embx86-auto' 144 | ``` 145 | 146 | 147 | ## 一些可用镜像地址: 148 | ``` 149 | # 推荐使用带有 /GoogleDrive/ 链接, 速度更快. 150 | # 当然也可以使用自己GoogleDrive中储存的镜像,使用方式: 151 | https://image.moeclub.org/GoogleDrive/ 152 | 153 | # win7emb_x86.tar.gz: 154 | https://image.moeclub.org/GoogleDrive/1srhylymTjYS-Ky8uLw4R6LCWfAo1F3s7 155 | https://image.moeclub.org/win7emb_x86.tar.gz 156 | 157 | # win8.1emb_x64.tar.gz: 158 | https://image.moeclub.org/GoogleDrive/1cqVl2wSGx92UTdhOxU9pW3wJgmvZMT_J 159 | https://image.moeclub.org/win8.1emb_x64.tar.gz 160 | ``` 161 | ## 一些提示: 162 | 163 | 特别注意: 164 | 165 | 萌咖提供的dd安装镜像 166 | 167 | 远程登陆账号为: ```Administrator``` 168 | 169 | 远程登陆密码为: ```Vicer``` 170 | 171 | 仅修改了主机名,可放心使用.(建议自己制作.) 172 | 173 | 在dd安装系统镜像时: 174 | 175 | 在你的机器上全新安装,如果你有VNC,可以看到全部过程. 176 | 177 | 在dd安装镜像的过程中,不会走进度条(进度条一直显示为0%).完成后将会自动重启. 178 | 179 | 分区界面标题一般显示为: “Starting up the partitioner“ 180 | 181 | 使用谷歌网盘中储存的镜像: [无限制大小] 获取谷歌网盘文件临时直接下载链接 182 | 183 | 在全自动安装CentOS时: 184 | 185 | 如果看到 “Starting graphical installation” 或者类似表达,则表示正在安装. 186 | 187 | 正常情况下只需要耐心等待安装完成即可. 188 | 189 | 如果需要查看进度,使用VNC Viewer(或者其他VNC连接工具) 190 | 191 | 连接提示中的IP地址:端口进行连接.(端口一般为```1```或者```5901```) 192 | 193 | -------------------------------------------------------------------------------- /wget_udeb_amd64.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyanglan/KVM-install/9a4693a18464f369edcca2d0d70a21dfc64adfb0/wget_udeb_amd64.tar.gz --------------------------------------------------------------------------------