centos7.5免编译安装绿色python3.8和jdk-8u371-linux-x64.tar.gz

(base) [root@bp-centos-0 tmp]# cat /etc/redhat-release 
CentOS Linux release 7.9.2009 (Core)
(base) [root@bp-centos-0 tmp]# 
(base) [root@bp-centos-0 tmp]# uname -a
Linux bp-centos-0 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
(base) [root@bp-centos-0 tmp]# 

这个系统自带python2.7:

(base) [root@bp-centos-0 tmp]# python2.7
Python 2.7.5 (default, Jun 20 2023, 11:36:40) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

先进行升级:

yum update;
yum install epel-release yum-utils;
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm;
yum-config-manager --enable remi;
yum install centos-release-scl;

yum list | grep python3;   #发现是python3.6.8

yum install -y  python3.x86_64;
# python3.x86_64 0:3.6.8-19.el7_9

(base) [root@bp-centos-0 tmp]# yum list installed| grep python
dbus-python.x86_64                   1.1.1-9.el7                @CentOS         
libxml2-python.x86_64                2.9.1-6.el7_9.6            @updates        
python.x86_64                        2.7.5-93.el7_9             @updates        
python-chardet.noarch                2.2.1-3.el7                @base           
python-gobject-base.x86_64           3.22.0-1.el7_4.1           @base           
python-iniparse.noarch               0.4-9.el7                  @CentOS         
python-kitchen.noarch                1.1.1-5.el7                @CentOS         
python-libs.x86_64                   2.7.5-93.el7_9             @updates        
python-pycurl.x86_64                 7.19.0-19.el7              @CentOS         
python-urlgrabber.noarch             3.10-10.el7                @base           
python3.x86_64                       3.6.8-19.el7_9             @updates        
python3-libs.x86_64                  3.6.8-19.el7_9             @updates        
python3-pip.noarch                   9.0.3-8.el7                @base           
python3-setuptools.noarch            39.2.0-10.el7              @base           
python36-pysocks.noarch              1.6.8-7.el7                @epel           
python36-six.noarch                  1.14.0-3.el7               @epel           
python36-urllib3.noarch              1.25.6-2.el7               @epel           
rpm-python.x86_64                    4.11.3-48.el7_9            @updates        
(base) [root@bp-centos-0 tmp]# 

接下来安装Anaconda3,这里面包含了丰富的python版本.

curl -k -LO  https://repo.anaconda.com/archive/Anaconda3-2020.07-Linux-x86_64.sh;
bash Anaconda3-2020.07-Linux-x86_64.sh;

安装完毕后重新登录,PATH变量新加了:

/root/anaconda3/bin:/root/anaconda3/condabin:

# find /root/anaconda3 -name "*python*";  #太多了
conda search "^python$";
# 显示很多的python版本

输入python后按tab自动补全,发现自动有python3.8

(base) [root@bp-centos-0 tmp]# python
python            python2           python2.7         python3           python3-config    python3.6         python3.6m        python3.8         python3.8-config  
(base) [root@bp-centos-0 tmp]# python


(base) [root@bp-centos-0 tmp]# python3.8
Python 3.8.3 (default, Jul  2 2020, 16:21:59) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

这样就有了python3.8.

/root/anaconda3/bin/python3.8 -m pip list
/root/anaconda3/bin/python3.8 -m pip install -i http://pypi.douban.com/simple --trusted-host pypi.douban.com  websocket-client;

接下来安装jdk :

java version "1.8.0_371"

(base) [root@bp-centos-0 tmp]# java -version
java version "1.8.0_371"
Java(TM) SE Runtime Environment (build 1.8.0_371-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.371-b11, mixed mode)
(base) [root@bp-centos-0 tmp]# 

相关网址(可能需要注册):

https://www.oracle.com/java/technologies/downloads/archive/

https://www.oracle.com/java/technologies/javase/javase8u211-later-archive-downloads.html

Linux x64 Compressed Archive 	132.77 MB 	
jdk-8u371-linux-x64.tar.gz

https://www.oracle.com/webapps/redirect/signon?nexturl=
https://download.oracle.com/otn/java/jdk/8u371-b11/ce59cff5c23f4e2eaf4e778a117d4c5b/jdk-8u371-linux-x64.tar.gz
cd /tmp;
curl  -k -LO  https://download.oracle.com/otn/java/jdk/8u371-b11/ce59cff5c23f4e2eaf4e778a117d4c5b/jdk-8u371-linux-x64.tar.gz


tar -xzvf jdk-8u371-linux-x64.tar.gz ; 
ls -al ./jdk1.8.0_371;  
ls -al ./jdk1.8.0_371/jre/bin; 
ln  -s /tmp/jdk1.8.0_371/jre/bin/java /bin/java;

你可能感兴趣的:(linux,运维,服务器)