This is a Bash script to automate the installation of Mikrotik WinBox4 on Linux distributions. The script downloads the official WinBox4 binaries, sets up a symlink for easy access, creates a desktop entry, and attempts to migrate previous WinBox data if available.
- Downloads the official Mikrotik WinBox4 binaries.
- Unpacks the archive and installs it to
/opt/winbox4
. - Creates a symlink to
winbox
in/usr/local/bin
for easy terminal access. - Adds a desktop entry in
/usr/share/applications
for launching from the application manager. - Migrates previous
Addresses.cdb
data from older installations (if found). - Automatically checks the Mikrotik download page for updated versions of WinBox4.
- Avoids overwriting existing symlinks, desktop entries, and data.
- Linux distribution.
- Must be run as
root
or withsudo
privileges to modify system directories. wget
andunzip
must be installed on the system.
-
Clone the repository:
git clone https://github.com/edyatl/winbox4-install-helper.git
-
Navigate to the repository directory:
cd winbox4-install-helper
-
Make the script executable:
chmod +x winbox4_install.sh
-
Run the script as root:
sudo ./winbox4_install.sh
- Download: It downloads the official Mikrotik WinBox4 archive from the Mikrotik website.
- Install: Unpacks the downloaded archive and moves it to
/opt/winbox4
. - Symlink: Creates a symlink from
/opt/winbox4/WinBox
to/usr/local/bin/winbox
for easy command-line access. - Desktop Entry: Adds a
.desktop
entry in/usr/share/applications/winbox4.desktop
to allow launching WinBox from the application menu. - Data Migration: Attempts to find previous
Addresses.cdb
data in~/.winbox/drive_c/users/<user>/AppData/Roaming/Mikrotik/Winbox/Addresses.cdb
and copies it to the new installation at~/.local/share/MikroTik/WinBox/Addresses.cdb
. - Version Check: Automatically checks the Mikrotik download page for new versions of WinBox4 and updates the installation if a new version is found.
- Avoids Overwriting: If any symlink, desktop file, or address database already exists, the script skips these steps.
To completely uninstall WinBox4, you can use the provided uninstall script winbox4_uninstall.sh
:
-
Make the script executable:
chmod +x winbox4_uninstall.sh
-
Run the script as root:
sudo ./winbox4_uninstall.sh
- Removes the symlink: Deletes the symlink
/usr/local/bin/winbox
used to launch WinBox from the terminal. - Removes the desktop entry: Deletes the
.desktop
file at/usr/share/applications/winbox4.desktop
used to launch WinBox from the application menu. - Removes the installation directory: Deletes the WinBox4 installation folder located at
/opt/winbox4
. - Preserves user data: The script does not automatically delete your saved
Addresses.cdb
file. It will notify you if the file is found at$HOME/.local/share/MikroTik/WinBox/Addresses.cdb
, allowing you to decide if you want to remove it manually.
If you wish to remove your saved addresses and configuration data, you can manually delete the file:
rm -rf ~/.local/share/MikroTik/WinBox
After running the uninstall script and optionally removing user data, WinBox4 will be fully removed from your system.
To uninstall WinBox4 without uninstall script, you can manually remove the following:
-
Remove the symlink:
sudo rm /usr/local/bin/winbox
-
Remove the installation directory:
sudo rm -rf /opt/winbox4
-
Remove the desktop entry:
sudo rm /usr/share/applications/winbox4.desktop
To update WinBox4 to a new version, first run the uninstall script, then reinstall the latest version using the install script:
sudo ./winbox4_uninstall.sh && sudo ./winbox4_install.sh
This ensures that the previous installation is completely removed before installing the updated version. The script will automatically download the latest WinBox4 version available from Mikrotik’s official download page.
-
2024-09-30:
- Updated the command used to fetch the latest WinBox4 Linux download link from the Mikrotik website.
- Adapted the script to handle changes in the Mikrotik download page HTML structure.
- The download link extraction now reliably matches the
<a>
tag with the keyword 'Linux' without depending on surrounding text like '64-bit'.
- Updated the command used to fetch the latest WinBox4 Linux download link from the Mikrotik website.
-
2024-09-10:
- Improved handling of
$HOME
and user environment when running the script withsudo
:- The script now correctly identifies the original user invoking
sudo
using theSUDO_USER
environment variable. - Updated file paths for downloading WinBox4 and migrating
Addresses.cdb
to reflect the original user's home directory, ensuring correct ownership and avoiding root's home. - Adjusted the
xdg-user-dir
call to use the original user’s environment by running it withsudo -u $ORIGINAL_USER
. - Ensured file operations like
wget
,unzip
,mkdir
, andcp
are executed as the original user to avoid permission issues.
- The script now correctly identifies the original user invoking
- Applied similar changes to the uninstall script to handle user-specific data correctly during the uninstallation process.
- Improved handling of
-
2024-09-09:
- Added automatic checking of new WinBox4 versions from the Mikrotik download page.
- Improved script to detect and update the latest download link.
-
2024-09-07:
- Initial release with features to automate WinBox4 installation.
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please open an issue or submit a pull request if you have suggestions or improvements.