How to install socket.io-computer on your server: Difference between revisions

From Computernewb Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{{Defunct}}
{{Defunct}}
:''Note: The CollabVM team does not develop this product. Cosmic Sans, Dartz, and other members of the team will not provide support for any problems you have with socket.io-computer.'' '''It is highly recommended that you instead install [[How to Setup a UserVM|CollabVM Server 1.x]] instead. Socket.io-computer is inferior in almost every way and cannot be used to create UserVMs (because they are incompatible with CollabVM 1.x)'''

:''Note: The CollabVM team does not develop this product. Cosmic Sans, Dartz, and other members of the team will not provide support for any problems you have with socket.io-computer.''

'''It is highly recommended that you instead install [[How to Setup a UserVM|CollabVM Server 1.x]] instead. socket.io-computer is inferior in almost every way and cannot be used to create UserVMs'''



This article documents how to install the socket.io-computer, better known as '''[[socket.computer]]''', on your server.
This article documents how to install the socket.io-computer, better known as '''[[socket.computer]]''', on your server.
Line 10: Line 6:
The instructions are for Debian-based distributions, including Ubuntu. However this tutorial should work on any flavor of Linux and will probably work on Windows and Mac as well.
The instructions are for Debian-based distributions, including Ubuntu. However this tutorial should work on any flavor of Linux and will probably work on Windows and Mac as well.


== Preparation ==
*Grab socket.computer's source code from here: https://github.com/kevin-roark/socket.io-computer. You can use git to clone it or you can download the files manually.
# You can download the [[socket.computer]] source code from [https://github.com/kevin-roark/socket.io-computer here]. You can use Git to clone it or you can download the files manually.
*Now it's time to install the dependencies. We'll start with qemu. Installing qemu is really easy.
**On Linux: Depending on your distribution this might be different but on Debian you can type <code>sudo apt install qemu-system-x86 -y</code>. Click [[QEMU/Installation|here]] for a whole list of install commands.
# Now it's time to install the dependencies. We'll start with Qemu. Installing Qemu is really easy. Depending on your distribution, this might be different, but on Debian you can type <code>sudo apt install qemu-system-x86 -y</code>. Click [[QEMU/Installation|here]] for a whole list of install commands.
*Next dependency is redis-server. Install it by doing <code>sudo apt install redis-server -y</code> if you're on Debian. It should install with no errors.
# Next dependency is redis-server. Install it by doing <code>sudo apt install redis-server -y</code> if you're on Debian. It should install with no errors.
*Next dependency is node.js. We can install it by doing <code>sudo apt install nodejs npm</code>.
# Next dependency is node.js. We can install it by doing <code>sudo apt install nodejs npm</code>. '''NOTICE:''' On Debian-based distributions, there is a package called node. This is NOT nodejs! That is an unrelated package designed for TCP/IP and packet radio network connections.
# Afterwards, we are going to create a symbolic link to make sure that our dependencies will have no issues. Type this command into the terminal like so: <code>sudo ln -s /usr/bin/nodejs /usr/bin/node</code>
**'''NOTICE:''' On Debian-based distributions, there is a package called node. This is NOT nodejs! That is an unrelated package designed for TCP/IP and packet radio network connections.
# Next we need Canvas. Canvas is somewhat known for being a pain to install on Ubuntu-based distros, but it's not too hard. First what we need is to download <code>libjpeg9a</code> and <code>libjpeg9a-dev</code>. These are not in the Ubuntu or Debian based distributions so we must download and install them manually. We do not need compilation for this.
*Afterwards, we're going to need to create a symbolic link as to make sure that our dependencies will have no issues. Type the following into the Terminal: <code>sudo ln -s /usr/bin/nodejs /usr/bin/node</code>
## Download these from here: https://packages.debian.org/search?keywords=libjpeg9 and download them based on your distribution. If you're not testing Debian 9 just pick sid on <code>libjpeg9</code> and <code>libjpeg9-dev</code>.
*Next we need Canvas. Canvas is somewhat known for being a pain to install on Ubuntu-based distros, but it's not too hard. First what we need is to download libjpeg9a and libjpeg9a-dev. These are not in the Ubuntu or Debian based distributions so we must download and install them manually. We do not need compilation for this.
## To install the packages do this: <code>sudo dpkg -i libjpeg99a-2(yourarch).deb && sudo dpkg -i libjpeg9-dev9a-2(yourarch).deb</code>
**Download these from here: https://packages.debian.org/search?keywords=libjpeg9 and download them based on your distribution. If you're not testing Debian 9 just pick sid on libjpeg9 and libjpeg9-dev.
***To install the packages do this: <code>sudo dpkg -i libjpeg99a-2(yourarch).deb && sudo dpkg -i libjpeg9-dev9a-2(yourarch).deb</code>
# Next, install Canvas dependencies by doing the following command: <code>sudo apt install libcairo2-dev libpango1.0-dev libgif-dev build-essential g++</code>
*Next, install Canvas dependencies by doing the following command: <code>sudo apt install libcairo2-dev libpango1.0-dev libgif-dev build-essential g++</code>
*Finally, lets get back to the socket.computer folder and install everything we need. Do: <code>npm install -g</code>. Or if you want them all in the same folder you can just do npm install. It doesn't really matter.
*Let's go ahead and make a qemu-img now. socket.computer can run any operating system that QEMU can, but it is not recommended to run Windows 95 or anything that doesn't support USB because -usbdevice tablet is somewhat necessary for nice operation. To make a qemu-img for this example, make one called <code>qemu-img create -f qcow2 winxp.img 5G</code>
*This will make a qcow2 named winxp.img with the size of about 5 gigabytes. Of course you can make this more and you can use RAW if you want it to be faster but that will take up all the space you specified.
*We now need to edit redis.js and app.js. Go to line 4 and you'll find a line that says "var uri = process.env.COMPUTER_REDIS_URI || 'localhost:6379';". Change 'localhost' to your VPS/computers IP.
*Next, open app.js and go to line 32. You will find:
**var url = process.env.COMPUTER_IO_URL || 'http://localhost:6001'; Again, change this to your VPS/computers IP.
*To edit the way qemu starts up, open qemu.js and go to line 36. You will find the commands to add.

It is HIGHLY recommended that you install your operating system in the real QEMU instead of socket.computer, then run the snapshot in socket.computer. It is also highly recommended to keep a backup of said snapshot somewhere on the computer, or use loadvm and savevm in the possible event someone destroys your virtual machine.

To start socket.computer use the following commands. Note, you might need to run them with sudo privileges.
*node app.js
*node io.js
*COMPUTER_ISO=(youriso).iso COMPUTER_IMG=(yourimg).img node qemu.js
*COMPUTER_IMG=(yourimg).img node emu-runner.js

And now you are all set up and ready to use socket.computer! There's also an optional patch. socket.computer has a vulnerability that allows people to send QEMU commands and take mouse control. As this can result in the compromisation of your server it is recommended to install this unofficial patch on your server which fixes these problems. This has been thoroughly tested but there could be other methods. Let me know if you find any.


== Configuring & launching socket.computer ==
http://computernewb.com/socketcomputerpatch.zip
# Finally, let's go back to the socket.computer folder and install everything we need. Type <code>npm install -g</code>, or if you want them all in the same folder you can just do <code>npm install</code>. It doesn't really matter.
# Let's go ahead and make a Qemu disk image now. [[socket.computer]] can run any operating system that QEMU can, but it is not recommended to run Windows 95 or anything that doesn't support USB because -usbdevice tablet is somewhat necessary for nice operation. To make a Qemu disk image for this example, type <code>qemu-img create -f qcow2 winxp.img 5G</code>. You can learn more about qemu-img by clicking [[How to create a disk image in QEMU|here]]. This will make a qcow2 named winxp.img with the size of about 5 gigabytes.
# We now need to edit redis.js and app.js. Go to line 4 and you'll find a line that says <code>var uri = process.env.COMPUTER_REDIS_URI || 'localhost:6379';</code>. Change the <code>localhost</code> part of <code>'localhost:6379'</code> (don't remove the port or anything else) to your VPS/computers IP.
# Next, open app.js and go to line 32, which looks like this: <code>var url = process.env.COMPUTER_IO_URL || 'http://localhost:6001';</code> Again, change the localhost part to your VPS/computers IP.
# To edit the way Qemu starts up, open qemu.js and go to line 36, where you will find the init function and from there you can see the arguments array which you can edit to your liking. '''It is HIGHLY recommended that you install your operating system in the real QEMU instead of socket.computer, then run the snapshot in socket.computer!''' It is also highly recommended to keep a backup of said snapshot somewhere on the computer, or use loadvm and savevm in the possible event someone destroys your virtual machine.
# To start socket.computer use the following commands: <code>node app.js && node io.js && COMPUTER_ISO=(youriso).iso COMPUTER_IMG=(yourimg).img node qemu.js && COMPUTER_IMG=(yourimg).img node emu-runner.js</code> (Note, you might need to run them with sudo privileges) And now you are all set up and ready to use socket.computer! There's also an optional patch. [[socket.computer]] has a vulnerability that allows people to send QEMU commands and take mouse control. As this can result in the compromisation of your server it is recommended to install this unofficial patch on your server which fixes these problems. This has been thoroughly tested but there could be other methods. Let me know if you find any. You can download the patch here: http://computernewb.com/socketcomputerpatch.zip


[[Category:Tutorials]]
[[Category:Tutorials]]

Revision as of 15:37, 3 October 2022

This article/section contains info about defunct content.
Note: The CollabVM team does not develop this product. Cosmic Sans, Dartz, and other members of the team will not provide support for any problems you have with socket.io-computer. It is highly recommended that you instead install CollabVM Server 1.x instead. Socket.io-computer is inferior in almost every way and cannot be used to create UserVMs (because they are incompatible with CollabVM 1.x)

This article documents how to install the socket.io-computer, better known as socket.computer, on your server.

The instructions are for Debian-based distributions, including Ubuntu. However this tutorial should work on any flavor of Linux and will probably work on Windows and Mac as well.

Preparation

  1. You can download the socket.computer source code from here. You can use Git to clone it or you can download the files manually.
  2. Now it's time to install the dependencies. We'll start with Qemu. Installing Qemu is really easy. Depending on your distribution, this might be different, but on Debian you can type sudo apt install qemu-system-x86 -y. Click here for a whole list of install commands.
  3. Next dependency is redis-server. Install it by doing sudo apt install redis-server -y if you're on Debian. It should install with no errors.
  4. Next dependency is node.js. We can install it by doing sudo apt install nodejs npm. NOTICE: On Debian-based distributions, there is a package called node. This is NOT nodejs! That is an unrelated package designed for TCP/IP and packet radio network connections.
  5. Afterwards, we are going to create a symbolic link to make sure that our dependencies will have no issues. Type this command into the terminal like so: sudo ln -s /usr/bin/nodejs /usr/bin/node
  6. Next we need Canvas. Canvas is somewhat known for being a pain to install on Ubuntu-based distros, but it's not too hard. First what we need is to download libjpeg9a and libjpeg9a-dev. These are not in the Ubuntu or Debian based distributions so we must download and install them manually. We do not need compilation for this.
    1. Download these from here: https://packages.debian.org/search?keywords=libjpeg9 and download them based on your distribution. If you're not testing Debian 9 just pick sid on libjpeg9 and libjpeg9-dev.
    2. To install the packages do this: sudo dpkg -i libjpeg99a-2(yourarch).deb && sudo dpkg -i libjpeg9-dev9a-2(yourarch).deb
  7. Next, install Canvas dependencies by doing the following command: sudo apt install libcairo2-dev libpango1.0-dev libgif-dev build-essential g++

Configuring & launching socket.computer

  1. Finally, let's go back to the socket.computer folder and install everything we need. Type npm install -g, or if you want them all in the same folder you can just do npm install. It doesn't really matter.
  2. Let's go ahead and make a Qemu disk image now. socket.computer can run any operating system that QEMU can, but it is not recommended to run Windows 95 or anything that doesn't support USB because -usbdevice tablet is somewhat necessary for nice operation. To make a Qemu disk image for this example, type qemu-img create -f qcow2 winxp.img 5G. You can learn more about qemu-img by clicking here. This will make a qcow2 named winxp.img with the size of about 5 gigabytes.
  3. We now need to edit redis.js and app.js. Go to line 4 and you'll find a line that says var uri = process.env.COMPUTER_REDIS_URI || 'localhost:6379';. Change the localhost part of 'localhost:6379' (don't remove the port or anything else) to your VPS/computers IP.
  4. Next, open app.js and go to line 32, which looks like this: var url = process.env.COMPUTER_IO_URL || 'http://localhost:6001'; Again, change the localhost part to your VPS/computers IP.
  5. To edit the way Qemu starts up, open qemu.js and go to line 36, where you will find the init function and from there you can see the arguments array which you can edit to your liking. It is HIGHLY recommended that you install your operating system in the real QEMU instead of socket.computer, then run the snapshot in socket.computer! It is also highly recommended to keep a backup of said snapshot somewhere on the computer, or use loadvm and savevm in the possible event someone destroys your virtual machine.
  6. To start socket.computer use the following commands: node app.js && node io.js && COMPUTER_ISO=(youriso).iso COMPUTER_IMG=(yourimg).img node qemu.js && COMPUTER_IMG=(yourimg).img node emu-runner.js (Note, you might need to run them with sudo privileges) And now you are all set up and ready to use socket.computer! There's also an optional patch. socket.computer has a vulnerability that allows people to send QEMU commands and take mouse control. As this can result in the compromisation of your server it is recommended to install this unofficial patch on your server which fixes these problems. This has been thoroughly tested but there could be other methods. Let me know if you find any. You can download the patch here: http://computernewb.com/socketcomputerpatch.zip