Loading... <h2>Centos7环境下重装Centos7</h2> 先安装所需工具组件: <pre class="corepress-code-pre"><code>yum -y install wget vim lsof net-tools</code></pre> 完成后将以下代码全部复制后到ssh粘贴并回车,此方式主要是使用initrd.img和vmlinuz来运行网络VNC <pre class="corepress-code-pre"><code>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</code></pre> 上述代码完成后运行<code>Reinstall.sh</code>脚本,注意确认运行过程中要无报错 <pre class="corepress-code-pre"><code>bash /boot/Reinstall.sh</code></pre> 重启进入网络安装<strong>(注意安装完成后记得在VNC界面手动重启,详见图3</strong>) <pre class="corepress-code-pre"><code>reboot</code></pre> 等待5-20分钟后,使用Vnc Viewer连接服务器,vnc端口为1,连接密码为11223355 <h2>从DD好的Centos7系统环境下再次重装Centos7</h2> 还是要先安装所需工具组件: <pre class="corepress-code-pre"><code>yum -y install wget vim lsof net-tools</code></pre> 将以下代码全部复制后到ssh粘贴回车即可(注意这里的gpt2,有些机器可能是gpt3) <pre class="corepress-code-pre"><code>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 </code></pre> 上述代码完成后同样还是运行<code>Reinstall.sh</code>脚本,注意确认运行过程中要无报错 <pre class="corepress-code-pre"><code>bash /boot/Reinstall.sh</code></pre> 重启进入网络安装<strong>(注意安装完成后记得在VNC界面手动重启,详见图3)</strong> <pre class="corepress-code-pre"><code>reboot</code></pre> <span>等待5-20分钟后,使用Vnc Viewer连接服务器,vnc端口为1,连接密码同样还是为11223355</span> <h2>相关图片:</h2> <strong><img src="https://s3.bmp.ovh/imgs/2023/01/12/29edde5d6be3e606.png" /><img src="https://s3.bmp.ovh/imgs/2023/01/12/32fce55a54fba424.png" /></strong> <img src="https://s3.bmp.ovh/imgs/2023/01/12/826b039612e1d552.png" /> 最后修改:2024 年 02 月 21 日 © 允许规范转载 赞 如果觉得我的文章对你有用,请随意赞赏