Mapas de Rede

De Infraestrutura São Carlos
Ir para navegação Ir para pesquisar

Objetivo

Instalar e configurar o software The Dude no linux como um serviço. O software deve iniciar automaticamente com o sistema.

Requisitos de Software

  • Sistema operacional linux - Debian

Procedimentos

Instalar o sistema operacional e atualizar.

Instalar o software necessário

Wine (Windows Emulator)

Instalar o wine para executar programas em windows. Para tanto é necessário configurar para instalar a versão i386.

  1. Configurar a arquitetura:
    # dpkg --add-architecture i386
  2. Atualizar:
    # apt-get update
  3. Instalar o wine i386:
    # apt-get install wine-bin:i386

Xvfb (X framebuffer virtual)

Precisamos de uma interface gráfica para instalar o The Dude. Normalmente em sistemas servidores não temos essa interface. Esse programa permitirá criar um virtual X server e utiliza-lo.

  1. Instalar o Xvfb:
    # apt-get install xvfb

X11vnc (X para VNC)

Para acessa a interface virtual vamos utilizar o vnc.

  1. Instalar o X11vnc:
    # apt-get install x11vnc

Instalar o The Dude

  1. Criar o desktop virtual:
    Xvfb :1 -screen 0 1024x768x16 &
  2. Criar o servidor vnc:
    x11vnc -display :1  -bg -forever
  3. Iniciar a seção do wine:
    # export DISPLAY=:1
    # export WINEPREFIX=/srv/dude
    # wine dude-installer-xxx.exe
  4. Conecte-se ao servidor através do seu programa favorito VNC
  5. Continue a instalação normalmente como se fosse no windows

Configurando como serviço

  1. Crie o /etc/init.d/dude arquivo:
    #!/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\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
    
    # -----------------------------------------------------------------------
    
  2. Habilite o serviço:
    insserv dude

Referências