mirror of
https://github.com/sipeed/NanoKVM.git
synced 2026-09-11 00:22:56 -05:00
feat: support downloading image from online URL feat: add keyboard shortcut Ctrl+Alt+Del fix: fix the CSRF issue perf: add an option to configure custom ICE servers perf: removed unnecessary modifications to DNS configuration perf: add an SSH enable/disable toggle in the web UI perf: add a Tailscale enable/disable toggle in the web UI perf: download Tailscale installation package from the official source perf: automatic enable/disable GOMEMLIMIT on tailscale start/stop perf: add JWT configuration perf: implement secure password storage using bcrypt hashing perf: implement integrity checks for online updates refactor: refactor HDMI module and remove the dependency libmaixcam_lib.so refactor: web terminal use pty instead of SSH refactor: move Tailscale APIs from the network module to the extensions module
3.7 KiB
3.7 KiB
NanoKVM Server
This is the backend server implementation for NanoKVM.
For detailed documentation, please visit our Wiki.
Structure
server
├── common // Common utility components
├── config // Server configuration
├── dl_lib // Shared object libraries
├── include // Header files for shared objects
├── logger // Logging system
├── middleware // Server middleware components
├── proto // API request/response definitions
├── router // API route handlers
├── service // Core service implementations
├── utils // Utility functions
└── main.go
Configuration
The configuration file path is /etc/kvm/server.yaml.
proto: http
port:
http: 80
https: 443
cert:
crt: server.crt
key: server.key
# Log level (debug/info/warn/error)
# Note: Use 'info' or 'error' in production, 'debug' only for development
logger:
level: info
file: stdout
# Authentication setting (enable/disable)
# Note: Only disable authentication in development environment
authentication: enable
jwt:
# JWT secret key. If left empty, a random 64-byte key will be generated automatically.
secretKey: ""
# JWT token expiration time in seconds. Default: 2678400 (31 days)
refreshTokenDuration: 2678400
# Invalidate all JWT tokens when the user logs out. Default: true
revokeTokensOnLogout: true
# Address for custom STUN server
stun: stun.l.google.com:19302
# Address and authentication for custom TURN server
turn:
turnAddr: turn.cloudflare.com:3478
turnUser: example_user
turnCred: example_cred
Compile & Deploy
Note: Use Linux operating system (x86-64). This build process is not compatible with ARM, Windows or macOS.
-
Install the Toolchain
- Download the toolchain from the following link: Download Link.
- Extract the file and add the
host-tools/gcc/riscv64-linux-musl-x86_64/bindirectory to your PATH environment variable. - Run
riscv64-unknown-linux-musl-gcc -v. If there is version information in the output, the installation is successful.
-
Compile the Project
- Run
cd serverfrom the project root directory. - Run
go mod tidyto install Go dependencies. - Run
CGO_ENABLED=1 GOOS=linux GOARCH=riscv64 CC=riscv64-unknown-linux-musl-gcc CGO_CFLAGS="-mcpu=c906fdv -march=rv64imafdcv0p7xthead -mcmodel=medany -mabi=lp64d" go buildto compile the project. - After compilation, an executable file named
NanoKVM-Serverwill be generated.
- Run
-
Modify RPATH
- Run
sudo apt install patchelforpip install patchelfto install patchelf. - Run
patchelf --version. Ensure the version is 0.14 or higher`. - Run
patchelf --add-rpath \$ORIGIN/dl_lib NanoKVM-Serverto modify the RPATH of the executable file.
- Run
-
Deploy the Application
- File uploads requires SSH. Please enable it in the Web Settings:
Settings > SSH; - Replace the original file in the NanoKVM
/kvmapp/server/directory with the newly compiledNanoKVM-Server. - Restart the service on NanoKVM by executing
/etc/init.d/S95nanokvm restart.
- File uploads requires SSH. Please enable it in the Web Settings:
Manually Update
File uploads requires SSH. Please enable it in the Web Settings:
Settings > SSH;
- Download the latest application from GitHub;
- Unzip the downloaded file and rename the unzipped folder to
kvmapp; - Back up the existing
/kvmappdirectory on your NanoKVM, then replace it with the newkvmappfolder; - Run
/etc/init.d/S95nanokvm restarton your NanoKVM to restart the service.