Install CentOS 5.4 _ x86_64 on a USB flash drive to the server

Source: Internet
Author: User

When I buy a server, the supplier gives me an 8 gb usb flash drive. So I want to use this USB flash drive as a centos installation disk. The main benefits of this operation are as follows: it takes a long time to store the data disk (it becomes dirty after a period of time for the DVD disk to be placed, and it is not easy to install the system. I have learned a bitter lesson !) Fast installation speed and easy-to-use (compared with network installation, tftp and nfs are not required ).

Disk naming rules

The server's own hard disk is regarded as sda, and the USB flash disk is regarded as sdb. This should be clarified.

 

Before installation

Installation is easy, not to mention automatic installation. The work that needs to be done before installation is troublesome and prone to problems. Therefore, we will describe this process with a lot of space here.

(1) prepare the required software. Package the centos image (dvd.exe file and the syslinux.exe file in windows. Of course, you can directly use syslinuxon the Linux system, and use syslinuxon the Linux system as a boot tool to change syslinux.exe on Windows. Where is the problem? After executing syslinux-s/dev/sda1, You need to perform dd operations.

(2) Prepare two operating systems: one windows and one linux. windows for boot-write mbr and ldlinux. sys. linux for partition creation and file copy.

(3) perform the following operations on linux:

1. Download The centos image file. This file is very large, and a complete dvd image is downloaded online (such as a file ),

2. Mount the image file so that we can use the directory in the image file. Mount-o loop/path/CentOS-5.4_x86_64bin-DVD.iso/mnt/ios, execute the command cd/mnt/iso, you can view the Directory and its files like browsing the dvd disc.

3. Insert the USB flash disk into the linux server and run fdisk-l to check whether it is identified. In my system, it is identified as/dev/sdb.

(1) create two partitions. The command used is # fdisk/dev/sdb,

D # delete existing partition-repeat as necessary
N # new partition
P # primary
1 # partition number
<Enter> # take the default
+ 100 m # add 100 MB
T # change the type
1 # partition number
B # VFAT
N # new partition
P # primary
2 # partition number
<Enter> # take the default
<Enter> # take the default
A # toggle bootable flag
1 # partition number
W # write to disk


Shocould look something like this when done:
Disk/dev/sdb: 7948 MB, 7948206080 bytes
81 heads, 10 sectors/track, 19165 cylinders
Units = cylinders of 810*512 = 414720 bytes
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/Dev/sdb1*1 65 26320 B W95 FAT32
/Dev/sdb2 66 19165 7735500 83 Linux

(2) After creating a partition, you need to create a file system on it. This is not difficult. Its command is nothing more than # mkfs. msdos/dev/sdb1; mkfs. ext2/dev/sdb2: After successful execution, a dos partition and an ext2 partition are generated. Note that the ext2 file system is not ext3, because syslinux seems to be only friendly to dos and ext2 file systems.

(3) connect the two partitions to the linux system. The Mounted Directories I use are/mnt/usb1 and/mnt/usb2.

(4) Copy directories and files.

Cd/mnt/usb1
Cp-rv/mnt/ios/isolinux syslinux
Mv syslinux/isolinux. cfg syslinux/syslinux. cfg
Umount/mnt/ios

Copy a dvd Image File
Cp/path/CentOS-5.4_x86_64bin-DVD.iso/mnt/usb2

(4) perform operations on windows

Download a syslinux.exe

Insert the USB flash disk into windows. Assume It is an H disk.

Enter command prompt

H:

Syslinux.exe-m H:

Syslinux.exe-a H:

Syslinux.exe-s H:

Then you can install the new machine.

Note: When formatting the partition, do not select the USB flash disk. During the system installation process, you can rewrite the USB flash disk. You will not be able to install it next time. In addition, when partitioning a hard disk, You need to select the check, so that you can select the location where the grub is located.

If there are multiple hard disks and other linux instances have been installed, grub error 15 and other errors may occur if not all the partitions are formatted. The solution is to delete and format all partitions, and you must install the boot program on the MBR of the disk where you want to install the system. (In the case of multiple disks, a single MBR option may need to change the boot sequence)

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.