MikroBILL сервер на Linux

Материал из MikroBILL
Перейти к: навигация, поиск
  1. Данное пособие тестировалось на версии (MikroBill 2.0.3 BETA) для работы с Wine были внесены некоторые доработки в MikroBill Server.
  2. Злоупотреблять вином нельзя, помните!
Introduction

This guide will describe how to setup up MikroBILL as a Linux Service. That means MikroBILL will automatically start up during boot like any other allowed service in your system does.

  • Next step 1 (Install Required Software)
Software - Wine (Windows Emulator)
We are going to use Wine to run MikroBILL windows executable (.exe) under Linux.
Install Wine:
Go to Official Website WineHQ, select your OS.
https://wiki.winehq.org/Download
Next, follow the instructions and install Wine.

CentOS 5

You will need to add <RepoForge repository>
# sudo wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
# sudo rpm -i rpmforge-release-0.5.2-2.el5.rf.i386.rpm
# sudo yum update
Software - Xvfb (X virtual framebuffer)

As you can imagine, we are going to need a GUI to install MikroBILL. However, we usually don 't have one in server environments, unless you have a desktop manager installed like Gnome, KDE, etc. I sometimes install fluxbox (a very small desktop environment) for this purposes. Well, this program will allow us to create a virtual (fake) X Server used to install MikroBILL.

Debian 6

# sudo apt-get install xvfb

CentOS 5

# sudo yum install xorg-x11-server-Xvfb
Software - X11VNC (X to VNC)

This will allow us to manage the virtual framebuffer display created with Xfvb from our desktop computer using VNC protocol.

Debian 6

# sudo apt-get install x11vnc

CentOS 5

# sudo yum install x11vnc
  • Next step 2 (Install Wine Container)

Debian 6/CentOS 5

Creating a Virtual Display with Xvfb.
# Xvfb :1 -screen 0 1152x720x16 &
Enabling VNC access to the Virtual Display.
# x11vnc -display :1  -bg -forever
Starting Wine envelope installation.
# export DISPLAY=:1
# export WINEPREFIX=/srv/mikrobill
# export WINEARCH=win32
# wine uninstaller
!NB
Download NET. Framework 4.0 Extendet from site http://mikro-bill.com/files/dotnetfx40.exe
Copy dotnetfx40.exe to directory (/srv/mikrobill/drive_c/)
Download Free VNC Client from site https://www.realvnc.com/en/connect/download/viewer/windows/
Start VNC Client from your Windows PC and connect to the server via ip address.
If there is a proposal to install Wine-Mono or Gecko, select refuse or click close.
* In window "If available - select from list (wine-mono) and Remove".
* Next press 'Install' select (dotnetfx40.exe) from drive "C:", finish the installation process.
* After installation, you can remove installer (dotnetfx40.exe).
Find process Xvfb :1 -screen 0 1152x720x16
# ps fax
(My process has now pid:1612)
Kill this process use command:
# kill -9 (pid)
I did it like this
# kill -9 1612
  • Next step 3 (Install MikroBILL Server)
# cd /srv/mikrobill/drive_c
# mkdir mikrobill

Download latest MikroBILL and unzip all files in to root directory:(/srv/mikrobill/drive_c/mikrobill)

Set root privileges.
# sudo chown -R root:root /srv/mikrobill
  • Next step 4 (Setting up the MikroBILL Service)

Debian 6

Create the file /etc/init.d/mikrobill:
# sudo nano /etc/init.d/mikrobill
Paste this bash code
#!/bin/bash

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

action=${1}

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

export DISPLAY=$virtual_display
export WINEPREFIX=$mikrobill_path
export WINEARCH=win32
export WINEDEBUG=-all

start ()
{
        echo -n 'Starting MikroBILL virtual display: '
        Xvfb $virtual_display -screen 0 1152x720x16 &> /dev/null &
        echo $! > $xvfb_pidfile
        echo 'ok'
        echo -n 'Starting MikroBILL Server: '
        sleep 5
        wine 'c:\mikrobill\MikroBILL.exe' /SERVER &> /dev/null &
        echo $! > $wine_pidfile
        echo 'ok'
}

stop ()
{
        echo -n 'Stopping MikroBILL Server: '
        kill $(cat $wine_pidfile)
        rm -f $wine_pidfile
        sleep 5
        echo 'ok'
        echo -n 'Stopping MikroBILL 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

# -----------------------------------------------------------------------
Installing an executable file.
# sudo chmod +x /etc/init.d/mikrobill
Enable the service:
# sudo /usr/lib/insserv/insserv mikrobill

CentOS 5

Create the file /etc/init.d/mikrobill
# sudo nano /etc/init.d/mikrobill
Paste this bash code
#!/bin/bash

# chkconfig: - 50 20
# description: MikroBILL Server

# processname: MikroBILL

action=${1}

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

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

export DISPLAY=$virtual_display
export WINEPREFIX=$mikrobill_path
export WINEARCH=win32
export WINEDEBUG=-all

start ()
{
	echo -n 'Starting MikroBILL virtual display:'
	Xvfb $virtual_display -screen 0 1152x720x16 &> /dev/null &
	echo $! > $xvfb_pidfile
	success
	echo
	echo -n 'Starting MikroBILL Server:'
	sleep 5
	wine 'c:\mikrobill\MikroBILL.exe' /SERVER &> /dev/null &
	echo $! > $wine_pidfile
	success
	touch /var/lock/subsys/mikrobill
	echo
}

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

case "$action" in
	start)
		start
	;;

	stop)
		stop
	;;

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

# -----------------------------------------------------------------------
Installing an executable file.
# sudo chmod +x /etc/init.d/mikrobill
Enable the service:
# sudo chkconfig --add mikrobill
# sudo chkconfig mikrobill on


  • Next step 5 (First start MikroBILL Server)

Debian 6/CentOS 5

Start MikroBILL Server.

# sudo service mikrobill start

or

# sudo /etc/init.d/mikrobill start

Check if the server is working stably.

# ps fax
c:\mikrobill\MikroBILL.exe /SERVER
/usr/bin/wineserver
C:\windows\system32\services.exe
C:\windows\system32\winedevice.exe MountMgr
C:\windows\system32\plugplay.exe
C:\windows\system32\explorer.exe /desktop
  • Next step 6 (Stop MikroBILL Server)

Debian 6/CentOS 5

Stop MikroBILL Server finish the installation process.

# sudo service mikrobill stop

or

# sudo /etc/init.d/mikrobill stop
  • Next step 7 (Final start MikroBILL Server)
Let's make the final launch MikroBILL Server.

Debian 6/CentOS 5

Start MikroBILL Server.
# sudo service mikrobill start

or

# sudo /etc/init.d/mikrobill start
NB!
Now you can join the MikroBILL server using MikroREMOTE.exe
After the computer restarts, the MikroBILL service will start automatically.
Next, you can configure the web server and using other database servers or webhosting.
Сделал дело - выпей винишка.
Без труда не попьешь винишка с утра.
7 раз отмерь, один раз выпей винишка.
Будет день - будет винишко.
В семье не без винишка.

С автором статьи можно связаться через WhatsApp или Telegram (+372 56 942-223)