Setting up Dude on a Linux Server as a Service without X.

Hi, people!

I just wanted to create a very small tutorial on how to run Dude Server as a Linux Service under Mikrotik Wiki, but I don 't know how to do it. I couldn 't find where to create a new Wiki on the site =(
If anyone knows how to do that, please let me know!

Anyway, I 'll show you how I got it running. Any ideas & feedback are welcome!

The first thing that I want to add to that guide is how to install Dude on a specific directory.
By default, wine creates $HOME/.wine but I don 't like to have my services under the home directory of the root user.
So, you 'll need to:

# export WINEPREFIX=/path/to/install/dude
# wine dude-installer-x.x.exe

The second thing that is not covered is to install Dude on a Linux Server without X support.
You know you 'll need a GUI to install Dude =D

You have 2 options:
1 - Install Dude in your Linux Desktop and then copy the wine directory to the server.

# export WINEPREFIX=/srv/dude
# wine dude-installer-x.x.exe
(follow the installation process)
# scp -r /srv/dude root@server:/srv

2 - Install Dude in your Linux Server using your Desktop DISPLAY.
You 'll need to allow remote DISPLAY connections in your Desktop:

  • If you are using Debian or Ubuntu, just edit /usr/share/gdm/gdm.schemas, find the option 'DisallowTCP' and set it to 'false'
  • Restart your Desktop
  • Verify that your X server is listening for remote connections by:
desktop$ netstat -tln
...
tcp        0      0 0.0.0.0:6000            0.0.0.0:*               LISTEN
...
  • Then, allow your current DISPLAY to accept connections by:
desktop$ xhost +

Then, install Dude on the Linux Server by:

server# export WINEPREFIX=/srv/dude
server# export DISPLAY=ip-of-your-desktop:0
(example DISPLAY=192.168.0.100:0)
server# wine dude-installer-x.x.exe

And there you have it, the installation process is running on the server but the GUI will be displayed on your desktop.

\

  • Well, the final step is to run the Dude Server without X on your Linux Server as a System Service:

We 'll need to install virtual framebuffer support on the server:
If your server is CentOS:

# yum install xorg-x11-server-Xvfb

If your server is Debian:

# apt-get install xvfb

Create a script named 'dude' under /etc/init.d:

-----------------------------------------------------------------------

#!/bin/bash

# chkconfig: - 50 20
# description: Dude Server

# processname: dude

action=${1}

. /etc/rc.d/init.d/functions

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

export DISPLAY=$virtual_display
export WINEPREFIX='/srv/wine'

start ()
{
	echo -n 'Starting Dude virtual display:'
	Xvfb $virtual_display &> /dev/null &
	echo $! > $xvfb_pidfile
	success
	echo
	echo -n 'Starting Dude Server:'
	sleep 5
	wine 'c:\program files\dude\dude.exe' --server &> /dev/null &
	echo $! > $wine_pidfile
	success
	touch /var/lock/subsys/dude
	echo
}

stop ()
{
	echo -n 'Stopping Dude Server:'
	kill $(cat $wine_pidfile)
	rm -f $wine_pidfile
	sleep 5
	success
	echo
	echo -n 'Stopping Dude virtual display:'
	kill $(cat $xvfb_pidfile)
	rm -f $xvfb_pidfile
	success
	rm -f /var/lock/subsys/dude
	echo
}

case "$action" in
	start)
		start
	;;

	stop)
		stop
	;;

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

-----------------------------------------------------------------------

Adjust the 'User Options' section to your needs !!!
This scripts is for CentOS, but you can have it running under Debian with a few tweaks.

Then, run:
CentOS:

server# chkconfig --add dude
server# chkconfig dude on

Log into the wiki first, then you have options to edit it to add your information.

Yes, I guess so. But where should I go to create a new account?

Is it not the same as your forum account?

No … unless mine is not working. Anyone can give it a try?

I could not find where to make a new account but I do use my forum username and pass there… Been a while since I got access but I do remember it was separate somehow.

Can you access now?
I 've tried with forum user/pass and mikrotik user/pass … I got an error with both!

Yep just logged right in. I looked all over the wiki and could not find anyplace to make an account. Maybe just email normis and ask…

My forum username and password works on the wiki. I never specifically set up a wiki account, my forum username just always worked on it.

Hi from me :slight_smile:
I was thinking to write a tutorial about the topic as well but my inconvenient English was stopping me. It’s cool that somebody is going to do it!
Grate job elarrarte!
I was starting dude from rc.local but it’s much better to have it as a service

I did it in a bit different way … may be a bit easier :slight_smile:

The example is for CentOS no X installed. I had it running on FreeBSD as well

install wine and xorg-x11-xauth and all dependences

sudo yum install wine xorg-x11-xauth

edit /etc/ssh/sshd_config to enable X11Forwarding on the server
around Line 95

X11Forwarding yes

restart your sshd

sudo /sbin/service sshd restart

connect to the server using -X or -Y to allow X11Forwarding on your client (Should work on Windows with Putty as well http://www.math.umn.edu/systems_guide/putty_xwin32/xfwd_putty-sm.png )
client# ssh -X user@server

Download Dude

wget http://download.mikrotik.com/dude/4.0beta3/dude-install-4.0beta3.exe

Here is the cool part. You will see the installation on your client pc

wine dude-install-4.0beta3.exe

Here you can follow http://wiki.mikrotik.com/wiki/Dude_Linux_Installation to install Dude
or you can just click ‘next’ few times :slight_smile: the issues with the missing fonts doesn’t exist in version 4.0beta3

You can follow elarrarte steps to make Dude as a service.

sudo cp -R ~/.wine /srv/dude



sudo yum install xorg-x11-server-Xvfb

I commented the line causing me troubles and I replaced it with
wine /srv/dude/drive_c/Program\ Files/Dude/dude.exe --server &> /dev/null &
Create a script named ‘dude’ under /etc/init.d:

#!/bin/bash

# chkconfig: - 50 20
# description: Dude Server

# processname: dude

action=${1}

. /etc/rc.d/init.d/functions

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

export DISPLAY=$virtual_display
export WINEPREFIX='/srv/wine'

start ()
{
   echo -n 'Starting Dude virtual display:'
   Xvfb $virtual_display &> /dev/null &
   echo $! > $xvfb_pidfile
   success
   echo
   echo -n 'Starting Dude Server:'
   sleep 5
   #wine 'c:\program files\dude\dude.exe' --server &> /dev/null &
   wine /srv/dude/drive_c/Program\ Files/Dude/dude.exe --server &> /dev/null &
   echo $! > $wine_pidfile
   success
   touch /var/lock/subsys/dude
   echo
}

stop ()
{
   echo -n 'Stopping Dude Server:'
   kill $(cat $wine_pidfile)
   rm -f $wine_pidfile
   sleep 5
   success
   echo
   echo -n 'Stopping Dude virtual display:'
   kill $(cat $xvfb_pidfile)
   rm -f $xvfb_pidfile
   success
   rm -f /var/lock/subsys/dude
   echo
}

case "$action" in
   start)
      start
   ;;

   stop)
      stop
   ;;

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

Don’t forget to make the dude script executable

sudo chmod +x /etc/init.d/dude



sudo chkconfig --add dude



sudo chkconfig dude on

Now you can connect you dude client to the remote server!