How to Get Started and Install Wine for Ubuntu – Adam the Automator

Suppose you use Linux as your daily driver, then your job or school prescribes a program that only runs on Windows. What a bummer. But before you think about launching a virtual machine, which would hog your computer’s resources, why not consider a better alternative: Wine for Ubuntu?

Stay tuned and learn how to install and configure Wine for Ubuntu and run Windows apps smoothly in no time!

Prerequisites

This tutorial will be a hands-on demonstration. If you want to follow it, you’ll need a computer running at least Ubuntu 18.04 and a desktop environment. This guide uses Ubuntu 20.04.

Related: Speed and Simplicity with Cinnamon Desktop Environment

Enabling Multi-Arc Support on Your Computer Ubuntu

Wine comes in 64-bit and 32-bit binaries. If you have a 64-bit compatible CPU, you must install both to ensure program compatibility for both architectures. But before you can install the required 32-bit binaries, you need to enable multi-arc support on your Ubuntu computer.

1. First, open a terminal window on your Ubuntu desktop or log in via SSH if you are remote.

Related: How to secure SSH with Fail2Ban

2. Next, run the following command to determine your computer’s CPU architecture.

Find the value of the CPU operation modes in the result. The result determines whether your computer can run only 32-bit or 64-bit and 32-bit programs. As you can see below, this computer can run both 64-bit and 32-bit programs.

If the CPU architecture is only 32-bit, skip the remaining steps in this section because they do not apply to the computer.

3. Now, enable multi-arca support on your Ubuntu computer by running the following command.

4. Finally, refresh the package cache by running the following command.

As you can see, the local packet cache now includes 32-bit (i386) packages.

Installing Wine for Ubuntu from the Ubuntu repository The fastest and most convenient way to install

Wine for Ubuntu is from the Ubuntu repository

. How? If you know how to execute the apt command, then you’re already halfway there.

The official Ubuntu repository may not always have the latest version of Wine. If you prefer to install the latest stable Wine for Ubuntu, you can skip this section.

To install Wine from the Ubuntu repository via APT, follow these steps.

Depending on the

CPU capacity, run one of the following commands to install the appropriate version of Wine for Ubuntu. This tutorial installs win64 and win32. Because you are installing with apt, the process automatically installs the additional dependencies.

Now, confirm that the installation was successful by checking the version of Wine for Ubuntu.

You will see the version number of Wine you have installed. At the time of writing, the latest stable version is Wine 5.0.3. Your version number may be different.

Installing Wine for Ubuntu from the WineHQ repository If you

don’t want to guess the Wine version and make sure you’re installing the latest one, installing from the WineHQ repository is your best bet

.

Note: If you have already installed Wine for Ubuntu before, uninstall them before performing the steps in this section.

Related:Learning Ubuntu Apt Get Examples

The official WineHQ repository is a PPA (Personal Package Archive) containing the latest stable version of

Wine.

To install Wine from the WineHQ repositories, perform these steps

.

1. First, download and add the WineHQ GPG key by running the following command. This step ensures that the packages you install come from a trusted source.

Related:Download a file with an alternate PowerShell wget command

2. Then run the following command to add the WineHQ repository to your sources.list file.

As a result, your package source list now includes URLs from the WineHQ repository.

3. Now, install Wine for Ubuntu by running the following command. This command installs the latest stable version using the winehq-stable package. The -install-recommended ensures that apt installs the recommended packages along with Wine.

If you want to test the development version instead of the stable version for some reason, the package name should be winehq-devel.

4. Finally, run the following command to check the version of Wine you installed.

At the time of writing, the latest stable version of the WineHQ repository is Wine 7.0. Your version number may be different.

Initializing the environment

Wine

can now run Windows executable programs on your Ubuntu computer after installing Wine. But to avoid unnecessary interruptions when running an application in Wine for the first time, it is advisable to initialize the Wine environment.

Simply put, initializing the Wine environment creates the ~/.wine directory where Wine stores all its configuration files. And if support packages are missing, Wine will prompt you to install them during initialization.

The ~/.wine folder is also called the WINEPREFIX folder. You can find other variations, such as Wine Prefix and Wine Bottle.

1. Log in to your Ubuntu desktop and open a new terminal window.

2. Run the following command to initialize your Wine environment. The wineboot command is Wine’s implementation of the startup and shutdown sequence of a Windows computer.

You will see a pop-up window similar to the screenshot below, showing the directory of the Wine environment.

3. When the prompt to install Wine Mono appears, click Install. Mono is a cross-platform implementation of the .NET Framework that Wine needs to run .NET applications.

Wait for the installation of Wine Mono to finish in a few seconds.

Back in the terminal, you should see a confirmation message similar to the screenshot below stating that the initial setup was successful.

4. Open your computer’s file manager and browse the ~/.wine directory. You should see objects similar to the screenshot below. This folder contains the log files and the Wine C drive as a subfolder.

Run

Windows apps with Wine

Now that you’ve installed Wine for Ubuntu, what are the Windows apps you can run with it? Just like a Windows computer that comes with ready-made programs, Wine also has built-in programs that you can run right away.

There are two ways to start a Windows program in Wine: via the command line or the file manager.

Open a Windows program from File Manager

For example, one of the programs built into Wine is Notepad.exe. To open this program, navigate to the ~/.wine/drive_c/windows/ folder. Right-click the Notepad .exe file and click Open with “Wine Windows Program Loader”.

Running

a Windows program in the terminal requires running the wine command followed by the program name. This example still uses Notepad.exe as a program to run.

In the terminal, run the following command.

Note that the terminal prompt is not available while the Windows program is open. It will only regain terminal control when you close the Windows program. Consequently, if you need to run another Windows program, you will have to open another terminal window.

An advantage of starting a Windows program with wine is that the command accepts arguments. For example, to start Notepad.exe and automatically open a text file, append the file path as an argument. The following command opens the Windows hosts file.

Installing

Windows applications in Wine

Wine does not restrict you to built-in programs only, which means that you can install other Windows applications. But not all Windows applications are compatible to run with Wine.

Visit WineHQ – Wine Application Database (AppDB) for the list of verified supported Windows applications.

To install a new application, you must download the EXE or MSI installation file and run it the same way you would run an already installed program.

Maybe you prefer Notepad++ instead of Windows Notepad. To install, follow these steps.

1. First, confirm that Notepad++ supports Wine by running a search in AppDB. As you can see below, Notepad++ appears in the results, confirming that Notepad++ is a compatible program.

2. Once you have confirmed the compatibility of the application, download the latest Notepad++ installer from this link.

3. After downloading, locate the installer in your file manager. Right-click the installer and click Open with “Wine Windows Program Loader”.

Complete the installation of Notepad++ as if you were installing it on a Windows computer.

4. Open Notepad++ by double-clicking its icon on your Ubuntu desktop or by running the following command in the terminal.

Installing additional packages

with Winetricks

Some Windows applications may require additional packages to work properly. For example, a Windows-based game may break if it cannot find a specific font on the system or if the Visual C++ 2013 libraries are not installed.

You can install these additional packages with the help of Winetricks. Winetricks is a helper script that helps download and install packages in Wine.

1. Run the following commands in your terminal to download the Winetricks script.

2. Now, invoke the winetricks script followed by the names of the packages to install. The following command installs the Visual C++ 2013 libraries (vcrun2013) and core Microsoft fonts (corefonts), including Arial, Courier, and Times New Roman.

3. Finally, run the following command to list all installed packages and confirm that major sources and VC++ 2013 are present.

Note: Running ./winetricks without parameters will open a graphical user interface instead.

Winetricks divides packages into the categories of applications, benchmarks, dlls, fonts and games. There is another category called configuration, which contains the editable configuration of Wine.

To list the available Winetricks packages (installed or not), run the following script. If you specify the configuration category, it will list the Wine configuration instead.

./winetricks <category name> list

For more information about the Winetricks script, run ./winetricks -help to view the built-in help documentation.

Wine settings for

Ubuntu app

settings

At this point, you have a fully functional Wine setup. You can start using Wine as is, and in most cases, you wouldn’t need to set up anything else. But whenever you need to make changes to Wine’s settings, the winecfg tool is your weapon.

The Wine version of the Windows operating system is Windows 7 by default. Some Windows programs may require a specific version of Windows to run. In which case, you can change the default version of Windows or set the version per application.

1. Open the Wine Setup tool by running the following command in the terminal.

2. The Wine Settings tool has six tabs for different groups of settings. In this example, click the Applications tab and you will see the Default Settings in the list, which is the global settings for the application. Don’t change the default version of Windows yet.

3. Suppose Notepad++ is more compatible with Windows 10, then you need to create an explicit configuration for that application. To do this, click Add Application, locate and select the notepad++ file.exe, and click Open.

4. Click the

new notepad++.exe setting in the list, click the Windows version drop-down box and select Windows 10. Once you have set the Windows version, click OK to save the application settings and exit the Wine Settings tool.

From this point on, notepad++.exe runs on your computer as if it were running natively on a Windows 10 PC.

Conclusion

In this tutorial, you learned how to get started with Wine for Ubuntu. You learned how to install Wine and how to launch a Windows app. You also learned how to configure Wine to get the best experience for the application you want to run.

The wine has come a long way since its inception and continues to improve with each new version. This solution is a great way to use your favorite Windows applications on Linux without dual booting your system.

If you feel like you’re cheating on Linux using Wine (in a good way), you’re not wrong. If Wine allows you to achieve what you need on Linux, use it!

Contact US