Cockpit安装配置速记

安装

参考文档:https://cockpit-project.org/running.html

本系统为 AlmaLinux 9

1
2
3
4
5
6
7
#dnf或yum下载
sudo dnf install cockpit
#启用
sudo systemctl enable --now cockpit.socket
#若有防火墙请注意放行
sudo firewall-cmd --add-service=cockpit
sudo firewall-cmd --add-service=cockpit --permanent

创建用户

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#新增子账号
sudo useradd -g root username
passwd username
#开启密码登录 PasswordAuthentication yes
vim /etc/ssh/sshd_config
#刷新sshd
systemctl restart sshd
#开启子账号sudo权限
vim /etc/sudoers

root all=(all) all
username all=(all) all

#刷新权限
chmod u-w /etc/sudoers

Podman

使用 Podman 前先对服务器进行配置国内源

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 安装完毕后
vim /etc/containers/registries.conf

# unqualified-search-registries = ["registry.access.redhat.com", "registry.redhat.io", "docker.io"]
unqualified-search-registries = ["docker.io"]
[[registry]]
prefix = "docker.io"
insecure = false
blocked = false
location = "docker.m.daocloud.io"
[[registry.mirror]]
# 请填写自己的阿里云镜像服务地址
location = "xxx.mirror.aliyuncs.com"
[[registry.mirror]]
location = "docker.jianmuhub.com"
[[registry.mirror]]
location = "dockerhub.timeweb.cloud"
[[registry.mirror]]
location = "docker.hlyun.org"
[[registry.mirror]]
location = "huecker.io"
[[registry.mirror]]
location = "noohub.ru"

# 保存后刷新配置
podman info

最后也要记得刷新 Cockpit 里 Podman API Service 服务

podman info

环境

PHP 相关

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# 安装 php 预先环境
sudo dnf install -y git gcc gcc-c++ make zlib-devel bzip2 bzip2-devel readline-devel libffi-devel openssl-devel libxml2 libxml2-devel sqlite sqlite-devel libcurl libcurl-devel libpng libpng-devel libjpeg libjpeg-devel icu libicu libicu-devel oniguruma oniguruma-devel tidy libtidy-devel libxslt libxslt-devel libzip libzip-devel
# 倘若部分无法安装可以尝试开启CRB (CodeReady Builder) 和EPEL (Extra Packages for Enterprise Linux) 仓库重试
dnf config-manager --set-enabled crb -y
sudo dnf install epel-release
git clone https://github.com/phpenv/phpenv.git /opt/phpenv
# 注册环境变量
export PHPENV_ROOT="/opt/phpenv"
export PATH="$PHPENV_ROOT/bin:$PATH"
eval "$(phpenv init -)"
source ~/.bashrc
# 重载bash
# 验证phpenv 正常显示system (set by /opt/phpenv/version)
phpenv version
# 安装 php-build 插件
git clone https://github.com/php-build/php-build $(phpenv root)/plugins/php-build
# 验证符合需求版本
phpenv install --list
# 正式安装 php
phpenv install 8.1.30
# [Info]: Done
# [Info]: The Log File is not empty, but the Build did not fail. Maybe just warnings got logged. You can review the log in /tmp/php-build.8.1.30.20241115003455.log or rebuild with '--verbose' option
# [Success]: Built 8.1.30 successfully.
phpenv versions
phpenv global 8.1.30
php -v
# PHP 8.1.30 (cli) (built: Nov 15 2024 17:42:32) (NTS)
# Copyright (c) The PHP Group
# Zend Engine v4.1.30, Copyright (c) Zend Technologies

# 正式安装 php-fpm 驱动

推荐应用

  • nginx-proxy-manager

https://hub.docker.com/r/jlesage/nginx-proxy-manager/tags

podman pull jlesage/nginx-proxy-manager

在 Cockpit 里 Podman 容器,创建来自docker.io/jlesage/nginx-proxy-manager:latest 镜像包容器。

<font style="color:rgb(21, 21, 21);">端口:0.0.0.0:8080 → 8080/tcp 0.0.0.0:8181 → 8181/tcp</font>

<font style="color:rgb(21, 21, 21);">环境变量:TZ=Asia/Shanghai</font>

账号密码可以看日志:info Creating a new user: admin@example.com with password: changeme

  • nginx-ui

  • 文件管理器

https://github.com/45Drives/cockpit-navigator

1
2
3
4
5
nmcli con show        # 列出所有连接
nmcli con modify <connection-UUID> ipv4.dns "8.8.8.8 8.8.4.4"
nmcli con up <connection-UUID>
sudo systemctl restart NetworkManager
cat /etc/resolv.conf
作者

Catooilg

发布于

2024-08-16

更新于

2025-02-10

许可协议

评论