「Linux」- 在操作系统安装后,进行简单设置

Debian-based

# --------------------------------------------------------- # 添加自定义设置

cat >> ~/.bashrc <<EOF

# https://github.com/microsoft/WSL/issues/930
# LS_COLORS="$LS_COLORS":'di=0;36' ; export LS_COLORS

# 调整 PS1 变量
export PS1="\e[01;31m\u@\h \w\e[00m""\e[34;1m\e[0m""\n""# "

# 常用命令别名
alias ll='ls -l -a --color'
alias ls='ls -a --color'
EOF

touch ~/.hushlogin

exec su - root # 配置重载,以使其生效

# --------------------------------------------------------- # 安装常用工具,以方便系统维护管理

apt-get update
apt-get install -y vim tmux rsync tree iotop sysstat bash-completion

配置源,以提高应用的安装速度(可选):

cp /etc/apt/source.list /etc/apt/source.list.backup

cat > /etc/apt/source.list <<EOF
deb https://mirrors.aliyun.com/debian  stable main contrib non-free
deb https://mirrors.aliyun.com/debian  stable-updates main contrib non-free
EOF

apt-get update

CentOS 7.x

# 取消「You have mail in /var/spool/mail/root」提示
echo 'unset MAILCHECK'  >> .bashrc

# 调整 PS1 变量
cat >> ~/.bashrc  <<EOF
export PS1="\e[01;31m\u@\h \w\e[00m""\e[34;1m\e[0m""\n""# "

# 常用命令别名
alias ll='ls -l -a --color'
alias ls='ls -a --color'
EOF

# 重新登录一下
exec su - root

# 每次安装完 CentOS 之后,执行如下命令:
yum install -y epel-release                                                    \
    && yum install -y yum-cron yum-utils yum-cron                              \
    && yum install -y sysstat procps-ng psmisc bash-completion tmux vim rsync wget