Something about Ubuntu - Change apt source to tsinghua source

原创
2022/11/12 11:02
阅读数 37

A problem happens when just copy content in Ubuntu 镜像 to /etc/apt/sources.list for ca-certificates failure like below:

Certificate verification failed: The certificate is NOT trusted. The certificate chain uses expired certificate. Could not handshake: Error in the certificate verification
————————————————
版权声明:本文为CSDN博主「某呆啊」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/q965844841qq/article/details/121482942

Following Sonui's page and code in Ubuntu 镜像,a shell script is done,have fun!

At the same time,the offical page has given the same solution to fix this problem in Debian 镜像使用.

#!/bin/bash
sed -i "s@http://.*archive.ubuntu.com@http://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list && \
sed -i "s@http://.*security.ubuntu.com@http://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list && \
sed -i "s@http://ports.ubuntu.com@http://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list && \
apt update && \
apt install ca-certificates -y && \
sed -i "s/http/https/g" /etc/apt/sources.list

For python,script below will also switch to tsinghua resource:

python3 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip 
# pip3 below version 3.8 (maybe) has no config command
pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple 

Damn the empty-line-adding-in-the-end-of-code when switch between HTML editor and Markdown,oschina hasn't fix it!

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部