FreeVM-Server-KVM/start-linux.js

10 lines
464 B
JavaScript

const http = require('http');
const child = require("child_process");
let makedisk = "qemu-img create vm.img 30G" // make a 30GB disk
let qemucmd = "qemu-system-x86_64 -vnc :1 -m 1G -hda vm.img"
child.execSync(makedisk)
child.execSync(qemucmd)
http.createServer(function (req, res) {
res.write('Server running at IP 127.0.0.1:5901 (VNC)'); //write a response to the client
res.end(); //end the response
}).listen(8080); //the server object listens on port 8080