Cobbler无人值守全自动安装部署Linux系统

注意事项:使用VMware Workstation实验时,注意网卡的模式,NAT模式下关闭默认的DHCP服务器!

[[email protected]~]# cat /etc/redhat-release

CentOS release 6.7 (Final)

[[email protected]~]# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

[[email protected]~]# yum install cobbler cobbler-web dhcp cman pykickstart debmirror python-ctypes -y

[[email protected]~]# yum install pykickstart debmirror python-ctypes -y

[[email protected]~]# vim /etc/httpd/conf/httpd.conf  #编辑修改http配置文件

ServerName localhost:80

[[email protected]~]# cat /etc/xinetd.d/rsync |grep disable

disable = no

[[email protected]~]# cat /etc/xinetd.d/tftp |grep disable

disable                 = no

[[email protected]~]# service httpd start

[[email protected]~]# service xinetd start

[[email protected]~]# service cobblerd start

[[email protected]~]# cobbler get-loaders # 首次执行会报错,重新启动cobbler再次执行即可

[[email protected]~]# service cobblerd restart

[[email protected]~]# cobbler get-loaders  #再次执行,等待下载完成即可[需要联网]

[[email protected]~]# sed -i ‘[email protected]_server: [email protected]_server: [email protected]‘ /etc/cobbler/settings

[[email protected]~]# sed -i ‘[email protected]: 12[email protected]: [email protected]‘ /etc/cobbler/settings

[[email protected]~]# sed -i ‘[email protected]="i386"$#@arches="i386"$g‘ /etc/debmirror.conf

[[email protected]~]# sed  -i ‘[email protected]="sid"$#@dists="sid"$g‘ /etc/debmirror.conf

[[email protected]~]# openssl passwd -1 -salt ‘random-phrase-here‘ ‘yangjie‘

[[email protected]~]# $1$random-p$LVezyn3LDLBs0eno3kbbN/

[[email protected]~]# vim /etc/cobbler/settings  #修改密码

default_password_crypted: "$1$random-p$LVezyn3LDLBs0eno3kbbN/"

[[email protected]~]# cobbler check    #检查配置,根据提示修改对应的参数即可

[[email protected]~]# cp /etc/cobbler/dhcp.template /etc/dhcp/dhcpd.conf

[[email protected]~]# vim /etc/dhcp/dhcpd.conf

[[email protected]~]# cat /etc/dhcp/dhcpd.conf

ddns-update-style interim;

allow booting;

allow bootp;

ignore client-updates;

set vendorclass = option vendor-class-identifier;

option pxe-system-type code 93 = unsigned integer 16;

subnet 192.168.1.0 netmask 255.255.255.0 {

option routers             192.168.1.10;

option subnet-mask         255.255.255.0;

range dynamic-bootp        192.168.1.100 192.168.1.254;

default-lease-time         21600;

max-lease-time             43200;

next-server                192.168.1.10;

class "pxeclients" {

match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";

if option pxe-system-type = 00:02 {

filename "ia64/elilo.efi";

} else if option pxe-system-type = 00:06 {

filename "grub/grub-x86.efi";

} else if option pxe-system-type = 00:07 {

filename "grub/grub-x86_64.efi";

} else {

filename "pxelinux.0";

}

}

}

[[email protected]~]# mount /dev/sr0 /media

[[email protected]~]# cobbler import --path=/media/ --name=Centos6.7 #添加镜像文件

[[email protected]~]# cobbler list

[[email protected]~]# cobber distro list

[[email protected]~]# cobbler profile report

#添加镜像文件时默认关联cfg文件,文件路径为/var/lib/cobbler/kickstart/sample_end.cfg

#可以直接使用默认文件进行安装!此处修改关联ks文件,

[[email protected]~]# cobbler profile edit --name=Centos6.7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/Centos6.cfg

[[email protected]~]# cobbler sync    #每次修改设置后执行同步操作生效

[[email protected]~]# service httpd restart

[[email protected]~]# service xinetd restart

[[email protected]~]# service dhcpd restart

[[email protected]~]# service cobblerd restart

安装kickstart程序可以自定义自己需要的ks文件:

[[email protected]~]# yum install -y system-config-kickstart

kickstart文件示例 for Centos6.7:

#platform=x86, AMD64, 或 Intel EM64T

#version=DEVEL

# Firewall configuration

firewall --disabled

# Install OS instead of upgrade

install

# Use network installation

url --url=http://192.168.1.10/cblr/links/Centos6.7-x86_64

# Root password

rootpw --iscrypted $1$fAEc8og0$FUo010cL80ub9ko5lQcjO0

# System authorization information

auth  --useshadow  --passalgo=sha512

# Use text mode install

text

firstboot --disable

# System keyboard

keyboard us

# System language

lang zh_CN

# SELinux configuration

selinux --disabled

# Installation logging level

logging --level=info

# Reboot after installation

reboot

# System timezone

timezone  Asia/Shanghai

# Network information

network  --bootproto=dhcp --device=eth0 --onboot=on

# System bootloader configuration

bootloader --location=mbr

# Clear the Master Boot Record

zerombr

# Partition clearing information

clearpart --all

# Disk partitioning information

part /boot --fstype="ext4" --size=100

part swap --fstype="swap" --size=2000

part / --fstype="ext4" --grow --size=1

%post

useradd admin

sed -i ‘100 i admin ALL=(ALL)   ALL‘ /etc/sudoers

echo -e "net.core.netdev_max_backlog = 262144" >> /etc/sysctl.conf

echo -e "net.core.wmem_default = 8388608" >> /etc/sysctl.conf

echo -e "net.core.rmem_default = 8388608" >> /etc/sysctl.conf

echo -e "net.core.rmem_max = 16777216" >> /etc/sysctl.conf

echo -e "net.core.wmem_max = 16777216" >> /etc/sysctl.conf

echo -e "net.ipv4.route.gc_timeout = 20" >> /etc/sysctl.conf

echo -e "net.ipv4.ip_local_port_range = 10024 65535" >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_retries2 = 5" >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_fin_timeout = 30" >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_syn_retries = 1" >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_synack_retries = 1" >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_timestamps = 0" >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_tw_recycle = 1" >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_tw_reuse = 1" >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_keepalive_time = 120" >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_keepalive_probes = 3" >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_keepalive_intvl = 15" >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_max_tw_buckets = 36000" >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_max_orphans = 3276800" >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_max_syn_backlog = 262144" >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_wmem = 8192 131072 16777216" >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_rmem = 32768 131072 16777216" >> /etc/sysctl.conf

echo -e "net.ipv4.tcp_mem = 94500000 915000000 927000000" >> /etc/sysctl.conf

#/etc/security/limits.conf

echo -e "* soft nproc unlimited" >> /etc/security/limits.conf

echo -e "* hard nproc unlimited" >> /etc/security/limits.conf

echo -e "* soft nofile 655350" >> /etc/security/limits.conf

echo -e "* hard nofile 655350" >> /etc/security/limits.conf

#/etc/proflie

echo -e "ulimit -SHn 655350" >> /etc/profile

echo -e "ulimit -SHu unlimited" >> /etc/profile

echo -e "ulimit -SHd unlimited" >> /etc/profile

echo -e "ulimit -SHm unlimited" >> /etc/profile

echo -e "ulimit -SHs unlimited" >> /etc/profile

echo -e "ulimit -SHt unlimited" >> /etc/profile

echo -e "ulimit -SHv unlimited" >> /etc/profile

source /etc/profile

sysctl -p

%end

%packages

@additional-devel

@base

@compat-libraries

@desktop-platform-devel

@development

@server-platform-devel

%end

###############################################

Centos7.* 7.1:

[[email protected]~]# cobbler import --path=/Centos7/ --name=Centos7.1

[[email protected]~]# chmod 655 /var/lib/cobbler/kickstarts/Centos7.cfg

[[email protected]~]# cobbler profile edit --name=Centos7.1-x86_64 --kickstart=/var/lib/cobbler/kickstarts/Centos7.cfg

[[email protected]~]# cobbler profile edit --name=Centos7.1-x86_64 --kopts=‘net.ifnames=0 biosdevname=0‘

[[email protected]~]# cobbler profile report --name=Centos7.1-x86_64

[[email protected]~]# cobbler sync

Centos7.cfg 文件示例:

#platform=x86, AMD64, or Intel EM64T

#version=DEVEL

# Install OS instead of upgrade

install

# Keyboard layouts

keyboard ‘us‘

# Reboot after installation

reboot

# Root password

rootpw --iscrypted $1$vrLoecRB$SEfZU7opkIKzYMU9b8Uhi0

# System timezone

timezone Asia/Shanghai

# Use network installation

url --url=$tree

# System language

lang zh_CN

# Firewall configuration

firewall --disabled

# Network information

$SNIPPET(‘network_config‘)

# System authorization information

auth  --useshadow  --passalgo=sha512

# Use text mode install

text

firstboot --disable

# SELinux configuration

selinux --disabled

# System bootloader configuration

bootloader --location=mbr

# Clear the Master Boot Record

zerombr

# Partition clearing information

clearpart --all --initlabel

# Disk partitioning information

part /boot --fstype="xfs" --size=100

part swap --fstype="swap" --size=2000

part / --fstype="xfs" --grow --size=1

%packages

@base

@compat-libraries

@development

%end

%addon com_redhat_kdump --disable --reserve-mb=‘auto‘

%end

时间: 2024-08-07 02:41:06

Cobbler无人值守全自动安装部署Linux系统的相关文章

Cobbler全自动批量安装部署Linux系统

前言:这篇文章是系统运维www.osyunwei.com的作品,我只是根据实践了一下,出于对原作者的尊重附原文链接如下: 原文链接:http://www.osyunwei.com/archives/7606.html 根据文章的说明是可以完成所属功能的,不过原文章有点小问题,在本文中我已经修改过了,仅供大家参考,有问题大家交流,E-mail:[email protected] 安装之前的一点说明 Cobbler服务器系统:CentOS5.10 64位 IP地址:192.168.21.128 需要

Kickstart+HTTP+DHCP+TFTP全自动批量安装部署Linux系统

说明: Kickstart服务器系统:CentOS 6.5 64位 IP地址:192.168.0.250 需要安装部署的Linux系统:CentOS 6.5 64位 eth0(第一块网卡,用于外网)IP地址段:60.28.x.x eth1(第二块网卡,用于内网)IP地址段:192.168.0.128 子网掩码:255.255.255.128 网关:192.168.0.250 DNS:114.114.115.115 8.8.4.4 所有服务器均支持PXE网络启动 实现目的:通过配置Kickstar

Cobbler实现自动化无人值守网络批量安装部署Linux系统

一.Cobbler(直译为补鞋匠) 使用 Cobbler,您无需进行人工干预即可安装机器.Cobbler 设置一个 PXE 引导环境(它还可使用 yaboot 支持 PowerPC),并控制与安装相关的所有方面,比如网络引导服务(DHCP 和 TFTP)与存储库镜像.当希望安装一台新机器时,Cobbler 可以: 1.使用一个以前定义的模板来配置 DHCP 服务(如果启用了管理 DHCP) 2.将一个存储库(yum 或 rsync)建立镜像或解压缩一个媒介,以注册一个新操作系统 3.在 DHCP

JMeter的安装部署——Linux系统

1.配置Java环境 在官网https://www.oracle.com/technetwork/java/javase/downloads/jdk10-downloads-4416644.html下载jdk安装包,并将此安装包拷贝到linux机器上: (1)新建jdk目录,并解压jdk安装包到该目录下: [[email protected] ~]# mkdir jdk [[email protected] ~]# tar -zxvf jdk-10-linux-x64.tar.gz -C /jd

详解使用Cobbler快速批量部署linux系统

前言:这几天闲着没事来系统组玩玩,学点东西总是好的嘛.系统组系统组当然还是从学会装系统开始.花了两个小时折腾了一下用cobbler批量部署linux系统.第一次做当然中间遇到很多问题,不过都顺利解决了.完了总结一下写个帖子和大家分享一下. 系统版本:Centos6.5 32位cobbler服务器IP:192.168.175.130 IP地址段:192.168.175.120-192.168.175.140子网掩码:255.255.255.0网关:192.168.175.2DNS:8.8.8.8

Centos6.7安装部署cobbler完成无人值守化安装部署

 Centos6.7部署cobbler完成无人值守化安装部署                   Cobbler是一个免费开源系统安装部署软件,用于自动化网络安装操作系统.在生产环境中,经常批量部署几十甚至上百台服务器时,实现自动化安装操作系统尤为重要,按照传统的光盘引导安装工作量是不可预估的:此前我们通过pxe+kickstart简单实现了自动化安装,但只能实现单一版本安装,当需要部署不同版本或不同引导模式(BIOS.EFI)时,此种方式就不够灵活.而Cobbler正是为了解决此问题而设计的.

cobbler 批量自动化部署 Linux 系统

实验介绍:Cobbler自动化部署linux系统,比PXE部署方式效率更高,因此在大多环境中,以cobbler 方式部署系统,更为方便:具体步骤如下所示: 若描述有误欢迎拍砖交流QQ:45223208 1.安装cobbler 和 DHCP服务: yum install cobbler -y yum install dhcp -y 2. 启动服务 systemctl start cobbler tftp httpd systemctl enable cobbler tftp httpd 3. 根据

Cobbler自动安装的Linux系统ssh无法进入

Linux ssh登陆老提示“permission denied,please try again” ,但是iptables已经关掉了 修改/etc/ssh/sshd_config文件.找如下的一句 #PermitRootLogin yes 改为如下的 PermitRootLogin yes 注意,要把前面的#号去掉. 重启sshd服务器 # service sshd restart Cobbler自动安装的Linux系统ssh无法进入,布布扣,bubuko.com

kvm cobbler无人值守批量安装操作系统

kvm cobbler无人值守批量安装操作系统 cobbler:一个自动网络安装系统的工具,集成PEX.dhcp.dns.tftpd.sync等服务.可以供大家管理安装操作系统 kvm:Linux系统自带的虚拟化软件,自行找资料学习. 环境描述: cobbler: 系统:CentOS_x86 6.8 网卡: eth0:vm1 (管理)10.10.100.131 ech1:NAT (上网)DHCP kvm: 系统:CentOS_x86 6.8 网卡: eth0:vm1 (管理)10.10.100.