Skip to content

Instantly share code, notes, and snippets.

@thesixonenine
Created February 11, 2023 13:38
Show Gist options
  • Save thesixonenine/2fc7b614f46bb146753e0e5bd656959f to your computer and use it in GitHub Desktop.
Save thesixonenine/2fc7b614f46bb146753e0e5bd656959f to your computer and use it in GitHub Desktop.
#!/bin/bash
printf '\n\n\n\n\n\n修改yum源\n\n\n\n\n\n'
sleep 3
# 修改yum源
sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
sudo curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
sudo sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
sudo yum makecache
sleep 3
printf '\n\n\n\n\n\n安装vim\n\n\n\n\n\n'
sleep 3
# 安装vim
sudo yum install vim -y
cat > .vimrc <<EOF
:set fileencodings=utf-8
:set encoding=utf-8
:set nowrap
:set nu
:set softtabstop=4
:set shiftwidth=4
:set tabstop=4
" 设置主题配色
" colorscheme solarized
" colorscheme koehler
colorscheme desert
EOF
sleep 3
printf '\n\n\n\n\n\n禁用firewalld\n\n\n\n\n\n'
sleep 3
# 禁用firewalld
sudo systemctl stop firewalld
sudo systemctl disable firewalld
sleep 3
printf '\n\n\n\n\n\nssh禁用dns解析\n\n\n\n\n\n'
sleep 3
# ssh禁用dns解析
oldstr="#UseDNS yes"
newstr="UseDNS no"
command=s@$oldstr@$newstr@
sudo sed -i -e "$command" /etc/ssh/sshd_config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment