修改DNS设置
vi /etc/resolv.confnameserver 114.114.114.114
nameserver 8.8.4.4安装wget
yum -y install wget修改为阿里源
备份本地yum源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bakmv /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo 获取阿里yum源配置文件
curl http://mirrors.aliyun.com/repo/Centos-7.repo -o /etc/yum.repos.d/CentOS-Base.repocurl http://mirrors.aliyun.com/repo/epel-7.repo -o /etc/yum.repos.d/epel.repo清理缓存
yum clean all更新缓存
yum makecache 更新
yum -y update修改为清华源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bakvi /etc/yum.repos.d/CentOS-Base.repo# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7yum makecache安装ifconfig
yum -y install net-tools.x86_64安装python3
http://blog.meixiangdao.cn/Centos7安装Python3的方法.html
关闭自带防火墙
查看防火墙状态
firewall-cmd --state停止firewall
systemctl stop firewalld.service禁止firewall开机启动
systemctl disable firewalld.service 安装 zsh
yum -y install zshwget https://raw.githubusercontent.com/skywind3000/vim/a368b047f97a0f4338a52236de8ace588ced8538/etc/zshrc.zshmv zshrc.zsh .zshrczshchsh -s /bin/zsh设置 swap
创建一个 2G 大小的 swap 交换文件
fallocate -l 2G /swap修改权限
chmod 0600 /swap制作为swap格式文件:
mkswap /swap再用swapon命令把这个文件分区挂载swap分区
swapon /swapecho "/swap swap swap default 0 0" >> /etc/fstab