说明: 里面使用的系统镜像来自cloudboot-1.5.1-1.x86_64.rpm
bin文件来自源码编译,其中cloudboot-server修改了更新数据库代码,数据库只需要导入sql就行
附件下载:链接:https://pan.baidu.com/s/1tIgbvhXjk4I9lUK_kJ0wLQ 密码:a0mv
yum install dhcp -y
[root@localhost ~]# cat /etc/dhcp/dhcpd.conf
allow booting;
allow bootp;
ddns-update-style none;
ping-check true;
ping-timeout 3;
default-lease-time 120;
max-lease-time 600;
authoritative;
option arch code 93 = unsigned integer 16;
option domain-name "osinstall";
option domain-name-servers 172.16.1.1;
option root-path "http://172.16.1.1";
next-server 172.16.1.10;
if option arch = 00:07 {
filename "pxelinux.efi";
} else {
filename "pxelinux.bios";
}
subnet 172.16.1.0 netmask 255.255.255.0 {
range 172.16.1.100 172.16.1.200;
option routers 172.16.1.10;
}
其中 subnet 只能有一个
,多个会重启 dhcp 服务失败(进入服务的时候输入网段会重启dhcp)。subnet 里面的内容可以不用填写
# 设置开机启动
systemctl enable dhcpd
# 启动dhcp服务
systemctl start dhcpd
# 安装 tftp-server服务
yum install tftp-server –y
# 如果启动失败需要安装
yum install xinetd
[root@localhost ~]# cat /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
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /opt/cloudboot/var/lib/tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
http://osinstall.idcos.com
填写后台服务端的地址,如果有 dns 服务就写域名,没有的话可以直接写 ip:protsystemctl enable xinetd
systemctl start xinetd
yum install nginx -y
$ cat nginx.conf
……
server {
# 服务监听地址
listen 8080;
server_name localhost;
location ^~/api {
# cloudboot-server 服务启动地址,端口号默认8083如果需要其他接口需要重新编译
proxy_pass http://172.16.1.10:8083;
}
location / {
# 把/opt/cloudboot中的home/www文件拷贝到这里,可以是静态文件服务器地址,指向的内容一样
root html/www;
index index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
……
./nginx
yum install mysql -y
创建的数据库名一定要和后面的数据库连接串一致,这里使用的是 cloudboot, sql 文件附录 cloudboot.sql
[root@localhost ~]# cat /etc/cloudboot-server/cloudboot-server.conf
{
"repo": {
"connection": "root:123456@tcp(172.16.1.1:3306)/cloudboot?charset=utf8&parseTime=True&loc=Local"
},
"osInstall": {
"pxeConfigDir": "/opt/cloudboot/var/lib/tftpboot/pxelinux.cfg"
},
"logger": {
"logFile": "./log/osinstall.log",
"level": "debug"
},
"vm": {
"storage": "guest_images_lvm"
},
"rsa": {
"publicKey": "/etc/cloudboot-server/rsa/public.pem",
"privateKey": "/etc/cloudboot-server/rsa/private.pem"
},
"cron": {
"installTimeout": 3600
},
"activeMQ": {
"server": "activemq.dev.idcos.net:61614"
},
"device": {
"maxBatchOperateNum": 5,
"maxOperateNumIn5Minutes": 5
}
}
启动文件在附录的 bin 里面
[root@localhost cloudboot]# ./cloudboot-server
2019/05/16 17:03:37.186 [I] [main.go:71] The HTTP server is running at http://0.0.0.0:8083
(/home/champly/golang/src/idcos.io/osinstall/model/mysqlrepo/os_install_platform_config.go:73)
[2019-05-16 17:03:37] [40.75ms] SELECT * FROM `platform_configs` WHERE `platform_configs`.`deleted_at` IS NULL AND ((name = 'Version'))
[1 rows affected or returned ]
2019/05/16 17:03:37.227 [D] [cron.go:41] current version:v1.5
如果安装 windows 的话需要安装这个服务,要不然拷贝 firstboot 文件会报错,共享的目录是/opt/cloudboot的 home/samba
如果是虚拟机环境启动的话,有可能系统进入 bootos 之后不会上报系统,需要手动执行
curl http://172.16.1.1/cloudboot-agent -o agent
chmod 755 agent
./agent
cloudboot-agent在附录中的bin里面,需要放到静态文件的根目录
之后就可以在服务端看到状态了,如果还是不行或者报错,查看cat /proc/cmdline
看里面的 SERVER_ADDR
的值是在 dhcp 配置的时候设置的,需要修改成为服务端地址
发现新设备之后先录入,然后安装,如果使用当前的sql文件的话里面有一个centos7.6的模板,只需要修改里面的地址为静态文件的地址就可以了,默认账户密码是root:yunjikeji