1、CentOS
CentOS自带的国外源有时候会很慢,我们替换成国内的阿里源,也有很多比如163源都很好,国内很多人用,但这里我们就用阿里源做个示例,想用其他源的同学可以去百度一下。
#先进入源的目录
cd /etc/yum.repo.d #备份一下官方源
mv CentOS-Base.repo CentOS-Base.repo.bak #将阿里源文件下载下来
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo #重建源数据缓存
yum makecache ok,换源完成
2、maven repository
原理:maven加载jar包过程,默认的是先扫描本地仓库,若本地仓库没有,则扫描远程仓库下载。默认的conf/settings.xml文件没有配置远程仓库,所以扫描的是maven的中央仓库(在国外),所以慢。
解决方法:配置国内镜像(如阿里云的镜像)
修改conf/settings.xml文件,配置阿里云镜像代码
<mirrors>
<!-- mirror
| Specifies a repository mirror site to use instead of a given repository. The repository that
| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
|
<mirror>
<id>mirrorId</id>
<mirrorOf>repositoryId</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://my.repository.com/repo/path</url>
</mirror>
-->
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>uk</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://uk.maven.org/maven2/</url>
</mirror>
<mirror>
<id>CN</id>
<name>OSChina Central</name>
<url>http://maven.oschina.net/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>nexus</id>
<name>internal nexus repository</name>
<!-- <url>http://192.168.1.100:8081/nexus/content/groups/public/</url>-->
<url>http://repo.maven.apache.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>3、Docker hub
使用阿里云镜像加速器
登陆阿里云控制台: https://cr.console.aliyun.com
点击“镜像加速器”菜单
1. 安装/升级Docker客户端
推荐安装1.10.0以上版本的Docker客户端,参考文档 docker-ce
2. 配置镜像加速器
针对Docker客户端版本大于 1.10.0 的用户
您可以通过修改daemon配置文件/etc/docker/daemon.json来使用加速器
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://g22jff5o.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker