######################################## # Linux Configuration # # # # Author: tomoncle # # # ################ Centos ################ >>> yum源配置 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo yum update >>> 内核升级 rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org yum -y install https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm sed -i 's#elrepo.org/linux#mirrors.aliyun.com/elrepo#g' /etc/yum.repos.d/elrepo.repo sed -i 's/mirrorlist=/#mirrorlist=/g' /etc/yum.repos.d/elrepo.repo yum --disablerepo="*" --enablerepo="elrepo-kernel" list available yum -y --enablerepo=elrepo-kernel install kernel-lt grub2-set-default 0 echo -e "\033[5;36m内核已经安装成功,重启后生效\033[0m" ## 升级 kernel-header, kernel-tools kernel-tools-libs 等,请在内核升级成功后再执行 yum erase kernel-headers kernel-tools kernel-tools-libs yum -y --enablerepo=elrepo-kernel install kernel-lt* >>> VM clone 网卡配置 rm -f /etc/machine-id && systemd-machine-id-setup sed -i "/UUID/c UUID=\"$(uuidgen)\"" /etc/sysconfig/network-scripts/ifcfg-ens33 systemctl restart network ################ Ubuntu ################# >>> apt源配置 ## ubuntu 22.04 mv /etc/apt/sources.list /etc/apt/sources.list.bak # 官方源 echo '# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to deb http://archive.ubuntu.com/ubuntu/ jammy main restricted deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted deb http://archive.ubuntu.com/ubuntu/ jammy universe deb http://archive.ubuntu.com/ubuntu/ jammy-updates universe deb http://archive.ubuntu.com/ubuntu/ jammy multiverse deb http://archive.ubuntu.com/ubuntu/ jammy-updates multiverse deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted deb http://security.ubuntu.com/ubuntu/ jammy-security universe deb http://security.ubuntu.com/ubuntu/ jammy-security multiverse ' > /etc/apt/sources.list # 阿里源 sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list # 镜像源 echo '# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to deb http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted deb http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted deb http://ports.ubuntu.com/ubuntu-ports/ jammy universe deb http://ports.ubuntu.com/ubuntu-ports/ jammy-updates universe deb http://ports.ubuntu.com/ubuntu-ports/ jammy multiverse deb http://ports.ubuntu.com/ubuntu-ports/ jammy-updates multiverse deb http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted universe multiverse deb http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted deb http://ports.ubuntu.com/ubuntu-ports/ jammy-security universe deb http://ports.ubuntu.com/ubuntu-ports/ jammy-security multiverse ' > /etc/apt/sources.list ## ubuntu 20.04