2022年8月、ホームページを全面リニューアルしました! 情報を分かりやすくお伝えできるサイト作りを目指してまいります。

WineでWindowsアプリを動かしてみる!

以降、Wineの オフィシャルサイト の説明文の直訳、Windowsプログラムを動かすためのUnixなラッパーとしてWineを考えてください。 Wineはそれが100%の非マイクロソフトコードから成るWindows APIの完全で自由な代替の実装であるのでマイクロソフトWindowsを必要としないで、Windows用アプリを利用可能である。しかしながら、Wineは任意にネイティブのWindows DLLsを使用できます(つまり、Windowsエミュレーターではない)。 WineはWindowsソースコードをUnixに移植するための開発ツールキットとプログラム・ローダの両方を提供します。
正直、俺の私見だが、MicrosoftOfficeはWineでは動作させることが出来なかったが、例えば、UbuntuLinux+OpenOffice+Wineが有れば、OFFICE業務は完璧に近い処理を行うことが可能になってきた。OpenSourceSoftware恐るべし!

とりあえず、VineLinux4.2がインストールされているノートパソコンへWineを入れてみました。


1.セットアップ準備
Wineをセットアップする前に、色々なライブラリを入れねばならない。

# apt-get update
# apt-get install flex
# apt-get install bison
# apt-get install zlib-devel
# apt-get install gd-devel
# apt-get install libpng-devel
# apt-get install texinfo
# apt-get install freetype-devel
# apt-get install freetype2-devel
# apt-get install alsa-lib alsa-lib-devel

glibcのソースをリビルドする。RPMの定番のリビルドを行う。wineには、glibc-2.3.4が必須のようだ。
# apt-get source glibc
# rpmbuild –target i686 –rebuild glibc-2.3.4-2vl3.3.src.rpm
# rpm -ivh /usr/src/vine/RPMS/i686/glibc-2.3.4-2vl3.3.i686.rpm –force


2.ビルド
オフィシャルサイトは、 ここ なので、ここからソースをゲットする。2008年の9月時点のstableは、 wine-1.1.4.tar.bz2 のようだ。

$ tar jxvf wine-1.1.4.tar.bz2
$ cd wine-1.1.4
$ ./configure –prefix=/usr/local/wine
$ make depend
$ make
# make install


3.Windows環境設定
インストールが完了したら、でWindows環境設定。
$ /usr/local/wine/bin/winecfg


4.WineでWindowsアプリをインストールする
WineでWindowsアプリをインストールする方法。
$ wine EXEファイル名
インストーラがEXEファイルの場合

$ msiexec MSIファイル名
インストーラがMSIファイルの場合

EXEファイルの場合は、Nautilusからインストーラのファイルをダブルクリックしてインストールすることもできる。

次に、一太郎11をインストールしてみます。セットアップ画面がちゃんと出力される様子を画面に沿って紹介します。
$ cd /media/ICHITARO11/
$ /usr/local/wine/bin/wine ./setup/setup.exe

図1

図1は、一応インストーラーが立ち上がった様子。

図2

図2のコピーフォルダの設定画面が出ました。プログラムの場所等は変更しないでね。

図3

図3は、コピーする機能の選択画面、一太郎11だけにチェックを入れる。ATOK14は入れても動作しないので注意。

図4

図4は、コピーするホルダーの確認、そのままで良いでしょう。

図5

図5は、コピー開始の確認画面です。いよいよコピーが開始されます。

図6

図6は、コピー中の画面です。

図7

図7は、セットアップ完了の画面です。セットアップが終了しました。だけど、再起動はしないでセットアップ終了ボタンを押しましょう。


5.WineでWindowsアプリを実行する
例えばIEを動かしたいのなら、
$ /usr/local/wine/bin/wine ie.exe

一太郎11を動かすのであれば、
$ cd .wine/drive_c/Program\ Files/Justsystem/TARO11/
$ /usr/local/wine/bin/wine ./TARO11.EXE

図8

図8の画面は、問題なく起動した画面だ。


6.アプリケーションの登録
アプリケーションの登録(rootで作業)例えば・・・。

# cd /usr/share/applications

# cp gftp.desktop WinSCP3.desktop として、

# vi WinSCP3.desktop
[Desktop Entry]
Name=WinSCP3
Comment=SSH Client
Comment[ja]=インターネット
Exec=/usr/local/wine/bin/wine “c:\\Program Files\\WinSCP3\\WinSCP3.exe”
Icon=gnome-laptop.png
Categories=Application;GTK;GNOME;Network;FileTransfer;
Terminal=false
Type=Application
Encoding=UTF-8

あとは適当に変更して保存します。


7.ちなみにUbuntuLinuxの場合のWine

1)セットアップ
UbuntuLinuxには、Wineは、パッケージとして用意されてるので、以下を行うだけでセットアップできる。

root@stranger:~# apt-get -u install wine
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
libssl-dev zlib1g-dev libbz2-dev
Use ‘apt-get autoremove’ to remove them.
The following extra packages will be installed:
binfmt-support winbind
Suggested packages:
msttcorefonts
The following NEW packages will be installed:
binfmt-support winbind wine
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 9669kB of archives.
After this operation, 60.8MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://jp.archive.ubuntu.com hardy/universe binfmt-support 1.2.10 [21.4kB]
Get:2 http://jp.archive.ubuntu.com hardy-updates/main winbind 3.0.28a-1ubuntu4.4 [2248kB]
Get:3 http://jp.archive.ubuntu.com hardy-updates/universe wine 1.0.0-1ubuntu4~hardy1 [7401kB]
Fetched 9669kB in 14s (671kB/s)
Selecting previously deselected package binfmt-support.
(Reading database … 156623 files and directories currently installed.)
Unpacking binfmt-support (from …/binfmt-support_1.2.10_all.deb) …
Selecting previously deselected package winbind.
Unpacking winbind (from …/winbind_3.0.28a-1ubuntu4.4_i386.deb) …
Selecting previously deselected package wine.
Unpacking wine (from …/wine_1.0.0-1ubuntu4~hardy1_i386.deb) …
Setting up binfmt-support (1.2.10) …
* Enabling additional executable binary formats binfmt-support [ OK ]

Setting up winbind (3.0.28a-1ubuntu4.4) …
* Starting the Winbind daemon winbind [ OK ]

Setting up wine (1.0.0-1ubuntu4~hardy1) …

Processing triggers for libc6 …
ldconfig deferred processing now taking place

root@stranger:~# exit
logout

mity@stranger:~$ winecfg
wine: created the configuration directory ‘/home/mity/.wine’
Could not load Mozilla. HTML rendering will be disabled.
wine: configuration in ‘/home/mity/.wine’ has been updated.

2)Ubuntu WineのUTF8コードによるアプリケーション文字化け回避策

■ 以下のコマンドを実行してVLゴシックフォントのシンボリックリンクを作成する。

mity@stranger:~$ ln -s /usr/share/fonts/truetype/vlgothic/VL-PGothic-Regular.ttf ~/.wine/drive_c/windows/Fonts/

■ さらに以下を実行して「~/.wine/system.reg」をテキストエディタで開きます。

mity@stranger:~$ gedit ~/.wine/system.reg

[Software\\Microsoft\\Windows NT\\CurrentVersion\\FontSubstitutes]
の項を探しだし(10900行前後、「FontSubstitutes」で検索すればすぐに見つかる)このブロックの最下行(空白行までが1ブロック)に以下を追記する。

“Tahoma”=”VL PGothic”

追記が終わったら保存してgeditqを閉じる。

■ キーボード設定

以下を実行して「~/.wine/user.reg」をテキストエディタで開きます。

mity@stranger:~$ gedit ~/.wine/user.reg

最終行に以下を追記したら保存してgeditを閉じる。

[Software\\Wine\\X11 Driver] 1221924920
“InputStyle”=”root”

以上

コメント