各种开发语言项目环境国内(中国国内加速镜像)配置教程和部分实践经验,包括github.com, nodejs,npm,nvm, yarn, java, maven, gradle, python, mysys2, elasticsearch, php等等,更多正在加入中
源码地址:https://github.com/yunchaoq/awesome-env-config-cn
欢迎大家一起补充
nodejs 安装
镜像源:npm.taobao.com
官方地址:nodejs.org
直接下载安装(推荐使用nvm管理nodejs版本自由切换):
nodejs 配置国内npm源,参考npm nodejs包管理工具配置
linux或者mac
镜像源:https://hub.fastgit.org/nvm-sh/nvm
官方地址:https://github.com/nvm-sh/nvm
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
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
export NVM_NODEJS_ORG_MIRROR=http://npm.taobao.org/mirrors/node
windows
镜像源:https://hub.fastgit.org/coreybutler/nvm-windows
官方推荐地址:https://github.com/coreybutler/nvm-windows
安装
配置国内源
nvm node_mirror http://npm.taobao.org/mirrors/node
nvm npm_mirror https://npm.taobao.org/mirrors/npm/
yarn 安装
官方地址:https://yarnpkg.com/
npm i -g yarn
或者
npm install -g yarn
配置国内源
yarn config set registry https://registry.npm.taobao.org
npm -v
npm i -g npm
npm install -g mirror-config-china
maven安装,apache比较良心,下载相关的基本都自带镜像 http://maven.apache.org/download.cgi
配置国内源
<mirror>
<id>alimavenid>
<name>aliyun mavenname>
<url>https://maven.aliyun.com/repository/publicurl>
<mirrorOf>centralmirrorOf>
mirror>
<mirror>
<id>jcenterid>
<name>jcentername>
<url>https://maven.aliyun.com/repository/centralurl>
<mirrorOf>centralmirrorOf>
mirror>
<mirror>
<id>googleid>
<name>googlename>
<url>https://maven.aliyun.com/repository/googleurl>
<mirrorOf>centralmirrorOf>
mirror>
<mirror>
<id>springid>
<name>aliyun maven springname>
<url>https://maven.aliyun.com/repository/springurl>
<mirrorOf>centralmirrorOf>
mirror>
<mirror>
<id>spring-pluginid>
<name>aliyun maven spring-pluginname>
<url>https://maven.aliyun.com/repository/spring-pluginurl>
<mirrorOf>centralmirrorOf>
mirror>
<mirror>
<id>gradle-pluginid>
<name>aliyun maven gradle-pluginname>
<url>https://maven.aliyun.com/repository/gradle-pluginurl>
<mirrorOf>centralmirrorOf>
mirror>
<mirror>
<id>grails-coreid>
<name>aliyun maven grails-corename>
<url>https://maven.aliyun.com/repository/grails-coreurl>
<mirrorOf>centralmirrorOf>
mirror>
<mirror>
<id>apache snapshotsid>
<name>aliyun maven apache snapshotsname>
<url>https://maven.aliyun.com/repository/apache-snapshotsurl>
<mirrorOf>centralmirrorOf>
mirror>
gradle 安装
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
}
}
}
sudo apt-get update
sudo apt-cache search python3*
sudo apt-get install python3.8 # python3.5 python3.6 python3.7 等,python3.8是当前书写的时候最新稳定版本
sudo yum install epel-release -y
sudo yum -y update
sudo yum list python3* # 使用此命令查看当前支持的python3版本
sudo yum install python37 # python35 python36 python37 等,python38是当前书写的时候最新稳定版本
mkdir %USERPROFILE%\.pip\
start %USERPROFILE%\.pip\
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
mkdir -p ~/.pip
# ubuntu 桌面下可以使用 gedit ~/.pip/pip.conf
# vi 入门可以参考 https://github.com/wsdjeg/vim-galore-zh_cn
vi ~/.pip/pip.conf
写入内容如下:[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py38_4.8.3-Linux-x86_64.sh
sh Miniconda3-py38_4.8.3-Linux-x86_64.sh.sh
conda config --set show_channel_urls yes
start %USERPROFILE%\
channels:
- defaults
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
conda config --set show_channel_urls yes
# ubuntu 桌面下可以使用 gedit ~/.condarc
# vi 入门可以参考 https://github.com/wsdjeg/vim-galore-zh_cn
vi ~/.condarc
写入内容如下:channels:
- defaults
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
# 更新系统包
pacman -Syu
# 基础包
pacman -S --needed base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake bash wget p7zip pacman pacman-mirrors msys2-runtime
# qt5
pacman -S mingw-w64-x86_64-clang mingw-w64-x86_64-clang-tools-extra mingw-w64-x86_64-clang-analyzer mingw-w64-x86_64-qt5 mingw-w64-x86_64-qt-creator