以 Linux 新系统安装配置清单 为蓝本,针对 Debian 11
系统进行相应的调整。
/root/.bashrc
PS1='\n${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' # If this is an xterm set the title to user@host:dir case "$TERM" in xterm*|rxvt*) PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h \a\]$PS1" ;; *) ;; esac export LS_OPTIONS='--color=auto' eval "`dircolors`" alias ls='ls $LS_OPTIONS' alias ll='ls $LS_OPTIONS -lh' alias rm='rm -i' alias cp='cp -i' alias mv='mv -i'
# 备份原来的 sources.list DATE_TIME_NOW=`date +"%Y%m%d_%H%M"` mv /etc/apt/sources.list /etc/apt/sources.list.bak_${DATE_TIME_NOW} # 设置 sources.list ,使用清华的镜像源 cat << \EOF > /etc/apt/sources.list deb https://mirrors.tuna.tsinghua.edu.cn/debian bullseye main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian bullseye-updates main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free EOF # 安装常用工具 apt install -y \ curl \ gnupg2 \ vim \ tmux \ nfs-common \ zip \ unzip \ unar \ p7zip-full \ fonts-noto-cjk \ fonts-wqy-microhei \ fonts-wqy-zenhei # vim 设置,写到 vimrc.local 中,避免更新时冲突。 cat << \EOF > /etc/vim/vimrc.local " 显示行号 set nu " 设置 yaml 文件缩进 autocmd FileType yaml,yml setlocal ts=2 sts=2 sw=2 expandtab indentkeys-=<:> EOF
1. pip 私服
/etc/pip.conf
[global] # 豆瓣源 # index-url = https://pypi.douban.com/simple # 清华源 index-url = https://pypi.tuna.tsinghua.edu.cn/simple # 阿里云源 # index-url = https://mirrors.aliyun.com/pypi/simple
使用方法参考 Python 设置 PYPI 私服说明
2. 虚拟环境设置
安装虚拟环境工具
apt install python3-virtualenvwrapper
配置
/etc/bash.bashrc
# 加载 virtualenvwrapper 脚本 if [ -f /usr/share/virtualenvwrapper/virtualenvwrapper.sh ]; then export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 export WORKON_HOME='~/.virtualenvs' source /usr/share/virtualenvwrapper/virtualenvwrapper.sh fi # 让 pip 使用系统证书 export REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
使用方法参考 virtualenvwrapper 安装配置说明
运行以下命令进行安装
apt install docker.io docker-compose