Thursday, 27 March 2014

Mikrotik The Dude on Ubuntu 12.04 LTS Server (Step-By-Step)

11:12 Posted by Jurgens Krause , , , , 9 comments

On my network I have a single, low power server, running on my single highsite. This server runs Ubuntu 12.04.2 LTS, and it does not have the oomph to virtualize windows for the sake of dude. To this end I have deployed The Dude running under Wine.

Dude is a network monitoring application by Mikrotik that is excellent for monitoring Mikrotik and other SNMP enabled devices.

We will not be compiling anything, opting rather for the easier apt-get installs where possible.

This tutorial is based off the instructions from the Mikrotik Wiki, but adapted for Ubuntu 12.04 and The Dude Version 4.0 Beta 3

Please Note:

I will be running The Dude on a headless server, ie. this machine has no desktop manager installed. I will also be setting up The Dude to run as a Linux Service so that it starts up with the server.

Prerequisites:

Make sure you are running as root
The first thing to install is the Wine abstraction layer:
# apt-get install wine

Next, you want to install is the Xvfb virtual frame buffer. This is to provide the graphical environment to run The Dude's installer
# apt-get install xvfb

Now install the x11vnc server:
# apt-get install x11vnc

Download The Dude installer, at the time of writing, the latest version is 4.0 Beta 3:
# wget http://download.mikrotik.com/dude/4.0beta3/dude-install-4.0beta3.exe

The Dude Installation:

Start a virtual display using xvfb and enable vnc access:
Xvfb :1 -screen 0 800x600x16 &
x11vnc -display :1 -bg -forever


You can now start the Dude installation.
export DISPLAY=:1
export WINEPREFIX=/srv/dude
wine dude-install*.exe

Use your favourite VNC client to connect to your Dude server, this will present you with The Dude install screen, the setup is fairly simple, you can simply click next until the install is finished:




Click close to finish the install. You may note that this also ends the process on the server once the install is done.


Running Dude as a Linux Server:

Create the file /etc/init.d/dude
# vim /etc/init.d/dude


And paste the following code (taken from Mikrotik Wiki):
#!/bin/bash

### BEGIN INIT INFO
# Provides: dude
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Dude Server
### END INIT INFO

action=${1}

# ----------------------------------------------
# User Options
# ----------------------------------------------
xvfb_pidfile='/var/run/dude-xvfb.pid'
wine_pidfile='/var/run/dude-wine.pid'
virtual_display=':1'
dude_path='/srv/dude'
# ----------------------------------------------

export DISPLAY=$virtual_display
export WINEPREFIX=$dude_path

start ()
{
echo -n 'Starting Dude virtual display: '
Xvfb $virtual_display &> /dev/null &
echo $! > $xvfb_pidfile
echo 'ok'
echo -n 'Starting Dude Server: '
sleep 5
wine 'c:\Program Files (x86)\Dude\dude.exe' --server &> /dev/null &
echo $! > $wine_pidfile
echo 'ok'
}

stop ()
{
echo -n 'Stopping Dude Server: '
kill $(cat $wine_pidfile)
rm -f $wine_pidfile
sleep 5
echo 'ok'
echo -n 'Stopping Dude virtual display: '
kill $(cat $xvfb_pidfile)
rm -f $xvfb_pidfile
echo 'ok'
}

case "$action" in
start)
start
;;

stop)
stop
;;

*)
echo "Usage: $0 {start|stop}"
;;
esac

# -----------------------------------------------------------------------


Make the init script executable:
chmod +x /etc/init.d/dude


Start The Dude service:
/etc/init.d/dude start


Add service to startup:
update-rc.d dude defaults

You can now connect to your Dude server using the standard Dude client on your Windows PC

9 comments:

  1. It seems that the Dude doesn't allow remote connections by default. I launched the Dude using wine on the server itself, and connected with VNC to try to connect locally. However, I still could not connect. The Dude says the local server is running, and I'm using admin with no password. Did you have this problem?

    ReplyDelete
    Replies
    1. I have not experienced that before, can you post the result of the following command:
      iptables -L

      Delete
    2. I'm having the same problem. Please advise on a resolution.
      Thanks

      Delete
  2. Hello I can help me please I installed The Dude nice on a linux server as in the tutorial ubuntu installed perfectly without any problem but after I tried to install on another computer with windows 7 operating system with programult tHE DUDE on Windows to connect to remote IP but the server can not connect why?

    ReplyDelete
    Replies
    1. And i have this error

      warning: dude stop runlevel arguments (0 1 6) do not match LSB Default-Stop values (none)

      Delete
    2. I also have the same runlevel arguments error and can not connect

      Delete
    3. as soon as i have some spare time i will review the steps and get back to you

      Delete
  3. Thank you for the post, works 100%
    How can I start the web server on port 81.
    Any Ideas?

    ReplyDelete