이동/러스트/자바
26.10 버전 차이
26.10 릴리스 노트 목록 Go 1.27, Rust 1.97.1 및 OpenJDK 25.0.4과 OpenJDK 27도 사용할 수 있습니다. 리포지토리 및 독립적으로 설치된 툴체인은 다를 수 있습니다. 프로젝트 요구 사항에 대해 go version, rustc --version 및 java -version를 확인하세요. 공식 릴리스 노트
이 문서에서는 Ubuntu 26.04에서 Go, Rust 및 Java 개발 환경을 설정하는 방법을 다룹니다.
Go 언어
Go 설치
공식 사이트에서 최신 버전을 다운로드하세요:
# Check the current stable release at https://go.dev/dl/ first (e.g. go1.26.4),
# then replace GO_VERSION below with the actual version number
GO_VERSION=1.26.4
wget https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz
# Remove old version and extract
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz
# Clean up the downloaded file
rm go${GO_VERSION}.linux-amd64.tar.gz~/.bashrc 또는 ~/.zshrc에 다음을 추가하여 환경 변수를 구성합니다.
export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin구성을 적용하고 다음을 확인합니다.
source ~/.bashrc
go versionGo 모듈 프록시 구성
중국 본토에서는 모듈 다운로드 속도를 높이려면 프록시를 구성하는 것이 좋습니다.
go env -w GOPROXY=https://goproxy.cn,directGo 프로젝트 기본
# Initialize a module
mkdir myproject && cd myproject
go mod init github.com/username/myproject
# Add a dependency
go get github.com/gin-gonic/gin
# Run the program
go run main.go
# Build
go build -o myapp
# Run tests
go test ./...
# Format code
go fmt ./...
# Install tools
go install golang.org/x/tools/gopls@latest공통 개발 도구
# Language server (IDE support)
go install golang.org/x/tools/gopls@latest
# Linter
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
# Hot reload
go install github.com/air-verse/air@latest러스트 언어
Rustup을 통해 설치
Rustup은 공식 Rust 설치 프로그램이자 버전 관리자입니다.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh설치 시 기본 옵션(옵션 1)을 선택하세요. 설치 후 환경을 로드합니다.
source "$HOME/.cargo/env"설치를 확인합니다.
rustc --version
cargo --version중국 미러 구성
~/.cargo/config.toml 편집:
[source.crates-io]
replace-with = 'ustc'
[source.ustc]
registry = "sparse+https://mirrors.ustc.edu.cn/crates.io-index/"또는 ByteDance 미러를 사용하세요.
[source.crates-io]
replace-with = 'rsproxy'
[source.rsproxy]
registry = "https://rsproxy.cn/crates.io-index"
[registries.rsproxy]
index = "https://rsproxy.cn/crates.io-index"
[net]
git-fetch-with-cli = true러스트 기초
# Create a new project
cargo new myproject
cd myproject
# Build and run
cargo run
# Build only
cargo build
# Build release version (optimized)
cargo build --release
# Run tests
cargo test
# Check code (no binary output, faster)
cargo check
# Format code
cargo fmt
# Lint
cargo clippy
# Add dependencies
cargo add serde tokioRust 툴체인 관리
# Update Rust
rustup update
# Install nightly version
rustup toolchain install nightly
# Switch toolchains
rustup default nightly
rustup default stable
# Set toolchain for a project
rustup override set nightly
# Install components
rustup component add rust-analyzer
rustup component add rust-src자바(OpenJDK)
OpenJDK 설치
Ubuntu 26.04의 저장소는 여러 OpenJDK 버전을 제공합니다.
# Install the default OpenJDK 25
sudo apt install default-jdk -y
# Or explicitly install OpenJDK 25
sudo apt install openjdk-25-jdk -y
# If you only need to run Java programs
sudo apt install default-jre -y설치를 확인합니다.
java --version
javac --version여러 Java 버전 관리
# List installed Java versions
sudo update-alternatives --list java
# Switch the default Java version
sudo update-alternatives --config java
sudo update-alternatives --config javacJAVA_HOME 구성
~/.bashrc에 추가:
export JAVA_HOME=/usr/lib/jvm/java-25-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATHsource ~/.bashrc
echo $JAVA_HOME메이븐 설치
Maven은 Java 프로젝트에 가장 널리 사용되는 빌드 도구입니다.
sudo apt install maven -y
mvn --version기본 사용법:
# Create a project
mvn archetype:generate -DgroupId=com.example -DartifactId=myapp -DarchetypeArtifactId=maven-archetype-quickstart
# Compile
mvn compile
# Package
mvn package
# Run tests
mvn test
# Clean build artifacts
mvn clean~/.m2/settings.xml을 편집하여 중국 미러를 구성합니다.
<settings>
<mirrors>
<mirror>
<id>aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Aliyun Maven Mirror</name>
<url>https://maven.aliyun.com/repository/central</url>
</mirror>
</mirrors>
</settings>Gradle 설치
# Install via SDKMAN (recommended)
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
sdk install gradle
# Verify
gradle --versionSDKMAN으로 JDK 관리
SDKMAN을 사용하면 여러 JDK 배포판을 쉽게 관리할 수 있습니다.
# List available JDKs
sdk list java
# Install a specific version
sdk install java 21.0.5-tem
# Switch versions
sdk use java 21.0.5-tem
sdk default java 21.0.5-tem이 세 가지 언어는 각각 장점이 있습니다. Go는 네트워크 서비스 및 클라우드 네이티브 개발에 적합하고, Rust는 시스템 프로그래밍 및 고성능 시나리오에 탁월하며, Java는 엔터프라이즈 애플리케이션 개발에 이상적입니다. 프로젝트 요구 사항에 따라 올바른 언어를 선택하십시오.