In the previous version of our article, we demonstrated how to setup a Contabo server using the Debian 9 Linux distro in order to run Monkersolver, without having to pay for the cost of a Windows licence.
The article was well received, and we received a lot of feedback from users who were successfully able to setup Monkersolver on their server using Linux. Since then, we have released additional articles expanding on the original article, as well as have had time to gather experience from running both our own and client’s servers.
In this updated guide we will demonstrate our most up-to-date way of setting up a Linux server, that is both more secure, and improves the usability of the server.
You will know longer have to deal with manual IP restriction to prevent your server from being taken down by a brute-force attack. We have also included copy-paste functionality from the get-go. In addition, the installation process is now more streamlined across platforms (Windows, Mac and Linux). In the article we will be focusing on how to complete the installation using Windows, but it should be intuitive how to complete the installation and setup using the other platforms as well. This article was written for use with Contabo servers, but should work with other hosting companies as well.N
Configuring Your Server
Before you can begin setting up your server’s software, you need to decide what hardware you want to use. Here we present you with our guidelines for server configuration. If you already have a server with Contabo, feel free to skip this section.
The following selection process is more or less the same as in our previous guide. We still recommend going with Contabo’s 10-Core Dedictated Server (256 GB ECC RAM) and upgrading it with an additional Xeon E5 2630v4 CPU.
The next option in our server configuration process is hard drive selection. There are multiple viable configurations here, some are better than others. At the very minimum, we would recommend selecting an SSD as your primary storage device, 250 GB will be used up relatively quickly, so we would recommend going with a 500 GB SSD as your base line. Another option would be to select ‘4 x 1 TB 24/7-HDD, RAID 10’, or for example ‘SSD 250 GB’ or ‘2000 GB hard disk’ as your boot device, and then to run your applications on an additional NVMe SSD (you can not configure NVMe for your boot drive). This all depends on your budget, but 17.99 EUR/mo will get you started, and give you a reasonably good user experience.
As the title of this article implies, we will be running our server using Debian 9. Debian 9 is a very reliable and stable Linux distro that has been tested and proven to work well with Monkersolver.
If you click the ‘OPTIONS’ drop down menu, you can also see that by selecting Debian 9, we are saving 49.99 EUR/mo on Windows licensing fees.
Basic Server Configuration
In order to connect to your server, we are going to use a piece of software called PuTTY.
Under ‘Host Name (or IP address)’ enter your servers IP address that was provided by Contabo. Under port, type ’22’. This is the port required to establish an SSH connection. When you’re done, hit ‘Open’. You will be prompted to ‘login as’. We are going to connect using the root user account and the password that Contabo provided us with in their email.
This is where we will diverge from our previous server installation guide. First of all we are going to start by creating a new user account that isn’t a root user. The root user account has administrative privileges, and should not be the default way we interact with our server, especially not for our use case.
Create New Non-Root User Account
First we need to install ‘sudo’. ‘Sudo’ will enable us to run administrative commands from our new non-root account as needed.
apt install sudo
In the next step we will create a user with our desired name and at that user to the group of sudoers. Replace ‘your_username’ with your desired username. Hit enter after each command.
usermod -aG sudo your_username
Install A Firewall
Debian 9 has built-in firewall capability through ‘iptables’, but we will install UFW firewall for the purpose of this guide. Hit ‘Enter’ after every command.
apt install ufw
In the next step, we are going to restrict the firewall to only allow connections through SSH.
ufw allow OpenSSH
Enable the firewall. When prompted, type y and hit ‘Enter’ to continue:
Confirm to see if UFW is running:
The output should also show that our firewall is now restricted to SSH connections only.
Status: active To Action From -- ------ ---- OpenSSH ALLOW Anywhere OpenSSH (v6) ALLOW Anywhere (v6)
Confirm SSH Login With The New Non-Root Account
Now that we have set up both a new non-root user account, and a firewall, we should confirm that we can connect using this new account. Open a new instance of PuTTY. This time when prompted to login, enter the new non-root account that we just created, with the password you specified. Assuming this was successful, we recommend to continue the rest of the setup process using your new user. Since this account is no longer the root account, you may notice that most commands will now need to be executed by typing sudo before them.
Configuring VNC On The Server
Now that we have completed some basic server configuration, let’s proceed to configuring our server so that we can use a graphical user interface through VNC.
Again, please hit ‘Enter’ after every command. You may also be prompted to confirm an installation by typing ‘y’ and then hitting ‘Enter’ as well. Since we will be typing sudo in front of most of our commands, we will initially and periodically be prompted to enter our new account’s password to confirm our commands.
Let’s start by updating our server’s list of packages:
sudo apt update
In the next step we are going to install the dekstop environment for our Linux graphical user interface:
sudo apt install xfce4 xfce4-goodies
Now install TightVNC, our preferred remote control software for Linux:
sudo apt install tightvncserver
Now that we have VNC and a desktop environment installed we could already begin using our Linux installation, however there are a few more configuration steps that we need to complete to get the most out of our server.
First off, let’s start vncserver to confirm it has installed correctly, and also to complete our basic setup of VNC.
You will be prompted to enter a password for connecting to your VNC client here. The password length has to be between six and eight characters. If you enter a password longer than eight characters, it will automatically be truncated to eight characters. Optionally, you can also set up a view-only password. You don’t need to fill out any personal information, just hit ‘Enter’ to skip. Make sure to remember your password, as we will need it later on to connect to our Debian desktop.
Once completed, your server output should look something like this:
New 'X' desktop is your_hostname:1 Creating default startup script /home/your_username/.vnc/xstartup Starting applications specified in /home/your_username/.vnc/xstartup Log file is /home/your_username/.vnc/your_hostname:1.log
Let’s go ahead and shut down the server.:
vncserver -kill :1
Modifying VNC’s Xstartup File To Enable Copy-Paste And Store Our Settings
Here we have another addition to this year’s guide where we will enable copy-paste from the initial setup.
Install autocutsel, which enables copy-pasting between your server and your local machine.
sudo apt install autocutsel
Now, create a backup of your xstartup backup file.
mv ~/.vnc/xstartup ~/.vnc/xstartup.bak
Next, we will create a new xstartup file, and add our additional parameters using the text editor ‘nano’:
Add the following lines to your xstartup file so it looks like this:
#!/bin/bash autocutsel -fork xrdb $HOME/.Xresources startxfce4 &
The first line after ‘#! /bin/bash’ enables autocutsel on our VNC server. The following commands relate to the graphical configuration of our VNC server. Any changes to the GUI (graphical user interface) that are made on the server will be saved to the .Xresources file.
Once you are done editing the xstartup file, press ‘ctrl+x’ to exit. When prompted, type ‘y’ to confirm that you would like to save, and ‘Enter’ to confirm the proposed location.
We need to make sure that this file is executable. We can do this using the command chmod:
sudo chmod +x ~/.vnc/xstartup
Now we can restart the server. Note that we have added additional parameters to the vncserver command. The ‘-depth’ parameter specifies the colour depth of our connection to VNC. The ‘-geometry’ parameter specifies it’s resolution. You can use different parameters if you please.
vncserver -depth 24 -geometry 1920x1080
Connecting To VNC Securely Via Encrypted SSH Tunnel
In the following step we are going to reconnect to our server using an SSH tunnel. First of all disconnect from all active PuTTY sessions by inputting the following command into all active PuTTY terminals:
This command will end our current session(s). For this step, we will need to reopen PuTTY on our local machine and go to ‘SSH’ and then ‘Tunnels’. Here we want to specify 5901 as our ‘Source port’. 5901 is the port that our VNC client listens on for incoming traffic. Under ‘Destination’ enter ‘localhost:5901’. Below select ‘Local’ and ‘IPv4’.
Now go back to ‘Sessions’, click ‘Default Settings’ and click ‘Save’ to make this your default mode of connecting to your server.
Next, click ‘Open’ to reconnect to your server using your newly established SSH tunnel. Don’t forget to login using your non-root user account.
Connecting To Our Servers Graphical User Interface
Now that we have correctly configured our server, we can go ahead and connect to our desktop using RealVNC’s VNC Viewer client. This is a multi-platform client, and will run on almost any mainstream OS, including mobile. From within the address bar of VNC Viewer, type ‘localhost:5901’ and hit ‘Enter’. If you completed all the steps correctly, this should connect you to your VNC server’s desktop. When prompted, enter the password you set during the initial setup of tightvncserver.
If prompted, select ‘Use default config’. Now you should see a desktop that looks roughly as the one below.
Installing Additional Software On Our Server
Before we can install Monkersolver, we need to first install some additonal software. We need to install Chromium (web browser), 7-zip (for extraction our Monkersolver file) and JRE (Java Runtime Environment) for running Monkersolver. We can install these all at the same time using the following command:
sudo apt install -y chromium && sudo apt install -y p7zip-full && sudo apt install -y default-jre
In order to proceed, you will need to have the installation file for Mac OS on your server. This file has a .dmg file extension. If you have downloaded this file using your web browser, it will typically be placed in your ‘Downloads’ folder, unless otherwise specified. In the following steps, we will assume that this is the case. If your file is somewhere else, please move it to the ‘Downloads’ folder, or adjust accordingly.
The following commands can be executed either from your terminal connection through PuTTY or from the terminal on your desktop. If you would like to use the terminal on your desktop, simply click the black box from the dock on your server.
Navigate to your ‘Downloads’ folder:
Now using 7-zip, we are going to extract the contents of our .dmg file:
7z x monkersolver-setup.dmg
This will extract the contents to a folder named ‘monkersolver-setup’ and place it within your ‘Downloads’ folder. Now navigate to that folder:
Now make ‘start2.sh’ executable. We need to run ‘start2.sh’ to start Monkersolver:
sudo chmod +x /home/your_username/Downloads/monkersolver-setup/start2.sh
From your desktop you can execute Monkersolver by typing the following from within your ‘monkersolver-setup’ folder. Hit ‘Enter’ after each command:
Note that ‘start2.sh’ is also where you can configure RAM settings for your server. That means change your -Xmx parameter, or the maximum RAM that can be assigned to each instance of Monkersolver through the Java Virtual Machine. View and edit the file from your terminal with the following command:
nano /home/your_username/Downloads/monkersolver-setup/ start2.sh
Also feel free to edit the file straight from your desktop environment if you prefer.
And that’s it. Congratulations for making it through the installation of your Monkersolver Linux server. As always, please leave feedback and let us know if you liked our guide or how it may be improved. Also let us know if you have found an error or need further clarification for one of the steps. Thanks for reading.