centos 7 装机
更新yum源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all;yum makecache
yum update -y
安装常用工具
yum install -y vim htop git wget unzip zip
显示IP
echo '
IP=$( hostname -I | cut -d" " -f1 )
export PS1="[\u@\[\e[31m\]$IP\[\e[m\](\h) \W]\\$ "
' >> /etc/profile
安装pyenv
yum install -y gcc zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel tk-devel libffi-devel xz-devel
# git clone https://github.com/pyenv/pyenv.git ~/.pyenv
wget https://github.com/pyenv/pyenv/archive/refs/heads/master.zip
unzip master.zip
mv pyenv-master ~/.pyenv
cd ~/.pyenv && src/configure && make -C src
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.profile
echo 'eval "$(pyenv init --path)"' >> ~/.profile
source ~/.profile
pyenv install 3.8.6
安装virtualenvwrapper
pyenv local 3.8.6
pip install virtualenvwrapper
echo "export VIRTUALENVWRAPPER_PYTHON=/root/.pyenv/versions/3.8.6/bin/python" >> ~/.bashrc
echo "source /root/.pyenv/versions/3.8.6/bin/virtualenvwrapper.sh" >> ~/.bashrc
source ~/.bashrc
修改时区:
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
echo "Asia/Shanghai" >> /etc/timezone
echo 'export LC_ALL="en_US.utf8" \n export TZ="Asia/Shanghai"' >> /etc/bashrc
source /etc/bashrc