0x01 简介

Cockpit是红帽开发的网页版图像化服务管理工具,优点是无需中间层,且可以管理多种服务,根据其项目主站描述,Cockpit 有如下特点:

  • 从易用性考虑设计,方便管理人员使用,而不是仅仅的终端命令按钮化;
  • 不会打乱已有终端或脚本服务配置,通过 Cockpit 启用的服务可以在终端停止,脚本运行的错误亦会被 Cockpit 捕获;
  • 支持一次性管理多个服务,实现自动化和批处理;

Cockpit 工作方式

注意目前 Cockpit 还处于早期开发阶段,不建议在生产环境使用!

官方项目站点: http://cockpit-project.org/

0x02 食用指南

Fedora

Cockpit comes installed by default in Fedora Server.
To install Cockpit on other variants of Fedora use the following commands. For the latest versions use COPR.

1.Install cockpit:

sudo dnf install cockpit

2.Enable cockpit:

sudo systemctl enable --now cockpit.socket

3.Open the firewall if necessary:

sudo firewall-cmd --add-service=cockpit
sudo firewall-cmd --add-service=cockpit --permanent

Red Hat Enterprise Linux

Cockpit is included in Red Hat Enterprise Linux 7 and later.
On RHEL 7, enable the Extras repository.
sudo subscription-manager repos --enable rhel-7-server-extras-rpms
RHEL 8 does not need any non-default repositories.

1.Install cockpit:

sudo yum install cockpit

2.Enable cockpit:

sudo systemctl enable --now cockpit.socket

3.On RHEL 7, or if you use non-default zones on RHEL 8, open the firewall:

sudo firewall-cmd --add-service=cockpit
sudo firewall-cmd --add-service=cockpit --permanent

Fedora CoreOS

The standard Fedora CoreOS image does not contain Cockpit packages.
1.Install Cockpit packages as overlay RPMs:

rpm-ostree install cockpit-system cockpit-ostree cockpit-podman 

Depending on your configuration, you may want to use other extensions as well, such as cockpit-kdump or cockpit-networkmanager.
If you have a custom-built OSTree, simply include the same packages in your build.
2.Reboot
3.Run the Cockpit web service with this privileged container (as root):

podman container runlabel --name cockpit-ws RUN cockpit/ws

4.Make Cockpit start on boot:

podman container runlabel INSTALL cockpit/ws
systemctl enable cockpit.service

Steps 3 and 4 are optional if the CoreOS machine will only be connected to from another host running Cockpit.

CentOS

Cockpit is included in CentOS 7.x:
1.Install cockpit:

sudo yum install cockpit

2.Enable cockpit:

sudo systemctl enable --now cockpit.socket

3.Open the firewall if necessary:

sudo firewall-cmd --permanent --zone=public --add-service=cockpit
sudo firewall-cmd --reload

Afterward, use a web browser to log into port 9090 on your host IP address as usual.

Debian

Cockpit is included in Debian unstable and in backports for 9 (Stretch).
1.For Debian 9 you have to enable the backports repository:

echo 'deb http://deb.debian.org/debian stretch-backports main' > \
 /etc/apt/sources.list.d/backports.list
apt-get update

2.Install the package:

sudo apt-get install cockpit

Ubuntu

Cockpit is included in Ubuntu 17.04 and later, and available as an official backport for 16.04 LTS and later. Backports are enabled by default, but if you customized apt sources you might need to enable them manually.
1.Install the package:

sudo apt-get install cockpit
Last modification:March 25th, 2020 at 03:23 am