cyc1111 发表于 2019-2-17 11:25:57

Cobbler 自动安装linux

  cobble 官网
  http://cobbler.github.io/
  快速入门
  http://cobbler.github.io/manuals/quickstart/
  Web 访问
  http://cobbler.github.io/manuals/2.8.0/5_-_Web_Interface.html
http://i2.运维网.com/images/blog/201810/10/d10988c1fdc77fe4e4c2265649fbef2f.jpg
  更新EPEL使用淘宝源
  wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
http://i2.运维网.com/images/blog/201810/10/c5ec893e1eb60d6f6b2bb65412e622ac.jpg
  安装Cobbler
  yum install -y httpd tftp dhcp cobbler cobbler-web pykickstart
  rpm -ql cobbler
http://i2.运维网.com/images/blog/201810/10/4ba9942de7dadee98a4149e7e097c834.jpg
  /etc/cobbler # 配置文件目录
  /etc/cobbler/settings # cobbler主配置文件,这个文件是YAML格式,Cobbler是python写的程序。
  /etc/cobbler/dhcp.template # DHCP服务的配置模板
  /etc/cobbler/tftpd.template # tftp服务的配置模板
  /etc/cobbler/rsync.template # rsync服务的配置模板
  /etc/cobbler/iso # iso模板配置文件目录
  /etc/cobbler/pxe # pxe模板文件目录
  /etc/cobbler/power # 电源的配置文件目录
  /etc/cobbler/users.conf # Web服务授权配置文件
  /etc/cobbler/users.digest # 用于web访问的用户名密码配置文件
  /etc/cobbler/dnsmasq.template # DNS服务的配置模板
  /etc/cobbler/modules.conf # Cobbler模块配置文件
  /var/lib/cobbler # Cobbler数据目录
  /var/lib/cobbler/config # 配置文件
  /var/lib/cobbler/kickstarts # 默认存放kickstart文件
  /var/lib/cobbler/loaders # 存放的各种引导程序
  /var/www/cobbler # 系统安装镜像目录
  /var/www/cobbler/ks_mirror # 导入的系统镜像列表
  /var/www/cobbler/images # 导入的系统镜像启动文件
  /var/www/cobbler/repo_mirror # yum源存储目录
  /var/log/cobbler # 日志目录
  /var/log/cobbler/install.log # 客户端系统安装日志
  /var/log/cobbler/cobbler.log # cobbler日志
  systemctl start httpd cobblerd
  systemctl status httpd cobblerd
  systemctl enable httpd cobblerd
http://i2.运维网.com/images/blog/201810/10/a960e16372af4a5e683aa9e3c2aeae74.jpg
  部署校验
  这货有一个自我检查的命令,可以知道在部署前还需要解决哪些问题
  cobbler check
http://i2.运维网.com/images/blog/201810/10/62b06ae80f2b2feba1f216433b95dd2a.jpg
  还有9个问题要处理,容我处理下
  设置服务器IP
  The 'server' field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work. This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it.
  vi /etc/cobbler/settings
  cat /etc/cobbler/settings | grep -v ^# | grep -v ^$
  改3个地方
  bind_master: 192.168.10.10
  next_server: 192.168.10.10
  server: 192.168.10.10
http://i2.运维网.com/images/blog/201810/10/ab7a8a12e3b07f09666504c9995a75fb.jpg
  禁用SELinux
  SELinux is enabled. Please review the following wiki page for details on ensuring cobbler works correctly in your SELinux environment:
  https://github.com/cobbler/cobbler/wiki/Selinux
  systemctl stop firewalld
  systemctl disable firewalld
  sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
  grep SELINUX=disabled /etc/selinux/config
  setenforce 0
  开启TFTP
  change 'disable' to 'no' in /etc/xinetd.d/tftp
  vi /etc/xinetd.d/tftp
http://i2.运维网.com/images/blog/201810/10/7b285b620694267c8916c1301bbbff20.jpg
  开启rsync
  enable and start rsyncd.service with systemctl
  systemctl start rsyncd
  systemctl enable rsyncd
http://i2.运维网.com/images/blog/201810/10/501fc68016bedf8d82b28803cd043289.jpg
  安装fencing
  fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
  rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
  yum install -y fence-agents
http://i2.运维网.com/images/blog/201810/10/ee58e6088ef1ff5778e3f68698e2cd8d.jpg
  systemctl restart cobblerd
  cobbler check
  剩下4个问题
http://i2.运维网.com/images/blog/201810/10/aadb1eac3ef5999ede3e36f97a116808.jpg
  下载启动程序
  Some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely. Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements.
  cobbler get-loaders
http://i2.运维网.com/images/blog/201810/10/322ba7445309f329ed765d29aa5050b6.jpg
  安装大便镜像package
  debmirror package is not installed, it will be required to manage debian deployments and repositories
  yum install -y debmirror.noarch
http://i2.运维网.com/images/blog/201810/10/5bbfc46366648d1a44c3108f9fdae81a.jpg
  The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one
  openssl passwd -1 -salt 'random-phrase-here' '12345.com'
  $1$random-p$N2Gta7Jon4dskSI6zKe5C1
  vi /etc/cobbler/settings
  把default_password_crypted 替换成新密码
http://i2.运维网.com/images/blog/201810/10/ab7c2bcdde8fa8dca6413d9685e41aed.jpg
  cobbler sync
  cobbler check
http://i2.运维网.com/images/blog/201810/10/f34a5a43158ffcdf364f94797c5038df.jpg
  还剩下2个问题
  vi /etc/debmirror.conf
  2行注释拿掉
http://i2.运维网.com/images/blog/201810/10/dca9e4cf46eded72c3f55bfd57efade6.jpg
  应用配置文件
  systemctl restart cobblerd
  cobbler sync
  cobbler check
http://i2.运维网.com/images/blog/201810/10/4503323ad47dd5eb714a739aa5e7d014.jpg
  all system go
  开启dhcp和pxe
  sed -i 's/manage_dhcp: 0/manage_dhcp: 1/g' /etc/cobbler/settings
  cat /etc/cobbler/settings | grep manage_dhcp
http://i2.运维网.com/images/blog/201810/10/185709857221c2281c23e860aa10e56a.jpg
  sed -i 's/pxe_just_once: 0/pxe_just_once: 1/' /etc/cobbler/settings
  cat /etc/cobbler/settings |grep pxe_just
http://i2.运维网.com/images/blog/201810/10/3db4297a3cd4a229c33d6fb88f6ae75c.jpg
  设置dhcp ip 地址池
  cp /etc/cobbler/dhcp.template /etc/cobbler/dhcp.template.original
  vi /etc/cobbler/dhcp.template
http://i2.运维网.com/images/blog/201810/10/3d83b890d7640e9faf9d898d51bfb3c8.jpg
http://i2.运维网.com/images/blog/201810/10/b85a259965e49531ce9eeab975164fe4.jpg
  systemctl restart dhcpd
  systemctl enable dhcpd
  挂载镜像
http://i2.运维网.com/images/blog/201810/10/13a4978719f575aa6d0dba83f449c6f9.jpg
  mount -t iso9660 -o ro /dev/cdrom /mnt
http://i2.运维网.com/images/blog/201810/10/551a30133baa71da8ff592ca62b9b7b8.jpg
  导入镜像
  cobbler import --path=/mnt/ --name=CentOS-7.5-x86_64 --arch=x86_64
http://i2.运维网.com/images/blog/201810/10/5ff2a77d7070785b37928d80a591550c.jpg
  cobbler distro list
http://i2.运维网.com/images/blog/201810/10/5235f6b325d0a18fe1ac64b43cc49131.jpg
  ls /var/www/cobbler/ks_mirror/
http://i2.运维网.com/images/blog/201810/10/5d301bf90abf1b86aebaa3470399303c.jpg
  查看镜像文件信息
  cobbler list
  cobbler distro report --name=CentOS-7.5-x86_64
http://i2.运维网.com/images/blog/201810/10/bfedeb5ee5cd87c469a5ac3ee7b7ad7f.jpg
  修改网卡配置,因为cenos 7之后网卡从eth0变成ens打头的了
  cobbler profile report
http://i2.运维网.com/images/blog/201810/10/6266b749c4a6d0bd457d3596914ba73d.jpg
  cobbler profile edit --name=CentOS-7.5-x86_64 --kopts='net.ifnames=0 biosdevname=0'
  cobbler profile report --name=CentOS-7.5-x86_64
http://i2.运维网.com/images/blog/201810/10/ea8b1c85dd3b2d684c59cf58a4eec1c2.jpg
  同步下数据
  cobbler sync
http://i2.运维网.com/images/blog/201810/10/9288e5c5c6f64bd1daae5f78c085772a.jpg
  自定义pxe菜单
  vi /etc/cobbler/pxe/pxedefault.template
http://i2.运维网.com/images/blog/201810/10/b5bb82d6bf0d99c2eef8de253f7caf70.jpg
http://i2.运维网.com/images/blog/201810/10/279a80dd942e0e140970d52d04f81753.jpg
http://i2.运维网.com/images/blog/201810/10/2d12a07dfed9c716cc35621e9adccafd.jpg
http://i2.运维网.com/images/blog/201810/10/5935a8253a840d9c863b9507b51f4623.jpg
http://i2.运维网.com/images/blog/201810/10/99e3ee7f18df941519550abf224fc679.jpg
  眼睛一闭就好了
http://i2.运维网.com/images/blog/201810/10/bc0465b57e195624832d7b44365e877d.jpg
  直接指定IP和MAC 绑定某一个安装菜单
  cobbler system add --name=CentOS --mac=00:0C:29:D6:4F:57 --profile=CentOS-7.5-x86_64 --ip-address=192.168.10.100 --subnet=255.255.255.0 --gateway=192.168.10.2 --interface=eth0 --static=1 --hostname=linux_node --name-servers="8.8.8.8"
  同步数据
  cobbler system list
  cobbler sync
  问题 找不到boot,磁盘空间不足
http://i2.运维网.com/images/blog/201810/10/176da2a4553243cfe8e232757217c157.jpg
  容我修个错误
  https://access.redhat.com/solutions/3353961
  Root Cause

[*]The memory defined for the system is not sufficient hence it is unable to process/download the live image.
[*]Minimum of 2GB of memory should be allocated.
  虚拟机给2G内存搞定
  问题 禁止PXE
  cobbler profile edit --name=CentOS-7.5-x86_64 --enable-gpxe=False
  cobbler profile report --name=CentOS-7.5-x86_64
http://i2.运维网.com/images/blog/201810/10/37ced36a5ecd48c53009c12c2177b82a.jpg
  cat /etc/cobbler/modules.conf | grep -v ^$ | grep -v ^#
http://i2.运维网.com/images/blog/201810/10/ea2a4f32d84a03c5d8350645843b192c.jpg
http://i2.运维网.com/images/blog/201810/10/2a86d8865d2a462a03fc8f7b57e44cc9.jpg



页: [1]
查看完整版本: Cobbler 自动安装linux