In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Customized big data platform one-click installation of OS
Big data platform one-click installation of OS series
Big data platform installs OS with one click [build script]
Customized OS image production
1. Operating environment
Operating environment: VMware Workstarion 9 and vSphere client
System: CentOS-6.8-x86_64
Tool: gconf-editor anaconda repodata createrepo mkisofs rsync
two。 Main ideas
Customization is achieved through kickstart scripts. After the linux system is installed, files such as anaconda-ks.cfg install.log will be generated in the root directory. Anaconda-ks.cfg is an automatic installation script, and install.log is some information record of the installation package. In the customization, we mainly use the anaconda-ks.cfg kickstart script, which can be generated by the tool or by modifying the anaconda-ks.cfg file of the original system. Here, for convenience, we use the anaconda-ks.cfg of the original system to modify. In the kickstart script, we can set the operation to be realized in the installation process to achieve automatic customized installation.
3. Tool installation
In the customization process, we need to install some tools, which are used to generate the files we need and finally make the image file. Enter centos and enter the following command in administrator mode: # Mount the image
[root@localhost ~] # mount / dev/sr0 / mnt/mount: block device / dev/sr0 is write-protected Mounting read-only [root@localhost] # df-THFilesystem Type Size Used Avail Use% Mounted on/dev/mapper/VolGroup-lv_root ext4 38G 27G 9.5G 74% / tmpfs tmpfs 985M 0985m 0% / dev/shm/dev/sda1 ext4 500M 42m 433M 9% / boot/dev/sr0 iso9660 5. 8G 5.8G 0100% / mnt# make local source touch / etc/yum.repos.d/vrv.repoecho "[vrv-local] name=vrv-localbaseurl= file:///mnt/gpgcheck=0enabled=1" > > / etc/yum.repos.d/vrv.repoyum clean all & & echo 'yum repository has been updated installation # installation tool yum-y install anaconda repodata createrepo mkisofs rsync
4. Customization process
# set up a system production directory
Mkdir / home/source
Mount the image centos6.8.iso
# copy all files except the Packages folder to the system production directory
Mount / dev/sr0 / mnt
Cd / mnt
Cp-rf * / home/source/
Upload ks.cfg server script configuration and ks-config.cfg client script configuration to the isolinux folder
Execute yum install dos2*
Dos2unix isolinux/*.cfg
# copy the anaconda-ks.cfg and install.log files of the original system to the system production directory
[root@localhost ~] # cp / root/anaconda-ks.cfg / root/install.log / home/source
# refer to the current system, copy the corresponding software package to the system production directory, install.log records the information of the software package installed on this machine, and refer to install.log to reduce the copying of redundant software packages.
[root@localhost ~] # mkdir / home/source/Packages
[root@localhost ~] # awk'/ Installing/ {print $2}'/ home/source/install.log | xargs-I cp / mnt/Packages/ {}. Rpm / home/source/Packages/
Cp / mnt/.discinfo / home/source/ # this step is very important
# modify / make a kickstart script, there are two ways to modify this script, the first is to modify the anaconda-ks.cfg script of the original system, and the second is to make it through the system-config-kickstart tool. The first is relatively simple, less modification, and the second method is to make a kickstart script, the production process by many parameters need to be manually set, prone to problems.
# explain the parameters in it
Timezone Asia/Shanghai # sets the time zone of the system. Do not add-utc before the time zone setting, otherwise the time zone setting will not take effect.
The parameter bootloader-location=mbr-driveorder=sda-append= "crashkernel=auto rhgb quiet" # auto rhgb quiet sets the startup mode of the system. Without rhgb, the boot animation will not be displayed during the boot process, but the startup process of the system will be printed in the form of text.
# 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 is
# not guaranteed to work
# the partition operation is set here. If it is not set in the kickstart script, it needs to be set manually during installation.
Clearpart-- all-initlabel
Part / boot-fstype=ext4-size=300
Part /-- fstype=ext4-- grow-- size=37000 # hard disk size is set according to the specific size. Generally, the size I give to the virtual machine is 40G, so here it is set to 37000. The remaining space is used for boot and swap partitions.
Part swap-grow-maxsize=1984-size=1984
# modify the boot display screen so that the background image of the boot display screen can only be replaced by other images inside the isolinux folder in the installation CD. Modify the system name (you cannot change the name when installing the ambari service)
# echo "OS release 1.1" > / etc/centos-release
# echo "OS release 1.1" > / etc/redhat-release
# sed-I 's/CentOS release 6.8 (Final) / OS release 1.1 Placement g' / etc/issue
# sed-I 's/CentOS release 6.8 (Final) / OS release 1.1 Placement g' / etc/issue.net
# sed-I's _
# sed-I's Universe CentOS etc/rc.d/rc.sysinit
# sed-I's Universe CentOS etc/grub.conf'/ Centro
5. Add background picture
Cd / home/source/Packages/isolinux/
# add background image
Menu background splash.jpg
Replace with
Note that the size and name of the picture must be the same as the original picture
# Custom installation option, set this option as the default option, and set the file path of the custom kickstart installation script to automatically install in text form. It's really important that if you don't become the same, you will encounter the situation that the picture can't be changed.
Add and modify menu options in format:
# # add the following
Label menu os server install new system
Menu os server install new system
Kernel vmlinuz
Append ks=cdrom:/isolinux/ks.cfg initrd=initrd.img
Label menu os client install new system
Menu os client install new system
Kernel vmlinuz
Append ks=cdrom:/isolinux/ks-config.cfg initrd=initrd.img
Label rescue
Menu label ^ Rescue installed system
Kernel vmlinuz
Append initrd=initrd.img rescue
Label Boot
Menu label Boot from ^ local drive
Localboot 0xffff
Label memtest86
Menu label ^ Memory test
Kernel memtest
Append-
Achievement map:
6. Generate a new image
# generate a new repodata document
[root@localhost ~] # cd / home/source
[root@localhost ~] # cp repodata/*comps.xml. / comps.xml
[root@localhost ~] # rm-rf repodata
[root@localhost ~] # declare-x discinfo= `head-1 .discinfo`
[root@localhost ~] # createrepo-g comps.xml / home/source
# or, it can be achieved through the following command, which differs from the above in that it only changes those items that have been modified, added or deleted after the last generation of metadata, so this command is generally used to regenerate repodata documents after modifying packages or groups, which can improve efficiency.
[root@localhost ~] # createrepo-u "media://$discinfo"-g comps.xml | / home/source
# for convenience, you can also operate through scripts. The specific scripts are as follows:
#! / bin/bashISO_DIR=/home/sourcecd ${ISO_DIR} declare-x discinfo=$ (head-1.discinfo) cp / mnt/repodata/*-c6-x86_64-comps.xml ${ISO_DIR} / comps.xml createrepo-g ${ISO_DIR} / comps.xml ${ISO_DIR} createrepo-u "media://$discinfo"-g ${ISO_DIR} / comps.xml ${ISO_DIR}
# sh 1.sh
Spawning worker 0 with 3233 pkgs
Workers Finished
Gathering worker results
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
# if you modify the software package in the Packages folder, you need to regenerate the comps.xml file. You can save the above script as a .sh file and use it at any time in the / root directory. All the preparatory work has been done here, and then you can start making the image file. The tools used to make the image file are mkisofs and implantisomd5, the former is used to make the image, and the latter is used to check the md5 check to detect whether the file is damaged during transfer. Go to the system production directory / home/source and run the command:
[root@localhost] # mkisofs-o os.iso-b isolinux/isolinux.bin-c isolinux/boot.cat-no-emul-boot-boot-load-size 4-boot-info-table-R-J-v-T-joliet-long / home/source
# after executing the above command, an image file named OS.iso will be generated in the / home/source directory and entered into the / home/source directory.
Using KRB5_001.RPM;1 for / home/source/Packages/krb5-server-ldap-1.10.3-57.el6.x86_64.rpm (krb5-server-1.10.3-57.el6.x86_64.rpm) Using PYTHO02T.RPM;1 for / home/source/Packages/python-simplejson-2.0.9-3.1.el6.x86_64.rpm (python-suds-0.4.1-3.el6.noarch.rpm) Using KDE_L01L.RPM 1 for / home/source/Packages/kde-l10n-Korean-4.3.4-5.el6.noarch.rpm (kde-l10n-Maithili-4.3.4-5.el6.noarch.rpm) Using XORG_021.RPM;1 for / home/source/Packages/xorg-x11-drv-tdfx-1.4.6-1.el6.x86_64.rpm (xorg-x11-drv-vmmouse-13.1.0-1.el6.x86_64.rpm) Using YUM_P005.RPM 1 for / home/source/Packages/yum-plugin-verify-1.1.30-37.el6.noarch.rpm (yum-plugin-tmprepo-1.1.30-37.el6.noarch.rpm) Using KDE_L01M.RPM;1 for / home/source/Packages/kde-l10n-Maithili-4.3.4-5.el6.noarch.rpm (kde-l10n-Icelandic-4.3.4-5.el6.noarch.rpm) Using CONTR001.RPM 1 for / home/source/Packages/control-center-filesystem-2.28.1-40.el6.x86_64.rpm (control-center-2.28.1-40.el6.x86_64.rpm) Using POSTG00A.RPM;1 for / home/source/Packages/postgresql-libs-8.4.20-6.el6.x86_64.rpm (postgresql-plpython-8.4.20-6.el6.x86_64.rpm) Using AUDIT001.RPM 1 for / home/source/Packages/audit-libs-python-2.4.5-3.el6.x86_64.rpm (audit-libs-2.4.5-3.el6.x86_64.rpm) Using ECLIP01R.RPM 1 for / home/source/Packages/eclipse-valgrind-0.6.1-1.el6.x86_64.rpm (eclipse-rpm-editor-0.5.0-2.el6.x86_64.rpm) Writing: Initial Padblock Start Block 0Done with: Initial Padblock Block (s) 16Writing: Primary Volume Descriptor Start Block 16Done with: Primary Volume Descriptor Block (s) 1Writing: Eltorito Volume Descriptor Start Block 17Size of boot p_w_picpath is 4 sectors-> No emulationDone with: Eltorito Volume Descriptor Block (s) 1Writing: Joliet Volume Descriptor Start Block 18Done with: Joliet Volume Descriptor Block (s) 1Writing: End Volume Descriptor Start Block 19Done with: End Volume Descriptor Block ( S) 1Writing: Version block Start Block 20Done with: Version block Block (s) 1Writing: Path table Start Block 21Done with: Path table Block (s) 4Writing: Joliet path table Start Block 25Done with: Joliet path table Block (s) 4Writing: Directory tree Start Block 29Done with: Directory tree Block (s) 326Writing: Joliet directory tree Start Block 355Done with: Joliet directory tree Block (s) 239Writing: Directory tree cleanup Start Block 594Done with: Directory tree cleanup Block (s) 0Writing: Extension record Start Block 594Done with: Extension record Block (s) 1Writing: The File (s) Start Block 595 0.16% done Estimate finish Tue Jun 20 00:20:32 2017 99.96% done, estimate finish Tue Jun 20 00:23:09 2017Total translation table size: 848976Total rockridge attributes bytes: 384427Total directory bytes: 660628Path table size (bytes): 848Done with: The File (s) Block (s) 3160548Writing: Ending Padblock Start Block 3161143Done with: Ending Padblock Block (s) 150Max brk space used 3aa0003161293 extents written (6174 MB)
Execute the command:
[root@localhost source] # / usr/bin/implantisomd5 os.iso
# insert md5 check value into the image file to prevent the image file from being damaged during the copying process. Enter the following command under the corresponding file directory during verification to verify the file. After the file is verified, you can copy the image file through xftp, and then you can install and test it.
[root@localhost] # checkisomd5 os.iso
Generate Mirror command:
Yum install-y mkisofs
Createrepo-g repodata/*x86_64-comps.xml / home/source/
Declare-x discinfo= `head-1 .discinfo`
Createrepo-u "media://$discinfo"-g repodata/*x86_64-comps.xml / home/source/
Mkisofs-o os.iso-b isolinux/isolinux.bin-c isolinux/boot.cat-no-emul-boot-boot-load-size 4-boot-info-table-R-J-v-T-joliet-long / home/source
7. Generate HDP image
The same operation as above
Createrepo-g repodata/*x86_64-comps.xml / home/hdp
Declare-x discinfo= `head-1 .discinfo`
Createrepo-u "media://$discinfo"-g repodata/*x86_64-comps.xml / home/hdp
Mkisofs-o hdp2.4.iso-b isolinux/isolinux.bin-c isolinux/boot.cat-no-emul-boot-boot-load-size 4-boot-info-table-R-J-v-T-joliet-long / home/hdp
Effect picture:
If you think the author's article is good, please reward the author with some money through Alipay or Wechat.
Do not need too much (0.1, 1 yuan, 3 yuan, 5 yuan), do not reward please like it, thank you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.