前言

  • 当前日期是 2022.7.6,CentOS 6 停止维护更新日期是 2020.11.30,CentOS 6 已停止维护近两年
  • 由于种种原因,qbit 需要在 CentOS 6.9 上通过 Miniconda 安装 Python 3.8,发现 glibc 版本太旧装不上,于是试验升级了glibc
  • 初始环境

    CentOS 6.9 x86_64
    glibc 2.12

升级步骤

  • 直接安装 MiniConda3 报错

    $ sh Miniconda3-py38_4.12.0-Linux-x86_64.sh 
    WARNING:
      The installer is not compatible with the version of the Linux distribution
      installed on your system. The version of GLIBC is no longer supported.
      Found version 2.12, which is less than 2.17
    Aborting installation.
    
  • 查看当前 glibc 版本

    $ ldd --version
    ldd (GNU libc) 2.12
    Copyright (C) 2010 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    由 Roland McGrath 和 Ulrich Drepper 编写。
  • 切换软件仓库(centos-vault源)

     curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-6.10.repo
  • 生成缓存

    yum makecache
  • github 上的脚本升级 glibc,脚本内容如下

    #!/bin/bash
    
    # update glibc to 2.17 for CentOS 6
    
    GLIBC=glibc
    OS=el6
    SERVER=https://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6
    VERSION=2.17-55
    FULL_VERSION=$GLIBC-$VERSION.fc20
    X64=x86_64
    I386=i386
    I636=i686
    REPO_32=epel-6-$I386
    REPO_64=epel-6-$X64
    
    SERVER_32=$SERVER/$REPO_32/$FULL_VERSION
    RPM_32=$VERSION.$OS.$I636.rpm
    SERVER_64=$SERVER/$REPO_64/$FULL_VERSION
    RPM_64=$VERSION.$OS.$X64.rpm
    
    # Packages
    P_1=$GLIBC
    P_2=$GLIBC-common
    P_3=$GLIBC-devel
    P_4=$GLIBC-headers
    P_5=$GLIBC-static
    P_6=$GLIBC-utils
    P_7=nscd
    
    # Required as dependency of glibc-utils
    sudo yum install --assumeyes gd
    
    # 64-bit
    sudo rpm -Uvh --force $SERVER_64/$P_1-$RPM_64 $SERVER_64/$P_2-$RPM_64 $SERVER_64/$P_3-$RPM_64 $SERVER_64/$P_4-$RPM_64 $SERVER_64/$P_5-$RPM_64 $SERVER_64/$P_6-$RPM_64 $SERVER_64/$P_7-$RPM_64
    # Print out versions
    strings /lib64/libc.so.6 | grep GLIBC
  • 再次检查当前 glibc 版本(不用重启)

    $ ldd --version
    ldd (GNU libc) 2.17
    Copyright (C) 2012 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    Written by Roland McGrath and Ulrich Drepper.
  • 正常安装 Miniconda3

    $ sh Miniconda3-py38_4.12.0-Linux-x86_64.sh 
    
    Welcome to Miniconda3 py38_4.12.0
    
    In order to continue the installation process, please review the license
    agreement.
    Please, press ENTER to continue
    >>> 

后记

  • 安装 Miniconda 后发现 pip3 不能安装包,一直卡住不动

    $ pip3 install pipx -vvv
    Using pip 21.2.4 from /home/centos/miniconda3/lib/python3.8/site-packages/pip (python 3.8)
    Non-user install because site-packages writeable
    Created temporary directory: /tmp/pip-ephem-wheel-cache-jyavgj8d
    Created temporary directory: /tmp/pip-req-tracker-uag0fca1
    Initialized build tracking at /tmp/pip-req-tracker-uag0fca1
    Created build tracker: /tmp/pip-req-tracker-uag0fca1
    Entered build tracker: /tmp/pip-req-tracker-uag0fca1
    Created temporary directory: /tmp/pip-install-i3llrili
    Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
     1 location(s) to search for versions of pipx:
     https://mirrors.aliyun.com/pypi/simple/pipx/
    Fetching project page and analyzing links: https://mirrors.aliyun.com/pypi/simple/pipx/
    Getting page https://mirrors.aliyun.com/pypi/simple/pipx/
    Found index url https://mirrors.aliyun.com/pypi/simple/
    Looking up "https://mirrors.aliyun.com/pypi/simple/pipx/" in the cache
    Request header has "max_age" as 0, cache bypassed
    Starting new HTTPS connection (1): mirrors.aliyun.com:443
  • 排查后发现是 Miniconda 的 openssl 有问题

    $ which openssl
    ~/miniconda3/bin/openssl
    $ openssl version
    OpenSSL 1.1.1n  15 Mar 2022
    $ openssl s_client mirrors.aliyun.com:443
    卡住...
  • 解决方式一,用 http 仓库代替 https 仓库

    pip3 config set global.index-url http://mirrors.aliyun.com/pypi/simple/
    pip3 config set global.trusted-host mirrors.aliyun.com
本文出自qbit snap

qbit
268 声望279 粉丝