特殊:Badtitle/NS100:WineServer
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/WineServer }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/af | • {{#if: UbuntuHelp:WineServer|Afrikaans| [[::WineServer/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/ar | • {{#if: UbuntuHelp:WineServer|العربية| [[::WineServer/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/az | • {{#if: UbuntuHelp:WineServer|azərbaycanca| [[::WineServer/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/bcc | • {{#if: UbuntuHelp:WineServer|جهلسری بلوچی| [[::WineServer/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/bg | • {{#if: UbuntuHelp:WineServer|български| [[::WineServer/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/br | • {{#if: UbuntuHelp:WineServer|brezhoneg| [[::WineServer/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/ca | • {{#if: UbuntuHelp:WineServer|català| [[::WineServer/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/cs | • {{#if: UbuntuHelp:WineServer|čeština| [[::WineServer/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/de | • {{#if: UbuntuHelp:WineServer|Deutsch| [[::WineServer/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/el | • {{#if: UbuntuHelp:WineServer|Ελληνικά| [[::WineServer/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/es | • {{#if: UbuntuHelp:WineServer|español| [[::WineServer/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/fa | • {{#if: UbuntuHelp:WineServer|فارسی| [[::WineServer/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/fi | • {{#if: UbuntuHelp:WineServer|suomi| [[::WineServer/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/fr | • {{#if: UbuntuHelp:WineServer|français| [[::WineServer/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/gu | • {{#if: UbuntuHelp:WineServer|ગુજરાતી| [[::WineServer/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/he | • {{#if: UbuntuHelp:WineServer|עברית| [[::WineServer/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/hu | • {{#if: UbuntuHelp:WineServer|magyar| [[::WineServer/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/id | • {{#if: UbuntuHelp:WineServer|Bahasa Indonesia| [[::WineServer/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/it | • {{#if: UbuntuHelp:WineServer|italiano| [[::WineServer/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/ja | • {{#if: UbuntuHelp:WineServer|日本語| [[::WineServer/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/ko | • {{#if: UbuntuHelp:WineServer|한국어| [[::WineServer/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/ksh | • {{#if: UbuntuHelp:WineServer|Ripoarisch| [[::WineServer/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/mr | • {{#if: UbuntuHelp:WineServer|मराठी| [[::WineServer/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/ms | • {{#if: UbuntuHelp:WineServer|Bahasa Melayu| [[::WineServer/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/nl | • {{#if: UbuntuHelp:WineServer|Nederlands| [[::WineServer/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/no | • {{#if: UbuntuHelp:WineServer|norsk| [[::WineServer/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/oc | • {{#if: UbuntuHelp:WineServer|occitan| [[::WineServer/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/pl | • {{#if: UbuntuHelp:WineServer|polski| [[::WineServer/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/pt | • {{#if: UbuntuHelp:WineServer|português| [[::WineServer/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/ro | • {{#if: UbuntuHelp:WineServer|română| [[::WineServer/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/ru | • {{#if: UbuntuHelp:WineServer|русский| [[::WineServer/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/si | • {{#if: UbuntuHelp:WineServer|සිංහල| [[::WineServer/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/sq | • {{#if: UbuntuHelp:WineServer|shqip| [[::WineServer/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/sr | • {{#if: UbuntuHelp:WineServer|српски / srpski| [[::WineServer/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/sv | • {{#if: UbuntuHelp:WineServer|svenska| [[::WineServer/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/th | • {{#if: UbuntuHelp:WineServer|ไทย| [[::WineServer/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/tr | • {{#if: UbuntuHelp:WineServer|Türkçe| [[::WineServer/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/vi | • {{#if: UbuntuHelp:WineServer|Tiếng Việt| [[::WineServer/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/yue | • {{#if: UbuntuHelp:WineServer|粵語| [[::WineServer/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/zh | • {{#if: UbuntuHelp:WineServer|中文| [[::WineServer/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/zh-hans | • {{#if: UbuntuHelp:WineServer|中文(简体)| [[::WineServer/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:WineServer | UbuntuHelp:WineServer | {{#if: | :}}WineServer}}/zh-hant | • {{#if: UbuntuHelp:WineServer|中文(繁體)| [[::WineServer/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:WineServer|:WineServer|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :WineServer/zh | | {{#ifexist: WineServer/zh | | {{#ifeq: {{#titleparts:WineServer|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:WineServer|1|-1|}} | zh | | }}
Wine allows you to run many Windows programs on Linux. Its homepage can be found at http://www.winehq.org. If you are running the latest release of Wine, you can get further assistance on the #winehq IRC channel.
Introduction
The intention of the WineServer is to run Windows services or applications on boot without a user needing to login. The need for this arose when I wanted to run a Windows service called EdAlive Network Server on a Ubuntu school server. EdAlive Network Server normally runs on a Windows server and maintains each student's score and progress for their suite of educational software.
Installing Wine
Install the gnome desktop & winbind
sudo apt-get install ubuntu-desktop winbind
I use WineHQ's Ubuntu package from http://wine.budgetdedicated.com/archive/index.html Install the WineHQ package manually.
sudo dpkg -i ./wine_1.0*
After the Ubuntu-desktop, winbind and Wine are installed reboot the server.
Installing and Configuring the application
After a reboot, login as your non-root user. Open a terminal (Applications -> Accessories -> Terminal) and run winecfg to set the drives and other settings.
winecfg
Ample documentation on this utility is available on the WineHQ site. For now just click OK to close the utility. This will allow us to use a subdirectory of your home drive to install Windows programs in (~/.wine/drive_c/). Using the terminal change directory to where you have placed the Windows application and install the program using Wine.
cd /usr/local/src wine ./EdAliveServerInstaller.exe
Install the program as per usual, for this program I selected "Install as a normal program" as opposed to as a "Windows Service" (This was an option within the Windows installer). Installing as a service has worked for other programs (eg. NCH Software's TimeChimes) , but in this particular case it didn't work.
Edit /etc/hosts so wine applications can work out the IP of the LAN interface. This seems to be a standard Wine trick...
sudo vi /etc/hosts
127.0.0.1 localhost 192.168.1.1 fileserver #127.0.1.1 fileserver.localdomain fileserver # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts
Check that the program works as intended. From the terminal:
cd ~/.wine/drive_c/Program Files/EdAlive Network Server wine ./EdAlive Network Server.exe
Or you can run it from the Applications menu under Wine. Assuming that the application works as intended we can now return our server to a text based headless server.
Starting Wine Applications on Boot
Create two new scripts in the /etc/init.d folder. The boot process will start the first script which in turn will execute the second script as the non-root user you installed the Wine application under. wine_launcher.sh
#!/bin/sh su - username -c /etc/init.d/wine.sh &
wine.sh
#!/bin/sh # Launches a new X session on display 3. X :3 -ac & # For nvidia graphics use #X :3 -ac & nvidia-settings --load-config-only # Forces the system to have a break for 2 seconds, X doesn't launch instantly sleep 2 # Launch the server. DISPLAY=:3 WINEDEBUG=-all wine "C:/Program Files/EdAlive Network Server/EdAlive Network Server.exe" & # Launch any other applications. # cd "/home/username/.wine/drive_c/Program Files/program_directory" #DISPLAY=:3 WINEDEBUG=-all wine "C:/Program Files/EdAlive Network Server/EdAlive Network Server.exe" & # To launch any applications installed as a service start any other wine application. eg notepad #DISPLAY=:3 WINEDEBUG=-all wine notepad & #Make sure you add the & to the end of the DISPLAY command to background the task so that the rest of the script continues to run.
Change the permissions to make the scripts executable.
chmod 755 /etc/init.d/wine.sh chmod 755 /etc/init.d/wine_launcher.sh
Add the link to wine_launcher.sh into /etc/rc.local to start the WineServer.
/etc/init.d/wine_launcher.sh
Edit /etc/X11/Xwrapper.config to allow anybody to start an X session.
Change allowed_users=console
To allowed_users=anybody
If you don't want the Gnome Desktop Manager to start at boot, remove the symlinks from /etc/rc2.d et.al.
Obviously is you want to keep the Gnome Desktop then omit this step - in that case you can switch back to the Gnome login by pressing ctrl+alt+F7
after the server boots.
rm /etc/rc0.d/K01gdm rm /etc/rc2.d/S13gdm rm /etc/rc4.d/S13gdm rm /etc/rc5.d/S13gdm rm /etc/rc6.d/K01gdm
Reboot! After a reboot the server will switch to the X server window (ctrl+alt+F7 or ctrl+alt+F8 is gdm is running) which runs the Wine applications - to switch back to a console use ctrl+alt+F1 -> ctrl+alt+F6.
Related Wiki Pages
Ubuntu Releases
6.06LTS Server Dapper Drake - tested