Cobblerは自動的にデプロイおよびインストールします
Cobblerの概要と環境構成
- Cobblerは、Pythonを使用して開発されたオープンソースプロジェクトであり、デプロイメントシステムに関連するすべてのサービスを集中させることにより、Linuxシステムの完全自動バッチおよび迅速な確立のためのネットワークインストール環境を提供します。
- VMware仮想マシンソフトウェアを使用してデモンストレーションを行うには、インターネットに接続する必要があり、すべての仮想マシンはNATモードを使用します。1台のCentOS7仮想マシンがサーバーとして使用され、もう1台のCentOS7仮想マシンがクライアントとして使用されます。これは、最終テストおよびシステムのインストールなどの通常の構成用に予約されています。クライアントテストマシンのメモリには2G以上が必要
コブラー自動設置サービスの建設手順
- 1.epelソースをインポートします
[root@localhost 1]# rz -E (直接把文件拖进来)
rz waiting to receive.
[root@localhost 1]# ls
epel-release-latest-7.noarch.rpm
[root@localhost ~]# rpm -ivh epel-release-latest-7.noarch.rpm
- 2.Cobblerとその関連サービスパッケージをインストールします
[root@localhost ~]# yum install -y cobbler dhcp tftp-server pykickstart httpd rsync xinetd
各ソフトウェアパッケージの機能は以下のとおりです。
ソフトウェア名 | 説明 |
---|---|
コブラー | Linuxネットワークインストール環境を迅速に確立するために使用されます |
dhcp | 空のホストにIPアドレスを自動的に割り当てるために使用されます |
tftp-server | ブートイメージファイルのダウンロードを提供する |
pykickstart | 無人インストールを実現 |
httpd | コンソールプログラムとして実行 |
rsync | データ同期を実現 |
xinetd | アクセス制御、強化されたログおよびリソース管理機能を提供します |
- 3.メインのcobbler構成ファイルを変更します
[root@localhost 1]# vim /etc/cobbler/settings
next_server: 192.168.131.13 (指向tftp服务器的IP,即本机IP)
server: 192.168.131.13 (指向cobbler服务器的IP,即本机IP)
manage_dhcp: 1 (让cobbler管理dhcp服务)
manage_rsync: 1 (让cobbler管理rsync服务)
manage_tftpd: 1 (让cobbler管理tftp服务)
- 4.関連サービスを開始し、ファイアウォールとselinuxを閉じます
[root@localhost ~]# systemctl start httpd.service
[root@localhost ~]# systemctl start cobblerd.service
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
- 5. tftpの設定ファイルを変更し、サービスを開始します
[root@localhost ~]# vim /etc/xinetd.d/tftp
service tftp
{
disable = no (开启tftp服务,此处将yse改为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
}
[root@localhost ~]# systemctl restart xinetd.service
[root@localhost ~]# systemctl start rsyncd.service
- 6.ブートオペレーティングシステムファイルをダウンロードします
[root@localhost ~]# cobbler get-loaders
task started: 2021-02-24_111551_get_loaders
task started (id=Download Bootloader Content, time=Wed Feb 24 11:15:51 2021)
downloading https://cobbler.github.io/loaders/README to /var/lib/cobbler/loaders/README
downloading https://cobbler.github.io/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo
downloading https://cobbler.github.io/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot
downloading https://cobbler.github.io/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux
downloading https://cobbler.github.io/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi
downloading https://cobbler.github.io/loaders/yaboot-1.3.17 to /var/lib/cobbler/loaders/yaboot
downloading https://cobbler.github.io/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0
downloading https://cobbler.github.io/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32
downloading https://cobbler.github.io/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi
downloading https://cobbler.github.io/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi
*** TASK COMPLETE ***
- 7.ソルト暗号化を使用して、Cobblerユーザーの初期パスワードを設定します
[root@localhost ~]# openssl passwd -1 -salt '11312' '11312' (使用盐值加密方式生成密钥。前面‘ ’里面的可以任意填写字符,后面
的‘ ’里面为安装完系统后root用户的密码)
$1$5514$rQPa3RgJ5WEG3TaZT6toR1
[root@localhost ~]# vim /etc/cobbler/settings (将生成的密钥加入Cobbler配置文件中)
:/default_password
default_password_crypted: "$1$5514$rWPa3RgJ5XQG3IaZT6toM1"
- 8.DHCPサービスを構成します
[root@localhost 1]# vim /etc/cobbler/dhcp.template
subnet 192.168.131.0 netmask 255.255.255.0 {
(这里修改的是网段)
option routers 192.168.131.13; (修改网关)
option domain-name-servers 192.168.131.2; (修改DNS,如果网卡使用的是dhcp模式,可通过nslookup 127.0.0.1 | grep
server 查询DNS地址)
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.131.10 192.168.131.100;(修改地址池)
default-lease-time 21600;
max-lease-time 43200;
- 9.構成されたテンプレートファイルをDHCPサービスの構成ファイルに同期し、DHCPサービスを再起動します
[root@localhost 1]# cobbler sync
...省略...
*** TASK COMPLETE ***
[root@localhost ~]# systemctl restart dhcpd.service
- 10.ISOイメージファイルをインポートします
[root@localhost ~]# mount /dev/cdrom /mnt/
[root@localhost ~]# cobbler import --path=/mnt/ --name=CentOS-7-x86_64 --arch=x86_64
(--path:表示镜像所挂载的目录;--name:表示为安装源定义的名字;--atch:表示指定安装源的系统位数; 默认导入存放路径
为/var/www/cobbler/ks_mirror/CentOS-7-x86_64)
- 11.カーネルファイルと初期化ファイルがtftp-server共有ディレクトリにあるかどうかを確認します
[root@localhost ~]# yum -y install tree (系统默认没有安装,需手动安装tree)
[root@localhost ~]# tree /var/lib/tftpboot/images (查看文件是否存在)
/var/lib/tftpboot/images
└── CentOS-7-x86_64
├── initrd.img
└── vmlinuz
- 12.すべてのサービスを再起動し、cobblercheckを使用してCobblerの設定を確認します
[root@localhost ~]# systemctl restart cobblerd.service
[root@localhost ~]# systemctl restart dhcpd.service
[root@localhost ~]# systemctl restart xinetd.service
[root@localhost ~]# systemctl restart httpd.service
[root@localhost ~]# cobbler check
The following are potential configuration items that you may want to fix:
1 : 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
2 : enable and start rsyncd.service with systemctl
3 : debmirror package is not installed, it will be required to manage debian deployments and repositories
4 : 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.
-
13.すべての構成が完了したら、空のホストの電源を入れて、システムを自動的にインストールします
-
このインストール方法は最小限のインストールであり、インストールされたシステムには文字インターフェイスしかありません
-
ログインアカウント:rootパスワード:11312
-
ログイン後、IPを照会し、Xshellを使用して接続します
グラフィカルインターフェイスが必要な場合は、手動でインストールできます
[root@localhost ~]# yum update grub2-common
[root@localhost ~]# yum install -y fwupdate-efi
[root@localhost ~]# yum install -y net-tools
[root@localhost ~]# yum groupinstall "GNOME Desktop" "Graphical Administration Tools"
[root@localhost ~]# reboot
- 言語を中国語に変更する
[root@localhost ~]# vim /root/anaconda-ks.cfg
1 #version=DEVEL
...略...
14 lang zh_CN.UTF-8
[root@localhost ~]# locale
LANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=