设为首页 收藏本站
查看: 1836|回复: 0

[经验分享] Cobbler 自动安装linux

[复制链接]

尚未签到

发表于 2019-2-17 11:25:57 | 显示全部楼层 |阅读模式
  cobble 官网
  http://cobbler.github.io/
  快速入门
  http://cobbler.github.io/manuals/quickstart/
  Web 访问
  http://cobbler.github.io/manuals/2.8.0/5_-_Web_Interface.html

  更新EPEL使用淘宝源
  wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

  安装Cobbler
  yum install -y httpd tftp dhcp cobbler cobbler-web pykickstart
  rpm -ql cobbler

  /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

  部署校验
  这货有一个自我检查的命令,可以知道在部署前还需要解决哪些问题
  cobbler check

  还有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

  禁用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

  开启rsync
  enable and start rsyncd.service with systemctl
  systemctl start rsyncd
  systemctl enable rsyncd

  安装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

  systemctl restart cobblerd
  cobbler check
  剩下4个问题

  下载启动程序
  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

  安装大便镜像package
  debmirror package is not installed, it will be required to manage debian deployments and repositories
  yum install -y debmirror.noarch

  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 替换成新密码

  cobbler sync
  cobbler check

  还剩下2个问题
  vi /etc/debmirror.conf
  2行注释拿掉

  应用配置文件
  systemctl restart cobblerd
  cobbler sync
  cobbler check

  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

  sed -i 's/pxe_just_once: 0/pxe_just_once: 1/' /etc/cobbler/settings
  cat /etc/cobbler/settings |grep pxe_just

  设置dhcp ip 地址池
  cp /etc/cobbler/dhcp.template /etc/cobbler/dhcp.template.original
  vi /etc/cobbler/dhcp.template


  systemctl restart dhcpd
  systemctl enable dhcpd
  挂载镜像

  mount -t iso9660 -o ro /dev/cdrom /mnt

  导入镜像
  cobbler import --path=/mnt/ --name=CentOS-7.5-x86_64 --arch=x86_64

  cobbler distro list

  ls /var/www/cobbler/ks_mirror/

  查看镜像文件信息
  cobbler list
  cobbler distro report --name=CentOS-7.5-x86_64

  修改网卡配置,因为cenos 7之后网卡从eth0变成ens打头的了
  cobbler profile report

  cobbler profile edit --name=CentOS-7.5-x86_64 --kopts='net.ifnames=0 biosdevname=0'
  cobbler profile report --name=CentOS-7.5-x86_64

  同步下数据
  cobbler sync

  自定义pxe菜单
  vi /etc/cobbler/pxe/pxedefault.template





  眼睛一闭就好了

  直接指定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,磁盘空间不足

  容我修个错误
  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

  cat /etc/cobbler/modules.conf | grep -v ^$ | grep -v ^#






运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-673524-1-1.html 上篇帖子: 从基础学linux 下篇帖子: Linux中的DNS服务
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表