Open account
Open accountLog In
Open account

How to Install MT4 on Linux (Ubuntu)

How to Install MT4 on Linux (Ubuntu)

This article will guide you through getting started with MetaTrader 4 on Linux, from downloading to installing. Your trading journey begins now!

What is MetaTrader 4?

MetaTrader 4 (MT4) is a trading platform widely used in Forex and CFDs. On Linux, it is not supported natively, but you can run it via a compatibility tool like Wine.

This guide walks you through everything you need to know to install and run MT4 on Linux — either on your desktop, or a virtual private server (VPS).

Prerequisites: prepare your system for Wine

Before installing Wine, make sure your system is ready. MetaTrader 4 is a 32-bit application, so you must enable 32-bit support and configure the official WineHQ repository.

Check your Ubuntu versionThese instructions work for Ubuntu 20.04 LTS, 22.04 LTS, and later. Run:

lsb_release -a

Which Linux distro works best?

Most modern Linux distributions can run MT4 with Wine, but some are more beginner-friendly:

  • Ubuntu (20.04 LTS, 22.04 LTS, newer) and Linux Mint are the most widely supported and recommended for stability.

  • On older hardware, lightweight options like MX Linux or Lubuntu offer smoother performance.

  • On servers, Ubuntu LTS is preferred for long-term support and easy package management.

Tip: The lighter the desktop environment, the faster MT4 will run. If your PC is weak, avoid heavy desktops like full GNOME with many extensions.

Enable 32-bit architecture

  • sudo dpkg --add-architecture i386

Download and add WineHQ keyring (modern method, apt-key is deprecated):

Add the WineHQ repository (replace $(lsb_release -cs) with your Ubuntu codename, e.g., jammy for 22.04):

  • sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/$(lsb_release-cs)/winehq-$(lsb_release -cs).sources

Update package lists

  • sudo apt update

Now your system is ready to instal Wine.

How to download and install MT4 on Linux Desktop

Step 1: Install a compatibility tool

A compatibility tool allows you to run MT4 on Linux. We recommend Wine, so you can trade from a lightweight, open-source system (often faster and more stable than Windows on older machines).

1. Open a terminal window and type the following command to install the latest version of Wine Stable:

sudo apt-get install wine-stable

2. To install a version for developers, type in:

sudo apt-get install wine-development

3. Confirm Wine is installed:

wine --version

You should see wine-6.0 or newer. Compare with the current stable release listed on WineHQ.org.

Step 1.1: Configure a 32-bit Wine prefix

MT4 is a 32-bit program, so you need to run it inside a 32-bit Wine environment. Open a terminal and run:WINEARCH=win32 WINEPREFIX=~/.wine32 winecfg

This creates a dedicated 32-bit prefix at ~/.wine32 and launches the Wine configuration panel.When prompted, allow Wine to install Mono (for .NET support) and Gecko (for rendering).

Step 1.2: Set Windows version and drives

  • In the winecfg window, under the Applications tab, make sure the Windows version is set to Windows 7 (default works fine).

  • Under the Drives tab, click Autodetect so Wine maps your Linux directories as Windows drives.

Step 1.3: Use the correct installation folder

Since MT4 is 32-bit, it should install under Program Files (x86) inside your Wine prefix. If the installer tries to use plain Program Files, change it to Program Files (x86).

Step 2: Download MetaTrader from FBS

Download the Windows MT4 setup file (mt4setup.exe) from the FBS trading platforms page. Make sure it says MT4, not MT5, in the filename.

Step 3: Install MetaTrader using Wine

You’ve downloaded the setup file, now it’s time to run it. There are two options:

  1. Open it with Wine Windows Program Loader, follow the installation steps in the Windows-style setup window and run terminal.exe.

  2. Copy the folder containing the terminal’s previously installed files from a Windows system. Once copied, simply launch the terminal’s executable file, terminal.exe — it will automatically open using Wine.

If you can’t install MT4 on Linux using the methods we’ve described, try a web version of MT4 or a mobile version. To learn how to trade from your mobile device, read the FBS article Three Steps to Start Trading on Your Mobile Device.

Once you register with FBS, create a trading account and log in (if you haven’t already).

Alternative method: install MT4 with PlayOnLinux or Bottles

If you prefer a graphical interface instead of running Wine from the terminal, you can use compatibility tools like PlayOnLinux or Bottles. These tools manage Wine prefixes for you and make it easier to isolate MT4 from other applications.

Using PlayOnLinux:

  1. Install PlayOnLinuxsudo apt install playonlinux

  2. Launch PlayOnLinux and click Install a program.

  3. Create a new 32-bit virtual drive (prefix).

  4. Select Install a non-listed program → browse for the MT4 installer (.exe).

  5. Follow the wizard to complete the installation. PlayOnLinux will create shortcuts for launching MT4 directly from its menu.

Using Bottles (an alternative modern tool)

  1. Install Bottles from your package manager or Flathub.

  2. Create a new 32-bit environment (Gaming or Application preset works).

  3. Add the MT4 installer and run it inside Bottles.

  4. Once installed, you can launch MT4 from Bottles with proper isolation and Wine settings automatically handled.

Using Lutris (gaming-focused, optional)Although Lutris is designed for games, it can also manage Wine prefixes. Advanced users can add MT4 as a custom executable inside Lutris to benefit from Wine version management and environment isolation.

These GUI tools are optional, but they simplify Wine configuration (prefix management, DLLs, libraries). If you’re new to Wine or prefer a cleaner setup, PlayOnLinux or Bottles can be more reliable than manual terminal configuration.

Where MT4 files are stored in Wine

Once MetaTrader 4 is installed under Wine, it creates a virtual Windows directory where all platform files live. Knowing this location is important if you want to add Expert Advisors (EAs), custom indicators, scripts, or save chart templates.

Default Data Folder path (with 32-bit Wine prefix):

~/.wine32/drive_c/Program Files (x86)/MetaTrader 4/

Inside this folder, you’ll find the standard MT4 subdirectories:

  • MQL4/Experts — place Expert Advisors (automated trading robots) here.

  • MQL4/Indicators — place custom technical indicators here.

  • MQL4/Scripts — store scripts for quick one-time actions.

  • profiles/templates — save or load your chart templates and layouts.

To quickly open the Data Folder from MT4 itself: in the platform menu, go to File — Open Data Folder. This will take you to the exact Wine path used for your installation.

Note: If you created a custom Wine prefix or used PlayOnLinux/Bottles, the path will differ (check the prefix location you configured).

Install MT4 on a Linux VPS

Many traders prefer to run MetaTrader 4 on a Virtual Private Server (VPS) for better uptime, lower latency, and 24/7 reliability. The process on a Linux VPS is similar to a desktop, but you’ll access it through SSH tools like PuTTY.

Step 1: Connect to your VPS

  • From Windows: download and install PuTTY.

  • From Linux/Mac: open your terminal.

  • Run: ssh user@your-vps-ip

(replace user and your-vps-ip with your VPS login details).

Step 2: Install Wine on the VPS

  • Once logged in, update packages and install Wine just as you would on your desktop:

sudo dpkg --add-architecture i386

sudo apt update

sudo apt install --install-recommends winehq-stable

  • Confirm Wine is working:

wine --version

Step 3: Configure Wine

  • Create a 32-bit prefix and run winecfg:

WINEARCH=win32 WINEPREFIX=~/.wine32 winecfg

Allow Mono and Gecko to install, set Windows version to Windows 7, and autodetect drives.

Step 4: Install or copy MT4

You have two options:

  • Run the installer directly on the VPS

    • Upload mt4setup.exe to your VPS via scp or your hosting control panel.

    • Launch it: wine mt4setup.exe

  • Copy an existing MT4 installation

    • Copy the MetaTrader 4 folder (from your PC) into your VPS Wine prefix: ~/.wine32/drive_c/Program Files (x86)/

    • Then run terminal.exe inside the folder:

wine terminal.exe

Step 5: Optimize VPS performance

  • Disable unnecessary VPS services to save resources.

  • Keep your MT4 terminal minimized to reduce CPU usage.

  • Regularly back up your MQL4 and profiles folders.

With MT4 on a Linux VPS, your Expert Advisors and trades can run around the clock, even if your home computer is offline.

First-run checklist: connect and place your first trade

After launching MT4 on Linux for the first time, take a few quick steps to make sure everything is working properly:

  1. Log in to your account

    • In MT4, go to File — Login to Trade Account.

    • Select an FBS server from the list, enter the login (account number) and password.

  2. Check the connection

    • Look at the bottom-right corner of the platform. A green/red connection bar with ping times means you’re connected.

  3. Open a chart

    • From the Market Watch panel, right-click on a symbol (e.g., EUR/USD) and choose Chart Window.

    • Apply any template or indicators you prefer.

  4. Place a test trade

    • Right-click on the chart or symbol — New Order.

    • Enter a small volume (e.g., 0.01 lots) to test execution.

    • Decide whether to Buy or Sell.

    • The order will appear in the Terminal — Trade tab.

  5. Close the trade

    • Highlight the open position in the Trade tab, right-click — Close Order.

    • This confirms your installation and connection are working correctly.

Tip: Use a demo account for the first run so you can safely test charts, orders, and server connections before trading live.

Troubleshooting common issues on Linux

Running MT4 under Wine isn’t always seamless. Here are some common problems and how to fix them:

  • Market tab not workingThe built-in Market (for indicators/EAs) may not function properly in Wine. This is a Wine limitation. As a workaround, download indicators or Expert Advisors manually from the MQL5 website and copy them into the MQL4 folder (see the Data Directory section below).

  • MT5 installs instead of MT4Some brokers’ links automatically download MT5. Double-check that you are using the correct MT4 installer (mt4setup.exe). You can always get the official MT4 installer directly from MetaQuotes.

  • Fonts look broken or unreadableIf charts or menus display strange characters, install Microsoft TrueType core fonts:sudo apt-get install ttf-mscorefonts-installer

Then restart Wine and MT4.

  • No connection to the trading serverSometimes network libraries don’t load properly in Wine. Make sure wine-gecko and wine-mono are installed, and check your firewall. If the issue persists, run MT4 in a fresh Wine prefix.

  • Crash after updateAfter an automatic platform update, MT4 may fail to start. Delete the terminal.exe cache (in the AppData/Roaming/MetaQuotes folder inside your Wine prefix) and reinstall MT4.

If issues persist, consider running MT4 in PlayOnLinux/Bottles with an isolated 32-bit prefix — this often improves stability.

How to download and install MT4 using only one command

How to download and install MT4 using only one command

If you want to make the installation process even easier, you can use a prebuilt script that downloads and installs MT4 automatically:

  • wiget https://download.mql5.com/cdn/web/metaquotes.software.corp/mt4/mt4ubuntu.sh ; chmod +x mt4ubuntu.sh ; ./mt4ubuntu.sh

What this script does

  • Downloads the official mt4ubuntu.sh script from MetaQuotes.

  • Makes it executable with chmod +x.

  • Runs it, which:

    • Installs required Wine packages.

    • Creates a Wine prefix for MT4.

    • Downloads and runs the MT4 installer automatically.

Prerequisites

Before running the script, make sure:

  • You’ve enabled 32-bit architecture (sudo dpkg --add-architecture i386).

  • The WineHQ repository and packages are already set up (see Prerequisites section).

  • You’re running it on Ubuntu 20.04 LTS, 22.04 LTS or later.

How to roll back (remove)

If something goes wrong or you want to remove the auto-installed MT4:

  1. Delete the Wine prefix created (usually ~/.wine or ~/.wine32 if modified):

    • rm -rf ~/.wine ~/.wine32
  2. Remove installed Wine packages if needed:

    • sudo apt remove --purge winehq-stable wine-stable wine-stable-i386 wine-stable-amd64

    • sudo apt autoremove

  3. Delete the script itself:

    • rm mt4ubuntu.sh

Tip: If you want more control (custom Wine prefix, PlayOnLinux/Bottles), stick to the manual method instead of the one-command script.

Security considerations when using Wine and shell scripts

Running Windows software on Linux through Wine introduces extra security considerations. Keep these in mind before installing or trading:

  • Verify sourcesAlways download installers (Wine, MT4, shell scripts) from official websites (WineHQ, MetaQuotes, FBS). Avoid third-party mirrors or forums.

  • Be cautious with one-command scriptsShell scripts can execute anything with your user privileges. Review the script contents before running it. Do not use sudo unless absolutely required.

  • Use the principle of least privilegeRun Wine with a regular user account, not as root. Keep MT4 confined to its own Wine prefix (e.g., ~/.wine32) so it doesn’t interfere with other apps.

  • Sandbox prefixesConsider creating a dedicated Wine prefix for MT4 instead of using the default. This isolates its files and reduces risk if something goes wrong.

  • System hygieneKeep your Linux distribution, Wine, and MT4 updated. Use a firewall and avoid installing unnecessary Windows software inside Wine.

Note: Running MT4 in Wine isn’t inherently less secure than running it on Windows, but it increases the attack surface. Treat your trading environment with the same care as a production system.

Maintenance: update, uninstall, and backup

Keeping your MT4 installation clean and running well on Linux requires some regular care.

Update WineHQ packages Keep Wine up to date for bug fixes and better compatibility:

  • sudo apt update

  • sudo apt upgrade

Check the Wine version:

  • wine --version

Update MT4 MT4 usually updates itself automatically. If an update breaks the platform under Wine, you can reinstall MT4 inside the same prefix or create a fresh prefix (see below).

Remove or reset a Wine prefix If your MT4 prefix becomes unstable:

  • rm -rf ~/.wine32

Then recreate it with:

  • WINEARCH=win32 WINEPREFIX=~/.wine32 winecfg

Back up your trading profilesBefore deleting or resetting Wine, always save your MT4 data folder. This keeps your indicators, EAs, and templates safe. Default location:

  • ~/.wine32/drive_c/Program Files (x86)/MetaTrader 4/

Copy the MQL4/ and profiles/ subfolders to another directory. You can restore them later into a clean MT4 installation.

Uninstall Wine completely (if needed)

  • sudo apt purge winehq-stable wine-stable

  • sudo apt autoremove

Tip: Regularly backing up your MQL4 and template folders saves hours of setup time if something goes wrong.

Share with friends:
In this article

FBS at social media

iconhover iconiconhover iconiconhover iconiconhover icon

Contact us

iconhover iconiconhover iconiconhover iconiconhover icon
store iconstore icon
Get on the
Google Play
store iconstore icon
Get MT4 on the
App Store
store iconstore icon
Get MT5 on the
App Store

Trading

Company

About FBS

Our social impact

Legal documents

Company news

FC Leicester City

Help Center

Partnership programs