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!
- Follow the guide on how to install Dude under Linux.
RouterOS - RouterOS - MikroTik Documentation
It 's very clear and easy. Congratulations to the author!
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