After switching to Ubuntu, many of you need to run your favorite windows application. Well, for that Wine is here.
To properly install wine on Ubuntu, you have to follow the steps below.
- Add i386 architecture support.
- Add extra repository if needed.
- Update the software repository.
- Find out which wine version you need.
- Install wine Ubuntu with apt.
- Configure and apply fixes to wine, if necessary.
After installing wine, you can install and run your windows apps through it, let's get started.
Contents
Add 32 bit architecture support
Most windows apps depends on many many 32 bit linux shared libraries to run. In fact you can not run most windows apps on a 64 bit system without them.
Open up your favorite terminal emulator like gnome terminal and the type the commands listed below one by one.
sudo dpkg --add-architecture i386
The command will ask for your password, type it and hit Enter. Now you can verify if the command worked properly or not.
sudo dpkg --print-foreign-architectures
The above command should return i386
, ant that's all you need to do in this step.
Add extra Wine repository
Ubuntu's default repository doesn't have the latest wine builds, so if you need a very recent wine release, then you've to use another repository.
There's three main wine repository from WineHQ, Stable branch, Development branch and Staging branch .
You need to run the commands below one by one to add the WineHQ repository.
wget -nc https://dl.winehq.org/wine-builds/Release.key sudo apt-key add Release.key sudo apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/
Update the apt software repository
Next you need to update the repository to make the changes available, it's fairly easy.
sudo apt-get update
Here's a detailed apt tutorial, have a look for more advanced options.
Which Wine version should you use?
Lightweight windows apps runs flawlessly on any linux Wine version. But large software or games runs much better on a specific version of Wine.
So, that's a bit complicated, you've to find out the best wine version for your software. Searching the web could help you, here's the official wine apps database.
You can install and use multiple versions of wine at the same time. But be careful about dependency and conflict betwen multiple versions.
The easiest way to manage multiple wine installations is by using different WINEPREFIX
for each version. That's another big topic, I'll discus about it later.
Install wine Ubuntu with apt
You can use either Ubuntu software center or the command line to install wine, here we'll use the commands.
To install full wine use the apt command, it will install wine and all it's 32 bit dependencies.
sudo apt-get install wine1.8
However, if you need a minimal install, use the --no-install-recommends
flag with apt.
sudo apt-get --no-install-recommends install wine1.8
To install wine 2.x series from the WineHQ development branch repository, use the command below.
sudo apt-get install wine-devel
Note that wine devel branch is installed under /opt
directory and doesn't create any application menu.
Configure and apply fixes to Wine Ubuntu
You need to install some windows related libraries and frameworks to use wine properly.
So, run winecfg
or /opt/wine-devel/bin/winecfg
depending on your wine version.
You'll be asked to installed .NET framework, Wine Gecko or Mono framework. Next they'll be installed automatically from internet.
You may also need to choose proper windows version, like windows 7 in the wine configuration editor.
Extra - Uninstall Wine
If you think wine is no more useful, and want to uninstall, then it's here.
Again We'll use the apt command to uninstall wine from Ubuntu. Simply run the command below.
sudo apt-get purge wine wine-* sudo apt-get autoremove --purge
Finally remove the directory containing all run time data generated by wine.
rm -rf ~/.wine/ rm -rf ~/.local/share/applications/wine*
It should be a pretty clean uninstall, removed almost everything related to wine.
Conclusion
Now most application has their Linux alternative, so it's better to run the native linux alternative than through wine.
However for games and some application like LTspice, we have no choice, so in that case wine is necessary.
So, that's all how to install install wine in Ubuntu 16.04, 17.04, 17.10 and later versions, hope that's simple enough to understand. If you have any question or suggestion, just drop a comment.
Nathan says
Good article, you may want to update the section about the keys, as I ran into an error:
https://forum.winehq.org/viewtopic.php?f=8&t=31621
Also, I don't know if "wine1.8" is too specific, you could do:
sudo apt install --install-recommends winehq-stable
That's according to:
https://wiki.winehq.org/Ubuntu
Thanks for the article
vankata says
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
winehq-staging : Depends: wine-staging (= 4.12.1~cosmic)
E: Unable to correct problems, you have held broken packages
PLZ HELP!!
Towhid says
When I ENTER THIS"sudo apt-get install wine1.8".I get this error:"Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'wine1.6' instead of 'wine1.8'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
wine1.6 : Depends: wine-stable
E: Unable to correct problems, you have held broken packages.
"
Arnab Satapathi says
May be Wine 1.8 not available on the Ubuntu repository.
Martin says
Please help!
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
wine-devel : Depends: wine-devel-amd64 (= 3.21~cosmic) but it is not going to be installed
Depends: wine-devel-i386 (= 3.21~cosmic)
E: Unable to correct problems, you have held broken packages.
Arnab Satapathi says
Are you sure that the i386 architecture is added to your system?
Try these commands below.
sudo dpkg --add-architecture i386
sudo apt update
sudo apt-get install -f
David says
Great article, however you have one mistake in the commands. You have:
sudo apt-get install install wine-devel
and it should be:
sudo apt-get install wine-devel
Arnab Satapathi says
Yeah, a small typo, fixed.
Thanks!
Charles M. says
Thank you. Ready to make the Linux leap. Getting as much info as possible beforehand.
Great prep tutorial.
Scott says
It's always good to see wine write-ups however they always seem to stop at the installation stage which although necessary is not terribly helpful. What would be really helpful to me and I assume other new/prospective users is an in detail walk through of how to get a program to work when it does not work out-of-the-box.
Arnab Satapathi says
Agreed, I should have added a troubleshooting section.
But the problem is it will be extremely long, and different for different applications.
Lesego says
Following this installation steps I get the error below, the
/usr/bin/wine: error while loading shared libraries: libwine.so.1: cannot create shared object descriptor: Operation not permitted
I libwine.so.1 available - ldd $(which wine):
linux-gate.so.1 => (0x2aa5c000)
libwine.so.1 => /usr/bin/../lib/i386-linux-gnu/libwine.so.1 (0x2a8a1000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0x2a859000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0x2a854000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0x2a69e000)
/lib/ld-linux.so.2 (0x2aa5e000)
Please help
Thanks
Arnab Satapathi says
May be a 32bit and 64bit shared library mismatch problem.
Try to run Wine like below.
LD_LIBRARY_PATH=/lib32 wine
Emils says
Thank you
Александр says
Very good tutoriel wine ubuntu, thank you,