一、准备工作
1、vmware 14 网盘
2、centos7 ios http://mirrors.aliyun.com/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-2009.iso
3、pyhton 3.8.6 https://www.python.org/ftp/python/3.8.6/Python-3.8.6.tgz
4、Xshell5 网盘
二、虚拟机建立及基础环境准备
1、创建虚拟机,iso中引入centos7镜像
2、网络选择桥接
3、xshell 配置ssh ,通过ip add 查看虚拟机ip,端口22
4、xshell 配置sftp ,新建sftp,端口22,即可。
三、centos7环境准备
1、yum更新 yum update -y
2、必要包及依赖安装
yum -y install wget ,yum install bzip2 gcc-c++ openssl-devel intltool -y
wget http://jaist.dl.sourceforge.net/project/kmphpfm/mwget/0.1/mwget_0.1.0.orig.tar.bz2
bzip2 -d mwget_0.1.0.orig.tar.bz2,tar -xvf mwget_0.1.0.orig.tar,cd mwget_0.1.0.orig,./configure,make && make install(mwget比wget稍快 )
'yum groupinstall -y 'Development Tools' yum install -y gcc openssl-devel bzip2-devel libffi-devel
3、新建目录 mkdir /home/installs , 通过xshell sftp 命令 put即可将python3.8.6 上传
OR:wget http://mirrors.sohu.com/python/3.6.4/Python-3.6.4.tgz
4、cd /home/installs ,tar zxf Python-3.8.6.tgz,cd Python-3.8.6,./configure prefix=/usr/local/python3, make && make install > install.log
5、修改软链接,指向python3
which python,cd /usr/bin/python。 cd /usr/bin, ls -la python。ls -la yum*,vi yum ,点击i,将#!/usr/bin/python 改为#!/usr/bin/python2,按ESC退出编辑,输入:wq!保存修改退出。同样文件 /usr/libexec/urlgrabber-ext-down 也按上修改。
ln -snf(修改,-s 新增) /usr/local/python3/bin/python3.8 /usr/bin/python
ln -s /usr/local/python3/bin/pip3.8 /usr/bin/pip3
6、辅助命令 gcc -v python --version pip-V ls -la python*
四、安装mysql
1、yum 安装 Yum Repository wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
2、 yum -y install mysql57-community-release-el7-10.noarch.rpm yum安装mysql
3、安装mysql服务器 yum -y install mysql-community-server
4、systemctl start mysqld.service,systemctl status mysqld.service,grep "password" /var/log/mysqld.log
5、mysql -uroot -p,ALTER USER 'root'@'localhost' IDENTIFIED BY '复杂密码';,exit
6、yum -y remove mysql57-community-release-el7-10.noarch 卸载yum re 防止后续更新
五、更新国内源及更新,速度提升
备份 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum makecache
六、python3中,可以使用退格及方向键
1、yum install readline-devel
2、cd /home/installs/Python3.8.6 , ./configure .... , make && make install >install.log (重编译动作建议和后续安装python3-tkinter等后一起做!!)
七、删除编译过的python3
1、whereis python3 ,rm -rf /usr/local/python3