I want to run wine headless and avoid the error message:
Make sure that your X server is running and that $DISPLAY is set correctly.
Is there a way or do I have to route/forward it to some output? Can it just run from a command line way?
CAUTION: Please note comments below this answer. Xvfb seems to have been deprecated.
I don't know any way to run wine totally headless but I can point you to
xvfb. It can create a virtual display to which X server can redirect its output. No need to have a physical display connected. We use it to run selenium tests in browsers on a headless Jenkins cluster.
Does that meet the requirements or are you bent on running wine absolutely headless?
You can configure Wine to run headless by installing X virtual frame buffer. For instance:
sudo apt-get install xvfb
Xvfb :0 -screen 0 1024x768x16 &
# On 64-bit also run: sudo dpkg --add-architecture i386
sudo add-apt-repository -y ppa:ubuntu-wine
sudo apt-get update
sudo apt-get install wine
Note: For detailed installation example, check
Install fonts if required:
Then run your apps as:
DISPLAY=:0.0 wine my_app.exe
or you can export it (so no need for the above prefix when running):
export DISPLAY=:0.0 # Select screen 0.
DISPLAY is your request to local display/input service (or:
export DISPLAY=[user's machine]:0).
Alternatively set-up X11 Forwarding. Then you don't need to use
X11Forwarding yes in
/etc/ssh/sshd_config on the headless server and
ForwardX11 yes in
/etc/sshd/ssh_config on the machine you're connecting from.
Then you can run GUI applications on your headless server and at the same time wine will be able to connect to your local X11 server, so you could run your console-based DOS executables.