奋斗
努力

OpenCloudOS Server 8命令?

云计算

OpenCloudOS 8 是基于 CentOS 8 的衍生版本,因此其命令与 RHEL/CentOS 8 高度兼容。以下是常用的系统管理命令分类整理:


1. 系统信息

  • 查看系统版本:
    cat /etc/opencloudos-release
  • 内核版本:
    uname -r
  • 系统负载:
    uptime

2. 包管理(DNF/YUM)

  • 安装软件包:
    dnf install <package>
  • 移除软件包:
    dnf remove <package>
  • 更新系统:
    dnf update
  • 搜索软件包:
    dnf search <keyword>
  • 列出已安装包:
    dnf list installed

3. 服务管理(Systemd)

  • 启动/停止服务:
    systemctl start <service>
    systemctl stop <service>
  • 启用开机自启:
    systemctl enable <service>
  • 查看服务状态:
    systemctl status <service>

4. 网络管理

  • 查看IP地址:
    ip addr  # 或 nmcli device show
  • 重启网络:
    nmcli connection reload
  • 防火墙(firewalld):
    firewall-cmd --list-all  # 查看规则
    firewall-cmd --add-port=80/tcp --permanent  # 开放端口
    firewall-cmd --reload

5. 磁盘管理

  • 查看磁盘空间:
    df -h
  • 查看目录大小:
    du -sh /path/to/dir
  • 挂载磁盘:
    mount /dev/sdX /mnt

6. 用户管理

  • 创建用户:
    useradd <username>
  • 设置密码:
    passwd <username>
  • 提权为root:
    sudo -i  # 或 su -

7. 日志查看

  • 查看系统日志:
    journalctl -xe  # 实时日志
  • 特定服务日志:
    journalctl -u <service>

8. 定时任务

  • 编辑定时任务:
    crontab -e
  • 查看任务列表:
    crontab -l

9. SELinux 管理

  • 查看状态:
    sestatus
  • 临时关闭:
    setenforce 0

10. 性能监控

  • 实时进程监控:
    top  # 或 htop(需安装)
  • 内存使用:
    free -h

注意事项

  • OpenCloudOS 8 默认使用 DNF 替代 YUM(兼容 YUM 命令)。
  • 部分命令可能需要 root 权限,通过 sudo 或切换至 root 用户执行。
  • 如需更详细帮助,可使用 man <command> 查看手册(如 man dnf)。

遇到具体问题时,可结合命令和日志进一步排查。

未经允许不得转载:云服务器 » OpenCloudOS Server 8命令?