One-day installation of Centos7 and the twists and turns of restoring Win7 boot later
1. Download centos 7 livecd iso
Visit image website, http://mirrors.aliyun.com/centos/7.0.1406/isos/x86_64/
Or directly download: http://mirrors.aliyun.com/centos/7.0.1406/isos/x86_64/CentOS-7.0-1406-x86_64-livecd.iso
Why select this ISO?
Because it is concise enough, some of them are basically there. For beginners, it is easier to use the graphic interface. High-end players can download other ISO files.
If it is used for Server Installation, you can also use this ISO to set it to INIT 3 after installation.
2. Create a USB boot disk
For a linux system, run the dd command.
Dd if = CentOS-7.0-1406-x86_64-livecd.iso of =/dev/sdc
Note:
The usb key created by the dd command cannot be viewed normally in WIN. But there is no problem in LINUX.
/Dev/sdc is the device name of the USB flash disk. Do not copy. You can first run the command fdisk-l to view the corresponding device name.
Do not use partition names such as/dev/sdc1, but/dev/sdc. Because it is written into the entire usb key.
For Windows, download and install the Universal-USB-Installer application. Because RHEL, FEDROA, and CENTOS are connected by blood. This program can only make live cd, which is one of the reasons why I want to select this ISO.
This application is provided in the package file on the second floor.
The following are some images that will appear during actual installation:
Note: For USB flash drive installation, we need to modify the image location.
2.2 select the first item: Install CentOS 7 and press the e key to enter the editing page.
Run vmlinuz initrd = initrd. img inst. stage2 = hd: LABEL = CentOS \ x207 \ x20x86_64 quiet
Changed to vmlinuz initrd = initrd. img inst. stage2 = hd:/dev/sdb4 quiet. Here, sdb4 is the partition where the USB flash disk is located, or it may be sdb1. You can modify it according to the actual situation (you can also use other methods) (this part is the parameter part that needs to be modified when the USB flash drive is installed on the Internet, but in fact I did not directly select the first option to complete the installation)
2.3 After modification, press Ctrl + x to perform modification. Normally, the installation interface will be displayed, such:
Select the language you want to install and click Continue, for example:
2.3.1. Time Zone Selection
If you have installed the English version, you need to change the time zone to Shanghai.
2.3.2. keyboard
The English and Chinese keyboards have the same layout !!
2.3.3. Language Support
Supports multiple languages at the same time
2.3.4. Installation source (it can be left blank by default)
The program will be automatically selected. You can manually specify it as the network location !!
2.3.5. Software selection (note)
After entering, you can see that multiple options are selected as needed, such:
Note: the installation is minimal by default, and there is no interface after installation !!!!
2.3.6 installation location (important)
I don't have it here. It comes from the network and is somewhat different from the actual situation.
1. In the local standard disk, select the local disk and USB flash disk.
2. For other storage options, select I want to configure partitions.
3. Note: at the bottom of the complete disk summary and boot program, open the boot program and choose not to add the boot program (to be added later). I don't know whether it is my problem or a common problem, first Select installation guide next step will be an error !!!, Click Finish to go to the following page.
Here, the "Bootstrap program" is a pitfall. When installing centos, you can select the partition to which the Bootstrap program is installed, but centos 7 cannot be added to the default partition, therefore, installing Centos7 will overwrite the windows MBR boot program. Therefore, it is very troublesome to add Grub boot for Windows after Centos7 is installed,
Note: We recommend that you use standard partitions. This is because LVMPV partitions cannot be mounted during grub boot, and are not recognized at all !! It is best not to use automatic creation
1. Click the plus (+) to add the swap and/Partitions respectively.
Size: swap is generally twice the memory size.
/For all the remaining space
Pay special attention to this step:
(1) When you select to automatically create a partition, the partition information cannot be updated (this may be my own problem, waiting for everyone to test)
Click Finish to return to the configuration summary page.
Note: In this case, select the installation location and select the partition not added above. Click Finish directly until the configuration interface is returned !!
2.3.6. Network and Host Name
The default network is closed. You can enable it here.
2.4. Click Start installation as follows:
During the installation process, you can set the root password and a new user (the last half of the installation cannot be changed !!) Wait for installation !!
Note: during the installation process, if the password is too simple, you need to click twice to confirm it!
So far, the installation is complete, restart, and boot is left !!!!!!!!!
Add a Windows boot program for Centos 7
There are many solutions available on the Internet: ①. Modify the Grub2 guide of Centos 7, add the Windows startup Item ②, enter PE to recover the Windows mbr boot (of course, The Grub2 Boot of Centos 7 is gone), and then use easyBCD to add the Grub2 boot solution of Centos 7 in Windows: when CentOS7 is installed, the boot program can only be the entire hard disk.
Network Solution 1:
After CentOS 7 is installed, the original Windows 7 will not appear in the startup project. After some online searches, the solution is to modify the grub. cfg file. Because CentOS 7 uses the new grub2 system, you need to enter the/boot/grub2 directory and use vim to edit the grub. cfg file. :
Declare the following Windows 7 startup Item:
### BEGIN /etc/grub.d/30_os-prober ###menuentry 'Windows 7 (loader) (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-XXX' {insmod part_msdosinsmod ntfsset root='hd0,msdos1'chainloader +1}### END /etc/grub.d/30_os-prober ###
After ### END/etc/grub. d/00_header. XXX is the UUID of your Windows 7 system partition.
After the modification, after the restart, the Windows 7 startup item can be viewed and successfully entered Windows 7. (I did this but it was not successful)
Network Solution ②:First enter the system. We can set grub2 to add the win7 startup Item.
Open the terminal, su to root,
Vi/etc/grub. d/40_custom
Add the following lines at the end
Menuentry 'win7 '{
Set root = (hd0, 1)
Chainloader + 1
} The position to be added. You can see that all the startup items start with menuentr. Just put them between two menuentries.
Reset grub2 and execute the following command:
Grub2-mkconfig-o/boot/grub2/grub. cfg
Restart the computer (follow this step, Windows boot fails): 2. After centos7 is installed, there is no win7 boot item in the boot item. Solution: Modify/boot/grub2/grub. cfg
Menuentry 'win7 '{
Insmod chain
Insmod ntfs
Set root = (hd0, msdos1)
Chainloader + 1
}
Menuentry 'win7 search '{
Insmod chain
Insmod ntfs
Search-f/ntldr -- set root
Chainloader + 1
} After you follow this step, the Windows boot fails:
Inspiration: grub2-mkconfig-o/boot/grub2/grub. cfg
Check whether an operating system exists on the local hard disk, and then generate the boot menu automatically.
You don't need to manually edit the file, and you don't have to worry about manual editing errors (in this case, the Windows boot still does not appear after the settings are restarted. What are the reasons? O! Understand that Linux can only recognize Ext3/4, fat32 format, while Windows is NTFS format disk partition, so Linux's Grub2 does not recognize the operating system on NTFS ).
Network Solution 3:
If you do not want to reinstall WIN7, we recommend that you use the original win7 installation disk to repair the win7 boot. The specific method is to prepare the original win7 installation disk (I don't know if it is not the original version, but I haven't tried it. You can try it. I don't think it's a big problem) and choose to start from the installation disk, after a specific step, select Advanced repair (do not choose to reinstall), open the command line, enter bootrec/fixmbr, and press enter to restart (if you haven't completely damaged your win7, now you should be able to enter win7), enter win7. However, note that the boot interface does not have any options for your linux version. Very simple, go to the official website (region + region/region + jugrTw1BFxvS2r8 + region + Cgo8YnI + region + CjxzdHJvbmc + region/region + tbYxvS8tL/joam8y + response/ihoyA8YnI + Cjxicj4KveK + response/response + CjEuIG1vdW50w/zB7iA8YnI + response/response + response /JnF1b3Q7ysewoizH67zM0PguLi48YnI + CiZndDsmZ3Q7Mi7F0LbPxMS49rfWx/logs = "d (LBA)
/Dev/sda3 26 4700 37544960 83 Linux
/Dev/sda4 4700 5222 4194304 82 Linux swap/Solaris
/Dev/sda5 5223 14593 75272526 7 HPFS/NTFS
Partition table entries are not in disk order
Disk/dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Sector size (logical/physical): 512 bytes/512 bytes
I/O size (minimum/optimal): 512 bytes/512 bytes
Disk identifier: 0xf0b1ebb0
Device Boot Start End Blocks Id System
/Dev/sdb1*1 2611 20972826 7 HPFS/NTFS
/Dev/sdb2 2612 19456 135307462 + f W95 Ext 'd (LBA)
/Dev/sdb5 2612 5875 26218048 + 7 HPFS/NTFS
/Dev/sdb6 5876 15539 77626048 + 7 HPFS/NTFS
/Dev/sdb7 15540 19456 31463271 7 HPFS/NTFS
........................................ ........................................ .............................
Now we enter the NTFS partition loading process. From the above view, we know that/dev/sda5 is in NTFS format;
1] create a directory for the mount point. For example, create a win1 directory under the/mnt/directory:
[Root @ localhost kalon] # mkdir/mnt/win1
2] Mount/dev/sda5 to/mnt/win1, so that if we view the/dev/sda5 disk content, we will find it in/mnt/win1;
[Root @ localhost kalon] # mount-t ntfs-3g-o nls = utf8, umask = 000/dev/sda5/mnt/win1
Note:-t ntfs indicates that the file system format is ntfs;-o is the option, nls = utf8, meaning Native Language Support (supported by local Language) is utf8, that is, the commonly used language encoding can also be changed to iocharset = utf8; the default language encoding of Fedora core 4.0 is utf8, which can display Chinese characters; umask = 000 indicates that all user groups can read and write data. However, because NTFS is not secure in Linux, it can only be read and cannot be written;
Is it mounted ?....
2. dh-lh disk usage command
> [Root @ localhost kalon] # df-lh
File System capacity in use available % mount point
/Dev/sda3 36g 4.4G 30G 13%/
Tmpfs 1012 M 1.7 M 1010 M 1%/dev/shm
/Dev/sda1 194 M 24 M 161 M 13%/boot
/Dev/sda5 72G 1.4G 71G 2%/mnt/win1
.......................... It indicates that it has been mounted. You can check it on cd/mnt/sysc, I won't say much about the rest .................................
........................................ ........................................ ........................................ ....................................
> Automatic mounting of boot partitions: place the command in/etc/fstab.
/Dev/sda5/mnt/win1ntfs-3g umask = 000, iocharset = utf8 0 0
> Cp-r-f srcDir dstDir // copy the directory file
> Rm-rf dstDir // Delete the directory file
>> .......
2. umount command
To detach a mounted directory or drive letter, run the following command:
[Root @ localhost kalon] # umount/mnt/win1