Yum源
curl -k -o Replace_yum_centos7.sh http://oss.xiaozhuhome.site/Linux%E8%84%9A%E6%9C%AC/centos%E6%8D%A2yum%E6%BA%90/Replace_yum_centos7.sh
chmod +x Replace_yum_centos7.sh
./Replace_yum_centos7.sh
yum -y install wget vim
vim yum.sh
cd /etc/yum.repos.d/
mkdir 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.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all
yum makecache
yum -y install net-tools bash-completion coreutils iproute
chmod 777 yum.sh
./yum.sh
yum update -y
安装常用命令
cd
vim .bashrc
if ! shopt -oq posix
if [ -f /usr/share/bash-completion/bash_completion ]
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]
. /etc/bash_completion
fi
fi
export PS1='[\033[01m][[\033[01;32m]\u[\033[00m][\033[01m]@[\033[01;35m]\h[\033[01;31m] [\033[01;36m]\w[\033[0m]] $ '
export HISTTIMEFORMAT=" %F %T "
HISTSIZE=10000
HISTFILESIZE=2000
source .bashrc
修改历史命令时间戳、最大值
vim .bashrc
export HISTTIMEFORMAT=" %F %T "
HISTSIZE=10000
HISTFILESIZE=2000
source .bashrc 重新加载 .bashrc文件
修改字符集颜色
vim .bashrc
# 添加
export PS1='[\033[01m][[\033[01;32m]\u[\033[00m][\033[01m]@[\033[01;35m]\h[\033[01;31m] [\033[01;36m]\w[\033[0m]] $ '
source .bashrc 重新加载 .bashrc文件
Tab自动补齐命令
vim .bashrc
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
source .bashrc 重新加载 .bashrc文件
配置sudo用户
adduser ceshi
passwd ceshi
groupadd sudo
usermod -aG sudo ceshi
vim /etc/sudoers
# 添加
%sudo ALL=(ALL:ALL) NOPASSWD:ALL
%suanfa ALL=(ALL) NOPASSWD:ALL
SeLinux说明
临时法
setenforce 0
永久关闭
vim /etc/selinux/config
然后重启服务器即可,配合上面的临时法可以暂时不用重启,反正下次重启后就生效了。