各种开发语言项目环境国内(中国国内加速镜像)配置教程和部分实践经验,包括github.com, nodejs,npm,nvm, yarn, java, maven, gradle, python, mysys2, elasticsearch, php等等,更多正在加入中
源码地址:https://github.com/yunchaoq/awesome-env-config-cn
欢迎大家一起补充
rubypod…nodejs 安装
镜像源:npm.taobao.com
官方地址:nodejs.org
直接下载安装(推荐使用nvm管理nodejs版本自由切换):
下载地址: http://npm.taobao.org/mirrors/node 选择对应的版本下载安装即可nodejs 配置国内npm源,参考npm nodejs包管理工具配置
linux或者mac
镜像源:https://hub.fastgit.org/nvm-sh/nvm
官方地址:https://github.com/nvm-sh/nvm
安装 linux或者mac安装,镜像: curl -o- https://raw.fastgit.org/nvm-sh/nvm/master/install.sh | bash 或者 wget -qO- https://raw.fastgit.org/nvm-sh/nvm/master/install.sh | bash linux或者mac安装,官方: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash 或者 wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash 配置国内源 设置环境变量:NVM_NODEJS_ORG_MIRROR,bash编辑/.bashrc,zsh编辑/.zshrc export NVM_NODEJS_ORG_MIRROR=http://npm.taobao.org/mirrors/nodewindows
镜像源:https://hub.fastgit.org/coreybutler/nvm-windows
官方推荐地址:https://github.com/coreybutler/nvm-windows
安装
镜像: https://hub.fastgit.org/coreybutler/nvm-windows/releases 下载最新的版本官方: https://github.com/coreybutler/nvm-windows/releases/ 下载最新的版本配置国内源
设置 nvm node_mirror http://npm.taobao.org/mirrors/node nvm npm_mirror https://npm.taobao.org/mirrors/npm/yarn 安装
官方地址:https://yarnpkg.com/
需要首先安装nodejs然后使用npm安装yarn或者更新npm i -g yarn 或者 npm install -g yarn配置国内源
yarn config set registry https://registry.npm.taobao.orgmaven安装,apache比较良心,下载相关的基本都自带镜像 http://maven.apache.org/download.cgi
在此页面下载,默认自动选择最快的镜像 http://maven.apache.org/download.cgi配置国内源
打开 maven 的配置文件( windows 机器一般在 maven 安装目录的 conf/settings.xml 或者用户目录下.m2/setting.xml ),在标签中添加 mirror 子节点, https://maven.aliyun.com/mvn/guide <mirror> <id>alimaven</id> <name>aliyun maven</name> <url>https://maven.aliyun.com/repository/public</url> <mirrorOf>central</mirrorOf> </mirror> <mirror> <id>jcenter</id> <name>jcenter</name> <url>https://maven.aliyun.com/repository/central</url> <mirrorOf>central</mirrorOf> </mirror> <mirror> <id>google</id> <name>google</name> <url>https://maven.aliyun.com/repository/google</url> <mirrorOf>central</mirrorOf> </mirror> <mirror> <id>spring</id> <name>aliyun maven spring</name> <url>https://maven.aliyun.com/repository/spring</url> <mirrorOf>central</mirrorOf> </mirror> <mirror> <id>spring-plugin</id> <name>aliyun maven spring-plugin</name> <url>https://maven.aliyun.com/repository/spring-plugin</url> <mirrorOf>central</mirrorOf> </mirror> <mirror> <id>gradle-plugin</id> <name>aliyun maven gradle-plugin</name> <url>https://maven.aliyun.com/repository/gradle-plugin</url> <mirrorOf>central</mirrorOf> </mirror> <mirror> <id>grails-core</id> <name>aliyun maven grails-core</name> <url>https://maven.aliyun.com/repository/grails-core</url> <mirrorOf>central</mirrorOf> </mirror> <mirror> <id>apache snapshots</id> <name>aliyun maven apache snapshots</name> <url>https://maven.aliyun.com/repository/apache-snapshots</url> <mirrorOf>central</mirrorOf> </mirror>gradle 安装
镜像,目前没有查询到国内下载gradle镜像的地址,大家知道的欢迎提供官网 https://services.gradle.org/distributions/gradle 配置
终极配置,在用户目录下~/.gradle/目录下增加init.gradle文件,内容如下
allprojects { buildscript { repositories { mavenLocal() def NEXUS_URL = 'https://maven.aliyun.com/repository/public' def jcenter_URL = 'https://maven.aliyun.com/repository/jcenter' def m2_URL = 'https://maven.aliyun.com/repository/gradle-plugin' def spring_plugin_URL = 'https://maven.aliyun.com/repository/spring-plugin' def spring_URL = 'https://maven.aliyun.com/repository/spring' def GOOGLE_URL = 'https://maven.aliyun.com/repository/google' all { ArtifactRepository repo -> if(repo instanceof MavenArtifactRepository){ def url = repo.url.toString() if (url.startsWith('https://repo1.maven.org/maven2') || url.startsWith('https://jcenter.bintray.com') || url.startsWith('http://mirrors.ibiblio.org')) { project.logger.lifecycle "Repository ${repo.url} replaced by $jcenter_URL." remove repo } else if (url.startsWith('https://plugins.gradle.org/m2/')) { project.logger.lifecycle "Repository ${repo.url} replaced by $m2_URL." remove repo } else if (url.startsWith('http://repo.spring.io/libs-milestone/')) { project.logger.lifecycle "Repository ${repo.url} replaced by $spring_URL." remove repo } else if (url.startsWith('http://repo.spring.io/plugins-release/')) { project.logger.lifecycle "Repository ${repo.url} replaced by $spring_plugin_URL." remove repo // 这里是安卓相关下载的加速,本地没有出现下载慢的情况,所以这个就屏蔽了 //}else if (url.startsWith('https://dl.google.com/dl/android/maven2/')) { // project.logger.lifecycle "Repository ${repo.url} replaced by $GOOGLE_URL." // println("buildscript ${repo.url} replaced by $GOOGLE_URL.") // remove repo } } } maven { url 'https://maven.aliyun.com/repository/public' } maven { url 'https://maven.aliyun.com/repository/spring' } maven { url 'https://maven.aliyun.com/repository/spring-plugin' } maven { url "https://maven.aliyun.com/repository/grails-core" } maven { url "https://maven.aliyun.com/repository/apache-snapshots" } maven { url "https://maven.aliyun.com/repository/gradle-plugin" } maven { url 'https://maven.aliyun.com/repository/google' } jcenter { url jcenter_URL } maven { url NEXUS_URL } } } repositories { mavenLocal() def NEXUS_URL = 'https://maven.aliyun.com/repository/public' def jcenter_URL = 'https://maven.aliyun.com/repository/jcenter' def m2_URL = 'https://maven.aliyun.com/repository/gradle-plugin' def spring_plugin_URL = 'https://maven.aliyun.com/repository/spring-plugin' def spring_URL = 'https://maven.aliyun.com/repository/spring' def GOOGLE_URL = 'https://maven.aliyun.com/repository/google' all { ArtifactRepository repo -> if(repo instanceof MavenArtifactRepository){ def url = repo.url.toString() if (url.startsWith('https://repo1.maven.org/maven2') || url.startsWith('https://jcenter.bintray.com') || url.startsWith('http://mirrors.ibiblio.org')) { project.logger.lifecycle "Repository ${repo.url} replaced by $jcenter_URL." remove repo } else if (url.startsWith('https://plugins.gradle.org/m2/')) { project.logger.lifecycle "Repository ${repo.url} replaced by $m2_URL." remove repo } else if (url.startsWith('http://repo.spring.io/libs-milestone/')) { project.logger.lifecycle "Repository ${repo.url} replaced by $spring_URL." remove repo } else if (url.startsWith('http://repo.spring.io/plugins-release/')) { project.logger.lifecycle "Repository ${repo.url} replaced by $spring_plugin_URL." remove repo // 这里是安卓相关下载的加速,本地没有出现下载慢的情况,所以这个就屏蔽了 //}else if (url.startsWith('https://dl.google.com/dl/android/maven2/')) { // project.logger.lifecycle "Repository ${repo.url} replaced by $GOOGLE_URL." // println("buildscript ${repo.url} replaced by $GOOGLE_URL.") // remove repo } } } maven { url 'https://maven.aliyun.com/repository/public' } maven { url 'https://maven.aliyun.com/repository/spring' } maven { url 'https://maven.aliyun.com/repository/spring-plugin' } maven { url "https://maven.aliyun.com/repository/grails-core" } maven { url "https://maven.aliyun.com/repository/apache-snapshots" } maven { url "https://maven.aliyun.com/repository/gradle-plugin" } maven { url 'https://maven.aliyun.com/repository/google' } jcenter { url jcenter_URL } maven { url NEXUS_URL } } }