foreword

  • The current date is 2022.7.6, the CentOS 6 maintenance update date is 2020.11.30, and CentOS 6 has been out of maintenance for nearly two years
  • Due to various reasons, qbit needs to install Python 3.8 on CentOS 6.9 through Miniconda, and found that the version glibc is too old to install, so the test was upgraded glibc
  • initial environment

     CentOS 6.9 x86_64
    glibc 2.12

Upgrade steps

  • Direct installation of MiniConda3 reports an error

     $ 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.
  • Check the current glibc version

     $ 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 编写。
  • Switch software repository (centos-vault source)

     curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-6.10.repo
  • Generate cache

     yum makecache
  • Use the script on github to upgrade glibc, the script content is as follows

     #!/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
  • Double check the current glibc version (without restarting)

     $ 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.
  • Install Miniconda3 normally

     $ 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
    >>>

postscript

  • After installing Miniconda, I found that pip3 cannot install the package, and it has been stuck

     $ 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
  • After investigation, it is found that there is a problem with Miniconda's openssl

     $ which openssl
    ~/miniconda3/bin/openssl
    $ openssl version
    OpenSSL 1.1.1n  15 Mar 2022
    $ openssl s_client mirrors.aliyun.com:443
    卡住...
  • Solution one, use http warehouse instead of https warehouse

     pip3 config set global.index-url http://mirrors.aliyun.com/pypi/simple/
    pip3 config set global.trusted-host mirrors.aliyun.com
This article is from qbit snap

qbit
268 声望279 粉丝