This is the backend server implementation for NanoKVM.
For detailed documentation, please visit our Wiki.
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
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 secret key configuration
# If left empty, a random key will be generated on each server start
secretKey: ""
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/bin
directory 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 server
from the project root directory. - Run
go mod tidy
to 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 build
to compile the project. - After compilation, an executable file named
NanoKVM-Server
will be generated.
- Run
-
Modify RPATH
- Run
sudo apt install patchelf
orpip install patchelf
to install patchelf. - Run
patchelf --version
. Ensure the version is 0.14 or higher`. - Run
patchelf --add-rpath \$ORIGIN/dl_lib NanoKVM-Server
to modify the RPATH of the executable file.
- Run
-
Deploy the Application
- Before deploying, update the application to the latest version in your browser. Follow the instructions here.
- 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
.