1517 字
8 分钟
Oracle的Centos7重装为Centos7
2020-04-16

此为甲骨文原生 Centos7系统专用! 2022年 6月 18日 测试: CentOS-7-2022.05.30-0镜像 正常重装

Centos7重装#

首次从 C7重装为 C7#

将以下代码全部复制后到 ssh 粘贴回车即可

主要是使用initrd.imgvmlinuz来运行网络 VNC

yum -y install wget vim lsof net-tools
cat << EOF >/boot/Reinstall.sh
#!/bin/bash
rm -rf /boot/initrd77.img /boot/vmlinuz77
wget -P /boot/ http://vault.centos.org/7.2.1511/os/x86_64/images/pxeboot/initrd.img -O /boot/initrd77.img
wget -P /boot/ http://vault.centos.org/7.2.1511/os/x86_64/images/pxeboot/vmlinuz -O /boot/vmlinuz77
cat << EOFEOF>/etc/grub.d/40_custom
#!/bin/sh
exec tail -n +3 \\$0
menuentry VNCInstallCentos7 {
set root='(hd0,gpt3)'
linuxefi /boot/vmlinuz77 inst.vnc inst.vncpassword=11223355 inst.headless ip=dhcp nameserver=114.114.114.114 inst.repo=http://vault.centos.org/7.2.1511/os/x86_64/ inst.lang=en_US inst.keymap=us
initrdefi /boot/initrd77.img
}
EOFEOF
#sed -i 's/GRUB_DEFAULT=saved/g' /etc/default/grub
grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
grub2-reboot VNCInstallCentos7
EOF
bash /boot/Reinstall.sh
#确认上面代码执行无报错后,重启进入网络安装
reboot

请注意!

/boot/efi/EFI/centos/grub.cfg

有的是

/boot/efi/EFI/redhat/grub.cfg

等待网络核心启动完成,然后用 vnc 连接机器 IP:1密码为 11223355

再次从 C7重装为 C7#

将以下代码全部复制后到 ssh 粘贴回车即可(注意这里的 gpt2,有些机器可能是 gpt3)

yum -y install wget vim lsof net-tools
cat << EOF >/boot/Reinstall.sh
#!/bin/bash
rm -rf /boot/initrd77.img /boot/vmlinuz77
wget -P /boot/ http://vault.centos.org/7.2.1511/os/x86_64/images/pxeboot/initrd.img -O /boot/initrd77.img
wget -P /boot/ http://vault.centos.org/7.2.1511/os/x86_64/images/pxeboot/vmlinuz -O /boot/vmlinuz77
cat << EOFEOF>/etc/grub.d/40_custom
#!/bin/sh
exec tail -n +3 \\$0
menuentry VNCInstallCentos7 {
set root='(hd0,gpt2)'
linuxefi /vmlinuz77 inst.vnc inst.vncpassword=11223355 inst.headless ip=dhcp nameserver=114.114.114.114 inst.repo=http://vault.centos.org/7.2.1511/os/x86_64/ inst.lang=en_US inst.keymap=us
initrdefi /initrd77.img
}
EOFEOF
#sed -i 's/GRUB_DEFAULT=saved/g' /etc/default/grub
grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
grub2-reboot VNCInstallCentos7
EOF
bash /boot/Reinstall.sh
#确认上面代码执行无报错后,重启进入网络安装
reboot

等待网络核心启动完成,然后用 vnc 连接机器 IP:1密码为 11223355

从原生 Linux 系统重装为 C7#

将以下代码全部复制后到 ssh 粘贴回车即可

yum -y install wget vim lsof net-tools
cat << EOF >/boot/Reinstall.sh
#!/bin/bash
rm -rf /boot/initrd77.img /boot/vmlinuz77
wget -P /boot/ http://vault.centos.org/7.2.1511/os/x86_64/images/pxeboot/initrd.img -O /boot/initrd77.img
wget -P /boot/ http://vault.centos.org/7.2.1511/os/x86_64/images/pxeboot/vmlinuz -O /boot/vmlinuz77
cat << EOFEOF>/etc/grub.d/40_custom
#!/bin/sh
exec tail -n +3 \\$0
menuentry VNCInstallCentos7 {
set root='(hd0,gpt3)'
linuxefi /boot/vmlinuz77 inst.vnc inst.vncpassword=11223355 inst.headless ip=dhcp nameserver=114.114.114.114 inst.repo=http://vault.centos.org/7.2.1511/os/x86_64/ inst.lang=en_US inst.keymap=us
initrdefi /boot/initrd77.img
}
EOFEOF
#sed -i 's/GRUB_DEFAULT=saved/g' /etc/default/grub
grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
grub2-reboot VNCInstallCentos7
EOF
bash /boot/Reinstall.sh
#确认上面代码执行无报错后,重启进入网络安装
reboot

等待网络核心启动完成,然后用 vnc 连接机器 IP:1密码为 11223355

Win7#

  • 此 DD 包仅适用于 Oracle 甲骨文 Ubuntu DD Win 使用

说明:Oracle 是采用 UEFI 启动,普通 DD 包均不支持 UEFI 启动

DD Windows 7 64位旗舰精简版 Oracle 甲骨文专用 [账户 Administrator 密码 www.nat.ee\]

Terminal window
apt-get install -y xz-utils openssl gawk file
wget --no-check-certificate -qO InstallNET.sh 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh' && bash InstallNET.sh -dd 'https://api.moeclub.org/GoogleDrive/1NHKdm3xfQ3HySNCGvrzgdz7RMVCI1qGy'

Debian#

甲骨文云 / Oracle Cloud DD Debian 10/11

https://github.com/bohanyang/debi

暂不支持 Oracle Linux 作为原系统。创建新机器时请选择 Ubuntu 20.04或 18.04系统模板。

Terminal window
# 登录名:root,密码:Kot6qKWr8K3bS7pKno,可自行修改
curl -fLO https://raw.githubusercontent.com/bohanyang/debi/master/debi.sh && chmod a+rx debi.sh
./debi.sh --cdn --network-console --ethx --bbr --user root --password Kot6qKWr8K3bS7pKno
  • --bbr 开启 BBR
  • --ethx 网卡名称使用传统形式,如 eth0 而不是 ens3
  • --cloud-kernel 安装占用空间较小的 cloud 内核,但可能会导致 UEFI 启动的机器(如 Oracle、Azure 及 Hyper-V、Google Cloud 等)VNC 黑屏。BIOS 启动的普通 VPS 则没有此问题。
  • 默认使用 Debian 官方 CDN 镜像源(deb.debian.org),添加 --china 可使用阿里云镜像源。

如果没有报错可以重启:

Terminal window
# 执行重启,开始 DD Debian 11
shutdown -r now

约 30秒后可以尝试 SSH 登录 installer 用户名,密码与之前设置的相同。如果成功连接,可以按 Ctrl-A 然后再按 4监控安装日志。安装完成后会自动重启进入新系统。

萌咖一键网络重装为 debian9+/ubuntu16.04+

重装后 SSH 登录,用户名 root, 密码:MoeClub.org

Terminal window
#先切换到root权限
sudo -i
运行:
#Debian/Ubuntu:
apt-get update
#RedHat/CentOS:
yum update
#确保安装了所需软件:
#Debian/Ubuntu:
apt-get install -y xz-utils openssl gawk file
#RedHat/CentOS:
yum install -y xz openssl gawk file
#下载及说明:
wget --no-check-certificate -qO InstallNET.sh 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh' && chmod a+x InstallNET.sh
Usage:
bash InstallNET.sh -d/--debian [dist-name]
-u/--ubuntu [dist-name]
-c/--centos [dist-version]
-v/--ver [32/i38664/amd64]
--ip-addr/--ip-gate/--ip-mask
-apt/-yum/--mirror
-dd/--image
-a/-m
# dist-name: 发行版本代号
# dist-version: 发行版本号
# -apt/-yum/--mirror : 使用定义镜像
# -a/-m : 询问是否能进入VNC自行操作. -a 为不提示(一般用于全自动安装), -m 为提示.
#安装debian9 (-firmware 额外驱动支持)
bash <(wget --no-check-certificate -qO- 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh') -d 9 -v 64 -a -firmware
#安装debian9 (-firmware 额外驱动支持)(阿里云镜像)
bash <(wget --no-check-certificate -qO- 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh') -d 9 -v 64 -a -firmware --mirror 'http://mirrors.aliyun.com/debian/'
#安装ubuntu16.04 (-firmware 额外驱动支持)
bash <(wget --no-check-certificate -qO- 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh') -u 16.04 -v 64 -a -firmware
#安装ubuntu18.10 (-firmware 额外驱动支持)
bash <(wget --no-check-certificate -qO- 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh') -u 18.10 -v 64 -a -firmware
#备用
https://www.ucblog.net/shell/InstallNET.sh

Debian-ARM#

甲骨文云 / Oracle Cloud 新配额 ARM DD Debian 10/11

https://github.com/bohanyang/debi

暂不支持 Oracle Linux 作为原系统。创建新机器时请选择 Ubuntu 20.04或 18.04系统模板。

Terminal window
# 登录名:root,密码:Kot6qKWr8K3bS7pKno,可自行修改
curl -fLO https://raw.githubusercontent.com/bohanyang/debi/master/debi.sh && chmod a+rx debi.sh
./debi.sh --cdn --network-console --bbr --ethx --architecture arm64 --user root --password Kot6qKWr8K3bS7pKno
  • --bbr 开启 BBR
  • --ethx 网卡名称使用传统形式,如 eth0 而不是 ens3
  • --cloud-kernel 安装占用空间较小的 cloud 内核,但可能会导致 UEFI 启动的机器(如 Oracle、Azure 及 Hyper-V、Google Cloud 等)VNC 黑屏。BIOS 启动的普通 VPS 则没有此问题。
  • 默认使用 Debian 官方 CDN 镜像源(deb.debian.org),添加 --china 可使用阿里云镜像源。

如果没有报错可以重启:

Terminal window
# 执行重启,开始 DD Debian 11
shutdown -r now

约 30秒后可以尝试 SSH 登录 installer 用户名,密码与之前设置的相同。如果成功连接,可以按 Ctrl-A 然后再按 4监控安装日志。安装完成后会自动重启进入新系统。

Centos7开启 bbr#

作者测试成功的方法,供大家参考

Terminal window
wget https://elrepo.org/linux/kernel/el7/x86_64/RPMS/kernel-ml-5.18.5-1.el7.elrepo.x86_64.rpm
yum install -y ./kernel-ml-5.18.5-1.el7.elrepo.x86_64.rpm
# 重新创建内核配置
grub2-mkconfig -o /boot/grub2/grub.cfg
# 查看系统中已有内核:
awk -F\\' \'$1==menuentry {print i++ : $2}\' /boot/grub2/grub.cfg
# 调整默认内核
grub2-set-default 0
# 开启BBR+fq
echo net.core.default_qdisc=fq >> /etc/sysctl.conf
echo net.ipv4.tcp_congestion_control=bbr >> /etc/sysctl.conf
# 关闭selinux
vi /etc/sysconfig/selinux
SELINUX=disabled
# 重启
reboot
# 然后查看bbr状态
lsmod grep bbr
sysctl net.ipv4.tcp_available_congestion_control
#------------------------------------------------------------
# 显示所有内核
rpm -qa grep kernel
# 最后,删除不能启动的内核以及旧内核
yum remove kernel-ml-5.5.7-1.el7.elrepo.x86_64
yum remove kernel-3.10.0-327.el7.x86_64
# 清理之后可能需要重新创建内核配置
grub2-mkconfig -o /boot/grub2/grub.cfg
# 其他
# 开启BBR+cake
echo net.core.default_qdisc=cake >> /etc/sysctl.conf
echo net.ipv4.tcp_congestion_control=bbr >> /etc/sysctl.conf
# 然后查看bbr状态
sysctl net.ipv4.tcp_available_congestion_control

error#

  • Error, Not found interfaces config.
Terminal window
mkdir /etc/network/interfaces.d
echo # This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug ens3
iface ens3 inet dhcp
> /etc/network/interfaces