写这个的目的是记录下自己装centOS的过程,回顾+总计,也是为了给哪些正在因装不上Linux而困惑的同学们一点点参考。


第一次装Linux


第一次装Linux是在VMWare进行的,系统用的是redhat9.0这个没什么说的,我想大家都会,即使不会,网上教程也是一大把。


第二次装Linux


经过一段时间的摸索,开始打算装一个实实在在的Linuxdistribution选的是:centOS6.486_64台式机:WIN764系统,打算双系统。


原理如果ISO小于4G的话,直接用ultraISOISO写到U盘里面,再把ISOcopy进去就好了。但是DVD版的ISO往往又大于4G,

windowsLinux都识别的VFAT文件系统最大只能容纳4G以下的ISO,别给我说NTFS由于害怕和windows的纷争,大部分Linux安装程序都不

识别NTFS所以问题的关键就是创建一个可以容纳大于4G的文件系统,并且被Linux安装程序识别那么Linux下的ext2/ext3/ext4都可以

由于ext3只比ext2多加一个日志的功能ext4还没关注过,而且创建ext2要比ext3快很多,所以最优选择:ext2


安装过程中可能会出现的一些问题:

A:U盘安装有个问题,就是安装程序可能会卡在进入安装时的那界面,这个和你ISO安装程序载入的kernel和你的U有一定的关系。我就是被

这个坑了安装了2个星期就有1个半星期花在U盘安装上面,U盘一会卡能安装,一会又卡在安装画面,恨死了

B:安装完后不能进入Windows 系统,因为我有2个硬盘,我又不想我WIN7坏了时,重装WIN7时把bootloader覆盖掉,所以我的WIN7 安装在ST 500G 上面

GRUBCentOS装在 TOSHIBA1T 上面。 在这种情况下如果出现windows引导不了 的话 ,很有可能时 BIOS   在装Linux时 识别的 硬盘  和装完启动识别的

硬盘的设备编号 不一样导致。 你可以查看:/boot/grub/device.map  

例如:hd0   sda

hd1   sdb

着情况下更改 device.map 是不够的 ,需要 从新map 设备编号。

例如:title windows  2003

  map (hd1) (hd0)

  map (hd0) (hd1)

rootnoverify(hd1,0)

  savedefalt

  chainloader +1

  makeactive

上面2map的意义是: 交换磁盘编号hd1 换成hd0  hd0 换成hd1




安装

工具:Ext2Fsd-0.51 :在windows下挂载并且读写ext2分区

ParagonPartitionManager-v9.1:在windows下划分 ext2分区

UltraISO:在windows下制作安装引导。


CentOS DVD1 里面的package 删除,这个文件有3.8G,我们用不着,我们只引导。然后 将 ISO 写入硬盘镜像。

ParagonPartitionManager-v9.1在你的磁盘上面分割出一个10G大小空间,然后格式化成ext2

Ext2Fsd-0.51将你 分割出来的 盘挂载上去。

最后直接将镜像 copy 进去。


当系统安装到让你选择镜像所在位置时,选择你才镜像所在的ext2,如果你往了你也可以一个个的试,更可以切换到 控台:Ctrl+alt+F3  好像是哈  要不就F4之类的。 切到控台后执行:fdisk –l  自己看看就知道了。


我是这样安装成功的。


第三次装Linux


注意:

经过多次查看资料,找到了自己在制作U盘启动时失败的重要原因:VFAT分区未激活。关于激活这个步骤在大多数教程里都没要讲到 ,自己傻呼呼的 没注意,被坑了。

你可以找个虚拟机来拥有Linux 环境。

工具:8GU盘     Linux下的syslinux     Linux作业系统。


安装:

1.检查U


[root@localhostDesktop]# fdisk -l




Disk/dev/sdb: 1000.2 GB, 1000204886016 bytes


255heads, 63 sectors/track, 121601 cylinders


Units= cylinders of 16065 * 512 = 8225280 bytes


Sectorsize (logical/physical): 512 bytes / 4096 bytes


I/Osize (minimum/optimal): 4096 bytes / 4096 bytes


Diskidentifier: 0x00097a54




DeviceBoot      Start         End      Blocks   Id  System


/dev/sdb1  *           1          64      512000   83  Linux


Partition1 does not end on cylinder boundary.


/dev/sdb2             64       25561   204800000   83  Linux


/dev/sdb3          25561       51057   204800000   83  Linux


/dev/sdb4          51057      121602   566648832    5  Extended


/dev/sdb5          51057       57432    51200000   83  Linux


/dev/sdb6          57432       57687     2048000   82  Linux swap / Solaris


/dev/sdb7          57687       67885    81920000   83  Linux


/dev/sdb8          67885       74260    51200000    6  FAT16


/dev/sdb9          74260       80634    51200000   83  Linux


/dev/sdb10         80634       83184    20480000   83  Linux




Disk/dev/sda: 500.1 GB, 500107862016 bytes


255heads, 63 sectors/track, 60801 cylinders


Units= cylinders of 16065 * 512 = 8225280 bytes


Sectorsize (logical/physical): 512 bytes / 4096 bytes


I/Osize (minimum/optimal): 4096 bytes / 4096 bytes


Diskidentifier: 0x3fd214ec




DeviceBoot      Start         End      Blocks   Id  System


/dev/sda1  *           1        7833    62918541    7  HPFS/NTFS


Partition1 does not start on physical sector boundary.


/dev/sda2           7834       60801   425465460    f  W95 Ext'd (LBA)


Partition2 does not start on physical sector boundary.


/dev/sda5           7834       33943   209728543+   7  HPFS/NTFS


/dev/sda6          33944       47390   108012996    7  HPFS/NTFS


Partition6 does not start on physical sector boundary.


/dev/sda7          47391       60801   107723826    7  HPFS/NTFS


Partition7 does not start on physical sector boundary.




Disk/dev/sdc: 31.2 GB, 31214010368 bytes


255heads, 63 sectors/track, 3794 cylinders


Units= cylinders of 16065 * 512 = 8225280 bytes


Sectorsize (logical/physical): 512 bytes / 512 bytes


I/Osize (minimum/optimal): 512 bytes / 512 bytes


Diskidentifier: 0xcad4ebea




DeviceBoot      Start         End      Blocks   Id  System


/dev/sdc4  *           1        3795    30482400+   c  W95 FAT32 (LBA)


我的U盘: /dev/sdc:31.2G


2.删除旧分区,建立新分区:ext&  FAT32


[root@localhostDesktop]# fdisk/dev/sdc




WARNING:DOS-compatible mode is deprecated. It's strongly recommended to


switchoff the mode (command 'c') and change display units to


sectors(command 'u').




Command(m for help): d


Selectedpartition 4




Command(m for help): p




Disk/dev/sdc: 31.2 GB, 31214010368 bytes


255heads, 63 sectors/track, 3794 cylinders


Units= cylinders of 16065 * 512 = 8225280 bytes


Sectorsize (logical/physical): 512 bytes / 512 bytes


I/Osize (minimum/optimal): 512 bytes / 512 bytes


Diskidentifier: 0xcad4ebea




DeviceBoot      Start         End      Blocks   Id  System




Command(m for help): n


Commandaction


e  extended


p  primary partition (1-4)


p


Partitionnumber (1-4): 1


Firstcylinder (1-3794, default 1):


Usingdefault value 1


Lastcylinder, +cylinders or +size{K,M,G} (1-3794, default 3794): +10G




Command(m for help):n


Commandaction


e  extended


p  primary partition (1-4)


p


Partitionnumber (1-4):


Valueout of range.


Partitionnumber (1-4):


Valueout of range.


Partitionnumber (1-4): 2


Firstcylinder (1307-3794, default 1307):


Usingdefault value 1307


Lastcylinder, +cylinders or +size{K,M,G} (1307-3794, default 3794):


Usingdefault value 3794




Command(m for help):p




Disk/dev/sdc: 31.2 GB, 31214010368 bytes


255heads, 63 sectors/track, 3794 cylinders


Units= cylinders of 16065 * 512 = 8225280 bytes


Sectorsize (logical/physical): 512 bytes / 512 bytes


I/Osize (minimum/optimal): 512 bytes / 512 bytes


Diskidentifier: 0xcad4ebea




Device Boot      Start         End     Blocks   Id  System


/dev/sdc1              1        1306    10490413+  83  Linux


/dev/sdc2           1307        3794    19984860   83  Linux



Command(m for help): w


Thepartition table has been altered!




Callingioctl() to re-read partition table.




WARNING:Re-reading the partition table failed with error 16: Device orresource busy.


Thekernel still uses the old table. The new table will be used at


thenext reboot or after you run partprobe(8) or kpartx(8)


Syncingdisks


[root@localhostDesktop]#partprobe


Warning:WARNING: the kernel failed to re-read the partition table on /dev/sdb(Device or resource busy).  As a result, it may not reflect all ofyour changes until after reboot.


又忘了激活分区了,下面激活分区。


[root@localhostDesktop]# fdisk/dev/sdc




WARNING:DOS-compatible mode is deprecated. It's strongly recommended to


switchoff the mode (command 'c') and change display units to


sectors(command 'u').




Command(m for help): p




Disk/dev/sdc: 31.2 GB, 31214010368 bytes


255heads, 63 sectors/track, 3794 cylinders


Units= cylinders of 16065 * 512 = 8225280 bytes


Sectorsize (logical/physical): 512 bytes / 512 bytes


I/Osize (minimum/optimal): 512 bytes / 512 bytes


Diskidentifier: 0xcad4ebea




DeviceBoot      Start         End      Blocks   Id  System


/dev/sdc1              1        1306    10490413+  83  Linux


/dev/sdc2           1307        3794    19984860   83  Linux




Command(m for help):a


Partitionnumber (1-4):1




Command(m for help):p




Disk/dev/sdc: 31.2 GB, 31214010368 bytes


255heads, 63 sectors/track, 3794 cylinders


Units= cylinders of 16065 * 512 = 8225280 bytes


Sectorsize (logical/physical): 512 bytes / 512 bytes


I/Osize (minimum/optimal): 512 bytes / 512 bytes


Diskidentifier: 0xcad4ebea




DeviceBoot      Start         End      Blocks   Id  System


/dev/sdc1  *           1        1306    10490413+  83  Linux


/dev/sdc2           1307        3794    19984860   83  Linux






3.格式化分区成fat32/ext2

[root@localhostDesktop]#mkfs.vfat -n boot /dev/sdc1


[root@localhostDesktop]# mkfs.ext2-L data /dev/sdc2


3.制作引导:/boot

1.把镜像里面的p_w_picpathisolinux copy VFAT分区下,你可以选择在windows下用 用我上面说的 “第二次安装” 来直接把  p_w_picpathisolinux 放到你的FAT分区下,也可以在linux下进行 copy,我就直接用 linuxcopy

2.挂载镜像,我的镜像在/tmp/CentOS-6.4-x86_64-bin-DVD1.iso


[root@localhostiso]# mkdir/mnt/iso

[root@localhostmnt]# mount-t iso9660 -o loop /tmp/CentOS-6.4-x86_64-bin-DVD1.iso /mnt/iso

[root@localhostmnt]#ls


boot iso  data


[root@localhostmnt]# cd iso


[root@localhostiso]# ls


CentOS_BuildTag isolinux                  RPM-GPG-KEY-CentOS-Debug-6


EFI             Packages                  RPM-GPG-KEY-CentOS-Security-6


EULA            RELEASE-NOTES-en-US.html  RPM-GPG-KEY-CentOS-Testing-6


GPL             repodata                  TRANS.TBL


p_w_picpaths          RPM-GPG-KEY-CentOS-6


[root@localhost~]# mount/dev/sdc1 /mnt/boot


[root@localhost~]#cd /mnt/iso


[root@localhostiso]#ls


CentOS_BuildTag isolinux                  RPM-GPG-KEY-CentOS-Debug-6


EFI             Packages                  RPM-GPG-KEY-CentOS-Security-6


EULA            RELEASE-NOTES-en-US.html  RPM-GPG-KEY-CentOS-Testing-6


GPL             repodata                  TRANS.TBL


p_w_picpaths          RPM-GPG-KEY-CentOS-6

[root@localhostiso]#cp -a isolinux/ /mnt/boot

[root@localhostiso]# cp-a p_w_picpaths/ /mnt/boot

[root@localhostiso]# ls/mnt/boot


p_w_picpaths isolinux



使用syslinux工具将U盘的/dev/sdb1分区制作成启动盘,如果系统中没有安装syslinux工具,yuminstallsyslinux安装一下。

这个工具也有windows版本的,我这里就只示范用linux版的了。

[root@localhostiso]#yuminstallsyslinux


Loaded plugins: fastestmirror,refresh-packagekit, security


Loading mirror speeds from cachedhostfile


*base:mirrors.btte.net


*extras:mirrors.btte.net


*updates:mirrors.btte.net


Setting up Install Process


Package syslinux-4.02-8.el6.x86_64already installed and latest version


Nothing to do


这个说明我已经安装好了。

[root@localhostiso]#syslinux--stupid/dev/sdc1


[root@localhostiso]#ls/mnt/boot


p_w_picpaths isolinux  ldlinux.sys



有了上面3个文件U盘安装盘boot部分就做好了。


3.制作引导:/data

data部分的制作方法很多,在windows下面可以用“第二种安装”里面的方法和工具 直接将ISOcopy 进去。在linux下也一样,但是你得等个半个多小时才能copy完,我是等不了的,直接用windowscopy 几分钟就搞定。


[root@localhostiso]#mount /dev/sdc2 /mnt/data


[root@localhostiso]# cp/tmp/CentOS-6.4-x86_64-bin-DVD1.iso /mnt/dat

[root@localhostiso]# cp/tmp/CentOS-6.4-x86_64-bin-DVD2.iso /mnt/dat