153 lines
3.3 KiB
Markdown
153 lines
3.3 KiB
Markdown
# Erstellung eines Installationsmediums für Rust + MSVC (Offline)
|
||
|
||
Dieser Artikel beschreibt, wie du ein **vollständiges Installationsmedium** für die **Rust-Toolchain mit MSVC** unter Windows vorbereitest, damit du Rust auf anderen Rechnern **ohne Internetzugang** einrichten kannst.
|
||
|
||
---
|
||
|
||
## Ziel
|
||
|
||
Ein USB-Stick oder Offline-Verzeichnis mit:
|
||
|
||
- Rust-Installer (offlinefähig)
|
||
- Visual Studio Build Tools (komplett inkl. MSVC)
|
||
- Optional: vorkompilierte Ziel-Toolchains
|
||
|
||
---
|
||
|
||
## 1. Rust Offline-Installer vorbereiten
|
||
|
||
### 1.1 Rustup Offline-Installer besorgen
|
||
|
||
Gehe auf:
|
||
|
||
https://forge.rust-lang.org/infra/release-archives.html
|
||
|
||
Lade von dort:
|
||
|
||
- `rust-<version>-x86_64-pc-windows-msvc.msi`
|
||
- `cargo-<version>-x86_64-pc-windows-msvc.msi` (optional)
|
||
|
||
Oder direkt über:
|
||
|
||
https://static.rust-lang.org/dist/
|
||
|
||
### 1.2 Installation ohne Internet
|
||
|
||
Auf dem Zielrechner:
|
||
|
||
- Führe `.msi`-Datei lokal aus
|
||
- Setze den `Path` manuell oder automatisch via Skript
|
||
|
||
---
|
||
|
||
## 2. Visual Studio Build Tools offline installieren
|
||
|
||
### 2.1 Installer herunterladen
|
||
|
||
Lade den **Visual Studio Installer** von:
|
||
|
||
https://visualstudio.microsoft.com/de/visual-cpp-build-tools/
|
||
|
||
Starte dann:
|
||
|
||
```cmd
|
||
vs_BuildTools.exe --layout C:\VSOffline --lang de-DE
|
||
```
|
||
|
||
Dieser Befehl erstellt einen vollständigen Offline-Installer im Verzeichnis `C:\VSOffline`.
|
||
|
||
### 2.2 Auswahl der Workloads
|
||
|
||
Wähle beim interaktiven Download (GUI oder CLI):
|
||
|
||
- **C++ Build Tools**
|
||
- Workload-Komponenten:
|
||
- MSVC v14.x (x64/x86)
|
||
- Windows 10/11 SDK
|
||
- CMake-Tools (optional)
|
||
|
||
> 💡 Achtung: Download-Größe ca. 4–6 GB!
|
||
|
||
### 2.3 Installation auf Zielsystem (Offline)
|
||
|
||
Auf dem Zielrechner:
|
||
|
||
```cmd
|
||
C:\VSOffline\vs_BuildTools.exe --noweb --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --quiet --wait
|
||
```
|
||
|
||
Alternativ über `vs_setup.exe`, je nach Version.
|
||
|
||
---
|
||
|
||
## 3. Optional: Toolchains, Crates & Targets vorbereiten
|
||
|
||
Falls du zusätzliche Targets (z. B. Linux oder ARM) brauchst:
|
||
|
||
### 3.1 Ziel-Toolchain lokal laden
|
||
|
||
```cmd
|
||
rustup target add x86_64-unknown-linux-gnu --print
|
||
```
|
||
|
||
Lade die `.tar.gz` von:
|
||
|
||
https://static.rust-lang.org/dist/
|
||
|
||
Speichere diese im `dist/`-Ordner und installiere offline via:
|
||
|
||
```cmd
|
||
rustup toolchain link <name> <pfad_zur_toolchain>
|
||
```
|
||
|
||
---
|
||
|
||
## 4. Automatisierung via USB-Stick
|
||
|
||
### Dateistruktur auf Stick
|
||
|
||
```text
|
||
USB-STICK/
|
||
├── rust/
|
||
│ └── rust-1.xx.x-x86_64-pc-windows-msvc.msi
|
||
├── vsbuildtools/
|
||
│ └── setup + Offline-Daten
|
||
├── install.cmd
|
||
```
|
||
|
||
### Beispiel `install.cmd`
|
||
|
||
```cmd
|
||
@echo off
|
||
echo [1/2] Installiere Rust...
|
||
start /wait rust\rust-*.msi
|
||
|
||
echo [2/2] Installiere Visual Studio Build Tools...
|
||
start /wait vsbuildtools\vs_BuildTools.exe --noweb --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --quiet --wait
|
||
|
||
echo Fertig. Bitte PC neu starten!
|
||
pause
|
||
```
|
||
|
||
---
|
||
|
||
## 5. Validierung
|
||
|
||
Nach der Offline-Installation auf Zielsystem:
|
||
|
||
```cmd
|
||
cargo new testprojekt
|
||
cd testprojekt
|
||
cargo build --release
|
||
```
|
||
|
||
Ergebnis:
|
||
|
||
target\release\testprojekt.exe
|
||
|
||
---
|
||
|
||
## Fazit
|
||
|
||
Mit dieser Methode kannst du eine vollständige Rust- und MSVC-Umgebung offline auf jedem Windows-System aufsetzen – ideal für abgeschottete Systeme ohne Internetverbindung.
|