配置CentOS固定IP
通过网络配置文件/etc/sysconfig/network-scripts/ifcfg-ensxxxx
,配置虚拟机网卡
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| [root@localhost ~] TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=ens33 UUID=f79868e1-727a-4a1a-90a8-015f281b25cc DEVICE=ens33 ONBOOT=no
IPADDR=192.168.100.128 NETMASK=255.255.255.0 GATEWAY=192.168.100.2 DNS1=8.8.8.8
|
配置Java8环境变量(linux)
**编辑配置文件~/.bashrc
或者/etc/profile
,在末尾处添加
1 2 3
| export JAVA_HOME=/usr/local/java8 export PATH=$JAVA_HOME/bin:$PATH export CLASSPATH=:$JAVA_HOME/lib:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
|
配置Java11环境变量(linux)
**编辑配置文件~/.bashrc
或者/etc/profile
,在末尾处添加
1 2
| export JAVA_HOME=/usr/local/java11 export PATH=$JAVA_HOME/bin:$PATH
|
配置go环境变量
国内常用代理列表
|提供者|地址|
|–|–|
|官方全球代理|https://proxy.golang.com.cn|
|七牛云|https://goproxy.cn|
|阿里云|https://mirrors.aliyun.com/goproxy|
|GoCenter|https://gocenter.io|
|百度|https://goproxy.bj.bcebos.com|
“direct” 为特殊指示符,用于指示 Go 回源到模块版本的源地址去抓取(比如 GitHub 等),当值列表中上一个 Go module proxy 返回 404 或 410 错误时,Go 自动尝试列表中的下一个,遇见 “direct” 时回源,遇见 EOF 时终止并抛出类似 “invalid version: unknown revision…” 的错误。
1 2 3
| export GOROOT=/usr/local/go export PATH=$PATH:$GOROOT/bin export GOPROXY=https://proxy.golang.com.cn,direct
|
配置cmake环境变量
1
| export PATH=$PATH:/usr/local/cmake-3.23.5-linux-x86_64/bin
|
配置maven国内源
- 配置
JAVA_HOME
,下载maven配置MAVEN_HOME
并把/bin
加入到PATH
- 打开
~/apache-maven-3.6.3/conf/settings.xml
文件,在localRepository
填下载位置
- 局部配置在
${localRepository}/.m2/settings.xml
文件,写入以下配置
- 全局配置在
~/apache-maven-3.6.3/conf/settings.xml
文件,写入以下配置1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> <localRepository/> <interactiveMode/> <usePluginRegistry/> <offline/> <pluginGroups/> <servers/>
<mirrors> <mirror> <id>aliyunmaven</id> <mirrorOf>central</mirrorOf> <name>阿里云公共仓库</name> <url>https://maven.aliyun.com/repository/public</url> </mirror> <mirror> <id>nexus-tencentyun</id> <mirrorOf>central</mirrorOf> <name>tencent</name> <url>http://mirrors.cloud.tencent.com/nexus/repository/maven-public/</url> </mirror> <mirror> <id>huaweicloud</id> <mirrorOf>*</mirrorOf> <name>HuaWei</name> <url>https://repo.huaweicloud.com/repository/maven/</url> </mirror> </mirrors>
<proxies/> <profiles> <profile> <id></id> <repositories> </profile> </profiles> <activeProfiles/> </settings>
|
配置gradle国内源
- 全局配置在
(用户家目录)/.gradle/init.gradle
文件添加以下内容1 2 3 4 5 6 7
| allprojects { repositories { maven { url "http://maven.aliyun.com/nexus/content/groups/public" } } }
|
- 项目配置修改项目的
build.gradle
文件,添加以下内容1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| buildscript { repositories { maven { url 'https://maven.aliyun.com/repository/public' } } }
allprojects { repositories { maven { url 'https://maven.aliyun.com/repository/public' } } }
repositories { maven { url "http://maven.aliyun.com/nexus/content/groups/public" } }
|