Table of Contents#
- Introduction
- Prerequisites
- Installing Wine on Ubuntu 20.04
- Configuring Wine
- Installing Windows Applications with Wine
- Uninstalling Wine (Optional)
- Troubleshooting Common Issues
- Conclusion
- References
Prerequisites#
Before starting, ensure you have:
- Ubuntu 20.04 LTS (Focal Fossa) installed (64-bit recommended).
- sudo privileges: You’ll need administrative access to install packages.
- Internet connection: To download Wine and dependencies.
Installing Wine on Ubuntu 20.04#
Wine is not included in Ubuntu’s default repositories (or is outdated there). For the latest stable version, we’ll use the official WineHQ repository. Follow these steps:
Step 1: Update System Packages#
First, update your system’s package list and upgrade existing packages to avoid conflicts:
sudo apt update && sudo apt upgrade -yThis ensures your system has the latest security patches and dependencies.
Step 2: Enable 32-bit Architecture#
Many Windows applications are 32-bit, so we need to enable 32-bit support on your 64-bit Ubuntu system. Run:
sudo dpkg --add-architecture i386If you see an error like dpkg: error: unable to process architecture i386, your system may be 32-bit (rare for modern Ubuntu). Skip this step if you’re on a 32-bit system.
Step 3: Add the WineHQ Repository#
WineHQ provides official repositories for Ubuntu. To add it:
a. Install wget (if missing)#
wget is required to download the WineHQ GPG key. Install it with:
sudo apt install -y wgetb. Import the WineHQ GPG Key#
GPG keys verify the authenticity of packages. Import WineHQ’s key:
wget -qO - https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add -If you get an error like apt-key is deprecated, use gpg instead (Ubuntu 20.04 still supports apt-key, but for future-proofing):
wget -qO - https://dl.winehq.org/wine-builds/winehq.key | gpg --dearmor | sudo tee /usr/share/keyrings/winehq-archive-keyring.gpg > /dev/nullc. Add the WineHQ Repository#
Add the repository for Ubuntu 20.04 (codename focal):
sudo add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main'If you used the gpg --dearmor method earlier, use this command instead to reference the keyring:
echo "deb [signed-by=/usr/share/keyrings/winehq-archive-keyring.gpg] https://dl.winehq.org/wine-builds/ubuntu/ focal main" | sudo tee /etc/apt/sources.list.d/winehq.list > /dev/nullStep 4: Install Wine#
Now update the package list again to include the WineHQ repository:
sudo apt updateInstall the stable version of Wine (recommended for most users). Run:
sudo apt install --install-recommends winehq-stable -y--install-recommendsensures optional dependencies (e.g., fonts, codecs) are installed, improving app compatibility.
Alternative Versions:
- For bleeding-edge features (unstable), install
winehq-devel. - For long-term support (older but stable), install
winehq-staging.
Step 5: Verify Installation#
Check if Wine installed correctly by running:
wine --versionYou should see output like:
wine-8.0.2 (or similar version)
If you get a "command not found" error, the installation failed. Check the previous steps for typos.
Configuring Wine#
After installation, configure Wine to set up the Windows environment (e.g., default Windows version, graphics, sound).
Run winecfg#
Launch the Wine configuration tool:
winecfgThis will:
- Create a hidden
.winedirectory in your home folder (~/.wine), which acts as the "C: drive" for Windows apps. - Open a GUI window with configuration options.
Key Settings in winecfg:#
- Windows Version: Choose a Windows version (e.g., Windows 10) from the dropdown. Most apps work with Windows 10.
- Graphics: Adjust screen resolution or enable "Emulate a virtual desktop" for apps that misbehave.
- Audio: Ensure your sound driver is selected (usually "PulseAudio" for Ubuntu).
- Libraries: Override specific Windows DLLs if an app requires older versions (advanced).
Click "OK" to save changes.
Installing Windows Applications with Wine#
Let’s install a sample app—Notepad++ (a popular text editor)—to test Wine.
Step 1: Download the Windows Installer#
Go to the Notepad++ website and download the 64-bit or 32-bit .exe installer (e.g., npp.8.5.4.Installer.exe).
Step 2: Run the Installer with Wine#
Navigate to your Downloads folder and run the installer:
cd ~/Downloads
wine npp.8.5.4.Installer.exeA Windows-style installer window will open. Follow the prompts (accept the license, choose install location, etc.).
Step 3: Launch the App#
Once installed, launch Notepad++ from the terminal:
wine ~/.wine/drive_c/Program\ Files/Notepad++/notepad++.exeOr, for easier access, create a desktop shortcut:
- Right-click your desktop → "Create Launcher".
- Name:
Notepad++ - Command:
wine ~/.wine/drive_c/Program\ Files/Notepad++/notepad++.exe - Icon: Download a Notepad++ icon (e.g., from Icons8) and select it.
Uninstalling Wine (Optional)#
If you no longer need Wine, remove it and its dependencies:
Step 1: Uninstall Wine#
sudo apt remove --purge winehq-stable -yReplace winehq-stable with winehq-devel or winehq-staging if you installed those versions.
Step 2: Remove Dependencies#
Clean up unused packages:
sudo apt autoremove -y && sudo apt autocleanStep 3: Delete Wine Configuration#
Remove the .wine directory (deletes all installed Windows apps):
rm -rf ~/.wineStep 4: Remove the WineHQ Repository (Optional)#
Delete the repository file:
sudo rm /etc/apt/sources.list.d/winehq.listAnd the GPG key (if you used apt-key):
sudo apt-key del F987672FTroubleshooting Common Issues#
1. "Wine: could not find Wine Gecko"#
Wine requires Gecko (a web rendering engine) for HTML support in installers. When prompted, click "Install" to download it automatically. If the prompt fails, install it manually:
sudo apt install wine-gecko -y2. "Wine: could not find Wine Mono"#
Mono is required for .NET applications. Install it:
sudo apt install wine-mono -y3. App Crashes or Doesn’t Launch#
Check the Wine AppDB for your app—users often share fixes. Common solutions:
- Use
winetricksto install missing libraries (e.g.,winetricks dotnet45for .NET 4.5). - Change the Windows version in
winecfg(try Windows 7/8 for older apps). - Run the app in a terminal to see error logs:
wine path/to/app.exe(look for "err:" messages).
4. 32-bit App Issues#
Ensure 32-bit architecture is enabled (sudo dpkg --add-architecture i386) and reinstall Wine with 32-bit support:
sudo apt install --install-recommends winehq-stable:i386 -yConclusion#
With Wine installed on Ubuntu 20.04, you can now run many Windows applications seamlessly. While not all apps work perfectly (check the AppDB for compatibility), Wine is constantly improving.
Whether you need to use Microsoft Office, Adobe Acrobat, or legacy utilities, Wine eliminates the need for a dual-boot or virtual machine. Experiment with different apps, and don’t hesitate to use winetricks or the Wine community forums for help!