一、Minimal安装
1.1 下载安装文件源 http://mirrors.aliyun.com/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1908.iso
1.2 新建Hyper-v第二代虚拟机 过程略......,安装完毕!!
注意:虚拟机设置别勾选"启用安全启动",其他选项默认
二
、
修
改
yum源(阿里 )
2.1 备份原yum源配置文件 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak
2.2 .获取阿里yum源配置文件 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
2.3 获取阿里epel置文件 wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo
2.4 清理更新源配置 yum clean all && yum makecache
2.6 查看更新结果 yum repolist enabled&&yum repolist all
三、安装MAN中文
3.1 安装MAN中文 包 yum install man-pages-zh-CN.noarch (查看包名称 yum list |grep man.*zh)
3.2 编辑配置文件使MAN中文包生效
1 全局所有用户生效 echo alias cman=\'man -M /usr/share/man/zh_CN\'>> /etc/bashrc && source /etc/bashrc
2 当前有用户生效 echo alias cman=\'man -M /usr/share/man/zh_CN\'>> ~/.bashrc && source ~/.bashrc
四、升级python2为python3( 默认)
4.1 下载安装文件到用户根目录(单线程有慢) wget -P ~ https://www.python.org/ftp/python/3.7.5/Python-3.7.5.tgz
4.2 安装依赖包 yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc libffi-devel
4.3 解压文件并进入目录 tar -xf ~/Python-3.7.5.tgz&&cd ~/Python-3.7.5
4.4 编译安装 mkdir /usr/local/python3 && ./configure --prefix=/usr/local/python3 && make && make install
4.5 备份python2后改python3为默认 mv /usr/bin/python /usr/bin/python2bak && ln -s /usr/local/python3/bin/python3.7 /usr/bin/python
4.6 建pip3软连接 ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3(或改pip默认为pip3: ln -s /usr/local/python3/bin/pip3 /usr/bin/pip)
4.7 修改yum及urlgrabber-ext-down配置(只能使用python2)文件头将 #!/usr/bin/python 改为 #!/usr/bin/python2
sed -i '1c #!/usr/bin/python2' /usr/bin/yum
sed -i '1c #!/usr/bin/python2' /usr/libexec/urlgrabber-ext-down
4.8 用户环境安装包 pip3 install --user dotmap
五、其他配置
5.1 .bash_profile
alias ll='ls -aslht'
alias cls='clear'
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
export PYTHONPATH=$HOME/.local/lib/python3.7/site-packages
export TIME_STYLE='+%Y-%m-%d %H:%M:%S'
export HISTTIMEFORMAT='%F %T '
export PS1='\D{%F %T} \u@\h$0 \v$PWD(\#)\$'