alpine、debian、ubuntu brew 常用的换源命令

文档说明: 只是记录关键点

alpine


test -f /etc/apk/repositories.save || cp /etc/apk/repositories /etc/apk/repositories.save

sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories

debian


test ! -f /etc/apt/source.list.save && cp  /etc/apt/sources.list /etc/apt/sources.list.save

sed -i "s@deb.debian.org@mirrors.ustc.edu.cn@g" /etc/apt/sources.list && \
sed -i "s@security.debian.org@mirrors.ustc.edu.cn@g" /etc/apt/sources.list

ubuntu


test ! -f /etc/apt/source.list.save && cp  /etc/apt/sources.list /etc/apt/sources.list.save

sed -i "s@security.ubuntu.com@mirrors.ustc.edu.cn@g" /etc/apt/sources.list && \
sed -i "s@archive.ubuntu.com@mirrors.ustc.edu.cn@g" /etc/apt/sources.list &&



debian 系列换源以后安装应用

    apt update -y && apt install -y curl vim  sudo tini libssl-dev ca-certificates
    apt install -y git curl wget make cmake gcc g++ python3 python3-pip ninja-build
    apt install -y tcpdump nmap traceroute net-tools dnsutils iproute2 procps iputils-ping

    apt install -y aria2 gettext
    apt install -y cockpit  #网页版图像化服务管理工具   http://your-machine-ip:9090

    pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

alpine 换源以后安装应用


apk update && apk add  --no-cache ca-certificates libc-dev openssl-dev 

apk add iproute2 procps  net-tools bind-tools nftables ipset ipvsadm

apk add python3 python3-dev python3-pip 

pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

msys2 换源


 sed -i "s#mirror.msys2.org/#mirrors.ustc.edu.cn/msys2/#g" /etc/pacman.d/mirrorlist*


brew 换源

export HOMEBREW_NO_ANALYTICS=1
export HOMEBREW_INSTALL_FROM_API=1
export HOMEBREW_API_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
export HOMEBREW_PIP_INDEX_URL="https://pypi.tuna.tsinghua.edu.cn/simple"

# 或者

export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.ustc.edu.cn/homebrew-core.git"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles"

macos brew install 实操

添加如下这几行,使用镜像加快下载速度,添加完毕,新打开一个窗口就自动生效了


vi ~/.bash_profile

export HOMEBREW_NO_ANALYTICS=1
export HOMEBREW_INSTALL_FROM_API=1
export HOMEBREW_API_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
export HOMEBREW_PIP_INDEX_URL="https://pypi.tuna.tsinghua.edu.cn/simple"

参考文档

  1. debian packages
  2. alpine packages
  3. debian version
  4. web搜索包或者应用程序入口
  5. brew 设置参考文档 官方站点
  6. brew 设置参考文档 清华镜像
  7. brew 设置参考文档 中科大镜像
  8. linux 使用 brew
posted @ 2022-10-25 17:01  jingjingxyk  阅读(558)  评论(0编辑  收藏  举报