Appearance
随记
多尝试后再问人。
很多软件在使用过程中,默认的软件源/仓库地址,由于是国外的,下载非常慢,因此需要配置国内源,这里记录一下常用软件源配置方法,默认修改为阿里源
maven
xml
<settings>
<!--需要改成自己的maven的本地仓库地址-->
<localRepository>/Users/shafulin/repository</localRepository>
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
</settings>centos
- centos7,修改为阿里源
shell
# 1. 备份软件源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
# 2. 下载阿里源配置,以下两条命令可任选其一
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
#curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
# 3. 生成缓存
yum makecachenpm,yarm
shell
# npm
npm config set registry https://registry.npmmirror.com
# yarn
yarn config set registry http://registry.npmmirror.com单独资源引入
访问https://npmmirror.com/,然后自由搜索你要的库, 例如vue引入格式 https://unpkg.com/库@版本/目录/文件名 ,例如
shell
https://unpkg.com/vue@3/dist/vue.global.jsPython-pip
pip国内的一些镜像
| 站点名 | 国内源地址 |
|---|---|
| 阿里云 | http://mirrors.aliyun.com/pypi/simple/ |
| 中国科技大学 | https://pypi.mirrors.ustc.edu.cn/simple/ |
| 豆瓣(douban) | http://pypi.douban.com/simple/ |
| 清华大学 | https://pypi.tuna.tsinghua.edu.cn/simple/ |
| 中国科学技术大学 | http://pypi.mirrors.ustc.edu.cn/simple/ |
shell
# 临时使用: 可以在使用pip的时候在后面加上-i参数,指定pip源
pip install scrapy -i https://pypi.tuna.tsinghua.edu.cn/simple
# 永久修改:一句命令换源
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simplelinux
修改 ~/.pip/pip.conf (没有就创建一个), 内容如下:
shell
cat > ~/.pip/pip.conf << EOF
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
EOFwin
直接在user目录中创建一个pip目录,如:
C:\Users\xx\pip,新建文件pip.ini,内容如下
shell
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simpledocker
shell
# 配置加速器
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": [
"https://docker.1ms.run",
"https://7jdhwfuo.mirror.aliyuncs.com",
"https://docker.m.daocloud.io",
"https://dockerproxy.com"
]
}
EOF
# 重新加载配置
sudo systemctl daemon-reload
# 重启docker服务
sudo systemctl start dockerjenkins
初始化后
在插件管理里,修改软件源为清华源
https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json初始化时
- 修改
.jenkins目录中的hudson.model.UpdateCenter.xml文件为:
xml
<?xml version='1.1' encoding='UTF-8'?>
<sites>
<site>
<id>default</id>
<url>https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json</url>
</site>
</sites>- 修改
.jenkins/jenkins_home/updates/default.json文件 替换文件中所有以下关键字
https://updates.jenkins-ci.org/download修改为https://mirrors.tuna.tsinghua.edu.cn/jenkinshttps://updates.jenkins.io/download修改为https://mirrors.tuna.tsinghua.edu.cn/jenkinshttp://www.google.com修改为http://www.baidu.com
在浏览器中,
http://IP:8080/reload,这样可以重新载入配置。访问 http://localhost:8080/reload ,重启一下Jenkins ,选择安装推荐插件, 秒速安装成功,简直超速!!
homebrew配置清华源
1.编辑~/.zshrc
shell
# ========== Homebrew 清华国内镜像完整配置 ==========
# 二进制包镜像
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles
# API 镜像
export HOMEBREW_API_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api
# git 源码仓库远程
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_CASK_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git"
# 屏蔽github官方接口,不走外网
export HOMEBREW_NO_GITHUB_API=1
# 本地不走代理
export no_proxy=localhost,127.0.0.1,::1
export NO_PROXY=localhost,127.0.0.1,::12.重载配置
shell
source ~/.zshrc
# 绑定清华git仓库
git -C "$(brew --repo)" remote set-url origin $HOMEBREW_BREW_GIT_REMOTE
git -C "$(brew --repo homebrew/core)" remote set-url origin $HOMEBREW_CORE_GIT_REMOTE
git -C "$(brew --repo homebrew/cask)" remote set-url origin $HOMEBREW_CASK_GIT_REMOTE3.清理缓存
shell
rm -rf ~/Library/Caches/Homebrew
brew cleanup
brew update