This commit is contained in:
veypi
2021-12-22 17:10:35 +08:00
parent 564847851b
commit 65e2409fae
18 changed files with 428 additions and 34 deletions
+24 -9
View File
@@ -1,5 +1,9 @@
# centos7 Cobbler
https://blog.csdn.net/qq_36441659/article/details/104965639
https://askubuntu.com/questions/476508/why-ubuntu-server-asks-to-insert-a-cd-rom-when-installed-from-pxe
[TOC]
## 安装
@@ -7,7 +11,16 @@
```bash
# cobbler 在epel源中
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum install cobbler xinetd dhcpd
yum install cobbler xinetd dhcp bind cobbler-web debmirror pykickstart fence-agents
systemctl enable cobblerd httpd xinetd dhcpd
systemctl start cobblerd httpd xinetd dhcpd
# 需要关闭seliux和防火墙
vim /etc/selinux/config
systemctl stop firewalld.service
systemctl disable firewalld.service
reboot
```
@@ -49,15 +62,7 @@ subnet 192.168.1.0 netmask 255.255.255.0 {
```
```bash
systemctl enable cobbler httpd xinetd
systemctl start cobbler httpd xinetd
# 需要关闭seliux和防火墙
vim /etc/selinux/config
systemctl stop firewalld.service
systemctl disable firewalld.service
reboot
# 检测 会提示一些操作, 根据需要去做
cobbler check
@@ -102,8 +107,11 @@ cobbler sync
# http://mirrors.aliyun.com/centos 下载镜像, 下载minimal版方便测试
mkdir /mnt/centos7
mount -t iso9660 -o loop,ro ~/CentOS-7-x86_64-Minimal-2003.iso /mnt/centos7
# 导入
cobbler import --name=centos7 --path=/mnt/centos7
cobbler import --name=u20 --bread=ubuntu --os-version=focal --path=/mnt/u20
cobbler signature update
## profile url http://192.168.10.60/cblr/svc/op/ks/profile/centos7-x86_64
## 访问这个链接可以查看完整版的ks文件, 也可以验证ks是否正确
@@ -343,6 +351,13 @@ cobbler profile report --name=centos7-x86_64
```
#### ubuntu20-server
```bash
# 需要将该文件作为initrd文件 否则会出现cd
/install/netboot/ubuntu-installer/amd64/initrd.gz
/var/lib/tftpboot/images/u20
```
+12 -10
View File
@@ -8,18 +8,20 @@
#!/bin/sh
LANG=""
up_time0=`ip -s link show $1 | grep "TX" -A 1 | sed -n '2p' | awk '{print $1}'`
down_time0=`ip -s link show $1 | grep "RX" -A 1 | sed -n '2p' | awk '{print $1}'`
while true
do
up_time1=`ifconfig $1 | grep "TX packets" | awk '{print $5}'`
down_time1=`ifconfig $1 | grep "RX packets" | awk '{print $5}'`
up_time1=`ip -s link show $1 | grep "TX" -A 1 | sed -n '2p' | awk '{print $1}'`
down_time1=`ip -s link show $1 | grep "RX" -A 1 | sed -n '2p' | awk '{print $1}'`
sleep 1
clear
up_time2=`ifconfig $1 | grep "TX packets" | awk '{print $5}'`
down_time2=`ifconfig $1 | grep "RX packets" | awk '{print $5}'`
up_time=`expr $up_time2 - $up_time1`
down_time=`expr $down_time2 - $down_time1`
up_time=`expr $up_time / 1024`
down_time=`expr $down_time / 1024`
echo 上传速度: $up_time KB/s
echo 下载速度: $down_time KB/s
up_time2=`ip -s link show $1 | grep "TX" -A 1 | sed -n '2p' | awk '{print $1}'`
down_time2=`ip -s link show $1 | grep "RX" -A 1 | sed -n '2p' | awk '{print $1}'`
up_time=`expr $[(up_time2 - up_time1) / 1024]`
down_time=`expr $[(down_time2 - down_time1) / 1024]`
up_time_all=$(expr $[(up_time2 - up_time0) / 1024 / 1024])
down_time_all=$(expr $[(down_time2 - down_time0) / 1024 / 1024])
echo 上传速度: $up_time KB/s $up_time_all MB
echo 下载速度: $down_time KB/s $down_time_all MB
done
+2 -1
View File
@@ -6,7 +6,8 @@ sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/i
sh -c "$(curl -fsSL https://public.veypi.com/install_zsh.sh)"
echo 'PROMPT=%m\ $PROMPT' >> ~/.zshrc
echo 'DISABLE_AUTO_UPDATE="true"' >> ~/.zshrc
sed -i '1i\DISABLE_AUTO_UPDATE="true"' ~/.zshrc
chsh -s /bin/zsh
sudo reboot -h now