ubuntu linux 批量部署,使用Cobbler批量部署Linux和Windows:CentOS/Ubuntu批量安装(二)...
通過前面服務端的部署,已經配置好了 Cobbler Server 端,接下來開始進行?CentOS/Ubuntu 的批量安裝,在進行 CentOS/Ubuntu 批量安裝時,也需要通過Cobbler來做相應的發行版導入配置。流程如下:上傳ISO鏡像到 Cobbler Server 端
導入ISO鏡像到 Cobbler Server 端
配置ISO鏡像相關自動值守安裝文件
一、CentOS 配置過程:上傳ISO鏡像
將 CentOS-7-x64-Minimal-1708.iso 鏡像拷貝至 cobbler server 服務器/root/目錄下,在/mnt/ 目錄下為其建立一個目錄并掛載,如下:
mkdir?/mnt/centos7mount?-t?iso9660?-o?loop,ro??CentOS-7-x64-Minimal-1708.iso?/mnt/centos7/
導入ISO鏡像
成功掛載后,開始導入至 cobbler 中,如下:
cobbler?import?--path=/mnt/centos7/?--arch=x86_64?--name=centos7
導入成功后,會輸出:*** TASK COMPLETE ***,截圖如下:
導入鏡像的同時,cobbler會自動生成該鏡像的 profile 和 distro,可以通過 list 和 report 命令來查看細節,如下:
cobbler?list
cobbler?report
從上圖可以看到我們導入的 centos7 使用的 Kickstart 文件是/var/lib/cobbler/kickstarts/sample_end.ks
配置ISO鏡像自動值守安裝文件
前面兩步的上傳和導入ISO鏡像都是基本步驟,無須解釋。這里第三步配置ISO鏡像自動值守安裝文件的目的是用來設定ISO鏡像在安裝過程中如何配置(也就是操作系統的那些設置,如硬盤分區、用戶帳號、密碼等)。
從第二步 “cobbler report” 中可以看到,導入的系統相關配置文件路徑為/var/lib/cobbler/kickstarts/sample_end.ks,那么我們就可以修改該文件,在該文件中來指定操作系統安裝的設置(事實上,我們可以在第二步中指定具體的配置,未指定才會使用該默認文件),配置如下:
以上是一個簡單配置文件,具體定制可以參考這里:KICKSTART 語法參考。
二、Ubuntu 配置過程:上傳ISO鏡像
將?ubuntu-16.04.3-server-x64.iso 鏡像拷貝至 cobbler server 服務器/root/目錄下,在/mnt/ 目錄下為其建立一個目錄并掛載,如下:
mkdir?/mnt/ubuntu16mount?-t?iso9660?-o?loop,ro?ubuntu-16.04.3-server-x64.iso?/mnt/ubuntu16導入ISO鏡像
成功掛載后,開始導入至 cobbler 中,如下:
cobbler?import?--name=ubuntu16?--path=/mnt/ubuntu16/?--breed=ubuntu
導入成功后,會輸出:*** TASK COMPLETE ***,截圖如下:
在導入ISO鏡像時,會有很多的標準錯誤輸出,如下:
這里出現了很多這樣的錯誤,最終導入實際上是成功的,但是不知道為什么這里出現了錯誤,推測可能是Cobbler的bug,該服務可能是在哪里重定向了標準輸出至標準錯誤,使得程序誤以為導入過程中出現問題(僅推測)。對于這樣的錯誤忽略即可。
在導入Ubuntu 16.04的ISO鏡像時,還額外生成了一個系統,如下:
這里生成的系統是一個快捷方式,至于為什么生成,不得而知。
導入鏡像的同時,Cobbler會自動生成該鏡像的 profile 和 distro,可以通過 list 和 report 命令來查看細節,如下:
從上圖可以看到我們導入的 Ubuntu 16.04 使用的 preseed 文件是/var/lib/cobbler/kickstarts/sample.seed
配置ISO鏡像自動值守安裝文件
這里的第三步和 CentOS 系統一樣,也是用來設定ISO鏡像在安裝過程中如何配置
d-i?debian-installer/locale?string?en_US
d-i?console-setup/ask_detect?boolean?falsed-i?keyboard-configuration/toggle?select?No?toggling
d-i?keyboard-configuration/layoutcode?string?us
d-i?keyboard-configuration/variantcode?stringd-i?netcfg/choose_interface?select?auto
d-i?netcfg/get_hostname?string?$myhostname
d-i?time/zone?string?US/Eastern
d-i?clock-setup/utc?boolean?trued-i?clock-setup/ntp?boolean?trued-i?clock-setup/ntp-server??string?ntp.ubuntu.com
d-i?mirror/country?string?manual
d-i?mirror/http/hostname?string?$http_server
d-i?mirror/http/directory?string?$install_source_directory
d-i?mirror/http/proxy?stringd-i?live-installer/net-image?string?http://$http_server/cobbler/links/$distro_name/install/filesystem.squashfsd-i?partman/choose_partition?select?finish
d-i?partman/confirm?boolean?trued-i?partman/confirm_nooverwrite?boolean?trued-i?partman-auto/method?string?lvm
d-i?partman-lvm/device_remove_lvm?boolean?trued-i?partman-lvm/confirm?boolean?trued-i?partman-lvm/confirm_nooverwrite?boolean?trued-i?partman-md/device_remove_md?boolean?trued-i?partman-partitioning/confirm_write_new_label?boolean?trued-i?partman-auto/choose_recipe?select?atomic
d-i?passwd/root-login?boolean?trued-i?passwd/root-password-crypted?password?$default_password_crypted
d-i?passwd/make-user?boolean?false$SNIPPET('preseed_apt_repo_config')
tasksel?tasksel/first?multiselect?standard
d-i?pkgsel/include?string?ntp?ssh?wgetd-i?grub-installer/grub2_instead_of_grub_legacy?boolean?trued-i?grub-installer/bootdev?string?default
d-i?debian-installer/add-kernel-opts?string?$kernel_options_post
d-i?finish-install/reboot_in_progress?note
d-i?preseed/early_command?string?wget?-O-?\
http://$http_server/cblr/svc/op/script/$what/$name/?script=preseed_early_default?|?\
/bin/sh?-s
d-i?preseed/late_command?string?wget?-O-?\
http://$http_server/cblr/svc/op/script/$what/$name/?script=preseed_late_default?|?\
chroot?/target?/bin/sh?-s
以上是一個簡單配置文件,具體定制可以參考這里:Preseed語法參考。
總結
以上是生活随笔為你收集整理的ubuntu linux 批量部署,使用Cobbler批量部署Linux和Windows:CentOS/Ubuntu批量安装(二)...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 出生率已逼近0%?这两地“真生不起”了!
- 下一篇: 网贷需要什么条件