使用SSH远程重装CentOS

2015年8月28日17:16:29 评论 8,197

前段时间看了一篇文章写的是通过ssh远程重装Centos,于是最近自己试验了下还是挺方便的。不过前提是机器还能ssh连上,如果ssh连不上那就然并卵了。

缺点:

1、对带宽要求较高,如果服务器带宽小的话.重装需要很长时间10M带宽重装时间大概是在20分钟左右;

2、对于定制系统还没有找到更好的方法

首先,选择适合服务器线路的CentOS源(自己有源库也可以用自己的),国内网易、阿里云都还不错,这里以网易为例,选择适合自己的版本.32位x86,64位的是x86_64,http://mirrors.163.com/centos/7/os/

其次,下载必要的文件,以Centos 7 64位为例,

mkdir /centos_install
cd /centos_install
wget http://mirrors.163.com/centos/7/os/x86_64/images/pxeboot/initrd.img
wget http://mirrors.163.com/centos/7/os/x86_64/images/pxeboot/vmlinuz
cp vmlinuz /boot/vmlinuz.cent.pxe
cp initrd.img /boot/initrd.img.cent.pxe

再次,更改grub启动项

vim /boot/grub/grub.conf
#在"hiddenmenu" 和 "title CentOS..." 增加一项:
#method中的url为安装centos的源
title Centos Install (PXE) 
    root (hd0,0) kernel /vmlinuz.cent.pxe vnc vncpassword=vnc连接密码 headless ip=服务器IP netmask=子网掩码 gateway=网关 dns=223.5.5.5 ksdevice=eth0 method=http://mirrors.163.com/centos/7/os/x86_64/ lang=en_US keymap=us 
    initrd /initrd.img.cent.pxe

最后,重启后使用vnc软件连接服务器IP:1,并输入刚刚设置的vnc密码即可进行centos的重装

weinxin
聂扬帆博客
一个分享IT运维相关工作经验和实战技巧的个人博客

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: