Wang 发布的文章

你想配置更大的 swap 空间,这是解决 Ubuntu 内存不足触发 OOM Killer 最实用的方法之一。我会给你提供完整、可直接操作的步骤,从查看当前 swap 到创建新的大 swap 文件,全程适配 Ubuntu 系统。

- 阅读剩余部分 -

  • 清理并备份原有仓库配置

    cd /etc/yum.repos.d/
    mkdir backup
    mv *.repo backup/
  • 使用国内镜像源加速

    cat <<EOF > /etc/yum.repos.d/CentOS-Vault.repo
    [base]
    name=CentOS-8 - Base
    baseurl=https://mirrors.aliyun.com/centos-vault/8.5.2111/BaseOS/x86_64/os/
    gpgcheck=1
    gpgkey=https://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-Official
    enabled=1
    
    [appstream]
    name=CentOS-8 - AppStream
    baseurl=https://mirrors.aliyun.com/centos-vault/8.5.2111/AppStream/x86_64/os/
    gpgcheck=1
    gpgkey=https://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-Official
    enabled=1
    
    [extras]
    name=CentOS-8 - Extras
    baseurl=https://mirrors.aliyun.com/centos-vault/8.5.2111/extras/x86_64/os/
    gpgcheck=1
    gpgkey=https://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-Official
    enabled=1
    EOF
  • 或者使用官方源

    cat <<EOF > /etc/yum.repos.d/CentOS-Vault.repo
    [base]
    name=CentOS-8 - Base
    baseurl=http://vault.centos.org/8.5.2111/BaseOS/x86_64/os/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
    enabled=1
    
    [appstream]
    name=CentOS-8 - AppStream
    baseurl=http://vault.centos.org/8.5.2111/AppStream/x86_64/os/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
    enabled=1
    
    [extras]
    name=CentOS-8 - Extras
    baseurl=http://vault.centos.org/8.5.2111/extras/x86_64/os/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
    enabled=1
    EOF
  • 清理 YUM 缓存并重新生成

    yum clean all
    yum makecache