CentOS 8 配置 Web Console
CentOS 8 启动之后,使用 SSH 登录发现了一行提示:Activate the web console with: systemctl enable –now cockpit.socket
。
出于好奇搜索了下 cockpit
,发现是个好东西。
这条命令是提示可以激活系统的 Web管理程序
,设置系统开机启动。
什么是 Cockpit
?
官方网站:https://cockpit-project.org/。
Cockpit 官网介绍:
Cockpit makes GNU/Linux discoverable. See your server in a web browser and perform system tasks with a mouse. It’s easy to start containers, administer storage, configure networks, and inspect logs.
Cockpit 是一个 Web 端的系统管理工具,只用鼠标就能管理系统,事实上也确实如此,启动 Cockpit 服务之后,只需要鼠标就能完成系统很多基础操作,比如查看系统信息,启动/停止服务,新增或者更改账户,系统更新,Web 终端及查看网络流量等功能。
安装 Cockpit
有的发行版本默认已经安装 cockpit,未安装的系统可以使用以下命令安装:
安装
1 | dnf install cockpit |
修改端口
编辑配置文件
1 | nano /etc/systemd/system/sockets.target.wants/cockpit.socket |
修改端口
1 | [Socket] |
修改后需要在防火墙开放对应的端口。
启动和注销 Cockpit
启动 Cockpit
按开机的提示执行以下命令启动:
1 | systemctl enable –now cockpit.socket |
注销 Cockpit
禁用 cockpit
1 | systemctl disable cockpit.socket |
注销 cockpit
1 | systemctl mask cockpit.socket |
设置防火墙
Cockpit
默认是使用 9090
进行 Web 管理,CentOS 8 默认开启了 Firewall
防火墙,需要设置防火墙开放对应的端口:
1 | firewall-cmd --permanent --zone=public --add-service=cockpit |
访问管理端
浏览器中输入以下地址访问远程管理,使用系统用户名和密码登录。
https://ip-address:9090
因为是自签名证书,打开时浏览器会提示证书不可信。
证书在下面的路径,如有需要可以替换。
1 | /etc/cockpit/ws-certs.d/** |