跳转到内容
搜索 RunEntLinux 文档

仅搜索 RunEntLinux 通用文档,各发行版文档使用各自的搜索入口。

    浏览当前文档目录

    初始化配置

    适用于 CentOS Stream 9 & 10 / AlmaLinux 9.x & 10.x / Rocky Linux 9.x & 10.x

    系统安装完成后,按照以下步骤完成初始配置,让系统处于安全、可用的状态。

    • 设置时区和主机名
    • 更新系统到最新版本
    • 安装常用基础工具
    • 配置基本安全设置
    • 已完成系统安装
    • 已登录系统(本地或 SSH)
    • 拥有 sudo 权限
    1. 查看当前时区

      Terminal window
      $ timedatectl
    2. 设置为中国时区

      Terminal window
      $ sudo timedatectl set-timezone Asia/Shanghai
    3. 启用 NTP 时间同步

      Terminal window
      $ sudo timedatectl set-ntp yes
    4. 验证

      Terminal window
      $ timedatectl

      确认 Time zone 显示为 Asia/Shanghai 且 NTP service 为 active。

    设置主机名
    $ sudo hostnamectl set-hostname my-server
    验证
    $ hostnamectl
    更新所有已安装的软件包
    $ sudo dnf update -y
    如有内核更新,重启系统
    $ sudo reboot
    安装常用工具
    $ sudo dnf install -y \
    vim-enhanced \
    wget \
    curl \
    tar \
    bash-completion \
    net-tools \
    bind-utils \
    lsof \
    tmux
    # htop 不在 BaseOS/AppStream,来自 EPEL:先 dnf install -y epel-release
    sudo dnf install -y htop

    查看正在运行的服务,关闭不需要的:

    列出正在运行的服务
    $ systemctl list-units --type=service --state=running

    常见可以关闭的服务(根据实际需求判断):

    如果不需要蓝牙(服务器通常不需要)
    $ sudo systemctl disable --now bluetooth