translated 20210518 manage your raspberry Pi

This commit is contained in:
RiaXu 2021-06-09 21:26:30 +08:00 committed by GitHub
parent 7e735eece7
commit 0696365877
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 166 additions and 164 deletions

View File

@ -1,164 +0,0 @@
[#]: subject: (Manage your Raspberry Pi with Cockpit)
[#]: via: (https://opensource.com/article/21/5/raspberry-pi-cockpit)
[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss)
[#]: collector: (lujun9972)
[#]: translator: (ShuyRoy)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Manage your Raspberry Pi with Cockpit
======
Establish central control over your Raspberry Pis with Cockpit.
![Neon colorized Raspberry Pi cluster with LEGOs][1]
Last year, I wrote about using [Cockpit to manage my Linux servers][2]. It is a web-based tool that gives you a clean, powerful interface for managing multiple servers and their associated services and applications. It also eases regular day-to-day administrative tasks.
In this article, I'll describe how to install the Cockpit web console for Linux servers on the Raspberry Pi operating system (OS), the standard OS provided by the Raspberry Pi Foundation. I'll also provide brief descriptions of its features.
### Installing Cockpit on Raspberry Pi OS
Log into your Raspberry Pi system using secure shell (SSH) using an account with sudo privileges. Set up an account if you haven't already done so:
```
$ ssh pibox
alan@pibox's password:
Linux pibox.someplace.org 5.10.17-v7+ #1403 SMP Mon Feb 22 11:29:51 GMT 2021 armv7l
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue May  4 09:55:57 2021 from 172.1.4.5
alan@pibox:~ $
```
The command to install the Cockpit web console is as simple on Raspberry Pi OS as it is on Linux servers:
```
`$ sudo apt install cockpit`
```
Cockpit only requires 60.4 kB of disk space. Together with its several package dependencies, total usage is 115MB.
The installation process will take care of setting up and starting the services. You can verify the status by using the `systemctl` command:
```
$ systemctl status cockpit.socket
● cockpit.socket - Cockpit Web Service Socket
   Loaded: loaded (/lib/systemd/system/cockpit.socket; enabled; vendor preset: enabled)
   Active: active (listening) since Tue 2021-05-04 10:24:43 EDT; 35s ago
     Docs: man:cockpit-ws(8)
   Listen: 0.0.0.0:9090 (Stream)
  Process: 6563 ExecStartPost=/usr/share/cockpit/motd/update-motd  localhost (code=exited, status=0/SUCCESS)
  Process: 6570 ExecStartPost=/bin/ln -snf active.motd /run/cockpit/motd (code=exited, status=0/SUCCESS)
    Tasks: 0 (limit: 2181)
   CGroup: /system.slice/cockpit.socket
```
### Using Cockpit
#### Connecting
The default listening port is 9090. Open your favorite web browser and enter the address, e.g., `https://pibox:9090`.
![Cockpit home page][3]
(Alan Formy-Duval, [CC BY-SA 4.0][4])
You can now log in with your regular user account. Again, it is helpful to have sudo privileges on this account—most likely the same one you use to SSH and run Apt. Be sure to check the box for "Reuse my password for privileged tasks".
#### Managing your Pi
Cockpit's initial screen starts with **System** and will provide details and graphs of current CPU and memory usage.
![Initial Cockpit screen][5]
(Alan Formy-Duval, [CC BY-SA 4.0][4])
You can view hardware details from this screen.
![Cockpit hardware details][6]
(Alan Formy-Duval, [CC BY-SA 4.0][4])
Explore the column on the left by clicking each item (e.g., Logs, Storage, Services, etc.). These are the standard Cockpit sections and are fairly self explanatory. Let me quickly describe each.
#### Logs
This section shows the logs. They can be filtered by date and severity.
#### Storage
The storage section shows the physical drives and RAID devices that are installed. Details such as size and serial number are shown. Graphs for read/write activity and actual space usage are displayed. Storage specific logs are presented at the bottom.
#### Networking
This section displays send and recieve activity, IP addresses, and network specific logs. You can also add more networking devices; such as bonds, bridges, and VLANs using the respective buttons.
#### Accounts
Existing accounts are shown here. Click each to manage or use the _Create New Account_ button to add users. Accounts can be deleted here also.
#### Services
This section allows the administrator to view the status of all of the system services. Clicking any service takes you to a screen with the standard tasks of start, restart, and disable.
#### Applications
Normally, this screen provides various applications for managing functions such as the 389 Directory Server or creation of Podman containers. On my Raspberry OS though, this screen only displayed the message, "No applications installed or available". At the time of writing, perhaps this has not yet been implemented. Although, you do have to wonder whether these types of processes would be too heavy for the Raspberry PI hardware.
#### Software Updates
Keeping software up to date is one of the most important tasks for any system administrator. Cockpit's Software Updates section checks and applies updates.
![Software updates in Cockpit][7]
(Alan Formy-Duval, [CC BY-SA 4.0][4])
#### Terminal
One of Cockpit's neatest features is the terminal. You can use it instead of opening a separate terminal emulator and using SSH. I used the terminal to install [ScreenFetch][8]:
```
`$ sudo apt install screenfetch`
```
And I used ScreenFetch to produce this screenshot:
![Terminal in Cockpit][9]
(Alan Formy-Duval, [CC BY-SA 4.0][4])
### Centralized control with Cockpit
Cockpit behaves on Raspberry Pi just like it does on any other Linux system. You can add it to a dashboard for centralized control. It allows organizations to integrate Raspberry Pi-based services and systems into their overall Linux infrastructure anywhere Cockpit is used as a management dashboard solution. This is highly convenient, given that Pis are often run headless in high-density racked data centers that generally lack KVM access.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/5/raspberry-pi-cockpit
作者:[Alan Formy-Duval][a]
选题:[lujun9972][b]
译者:[RiaXu](https://github.com/ShuyRoy)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/alanfdoss
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberrypi_kuberenetes_cluster_lead2_0.jpeg?itok=kx0Zc0NK (Neon colorized Raspberry Pi cluster with LEGOs)
[2]: https://opensource.com/article/20/11/cockpit-server-management
[3]: https://opensource.com/sites/default/files/uploads/cockpit_homepage.png (Cockpit home page)
[4]: https://creativecommons.org/licenses/by-sa/4.0/
[5]: https://opensource.com/sites/default/files/uploads/cockpit_initialscreen.png (Initial Cockpit screen)
[6]: https://opensource.com/sites/default/files/uploads/hardware_details.png (Cockpit hardware details)
[7]: https://opensource.com/sites/default/files/uploads/software_updates.png (Software updates in Cockpit)
[8]: https://opensource.com/article/20/1/screenfetch-neofetch
[9]: https://opensource.com/sites/default/files/uploads/pi_cockpit_terminal.png (Terminal in Cockpit)

View File

@ -0,0 +1,166 @@
[#]: subject: (Manage your Raspberry Pi with Cockpit)
[#]: via: (https://opensource.com/article/21/5/raspberry-pi-cockpit)
[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss)
[#]: collector: (lujun9972)
[#]: translator: (ShuyRoy)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
使用Cockpit管理你的树莓派
======
用Cockpit建立你的树莓派的控制中心。
![Neon colorized Raspberry Pi cluster with LEGOs][1]
去年,我写了关于使用[Cockpit管理我的Linux服务器的文章][2]。它是一个基于web的工具为管理多个服务器及其相关的服务和应用提供了一个干净、强大的接口。它还简化了日常的管理任务。
在这篇文章中我将会介绍如何在树莓派基金会提供的标准操作系统OS上安装Linux服务器的Cockpit web控制台。我还会简要介绍它的特性。
### 在树莓派OS上安装Cockpit
在sudo权限下使用一个账户通过SSH登录你的树莓派系统。如果你还没有建立一个账户
```
$ ssh pibox
alan@pibox's password:
Linux pibox.someplace.org 5.10.17-v7+ #1403 SMP Mon Feb 22 11:29:51 GMT 2021 armv7l
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue May  4 09:55:57 2021 from 172.1.4.5
alan@pibox:~ $
```
在树莓派OS上安装Cockpit web控制台和在Linux服务器上一样简单
```
`$ sudo apt install cockpit`
```
Cockpit只需要60.4 KB的磁盘空间。加上它的几个包依赖项总使用量是115MB。
安装过程将负责设置和启动服务。你可以使用 `systemctl` 命令来验证状态。
```
$ systemctl status cockpit.socket
● cockpit.socket - Cockpit Web Service Socket
   Loaded: loaded (/lib/systemd/system/cockpit.socket; enabled; vendor preset: enabled)
   Active: active (listening) since Tue 2021-05-04 10:24:43 EDT; 35s ago
     Docs: man:cockpit-ws(8)
   Listen: 0.0.0.0:9090 (Stream)
  Process: 6563 ExecStartPost=/usr/share/cockpit/motd/update-motd  localhost (code=exited, status=0/SUCCESS)
  Process: 6570 ExecStartPost=/bin/ln -snf active.motd /run/cockpit/motd (code=exited, status=0/SUCCESS)
    Tasks: 0 (limit: 2181)
   CGroup: /system.slice/cockpit.socket
```
### 使用Cockpit
#### 连接
默认的监听端口号是9090。打开你最喜欢的web浏览器并输入地址例如 `https://pibox:9090`.
![Cockpit home page][3]
(Alan Formy-Duval, [CC BY-SA 4.0][4])
你现在可以使用你的常规账户登录。同样在这个账户上使用sudo权限是很有帮助的——使用SSH和运行Apt很像。一定要勾选“为特权任务重用我的密码”。
#### 管理你的派
Cockpit的初始屏幕以 **System** 开始将提供当前CPU和内存使用的详细信息和图。
![Initial Cockpit screen][5]
(Alan Formy-Duval, [CC BY-SA 4.0][4])
你可以从这个屏幕看到硬件细节。
![Cockpit hardware details][6]
(Alan Formy-Duval, [CC BY-SA 4.0][4])
通过点击每一项来展开左边的列例如日志、存储、服务等。这些是标准的Cockpit部分而且非常明显。
#### 日志
这部分展示了日志。它们可以根据日期和严重程度来过滤。
#### 存储
存储部分展示了已经安装的物理驱动器和RAID设备。例如大小、序列号等细节都被展示了出来。还展示了读/写活动和真实的空间使用的图。专门存储日志的在底部展示。
#### 网络
这部分展示了发送和接收活动、IP地址以及网络的日志。你也可以添加更多的网络设备例如使用各自按钮的bonds、桥以及VLAN。
#### 账户
这里展示了已有的账户。点击每个账户来管理或使用创建新账户按钮来添加用户。账户也可以被删除。
#### 服务
这部分可以让管理员查看系统所有服务的状态。点击任何服务都会转到一个包含启动、重启和禁用的标准任务的屏幕。
#### 应用程序
通常这个屏幕提供了各种用于管理功能的应用程序例如389目录服务器或Podman同期的创建。但在我的树莓派OS上这个屏幕只显示“没有安装或可用的应用程序”。在写应用程序的时候这个或许还没有实现。尽管如此你得不得怀疑这类型的过程对于树莓派硬件来说是否太沉重。
#### 软件更新
对任何系统管理员来说保持软件最新是最重要的任务之一。Cockpit的软件更新部分检查并进行更新。
![Software updates in Cockpit][7]
(Alan Formy-Duval, [CC BY-SA 4.0][4])
#### 终端
Cockpit最整洁的特点之一是终端。你可以使用它而不是打开一个单独的终端模拟器并使用SSH。我使用中断来安装[ScreenFetch][8]
```
`$ sudo apt install screenfetch`
```
我使用ScreenFetch生成了这张截图
![Terminal in Cockpit][9]
(Alan Formy-Duval, [CC BY-SA 4.0][4])
### 使用Cockpit的中心控制
Cockpit在树莓派上的行为就像它在任何其他Linux系统上一样。你可以将它添加到控制面板上进行集中控制。它允许组织将基于树莓派的服务和系统集成到他们的整个Linux基础设施中无论Cockpit在哪里被用来作为管理控制面板的解决方案。这是非常方便的因为派经常在无领导者的高密度机架数据中心运行而这些数据中心通常会缺乏KVM访问。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/5/raspberry-pi-cockpit
作者:[Alan Formy-Duval][a]
选题:[lujun9972][b]
译者:[RiaXu](https://github.com/ShuyRoy)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/alanfdoss
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberrypi_kuberenetes_cluster_lead2_0.jpeg?itok=kx0Zc0NK (Neon colorized Raspberry Pi cluster with LEGOs)
[2]: https://opensource.com/article/20/11/cockpit-server-management
[3]: https://opensource.com/sites/default/files/uploads/cockpit_homepage.png (Cockpit home page)
[4]: https://creativecommons.org/licenses/by-sa/4.0/
[5]: https://opensource.com/sites/default/files/uploads/cockpit_initialscreen.png (Initial Cockpit screen)
[6]: https://opensource.com/sites/default/files/uploads/hardware_details.png (Cockpit hardware details)
[7]: https://opensource.com/sites/default/files/uploads/software_updates.png (Software updates in Cockpit)
[8]: https://opensource.com/article/20/1/screenfetch-neofetch
[9]: https://opensource.com/sites/default/files/uploads/pi_cockpit_terminal.png (Terminal in Cockpit)