File:0b0tchristmas2.png and CollabVM Server 1.x/Server setup for beginners: Difference between pages
(Difference between pages)
Undefishin (talk | contribs) (Undefishin moved page File:0b0tchristmas2.png to File:VM0b0t nyw2.png) Tag: New redirect |
No edit summary |
||
Line 1: | Line 1: | ||
{{UnsupportedCVM}} |
|||
#REDIRECT [[File:VM0b0t nyw2.png]] |
|||
{{OutdatedArticle|UserVM Handbook}} |
|||
This guide is intended to help get you setup with CollabVM 1.2.11 along with an NGINX server to handle your requests. You may host it publicly or run it privately. |
|||
These instructions are tested '''only''' with Debian 11 and CollabVM 1.2.11. If you vary, you will have to substitute commands for your own. Basic Linux knowledge is '''strongly''' recommended. |
|||
= Installation = |
|||
== Basic server requirements == |
|||
* OS: Windows is '''not''' supported (but works). As said, these instructions are tested with Debian 11. Most Linux distributions will work, however. |
|||
* CPU: Preferably one which supports hardware virtualization. It is not required, but performance may suffer without it. |
|||
* RAM: You will need enough RAM to host your OS, CollabVM and the associated virtual machine. Have at least 2 GB of RAM free. |
|||
* Disk: Technically you need only about 50 megabytes of storage to run CollabVM, however you will need space for NGINX and your associated VM. Have atleast 4 GB of free storage, much more (>16GB) if you are hosting full Windows VMs. |
|||
* Permissions: You'll likely need root-level access to the server you're using in order to install packages for the system. However, collab-vm-server should '''NEVER''' be run as root! (or administrator privileges, when on Windows) |
|||
== collab-vm-server setup == |
|||
Do the following under a user with limited privileges (with the exception of sudo commands, if you wish): |
|||
# You will need to grab the required libraries and some additional tools for collab-vm-server: |
|||
#* <code>sudo apt install -y libboost-dev libboost-system-dev libcairo-dev libvncserver-dev libc-dev libturbojpeg-dev libsqlite3-dev make clang git</code> |
|||
# Next, you'll want to clone (download) the collab-vm-server repository: <code>git clone https://github.com/computernewb/collab-vm-server-1.2.git -b release/1.2.11 --recurse-submodules</code> |
|||
# Now, change directory: <code>cd collab-vm-server</code> |
|||
# Since we will run collab-vm-server under NGINX, we will need to modify two files: |
|||
#* Using the editor of your choice, edit the file <code>src/websocketmm/websocket_user.cpp</code> inside the CollabVM source code. Remove the double slashes in the line containing <code>//#define WEBSOCKETMM_SUPPORT_PROXYING</code>. |
|||
#* The next file to edit is <code>src/CollabVM.cpp</code>. Here, look for a line containing <code>server_->start("0.0.0.0", port);</code>. Change the <code>0.0.0.0</code> to <code>127.0.0.1</code> |
|||
#** What we've done here is make it so CollabVM listens only on localhost. This way, malicious users cannot spoof their IP address by setting headers. |
|||
# To compile collab-vm-server, execute this command: <code>make -j$(nproc) JPEG=1</code> |
|||
#* If you would not like JPEG support (not recommended!) you can leave out the <code>JPEG=1</code> flag. Do not disable this unless you know what you are doing. |
|||
#* Note that this command will also use all of your cores, if you would like to utilize less cores, replace <code>$(nproc)</code> with the amount of cores you'd like to use |
|||
The collab-vm-binary is now compiled and ready to be used. It doesn't provide a proper HTTP server though, so it will not run |
|||
== Webapp setup == |
|||
Again, continue doing the following here under a user with limited privileges. |
|||
=== Main webapp === |
|||
# Go back 1 directory: <code>cd ..</code> |
|||
# Install node.js: |
|||
## First, you need curl: <code>sudo apt install -y curl</code> |
|||
## Run this command: <code>curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -</code> |
|||
## Then install it: <code>sudo apt install -y nodejs</code> |
|||
# Get the web app: <code>git clone https://github.com/computernewb/collab-vm-web-app.git</code> |
|||
# Change directory into the webapp <code>cd collab-vm-web-app/</code> |
|||
# Install the required packages: <code>npm i</code> |
|||
# And install gulp globally: <code>sudo npm i -g gulp</code> |
|||
# Time to edit another file: |
|||
#* Edit <code>src/js/collab-vm/common.js</code>, look for the line containing <code>serverAddress: window.location.host,</code>, change it to <code>serverAddress: window.location.host + '/cvmws',</code> |
|||
# Now run <code>gulp</code>, let it build the web app. |
|||
=== Admin webapp === |
|||
# Go back 1 directory, once again: <code>cd ..</code> |
|||
# Grab the admin webapp: <code>git clone https://github.com/computernewb/collab-vm-admin-web-app.git</code> |
|||
# Now change directory into the admin webapp <code>cd collab-vm-admin-web-app/</code> |
|||
# Then install the packages, once again: <code>npm i</code> |
|||
# We need to modify the same file: |
|||
#* Edit <code>src/collab-vm/common.js</code>, this time replacing <code>var serverAddress = window.location.host;</code> with <code>var serverAddress = window.location.host + '/cvmws';</code> |
|||
# Now run gulp once again: <code>gulp</code> |
|||
=== Constructing your HTTP directory === |
|||
We will be creating the directory in <code>/home/test/collab-vm-www</code>, please substitute the commands as needed. |
|||
# First we will create the directory: <code>mkdir /home/test/collab-vm-www/</code> |
|||
# Now we will add a file inside: |
|||
#* Create the file <code>index.html</code> with the following content: <syntaxhighlight lang="html"> |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<title>...</title> |
|||
<meta http-equiv="refresh" content="0; url=/collab-vm/" /> |
|||
</head> |
|||
<body> |
|||
</body> |
|||
</html> |
|||
</syntaxhighlight> |
|||
# Next, copy the main webapp into your www directory: <code>cp -r collab-vm-web-app/build /home/test/collab-vm-www/collab-vm</code> (Don't forget the <code>collab-vm/</code>) |
|||
# And the admin webapp: <code>cp -r collab-vm-admin-web-app/build /home/test/collab-vm-www/admin</code> |
|||
Now you have a working HTTP root for your Collab VM installation. We will be using NGINX in the next step in order to host this directory. |
|||
== NGINX installation == |
|||
We will be installing and configuring NGINX to host our webapp and proxy connections to the collab-vm-server instance. In this case, we are using port 6004, with collab-vm-server using port 6005 and our root directory being the same as previously (<code>/home/test/collab-vm-www</code>). We are also not accepting IPv6 connections, which may need some additional configuration. |
|||
# First, install NGINX: <code>sudo apt install nginx -y</code> |
|||
# Next, you will want to add an additional site configuration to NGINX. |
|||
#* Create the file <code>/etc/nginx/sites-enabled/collab-vm</code>, and insert the following contents inside. If needed, substitute the values as necessary. Root privileges might be required to edit this file. <syntaxhighlight lang="nginx"> |
|||
server { |
|||
listen 6004; # Listen on port 6004 |
|||
access_log /var/log/nginx/cvm.log; # Log visitors to this file |
|||
root /home/test/collab-vm-www/; # This will be your root www directory |
|||
location /cvmws { |
|||
proxy_pass http://127.0.0.1:6005; # This will be the port collab-vm-server will be listening on |
|||
proxy_http_version 1.1; |
|||
proxy_set_header Upgrade $http_upgrade; |
|||
proxy_set_header Connection "Upgrade"; |
|||
proxy_set_header Host $host:$server_port; |
|||
proxy_buffering off; |
|||
proxy_redirect off; |
|||
proxy_set_header Sec-WebSocket-Extensions $http_sec_websocket_extensions; |
|||
proxy_set_header Sec-WebSocket-Protocol $http_sec_websocket_protocol; |
|||
proxy_set_header Sec-WebSocket-Key $http_sec_websocket_key; |
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|||
proxy_connect_timeout 10s; |
|||
proxy_read_timeout 36000s; |
|||
proxy_temp_file_write_size 16k; |
|||
} |
|||
location / { |
|||
try_files $uri $uri/ =404; |
|||
} |
|||
} |
|||
</syntaxhighlight> |
|||
# Now, enable and start NGINX using these commands: |
|||
## <code>sudo systemctl enable nginx</code> |
|||
## <code>sudo systemctl start nginx</code> |
|||
Now, visit your server's IP address on port 6004. If the IP address were <code>192.168.1.100</code>, then visit http://192.168.1.100:6004/ in your browser. It should load the CollabVM interface with an endless loading spinner. |