• cobble服务器安装配置


    1、配置系统
    关闭
    firewalld防火墙
    [root@sky ~]# systemctl stop firewalld.service
    [root@sky ~]# systemctl disable firewalld.service
    [root@sky ~]# firewall-cmd --state
    not running
    关闭SELinux(修改完重启)

    [root@sky ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
    [root@sky ~]# reboot

    2、安装cobbler
    安装epel源
    [root@sky ~]# cd /etc/yum.repos.d/
    [root@sky yum.repos.d]# yum -y install epel-release
    安装cobbler

    [root@sky yum.repos.d]# yum install -y cobbler cobbler-web tftp xinetd dhcp cman pykickstart debmirror syslinux net-tools
    安装cobbler依赖包
    [root@sky yum.repos.d]# yum install -y ed patch perl perl-Compress-Zlib perl-Digest-SHA1 perl-LockFile-Simple perl-libwww-perl fence-agents

    设置服务开机启动

    [root@sky yum.repos.d]# systemctl enable httpd.service
    [root@sky yum.repos.d]# systemctl enable dhcpd.service
    [root@sky yum.repos.d]# systemctl enable xinetd.service
    [root@sky yum.repos.d]# systemctl enable cobblerd.service
    查看服务开启状态

    [root@sky yum.repos.d]# systemctl list-unit-files | grep -E "httpd|dhcpd|xinetd|cobblerd"
    cobblerd.service                            enabled 
    dhcpd.service                               enabled 
    httpd.service                               enabled 
    xinetd.service                              enabled 

    3、配置服务
    配置web

    [root@sky yum.repos.d]# sed -i 's/#ServerName www.example.com:80/ServerName 127.0.0.1:80/' /etc/httpd/conf/httpd.conf
    [root@sky yum.repos.d]# systemctl restart httpd.service
    配置cobbler
    [root@sky yum.repos.d]# sed -i 's/server: 127.0.0.1/server: 192.168.17.181/g' /etc/cobbler/settings 
    防止重装
    #sed -i 's/pxe_just_once: 0/pxe_just_once: 1/' /etc/cobbler/settings

    修改cobbler用户的默认密码,
    使用生成后的密码替换/etc/cobbler/settings中的密码
    [root@sky yum.repos.d]# openssl passwd -1 -salt 'root' 'weidai@123'
    $1$root$8e67rDXAsnndS790noSQV0
     
    [root@sky yum.repos.d]# vim /etc/cobbler/settings
    default_password_crypted: "$1$root$8e67rDXAsnndS790noSQV0"    <==替换掉此处内容
    配置cobber_web (Web页面默认不允许任何人登录,需要手动修改认证相关配置)
    [root@sky yum.repos.d]# useradd admin
    [root@sky yum.repos.d]# passwd admin
    [root@sky yum.repos.d]# sed -i 's/admin = ""/admin = "admin"/' /etc/cobbler/users.conf
    [root@sky yum.repos.d]# sed -i 's/module = authn_configfile/module = authn_pam/' /etc/cobbler/modules.conf
    配置xinetd

    [root@sky yum.repos.d]# sed -i '14s/yes/no/' /etc/xinetd.d/tftp 
    [root@sky yum.repos.d]# systemctl restart xinetd.service
    [root@sky yum.repos.d]# systemctl restart rsyncd.service
    [root@sky yum.repos.d]# systemctl enable rsyncd.service
    配置dhcp,pxe

    [root@sky yum.repos.d]# sed -i 's/manage_dhcp: 0/manage_dhcp: 1/' /etc/cobbler/settings
    [root@sky yum.repos.d]# sed -i 's/pxe_just_once: 0/pxe_just_once: 1/' /etc/cobbler/settings
    [root@localhost yum.repos.d]# mv /etc/cobbler/dhcp.template /etc/cobbler/dhcp.template.bak
    [root@sky yum.repos.d]# vim /etc/cobbler/dhcp.template 
    ddns-update-style interim;
     
    allow booting;
    allow bootp;
     
    ignore client-updates;
    set vendorclass = option vendor-class-identifier;
     
    subnet 192.168.17.0 netmask 255.255.255.0 {
        option routers             192.168.17.1;
        option domain-name-servers 114.114.114.114;
        option subnet-mask         255.255.255.0;
        range dynamic-bootp        192.168.17.100 192.168.17.200;
        filename                "/pxelinux.0";
        default-lease-time         21600;
        max-lease-time             43200;
        next-server                192.168.17.181;
    }
    启动服务

    [root@sky yum.repos.d]# systemctl restart cobblerd.service
    [root@sky yum.repos.d]# systemctl restart xinetd.service
    [root@sky yum.repos.d]# cobbler sync
    如果服务器对公网提供服务器,防火墙设置如下

    [root@sky yum.repos.d]# firewall-cmd --permanent --add-port=67/udp
    [root@sky yum.repos.d]# firewall-cmd --permanent --add-port=68/udp
    [root@sky yum.repos.d]# firewall-cmd --permanent --add-port=80/tcp
    [root@sky yum.repos.d]# firewall-cmd --permanent --add-port=443/tc
    [root@sky yum.repos.d]# firewall-cmd --permanent --add-port=443/tcp
    [root@sky yum.repos.d]# firewall-cmd --reload
    [root@sky yum.repos.d]# firewall-cmd --permanent --list-ports

    4、登录cobbler_web界面
    https://192.168.17.181/cobbler_web
    用户名:admin
    密码: 系统admin的密码

    5、挂载系统安装镜像到http服务器站点目录
    上传系统安装镜像文件CentOS-7-x86_64-DVD-1511.iso 到/usr/local/src/目录(拿U盘考,用Xftp工具上传都行)

    # mkdir -p /var/www/html/os/CentOS-7-x86_64      
    # mount -t iso9660 -o loop /usr/local/src/CentOS-7-x86_64-DVD-1511.iso  /var/www/html/os/CentOS-7-x86_64

    七、导入系统镜像到cobbler
    导入系统镜像文件,需要一段时间
    # cobbler import --path=/var/www/html/os/CentOS-7-x86_64/  --name=CentOS-7-x86_64  --arch=x86_64
    cobbler系统镜像导入目录在/var/www/cobbler/ks_mirror/下
    命令格式:cobbler import --path=镜像路径 -- name=安装引导名 --arch=32位或64位
    重复上面的操作,把其他的系统镜像文件导入到cobbler

    八、设置profile

    查看cobbler默认指定的profile设置
    # cobbler profile report --name CentOS-7-x86_64
    查看安装镜像文件信息
    #cobbler distro report --name redhat7.2-x86_64
    移除cobbler默认指定的错误profile
    # cobbler profile remove --name=CentOS-7-x86_64
    添加我们自己设置的新profile(CentOS7的自动安装脚本)
    # cobbler profile add --name=CentOS-7-x86_64 --distro=CentOS-7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS7.ks

    查看Cobbler列表
    # cobbler list
    # cobbler report
    # cobbler profile report
    # cobbler distro list


    注意:
    1、kickstart自动安装文件需要预先配置好
    2、每次修改完配置文件,需要执行一次同步操作:cobbler sync 配置才能生效
    3、kickstart自动安装文件可以用工具生成(需要用到图形界面操作)
    yum  install system-config-kickstart #安装
    yum groupinstall "X Window System" #安装X Window图形界面
    system-config-kickstart #运行kickstart配置
    service  cobbler  sync  #与cobbler sync作用相同
    service  cobbler  restart  #重启cobbler

    编辑profile
    # cobbler profile edit --name=CentOS-7-x86_64 --distro=CentOS-7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS7.ks  
    命令参数:cobbler profile add|edit|remove --name=安装引导名 --distro=系统镜像名 --kickstart=kickstart自动安装文件路径
    ➣   --name:自定义的安装引导名,注意不能重复
    ➣   --distro:系统安装镜像名,用cobbler distro list可以查看
    ➣   --kickstart:与系统镜像文件相关联的kickstart自动安装文件

    redhat7.2
    install
    keyboard 'us'
    rootpw --iscrypted $6$lpH7b/BtlAu/IjWL$Fqme918S3yPAaVRySfnC8jUqBGIvrGZr.IqeVOCkBR1G/H3xtb9cXwrRPJJklu4FfXUKvUONhaiVBLQyOkbsg0
    url --url="http://192.168.1.110/cobbler/ks_mirror/redhat7.2_x86_64-x86_64/"
    lang en_US
    firewall --disabled
    auth --useshadow --passalgo=sha512
    #text
    graphical
    firstboot --disable
    selinux --disabled
    network --bootproto=dhcp --device=eth0
    reboot
    timezone Asia/Shanghai --isUtc
    bootloader --append="rhgb quiet" --location=mbr
    zerombr
    clearpart --all --initlabel
    autopart --type=lvm
    user --name=dou--password=$6$Z2avWwYgGYk002zh$XMBlYsNZxWtgqHhMr4b31v9J19tNkWHkuDQDG3IRfPzt92qhfN6yYrCtx7vMaKpIh0aBq/pefygHh4ZUWPCW51 --iscrypted --gecos="sunyard"


    %packages
    @^graphical-server-environment
    @base
    @compat-libraries
    @core
    @desktop-debugging
    @development
    @dial-up
    @fonts
    @ftp-server
    @gnome-desktop
    @guest-agents
    @guest-desktop-agents
    @input-methods
    @internet-browser
    @multimedia
    @print-client
    @x11
    kexec-tools
    initial-setup
    initial-setup-gui
    vinagre
    %end

    %addon com_redhat_kdump --enable --reserve-mb='auto'

    %end

  • 相关阅读:
    redis官方网站及文档
    kafka 官网帮助文档
    elasticsearch 官方入门 及 API
    解决Maven出现Plugin execution not covered by lifecycle configuration 错误
    linux下scp用法
    Spring AOP 实现原理
    深入浅出spring IOC中三种依赖注入方式
    Servlet API 中文版
    【转】httpservlet 文章
    jsp request 对象详解
  • 原文地址:https://www.cnblogs.com/doufy/p/10730734.html
Copyright © 2020-2023  润新知