您当前的位置:首页 > 学海无涯 > 其他网站首页其他
各应用变更源仓
发布时间:2021-09-02作者:♂逸風★淩軒
一、安卓更换源仓
1、对特定项目变更源仓,在项目中的build.gradle修改内容
buildscript { repositories { maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' } maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' } maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' } maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' } } dependencies { classpath 'com.android.tools.build:gradle:3.2.1' } } allprojects { repositories { maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' } maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' } maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' } maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' } } }
2、对项目所有变更,在用户/.gradle/下创建init.gradle文件,内容如下:
allprojects{ repositories { def ALIYUN_REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public' def ALIYUN_JCENTER_URL = 'http://maven.aliyun.com/nexus/content/repositories/jcenter' all { ArtifactRepository repo -> if(repo instanceof MavenArtifactRepository){ def url = repo.url.toString() if (url.startsWith('https://repo1.maven.org/maven2')) { project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL." remove repo } if (url.startsWith('https://jcenter.bintray.com/')) { project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL." remove repo } } } maven { url ALIYUN_REPOSITORY_URL url ALIYUN_JCENTER_URL } } }
二、变更Yum源
1、Centos7
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo cp /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.bak curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
2、centos8
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo cp /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.bak curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
三、变更Pip源
vim ~/.pip/pip.conf [global] index-url = http://mirrors.aliyun.com/pypi/simple [install] trusted-host=mirrors.aliyun.com
windows下,直接在user目录中创建一个pip目录,如:C:\Users\xx\pip,新建文件pip.ini,内容同上。
四、Jekins变更源
cd /root/.jenkins/updates sed -i 's/http:\/\/updates.jenkins-ci.org\/download/https:\/\/mirrors.tuna.tsinghua.edu.cn\/jenkins/g' default.json && sed -i 's/http:\/\/www.google.com/https:\/\/www.baidu.com/g' default.json
五、Docker源
yum install -y yum-utils device-mapper-persistent-data lvm2 wget yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo yum makecache fast
六、Maven源
编辑setting.xml,在mirrors加入阿里云仓
<mirror> <id>nexus-aliyun</id> <mirrorOf>central</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror>
七、Npm源
#安装cnpm代替默认npm npm install -g cnpm --registry=https://registry.npm.taobao.org #单词使用 npm install --registry=https://registry.npm.taobao.org #永久使用 npm config set registry https://registry.npm.taobao.org
八、Docke安装源
yum remove -y docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine yum install -y yum-utils device-mapper-persistent-data lvm2 yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo yum -y install docker-ce
九、PIP源
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
关键字词:源仓

上一篇:Centos7升级内核版本
下一篇:返回列表
相关文章
-
无相关信息