简介
Cockpit是一个基于Web的系统管理界面,旨在简化管理Linux服务器的任务。它提供了一个直观的用户界面,让管理员可以轻松地监控系统性能、管理存储、配置网络以及执行其他常见的系统管理任务。Cockpit还支持远程管理,可以通过Web浏览器从任何地方访问服务器。它是一个功能强大且易于使用的工具,适用于各种规模的Linux环境。
图形化管理
Cockpit 使用 systemd 完成从运行守护进程到服务几乎所有的功能
集中式管理,通过一个会话窗口管理网络中的所有 Linux 服务器
软件安装
查看系统版本
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
[root@localhost ~]#
查看 dnf 安装包
[root@localhost ~]# yum list | grep epel-release
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
epel-release.noarch 7-14 @/epel-release-latest-7.noarch
[root@localhost ~]#
安装dnf包
yum install epel-release dnf -y
报错提示
需要换源,需要换源的请看此地址 GNU/Linux 一键更换系统软件源脚本-与世无争 (fiiill.top)
查看软件版本
[root@localhost ~]# dnf --version
4.0.9
Installed: dnf-0:4.0.9.2-2.el7_9.noarch at Thu 23 May 2024 04:31:54 PM EST
Built : CentOS BuildSystem <http://bugs.centos.org> at Wed 07 Apr 2021 03:52:38 PM EST
Installed: rpm-0:4.11.3-48.el7_9.x86_64 at Sat 06 Apr 2024 05:30:06 PM EST
Built : CentOS BuildSystem <http://bugs.centos.org> at Wed 24 Nov 2021 04:33:39 PM EST
安装 Cockpit
yum install -y cockpit cockpit-docker cockpit-machines cockpit-dashboard cockpit-storaged cockpit-packagekit
cockpit
是一个基于 web 的服务器管理工具,它提供了图形化界面来管理系统的各种方面,如用户账户、系统服务、网络设置等。cockpit-docker
是 Cockpit 的一个插件,用于管理 Docker 容器和容器镜像。cockpit-machines
是 Cockpit 的一个插件,用于管理和监控基于 KVM 的虚拟机。cockpit-dashboard
是 Cockpit 的一个插件,用于创建自定义的仪表板来监视系统性能和状态。cockpit-storaged
是 Cockpit 的一个插件,用于管理存储设备和文件系统。cockpit-packagekit
是 Cockpit 的一个插件,用于管理系统软件包的安装、更新和删除。
启动服务
设置自动开机启动
systemctl enable --now cockpit.socket
[root@localhost ~]# systemctl enable --now cockpit.socket
Created symlink from /etc/systemd/system/sockets.target.wants/cockpit.socket to /usr/lib/systemd/system/cockpit.socket.
[root@localhost ~]#
防火墙设置
防火墙设置一
查看防火墙状态
如果是是防火墙状态是开启的,是无法直接在web页面访问的,需要开通相应的应用服务。
[root@localhost ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: active (running) since Thu 2024-05-23 12:44:08 EDT; 1s ago
Docs: man:firewalld(1)
Main PID: 15410 (firewalld)
Tasks: 2
Memory: 24.1M
CGroup: /system.slice/firewalld.service
└─15410 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid
May 23 12:44:07 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
May 23 12:44:08 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
May 23 12:44:08 localhost.localdomain firewalld[15410]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option. It will be removed in a future release. Please cons...bling it now.
Hint: Some lines were ellipsized, use -l to show in full.
开启Cockpit 服务
firewall-cmd --permanent --zone=public --add-service=cockpit
# 重新加载防火墙配置
firewall-cmd --reload
[root@localhost ~]# firewall-cmd --permanent --zone=public --add-service=cockpit
success
[root@localhost ~]# firewall-cmd --reload
success
[root@localhost ~]#
防火墙设置二
如果防火墙是开机的,又不想开启端口,跟服务,可以选择直接关闭防火墙服务
# 停止防火墙服务
systemctl stop firewalld.service
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead) since Thu 2024-05-23 12:54:50 EDT; 7s ago
Docs: man:firewalld(1)
Process: 15410 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
Main PID: 15410 (code=exited, status=0/SUCCESS)
May 23 12:44:07 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
May 23 12:44:08 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
May 23 12:44:08 localhost.localdomain firewalld[15410]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option. It will be removed in a future release. Please cons...bling it now.
May 23 12:47:22 localhost.localdomain firewalld[15410]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option. It will be removed in a future release. Please cons...bling it now.
May 23 12:54:49 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewall daemon...
May 23 12:54:50 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# firewall-cmd --reload
FirewallD is not running
登录web页面
在电脑浏览器页面输入服务器IP + 端口号访问
如果提示以下信息请点击 高级 - 继续访问
页面登录
用户名:服务器登录名称
密 码:服务器登录密码
扩展模块安装
查看系统可安装的扩展模块
[root@localhost ~]# yum list cockpit*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Installed Packages
cockpit.x86_64 195.12-1.el7.centos @extras
cockpit-bridge.x86_64 195.12-1.el7.centos @extras
cockpit-dashboard.x86_64 195.12-1.el7.centos @extras
cockpit-docker.x86_64 195.12-1.el7.centos @extras
cockpit-machines.x86_64 195.12-1.el7.centos @extras
cockpit-packagekit.x86_64 195.12-1.el7.centos @extras
cockpit-storaged.noarch 195.12-1.el7.centos @extras
cockpit-system.noarch 195.12-1.el7.centos @extras
cockpit-ws.x86_64 195.12-1.el7.centos @extras
Available Packages
cockpit-composer.noarch 9-1.el7 extras
cockpit-doc.x86_64 195.12-1.el7.centos extras
cockpit-kubernetes.x86_64 195.12-1.el7.centos extras
cockpit-machines.noarch 195.6-1.el7.centos extras
cockpit-machines-ovirt.noarch 195.12-1.el7.centos extras
cockpit-packagekit.noarch 195.6-1.el7.centos extras
cockpit-pcp.x86_64 195.12-1.el7.centos extras
cockpit-subscriptions.noarch 160-1.el7.centos extras
cockpit-tests.x86_64 195.12-1.el7.centos extras
cockpit-ws.i686 195.10-1.el7.centos base
[root@localhost ~]#
cockpit-composer.noarch
: 用于创建和管理基于 Fedora 和 RHEL 的定制操作系统镜像的工具。cockpit-doc.x86_64
:cockpit
的文档。cockpit-kubernetes.x86_64
: 提供 Kubernetes 的集成管理功能。cockpit-machines.noarch
: 提供管理虚拟机的功能。cockpit-machines-ovirt.noarch
: 提供与 oVirt 虚拟化平台集成的功能。cockpit-packagekit.noarch
: 提供使用 PackageKit 进行软件包管理的功能。cockpit-pcp.x86_64
: 提供 Performance Co-Pilot (PCP) 性能监控的集成功能。cockpit-subscriptions.noarch
: 提供与 Red Hat 订阅服务集成的功能。cockpit-tests.x86_64
:cockpit
的测试套件。cockpit-ws.i686
,它是cockpit
的 Web 服务组件的 32 位版本。