cobbler安裝linux
1、系統信息:ios
[root@openstack ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.4 (Maipo)git
[root@openstack ~]# uname -r
3.10.0-693.el7.x86_64github
[root@openstack ~]# ifconfig ens33 |awk -F "[ :]+" 'NR==2 {print $3}'
192.168.209.7
[root@openstack ~]# systemctl stop firewalld
[root@openstack ~]# systemctl disable firewalld
[root@openstack ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
[root@openstack ~]# getenforce
Disabled
2、開始安裝cobblerweb
一、安裝依賴包
[root@openstack ~]# yum -y install epel-release
[root@openstack ~]# yum -y install cobbler cobbler-web dhcp tftp-server pykickstart httpdvim
二、啓動相關服務
[root@openstack ~]# systemctl start cobblerd
[root@openstack ~]# systemctl enable cobblerd
[root@openstack ~]# systemctl enable httpd
[root@openstack ~]# systemctl start httpdapp
三、檢查配置是否有問題
[root@openstack ~]# cobbler check
The following are potential configuration items that you may want to fix:
1 : 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.
2 : For PXE to be functional, the 'next_server' field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network.
3 : 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
4 : change 'disable' to 'no' in /etc/xinetd.d/tftp
5 : 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.
6 : change 'disable' to 'no' in /etc/xinetd.d/rsync
7 : debmirror package is not installed, it will be required to manage debian deployments and repositories
8 : 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
9 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
Restart cobblerd and then run 'cobbler sync' to apply changes.
按照提示解決問題:
問題一:less
[root@openstack ~]# sed -i 's/^server: 127.0.0.1/server: 192.168.209.7/' /etc/cobbler/settings # 修改server的ip地址爲本機ip
問題二:
[root@openstack ~]# sed -i 's/^next_server: 127.0.0.1/next_server: 192.168.209.7/' /etc/cobbler/settings # TFTP Server 的IP地址
問題四:
[root@openstack ~]# vim /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -B 1380 -v -s /var/lib/tftpboot
per_source = 11
cps = 100 2
flags = IPv4
}
問題5:
[root@openstack ~]# cobbler get-loaders # 下載缺失的文件
問題6:
[root@openstack ~]# systemctl enable rsyncd
[root@openstack ~]# systemctl start rsyncd
問題8:
[root@tiandong68 ~]# openssl passwd -1 -salt thunder thunder 8
$1$thunder$XsMPVXOj.YfZ3A66jbr5a1運維
[root@openstack ~]# vim /etc/cobbler/settings
101 default_password_crypted: "$1$123456$wOSEtcyiP2N/IfIl15W6Z0"
問題7和9不用處理,問題三把selinux設置爲disable就能夠了。dom
重啓cobbler而後再次check
[root@openstack ~]# systemctl restart cobblerd.service
[root@openstack ~]# cobbler check 這兩個問題能夠暫時忽略
The following are potential configuration items that you may want to fix:
1 : debmirror package is not installed, it will be required to manage debian deployments and repositories
2 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
Restart cobblerd and then run 'cobbler sync' to apply changes.
四、配置cobbler dhcp
修改cobbler配置
[root@openstack ~]# vim /etc/cobbler/settings
242 manage_dhcp: 1
修改/etc/cobbler/dhcp.template文件
subnet 192.168.209.0 netmask 255.255.255.0 {
option routers 192.168.209.254 ;
option domain-name-servers 119.29.29.29;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.209.100 192.168.209.254;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
重啓cobbler並同步配置,修改完dhcp必須sync同步配置
[root@openstack ~]# systemctl restart cobblerd.service
[root@openstack ~]# cobbler sync
[root@openstack ~]# netstat -lnup|grep dhcp
udp 0 0 0.0.0.0:67 0.0.0.0:* 4665/dhcpd
五、導入鏡像:
[root@openstack ~]# mount /dev/sr0 /mnt/
mount: /dev/sr0 寫保護,將以只讀方式掛載
[root@openstack ~]# cobbler import --path=/mnt --name=Centos-7.4 --arch=x86_64 # cobbler導入鏡像
# --path 鏡像路徑
# --name 爲安裝源定義一個名字
# --arch 指定安裝源是32位、64位、ia64, 目前支持的選項有: x86│x86_64│ia64
# 安裝源的惟一標示就是根據name參數來定義,本例導入成功後,安裝源的惟一標示就是:CentOS-7.4-x86_64
鏡像導入成功後查看:
[root@openstack ~]# cobbler list
distros:
Centos-7.4-x86_64
test
profiles:
Centos-7.4-x86_64
test
systems:
repos:
images:
mgmtclasses:
packages:
files:
導入的鏡像存儲的位置:
[root@openstack ~]# cd /var/www/cobbler/ks_mirror/
[root@openstack ks_mirror]# ll
總用量 0
dr-xr-xr-x 9 root root 288 7月 11 2017 Centos-7.4-x86_64
drwxr-xr-x. 2 root root 100 1月 9 21:11 config
六、導入kickstarts配置文件
[root@openstack ~]# cd /var/lib/cobbler/kickstarts/
[root@openstack kickstarts]# vim Centos-7.4-x86_64.cfg
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Keyboard layouts
keyboard 'us'
# Root password
#rootpw --iscrypted $1$m1pE0DG6$vALBphGGynqvUzfJaWZ6U1
# Use network installation
url --url="$tree"
# System language
lang en_US
# Firewall configuration
firewall --disabled
# System authorization information
auth --useshadow --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# SELinux configuration
selinux --disabled
# Network information
network --bootproto=dhcp --device=eth0
network --bootproto=dhcp --device=eth1
# Reboot after installation
reboot
# System timezone
timezone Asia/Shanghai
# 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 1024 --ondisk sda
#Oracle:part swap --size 16384 --ondisk sda
part swap --size 2048 --ondisk sda
part / --fstype xfs --size 1 --grow --ondisk sda
%packages
@base
@core
@compat-libraries
@debugging
@development
@gnome-desktop
@X Window System
%end
修改默認指定的配置文件爲咱們編譯的
[root@openstack ~]# cobbler profile edit --name Centos-7.4-x86_64 --kickstart=/var/lib/cobbler/kickstarts/Centos7.4-x86_64.cfg # 編輯profile,修改ks文件爲咱們剛剛上傳的Centos7.2-x86_64.cfg
[root@openstack ~]# cobbler profile edit --name Centos-7.4-x86_64 --kopts='net.ifnames=0 biosdevname=0'
# 修改安裝系統的內核參數,在CentOS7系統有一個地方變了,就是網卡名變成eno16777736這種形式,可是爲了運維標準化,咱們須要將它變成咱們經常使用的eth0,所以使用上面的參數。但要注意是CentOS7才須要上面的步驟,CentOS6不須要。
[root@openstack ~]# cobbler profile report --name=Centos-7.4-x86_64
Name : Centos-7.4-x86_64
TFTP Boot Files : {}
Comment :
DHCP Tag : default
Distribution : Centos-7.4-x86_64
Enable gPXE? : 0
Enable PXE Menu? : 1
Fetchable Files : {}
Kernel Options : {'biosdevname': '0', 'net.ifnames': '0'}
Kernel Options (Post Install) : {}
Kickstart : /var/lib/cobbler/kickstarts/Centos-7.4-x86_64.cfg
Kickstart Metadata : {}
Management Classes : []
Management Parameters : <<inherit>>
Name Servers : []
Name Servers Search Path : []
Owners : ['admin']
Parent Profile :
Internal proxy :
Red Hat Management Key : <<inherit>>
Red Hat Management Server : <<inherit>>
Repos : []
Server Override : <<inherit>>
Template Files : {}
Virt Auto Boot : 1
Virt Bridge : xenbr0
Virt CPUs : 1
Virt Disk Driver Type : raw
Virt File Size(GB) : 5
Virt Path :
Virt RAM (MB) : 512
Virt Type : kvm
同步:
[root@openstack ~]# cobbler sync
[root@openstack ~]#systemctl restart rsyncd
[root@openstack ~]#systemctl restart cobblerd
[root@openstack ~]#systemctl restart httpd
新建一個虛擬機:
完成了。