The initial process analysis and his image making process of a public cloud Linux cloud host in China

Source: Internet
Author: User

Recently learned a domestic public cloud Linux cloud host startup, in the image of the internal initialization process, shared, for reference only.

First, the boot process

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/88/A3/wKioL1f-C0nT_SB6AAFFuVSazf8353.jpg-wh_500x0-wm_3 -wmp_4-s_2882452023.jpg "title=" capture. JPG "alt=" Wkiol1f-c0nt_sb6aaffuvsazf8353.jpg-wh_50 "/>

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/88/A3/wKioL1f-C6vyzSvEAAFZ0kHZfpA247.jpg-wh_500x0-wm_3 -wmp_4-s_3513052784.jpg "title=" Capture 2. JPG "alt=" Wkiol1f-c6vyzsveaafz0khzfpa247.jpg-wh_50 "/>

You can see a series of scripts executed in numeric order at boot time, which also prompts for the ucloud of the name of the public cloud vendor, and the last one shows the cleanup work done. Into the system a look that sure enough to find these scripts.

Second, into the single user mode to find these scripts

Want to let the boot of the time do not let the last step 999-clwanup.sh implementation of a lot of methods, I take the approach is single-user mode, simple last figure, the specific method of everyone Google under.

Successfully entered single-user mode and copied his init script

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/88/A7/wKiom1f-FaOhlhzTAACnclo2Ryw774.jpg-wh_500x0-wm_3 -wmp_4-s_1080222807.jpg "title=" capture 33. JPG "alt=" Wkiom1f-faohlhztaacnclo2ryw774.jpg-wh_50 "/>


Analysis of the three-initialization process

(a) The entrance to script execution is still the traditional/etc/rc.local, the main program is bootstrap.sh

/ucloud_boot/bootstrap.sh

Catalogue such as (shameful to hide the uuid, afraid ucloud people to cut me)

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/88/A7/wKiom1f-GGGRgI91AAD56aTwdm8781.jpg-wh_500x0-wm_3 -wmp_4-s_3420980389.jpg "title=" Capture 4. JPG "alt=" Wkiom1f-gggrgi91aad56atwdm8781.jpg-wh_50 "/>

Main program code: Comment I added the

#!/bin/bashscript_abs=$ (readlink -m  "$")   script_ dir=$ (dirname  $script _abs)    #这两行是获取执行目录, it's complicated. I think maybe some mirrors have a soft connection) cd  $script _dir             . lib/utils.sh   #导入几个函数for   module in $ (ls modules/*.sh | sort)     #按照数字排列执行  modules directory sh file  do    $ (.  $module)     if [[ $? != 0  ]]; then        echo  "[$module] failed"      else        echo  "[$module] succeed"      fidone         if [[ -d  "$ Bootstrap_dir " ]]; then  #估计是老的写法代码没删掉         rm - rf  $BOOTSTRAP _dirfi 

Each module explains

050-sysprep.sh (remove the NIC Mac information that existed on the system)

100-interface.sh (write new NIC information to ifcfg file)

101-cleanup-ethx-bak.sh (Clear old Nic Backup)

110-dns.sh (set DNS)

120-hostname.sh (set hostname)

150-fix-epel-key.sh (Modify Epel Source configuration)

200-password-root.sh (Set Password)

300-disk.sh (if there is a new hard drive hanging on to/data)

700-add-rpmforge-repo.sh

701-add-remi-repo.sh

703-add-10gen-repo.sh

749-exclude-kernel-update.sh (update yum settings)

750-localize-repo.sh Setting the Yum source

760-lock-minor-version.sh Setting the Yum source version

799-clear-yum-repos.sh Cleanup Yum Directory

800-skip-fstab-check.sh force on boot without checking the hard drive

801-update-ntp-server.sh setting NTP

803-disable-service.sh disable Iptables If no Docker is installed

810-disable-gssapiauth.sh Modifying the configuration of the sshd

850-optimize-sysctl.sh Adjusting Network parameters Ulimit

855-cp-syslog.sh Set Log rotation

860-install-updates.sh Update bash and glibc

880-cp-set-irq-affinity.sh

996-install-sysstat.sh.disabled

997-install-kdump.sh.disabled

998-cleanup-last.sh Cleanup Site

999-cleanup.sh Cleanup History

This concludes the script file and then discovers that history and bash_history have not cleaned up

Four-part image making process

The following shows the Ucloud virtual machine production process, summed up a few things: switch to his kernel (do not know is not his own custom); Disable the firewall, disable the General Service to save memory, modify the serial port log output, set the Yum source

1 2016-07-21 12:52:26 ls

2 2016-07-21 13:14:33 ll/etc/grub.conf

3 2016-07-21 13:16:22 rm-f/etc/grub.conf; ln-s/boot/grub/grub.conf/etc/grub.conf

4 2016-07-21 13:16:27 ll/etc/grub.conf

5 2016-07-21 13:16:43 RZ

6 2016-07-21 13:19:11 ll/etc/grub.conf

7 2016-07-21 13:21:20 wget http://static.ucloud.cn/kernel/2.6.32-431.11.25.el6.ucloud.x86_64.tar.gz

8 2016-07-21 13:22:53 TAR-ZXVF 2.6.32-431.11.25.el6.ucloud.x86_64.tar.gz

9 2016-07-21 13:23:02 ls

Ten 2016-07-21 13:25:19 CD 2.6.32-431.11.25.el6.ucloud.x86_64

2016-07-21 13:25:28 ls

2016-07-21 13:31:00/sbin/iptables-p INPUT ACCEPT &&/sbin/iptables-f; Service Iptables Stop

2016-07-21 13:31:18 ls

2016-07-21 13:31:25 Bash install.sh

2016-07-21 13:48:17 ls

2016-07-21 13:50:04 yum-y Install lsof iotop sysstat

2016-07-21 13:51:34 Chkconfi--list

2016-07-21 13:51:39 chkconfig--list

2016-07-21 13:53:43 Getenforce

2016-07-21 13:59:06 chkconfig--level auditd 123456 0ff

2016-07-21 13:59:26 chkconfig--level auditd 123456 0ff

2016-07-21 14:00:18 chkconfig auditd--level 123456 0ff

2016-07-21 14:01:05 chkconfig auditd--level 123456 off

2016-07-21 14:04:23 chkconfig blk-availability--level 123456 off

2016-07-21 14:04:23 chkconfig cgconfig--level 123456 off

2016-07-21 14:04:23 chkconfig cgred--level 123456 off

2016-07-21 14:04:23 chkconfig dnsmasq--level 123456 off

2016-07-21 14:04:23 chkconfig FCoE--level 123456 off

2016-07-21 14:04:23 chkconfig ip6tables--level 123456 off

2016-07-21 14:04:23 chkconfig iptables--level 123456 off

2016-07-21 14:04:23 chkconfig iSCSI--level 123456 off

2016-07-21 14:04:23 chkconfig iscsid--level 123456 off

2016-07-21 14:04:23 chkconfig kdump--level 123456 off

2016-07-21 14:04:23 chkconfig lldpad--level 123456 off

2016-07-21 14:04:23 chkconfig lvm2-monitor--level 123456 off

2016-07-21 14:04:23 chkconfig mdmonitor--level 123456 off

PNS 2016-07-21 14:04:23 chkconfig multipathd--level 123456 off

2016-07-21 14:04:23 chkconfig netconsole--level 123456 off

2016-07-21 14:04:23 chkconfig netfs--level 123456 off

2016-07-21 14:04:23 chkconfig NFS--level 123456 off

2016-07-21 14:04:23 chkconfig nfslock--level 123456 off

2016-07-21 14:04:23 chkconfig pppoe-server--level 123456 off

2016-07-21 14:04:23 chkconfig rdisc--level 123456 off

2016-07-21 14:04:23 chkconfig restorecond--level 123456 off

2016-07-21 14:04:23 chkconfig rpcbind--level 123456 off

2016-07-21 14:04:23 chkconfig rpcgssd--level 123456 off

2016-07-21 14:04:23 chkconfig rpcidmapd--level 123456 off

2016-07-21 14:04:23 chkconfig rpcsvcgssd--level 123456 off

2016-07-21 14:04:23 chkconfig saslauthd--level 123456 off

2016-07-21 14:04:23 chkconfig sendmail--level 123456 off

Wuyi 2016-07-21 14:04:23 chkconfig udev-post--level 123456 off

2016-07-21 14:04:24 chkconfig wpa_supplicant--level 123456 off

2016-07-21 14:04:49 chkconfig--list | grep ": On"

2016-07-21 14:05:50 CD

2016-07-21 14:06:02 ll/etc/grub.conf

2016-07-21 14:07:17 rm-rfv/root/.ssh/*/tmp/*; rm-fv/root/*

2016-07-21 14:07:31 ls

2016-07-21 14:07:48 Rpm-qa | grep kernel

2016-07-21 14:26:35 rpm-e kernel-firmware-2.6.32-431.11.21.el6.ucloud.x86_64

2016-07-21 14:26:36 rpm-e kernel-headers-2.6.32-431.11.21.el6.ucloud.x86_64

2016-07-21 14:26:36 rpm-e kernel-2.6.32-431.11.22.el6.ucloud.x86_64

2016-07-21 14:26:37 rpm-e kernel-devel-2.6.32-431.11.22.el6.ucloud.x86_64

2016-07-21 14:26:39 rpm-e kernel-2.6.32-431.11.15.el6.ucloud.x86_64

2016-07-21 14:26:39 rpm-e kernel-devel-2.6.32-431.11.15.el6.ucloud.x86_64

2016-07-21 14:26:41 rpm-e kernel-firmware-2.6.32-431.11.22.el6.ucloud.x86_64

2016-07-21 14:26:41 rpm-e kernel-headers-2.6.32-431.11.22.el6.ucloud.x86_64

2016-07-21 14:26:41 rpm-e kernel-firmware-2.6.32-431.11.15.el6.ucloud.x86_64

2016-07-21 14:26:42 rpm-e kernel-headers-2.6.32-431.11.15.el6.ucloud.x86_64

2016-07-21 14:26:42 rpm-e kernel-2.6.32-431.11.21.el6.ucloud.x86_64

2016-07-21 14:26:45 rpm-e kernel-devel-2.6.32-431.11.21.el6.ucloud.x86_64

2016-07-21 14:26:52 Rpm-qa | grep kernel

2016-07-21 14:27:48 Rpm-qa | grep Kernel |grep 431 | Wc-l

2016-07-21 14:29:00 rm-f/etc/grub.conf; ln-s/boot/grub/grub.conf/etc/grub.conf

2016-07-21 14:29:11 ll/etc/grub.conf

2016-07-21 14:30:05 rm-rfv/root/.ssh/*/tmp/*; rm-fv/root/*

2016-07-21 14:30:19 ls

2016-07-21 14:31:18 Yum Check all

2016-07-21 14:31:54 yum-y Install Yum-utils

2016-07-21 14:33:26 yum-complete-transaction

2016-07-21 14:33:59 CD

Bayi 2016-07-21 14:34:01 ls

2016-07-21 14:34:14 package-cleanup--dupes (clean up the remaining cache of Yum installation software)

2016-07-21 14:34:32 Package-cleanup--cleandupes

2016-07-21 14:42:13 cd/etc/yum.repos.d/

2016-07-21 14:42:14 ls

2016-07-21 14:43:37 chkconfig--list | grep ": On" | Wc-l

2016-07-21 14:43:47 chkconfig--list | grep ": On"

2016-07-21 14:45:11 LL

2016-07-21 14:46:42 ll/etc/yum.repos.d/

2016-07-21 14:46:47 ll/etc/yum.repos.d/| Wc-l

2016-07-21 14:49:00 More Centos-base.repo

2016-07-21 14:50:01 sed-i ' s/centos.mirror.ucloud.cn/mirrors.ucloud.cn/g '/etc/yum.repos.d/centos-base.repo set yum Source

2016-07-21 14:50:33 sed-i ' s/centos.mirrors.ucloud.cn/mirrors.ucloud.cn/g '/etc/yum.repos.d/centos-base.repo

94 2016-07-21 14:50:51 More Centos-base.repo

2016-07-21 14:51:57 More Epel.repo

2016-07-21 14:53:13 sed-i ' s/epel.mirror.ucloud.cn/mirrors.ucloud.cn/g '/etc/yum.repos.d/epel.repo set Epel source

2016-07-21 14:53:27 More Epel.repo

98 2016-07-21 15:00:16 more/boot/grub/grub.conf

2016-07-21 15:03:50 cat/boot/grub/grub.conf | grep title | Wc-l

2016-07-21 15:07:25 cat/boot/grub/grub.conf | grep ' Console=tty1 console=ttys0,115200n8 ' | Wc-l

101 2016-07-21 15:07:55 CD

102 2016-07-21 15:08:36 Cat/etc/securetty | grep ttyS0 | Wc-l

103 2016-07-21 15:10:35 LS/

104 2016-07-21 15:10:54 rm-rf/boot_ucloud/

2016-07-21 15:10:58 LS/

106 2016-07-21 15:12:02 reboot

107 2016-07-21 15:41:22 Poweroff

108 2016-09-13 15:03:31 LL

109 2016-09-13 15:03:41 Tail/var/log/secure

2016-09-13 15:04:49 Cat/root/.bash_history

111 2016-09-13 15:05:01 Vim/root/.bash_history

2016-09-13 15:06:32 Sz/root/.bash_history

113 2016-09-13 15:07:13 History

2016-09-13 15:07:52 History >history.txt

Five summary:

From the surface, the Ucloud mirroring start-up process and the process of making the image is rough, the script is more chaotic, the style is completely inconsistent, the basic CentOS itself is not tuned. Attached to all the documents mentioned in this article, if Ucloud's friend presses, don't chop me. In addition, Windows does not have single-user mode, security mode is to password, in fact, there is a way, and so I have a free.


This article is from "Old Ann's Blog" blog, please be sure to keep this source http://superbigsea.blog.51cto.com/6862263/1861177

The initial process analysis and his image making process of a public cloud Linux cloud host in China

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.