就是通过网络 安装linux
首先简单介绍一下Centos7的一些功能
systemctl 启动,重启,暂停服务,还可以设置开机自启动
systemctl enable httpd.service 开启自启动
systemctl start httpd service 启动服务
防火墙变成了 firewalld
关闭防火墙 systemctl disable firewalld
====================================
开始安装cobbler
yum install cobbler cobbler-web dhcp tftp-server pykickstart httpd -y
如果报错Django>=1.4 下载django,安装
http://cbs.centos.org/koji/buildinfo?buildID=1027
安装好后,清除yum缓存,yum clean all
启动
/etc/init.d/httpd start
/etc/init.d/cobblerd start
查看cobbler
cobbler check
#如果出现一堆错误,就重新启动一下bobbler
出现下面这样,然后一条一条解决
#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 : 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.
4 : change 'disable' to 'no' in /etc/xinetd.d/rsync
5 : debmirror package is not installed, it will be required to manage debian deployments and repositories
6 : 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
7 : 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.
解决:
第1,2问题
vim /etc/cobbler/settings
#pxe的位置
next_server: 10.0.0.123
server: 10.0.0.123
#管理dhcp,启动
manage_dhcp: 1
第3问题
执行
cobbler get-loaders
第4问题
disable = no
vim /etc/xinetd.d/rsync
重启/etc/init.d/xinetd restart
第6问题
#修改密码
openssl passwd -1 -salt '12345' '12345' $1$12345$4Gam1JX4790weMm6hLf9I/ 复制到 vim /etc/cobbler/settings default_password_crypted: "$1$12345$4Gam1JX4790weMm6hLf9I/"
重启
etc/init.d/cobblerd restart
Stopping cobbler daemon: [确定]
Starting cobbler daemon: [确定]
测试
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.
剩下的可以不解决
yum install -y debmirror yum-utils fence-agents #装不装都行
#修改cobbler 下面的dhcp
vim /etc/cobbler/dhcp.template subnet 10.0.0.0 netmask 255.255.255.0 { option routers 10.0.0.2; #网关 option domain-name-servers 8.8.8.8; #dns option subnet-mask 255.255.255.0; range dynamic-bootp 10.0.0.100 10.0.0.200;#ip段 default-lease-time 21600; max-lease-time 43200; next-server $next_server; class "pxeclients" {
执行
cobbler sync
生成DHCP文件
cat /etc/dhcp/dhcpd.conf
挂载光盘镜像
mount /dev/cdrom /mnt
#生成镜像
cobbler import --path=/mnt/ --name=CentOS-7-x86_64 --arch=x86_64
#生成镜像位置
ll /var/www/cobbler/ks_mirror/
#查看镜像
cobbler list distros: CentOS-7-x86_64 profiles: CentOS-7-x86_64
#定义安装文件
#System language lang en_US #System keyboard keyboard us #Sytem timezone timezone Asia/Shanghai #Root password rootpw --iscrypted $default_password_crypted #rootpw --iscrypted $1$ops-node$7hqdpgEmIE7Z0RbtQkxW20 #Use text mode install text #Install OS instead of upgrade install #Use NFS installation Media url --url=$tree #url --url=http://192.168.56.11/CentOS-7.1-x86_64 #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 part swap --size 16384 --ondisk sda part / --fstype xfs --size 1 --grow --ondisk sda #System authorization infomation auth --useshadow --enablemd5 #Network information $SNIPPET('network_config') #network --bootproto=dhcp --device=eth0 --onboot=on # Reboot after installation reboot #Firewall configuration firewall --disabled #SELinux configuration selinux --disabled #Do not configure XWindows skipx %pre $SNIPPET('log_ks_pre') $SNIPPET('kickstart_start') $SNIPPET('pre_install_network_config') # Enable installation monitoring $SNIPPET('pre_anamon') %end #Package install information %packages @ base @ core sysstat iptraf ntp lrzsz ncurses-devel openssl-devel zlib-devel OpenIPMI-tools mysql nmap screen %end %post systemctl disable postfix.service %end
将上面这些放在
cd /var/lib/cobbler/kickstarts/Cobbler-Centos-7.cfg
查看profile
cobbler profile report Name : CentOS-7-x86_64 TFTP Boot Files : {} Comment : DHCP Tag : default Distribution : CentOS-7-x86_64 Enable gPXE? : 0 Enable PXE Menu? : 1 Fetchable Files : {} Kernel Options : {} Kernel Options (Post Install) : {} Kickstart : /var/lib/cobbler/kickstarts/sample_end.ks 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
#修改kickstarts 路径
cobbler profile edit --name=CentOS-7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/Cobbler-Centos-7.cfg
cobbler profile edit --name=CentOS-7-x86_64 --kopts='net.ifnames=0 biosdevname=0'
#在查看一下
cobbler profile report Name : CentOS-7-x86_64 TFTP Boot Files : {} Comment : DHCP Tag : default Distribution : CentOS-7-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/Cobbler-Centos-7.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
#在重新sync
cobbler sync
#重新帮你调整
现在就可以安装了
vm --- power---- power on to bios
#