How to remotely reinstall the CentOS system over ssh

Source: Internet
Author: User


VPS servers in foreign countries generally have control panels, and many types of systems can be installed on their own. However, some IDCs in China are relatively pitted, not only are there no panels, there is also a bunch of useless software in the original system, such as games and office, and some merchants have restrictions on the time to reinstall the system, for example, the Western Digital cloud limits the system to be reinstalled every eight hours. It is a waste of resources for websites. This method is applicable to remote reinstallation of any centos version on VPS or server over SSH. I tested that the system can be reinstalled perfectly in centos5.9 or later versions.

1. Because the common sources in China in centos are usually the latest, I use the centos source of the Chinese Emy of Sciences, which contains all the archives of centos versions. Of course, if you use a foreign VPS or server, find a foreign source, and the installation speed will be very fast.
Chinese Emy of sciences centos archive source address: http://yum.csdb.cn/vault.centos.org/
Foreign centos official Archive Source: http://vault.centos.org/
The following uses the domestic VPS to reinstall the centos5.9 system as an example:

Mkdir/centos_install
Cd/centos_install
Wget http://yum.csdb.cn/vault.centos.org/5.9/ OS /i386/images/pxeboot/initrd.img
Wget http://yum.csdb.cn/vault.centos.org/5.9/ OS /i386/images/pxeboot/vmlinuz
Cp vmlinuz/boot/vmlinuz. cent. pxe
Cp initrd. img/boot/initrd. img. cent. pxe

Centos 32-bit system is i386, 64-bit system is x86_64
2. Change the grub startup item

Vim/boot/grub. conf

# Add the following content between "hiddenmenu" and "title CentOS:
Title Centos Install (PXE)
Root (hd0, 0) kernel/vmlinuz. cent. pxe vnc vncpassword = vnc connection password headless ip = server IP netmask = subnet mask gateway = gateway dns = 8.8.8.8 ksdevice = eth0 method = http://yum.csdb.cn/vault.centos.org/5.9/ OS /i386/ lang = en_US keymap = us
Initrd/initrd. img. cent. pxe

Command for viewing the Gateway and mask:

1. ifconfig-a and cat/etc/resolv. conf (mainly View ip/netmask and dns)
2. netstat-rn
3. cat/etc/sysconfig/network
4. cat/etc/sysconfig/network-scripts/ifcfg-eth0

After the restart, use the vnc software to connect to the server IP Address: 1, and enter the vnc password you just set. Below is the normal centos system installed.
Note: If you want to install the system interface to Chinese, you can change lang = en_US lang = zh_CN.UTF-8 to see your grub. the default boot format in conf is/vmlinuz. cent. pxe or/boot/vmlinuz. cent. pxe, yes/initrd. img. cent. pxe or/boot/initrd. img. cent. pxe. In addition, you should also check whether it is root (hd0, 0) or other, as long as the default boot path in grub. conf is changed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.