Draw.io, now known as diagrams.net, is a popular and versatile diagramming software that allows users to create flowcharts, network diagrams, UML diagrams, and more. It’s widely used for its ease of use, extensive library of shapes, and seamless integration with cloud storage services like Google Drive and OneDrive. Draw.io is an essential tool for anyone needing to create visual representations of data or workflows.
On Ubuntu 24.04, 22.04, or 20.04, you can install Draw.io using several methods via the command-line terminal. The first method involves downloading the .deb package directly from the Draw.io website and installing it manually. Alternatively, Draw.io can be installed via Snap through Snapcraft, or via Flatpak with Flathub, both of which provide containerized environments that ensure easy updates and isolation from the rest of the system. This guide will walk you through all three methods to help you choose the one that best suits your needs.
Method 1: Install Draw.io via .deb package
Update Ubuntu Before Draw.io Installation
First, ensure that your system’s existing packages are up to date. This step is crucial to prevent any conflicts that might arise during the installation of Draw.io. Run the following commands in your terminal to update your system:
sudo apt update && sudo apt upgrade
These commands will refresh your package lists and upgrade the packages to their latest versions, ensuring a clean environment for the installation.
Install Initial Required Packages for Draw.io Installation
Next, install the necessary packages wget and curl. These utilities will aid in downloading files from the internet. Execute the following command:
sudo apt install curl -y
The -y flag automatically confirms the installation, providing a smoother process.
Download Draw.io Latest .deb package
Now, proceed to download the latest Draw.io desktop package for Ubuntu. Utilize the command below:
curl -s https://api.github.com/repos/jgraph/drawio-desktop/releases/latest | grep browser_download_url | grep 'amd64\.deb' | cut -d '"' -f 4 | wget -i -
Here’s a breakdown of how this command functions:
- curl -s https://api.github.com/repos/jgraph/drawio-desktop/releases/latest: Silently fetches the latest release data from the Draw.io desktop repository.
- grep browser_download_url: Filters the output to include only lines with download URLs.
- grep ‘amd64.deb’: Narrows down the results to Debian package files specifically for the amd64 architecture.
- cut -d ‘”‘ -f 4: Extracts the download URL from the JSON response.
- wget -i -: Downloads the .deb package using the extracted URL.
Finalize Draw.io Desktop Installation via APT Command
With the .deb package now downloaded, install Draw.io on your Ubuntu system. Run the command below:
sudo apt -f install ./drawio-amd64-*.deb
The -f or –fix-broken option in this command instructs apt to resolve any broken dependencies, ensuring that all required packages are installed or repaired. This results in a stable installation and a system free of broken packages, crucial when manually installing software via .deb files.
This is particularly useful when installing software manually using .deb files, as dependencies might not be satisfied yet, and this option helps in resolving such issues.
Method 2: Install Draw.io on Ubuntu via Snapcraft (Snapd)
Install Snap Core
Begin the process by ensuring the snap core is present and up to date on your desktop. Unless you have previously removed snapd, it should be available on your system. This step is crucial for preventing any potential conflicts during the installation of Draw.io.
Execute the following command to install or update the snap core:
sudo snap install core
This command ensures that the snapd package management system is initialized correctly and ready for software installations.
Install Draw.io via Snap Command
With the snap core in place, proceed to install Draw.io. Snap packages are well-maintained and offer a straightforward installation process. Although some users might prefer Flatpak for its extensive application support, Snapcraft ensures timely updates for Draw.io, making it an equally viable option.
Run the following command to install Draw.io:
sudo snap install drawio
This command fetches the latest version of Draw.io from the Snapcraft repository and installs it on your Ubuntu system.
Method 3: Install Draw.io via Flatpak and Flathub
Before installing Draw.io via Flatpak, ensure you have Flatpak installed on your Ubuntu system. If not, refer to this comprehensive guide: How to Install Flatpak on Ubuntu. Installing Flatpak is crucial as it is not included by default in Ubuntu distributions, considering Canonical, Ubuntu’s parent company, promotes Snap, its package manager.
Enable Flathub for Draw.io Installation
To initiate the installation process of Draw.io, you must first enable Flathub, the official repository for Flatpak applications.
Run the following command in your terminal to achieve this:
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
This command ensures that your system can access and fetch applications from Flathub, setting the stage for a successful Draw.io installation.
Install Draw.io via Flatpak Command
Once you have configured Flathub, proceed to install Draw.io using Flatpak. Run the following command:
flatpak install flathub com.jgraph.drawio.desktop -y
This command instructs Flatpak to install Draw.io directly from Flathub, ensuring you receive the most current version maintained by the package maintainers. Unlike Ubuntu’s software repositories, which prioritize stability and might offer older versions of applications, Flathub provides timely updates, enhancing performance and security.
Launching Draw.io on Ubuntu via CLI Commands or GUI
CLI Commands to Launch Draw.io
.deb Installation
If you have installed Draw.io via the .deb package, enter the following command in your terminal:
drawio
Snapcraft Installation
For those who have utilized Snapcraft for installation, the application can be launched with:
sudo snap run drawio
Flatpak Installation
Users who have opted for Flatpak installation need to execute:
flatpak run com.jgraph.drawio.desktop
GUI Method to Launch Draw.io
For desktop users who prefer a graphical approach, Draw.io is accessible via the application icon. Navigate through:
Activities > Show Applications > Draw.io
Additional Commands for Draw.io
Update Draw.io
To ensure optimal performance and access to the latest features, regularly update your Draw.io installation. Although update notifications typically appear automatically, they may occasionally fail to show up. In such cases, proactively check for updates using terminal commands tailored to your specific installation method.
Draw.io Installations via .deb:
For installations done using the .deb package, you must download and reinstall the latest version to update Draw.io. This process ensures you have the most current features and security enhancements.
Snap Draw.io Update Method
Snap installations offer a straightforward update process. Execute the following command:
sudo snap refresh
This command checks for available updates and applies them, keeping your Draw.io version current.
Flatpak Draw.io Update Method
Flatpak users can update Draw.io by running the following:
flatpak update
This command ensures you receive the latest updates and improvements for Draw.io.
Remove (Uninstall) Draw.io
If you remove Draw.io from your system, use the command corresponding to your installation method.
.deb Remove Method
Execute the following command to uninstall Draw.io:
sudo apt remove drawio
This command removes the application from your system, freeing up space.
Snap Remove Method
To uninstall Draw.io installed via Snap, run:
sudo snap remove drawio
This command efficiently removes the application and its associated data.
Flatpak Remove Method
For Flatpak installations, use:
flatpak remove --delete-data com.jgraph.drawio.desktop -y
Running this command ensures the complete removal of Draw.io and its data from your system.
Conclusion
By installing Draw.io on your Ubuntu system using the .deb package, Snap, or Flatpak, you gain access to a powerful tool for creating professional diagrams with ease. Each method offers its own benefits: the .deb
package provides a straightforward installation, Snap ensures easy updates through Snapcraft, and Flatpak offers a sandboxed environment with potentially newer versions available on Flathub. Regular updates will keep your Draw.io installation current, enabling you to take full advantage of its features for your diagramming needs on Ubuntu.