"Linux Micro Jobs" in week six

Source: Internet
Author: User

Please describe in detail the start-up process of the CentOS system (detailed to what each process system does)

1) power-on self-test, BIOS boot-boot phase, implement hardware initialization and find boot media in the process, Load Boot Manager (GRUB) from MBR and run the boot-boot management; 2) GRUB boot boot stage; load Stage1 load stage1.5 Mount Stage2 reads the/boot/grub.conf file and displays the boot menu, loads the selected kernel and INITRD files into memory 3) kernel phase: Run kernel boot parameters, unzip the initrd file and mount the Initd file system , mount the required drive, mount the root file system 4) INIT user space initialization phase: Start the/sbin/init program, run the Rc.sysinit script, set the system environment, start the swap partition, check and mount the file system, read the/etc/inittab Files, run service initialization scripts at different runlevel defined in/ET/RC.D/RC<#>.D; open character Terminal 1-6 Console/Open graphical display management, set login

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/8D/E6/wKioL1iusbeBZjMiAAJXyFhVDVg036.png-wh_500x0-wm_ 3-wmp_4-s_2553773522.png "title=" 1.png "alt=" Wkiol1iusbebzjmiaajxyfhvdvg036.png-wh_50 "/>

Second, add a new piece of hardware to the CentOS 6 running on the virtual machine, and provide two primary partitions;

(1) Create a new two primary partition for the hard disk, and install grub for it;

(2) Provide kernel and RAMDisk files for the first primary partition of the hard disk, and provide rootfs for the second partition;

(3) for Rootfs to provide bash, LS, cat programs and the library files that depend on;

(4) Provide the configuration file for grub;

(5) The new hard disk is set as the first boot item and can start the target host normally;

[10:45:49 [email protected]_s ~]# fdisk /dev/sdc          #为新硬盘新建两个主分区Device  contains neither a valid dos partition table ,  nor sun, sgi or osf disklabelbuilding a new dos disklabel  with disk identifier 0xb29dae4d. changes will remain in memory only, until you decide to  Write them. After that, of course, the previous content won ' t be recoverable. warning: invalid flag 0x0000 of partition table 4 will be  Corrected by w (rite) warning: dos-compatible mode is deprecated. it ' s  strongly recommended to         switch off  the mode  (command  ' C ')  and change display units to         sectors  (command  ' U '). command  (m for help):  ncommand action   e   extended    p   primary partition  (1-4) ppartition number  (1-4):  1first cylinder  (1-2610, default 1): using default value 1last  cylinder, +cylinders or +size{k,m,g}  (1-2610, default 2610):  +10GCommand   (M&NBSP;FOR&NBSP;HELP): ncommand action   e   extended    p   primary partition  (1-4) ppartition number  (1-4):  2first  cylinder  (1307-2610, default 1307):  using default value 1307last  cylinder, +cylinders or +size{K,M,G}  (1307-2610, default 2610):  using  default value 2610command  (M&NBSP;FOR&NBSP;HELP): wthe partition table has been  altered! Calling ioctl ()  to re-read partition table. Syncing disks. [10:58:53 [email protected]_s ~] #mkfs  -t ext4 /dev/sdc1[10:58:53 [email  protected]_s ~] #mkfs  -t ext4 /dev/sdc2[11:09:31 [email protected]_s ~ ] #mkdir  /mnt/{boot,sysroot}[11:09:33 [email protected]_s ~] #mount  /dev/sdc1 /mnt /boot/[11:10:03 [email protected]_s ~] #mount  /dev/sdc2 /mnt/sysroot/[11:26:36 [ Email protected]_s ~] #cp  /boot/vmlinuz-2.6.32-431.el6.x86_64 /mnt/boot/[11:26:37 [ Email protected]_s ~] #cp  /boot/initramfs-2.6.32-431.el6.x86_64.img /mnt/boot/[11:28:52  [email protected]_S ~]# vim /mnt/boot/grub/grub.conf          #新建一个  grub  ConfigurationFile default=0timeout=15title centos6.5 homemakeroot  (hd0,0) kernel / vmlinuz-2.6.32-431.el6.x86_64 ro root=/dev/sdc2 selinux=0 init=/bin/bashinitrd / Initramfs-2.6.32-431.el6.x86_64.img[11:31:29 [email protected]_s ~] #mkdir  -p /mnt/ Rootfs/{bin,lib64}[11:31:30 [email protected]_s ~] #cp  -r /bin/{bash,ls,cat} /mnt /rootfs/bin/         #复制bash, Ls,cat, dependent library files          [11:31:36 [email protected]_s ~] #cp  $ (ldd /bin/bash |  awk  ' $3~/^\/lib64/{print $3} ')  /mnt/rootfs/lib64/#[11:31:42 [email protected]_s  ~] #cp  $ (ldd /bin/ls | awk  ' $3~/^\/lib64/{print $3} ')  /mnt/rootfs/ Lib64/[11:31:54 [email protected]_s ~] #cp  $ (ldd /bin/cat | awk  ' $3~/^\ /LIB64/{PRINT&NBSP;$3} ')  /mnt/rootfs/lib64/restart server settingBooting from SDC into the system 


Third, make a kickstart file and a boot image. Describe its process.

[16:27:10 [email protected]_s ~] #cat  myks.cfg # Kickstart file  Automatically generated by anaconda. #version =DEVELINSTALLCDROMLANG&NBSP;ZH_CN. utf-8keyboard usnetwork --onboot no --device eth0 --bootproto dhcp -- noipv6rootpw  --iscrypted $6$we6z2youllzqleqq$97ev7j9sgwmi0p5hrj79nccpgypxqiqxsixn69puisja/ bmny92sfl7qobf2w4ies79nm.c0ii5acdvqwocft/firewall --service=sshauthconfig --enableshadow -- Passalgo=sha512selinux --enforcingtimezone --utc asia/shanghaibootloader --location=mbr  --driveorder=sda --append= "Crashkernel=auto rhgb quiet" # the following is  the partition information you requested# Note that any  Partitions you deleted are not expressed# here so unless you  clear all partitions first, this&nbSp;is# not guaranteed to work#clearpart --none#part /boot --fstype=ext4  --size=200#part swap --size=8192#part / --fstype=ext4 --grow --size= 200repo --name= "CentOS"   --baseurl=cdrom:sr0 --cost=100% packages@base@chinese-support@core@debugging@development@directory-client@java-platform@network-file-system-client@print- Client@server-platform@server-policy@workstation-policypaxoddjobsgpiodevice-mapper-persistent-datasystemtap-clientjpackag E-utilssamba-winbindcertmongerpam_krb5krb5-workstation[16:32:50 [email protected]_s ~] #mkdir  -p /data/iso/isolinux        [16:34:41 [email  Protected]_s ~] #cp  /media/isolinux/* /data/iso/isolinux/  [16:35:13 [email  Protected]_s ~] #cp  /root/anaconda-ks.cfg /data/iso/isolinux/myks.cfg         [16:36:47 [eMail protected]_s ~] #mkisofs  -r -j -t -v –no-emul-boot –boot-load-size  4 –boot-info-table -V  "Centos 6.8 x86_64 boot"  -b /data/iso/ isolinux/isolinux.bin -c /data/iso/isolinux/boot.cat -o /root/boot.iso myiso          #创建引导镜像


"Linux Micro Jobs" in week six

Related Article

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.