
Overview
This tutorial will guide you through installing Obsidian (AppImage) system-wide in /opt, making it executable, and creating .desktop files for both existing users and any future users on a Debian system.
Prerequisites
- Debian-based system
- sudo/root privileges
- Basic terminal knowledge
Step 1: Download Obsidian AppImage
First, download the latest Obsidian AppImage from the official website:
# Create temporary directory for download mkdir -p /tmp/obsidian_install cd /tmp/obsidian_install # Download Obsidian AppImage (replace URL with latest version) wget https://github.com/obsidianmd/obsidian-releases/releases/download/v1.5.8/Obsidian-1.5.8.AppImage # Alternatively, use the official download page if version changes: # wget https://obsidian.md/download -O Obsidian.AppImage
Step 2: Install Obsidian to /opt
# Create obsidian directory in /opt sudo mkdir -p /opt/obsidian # Move AppImage to /opt/obsidian sudo mv Obsidian-*.AppImage /opt/obsidian/obsidian.AppImage # Make the AppImage executable sudo chmod +x /opt/obsidian/obsidian.AppImage # Set appropriate ownership sudo chown root:root /opt/obsidian/obsidian.AppImage
Step 3: Create System-Wide Desktop File
Create a system-wide .desktop file that will be available to all users:
# Create the desktop file sudo nano /usr/share/applications/obsidian.desktop
Add the following content:
[Desktop Entry] Version=1.0 Type=Application Name=Obsidian Comment=Obsidian - A knowledge base that works on local Markdown files Exec=/opt/obsidian/obsidian.AppImage --no-sandbox Icon=obsidian Categories=Office;TextEditor; Keywords=note-taking;markdown;knowledge base; StartupWMClass=obsidian MimeType=text/markdown;text/x-markdown; Terminal=false StartupNotify=true
Save and exit (Ctrl+X, then Y, then Enter).
Step 4: Download and Install Icon
# Download Obsidian icon sudo wget -O /usr/share/icons/hicolor/256x256/apps/obsidian.png https://obsidian.md/images/obsidian-logo-gradient.svg # Alternatively, if the direct download doesn't work, create a simple icon: # sudo convert -size 256x256 xc:black -fill purple -pointsize 72 -gravity center -annotate +0+0 "O" /usr/share/icons/hicolor/256x256/apps/obsidian.png # Update icon cache sudo gtk-update-icon-cache -f -t /usr/share/icons/hicolor
Step 5: Create Helper Script for AppImage Integration (Optional but Recommended)
Some AppImages work better with additional integration. Create a wrapper script:
sudo nano /opt/obsidian/obsidian-wrapper.sh
Add this content:
#!/bin/bash # Wrapper script for Obsidian AppImage # Export necessary environment variables export DISPLAY=:0 export XDG_CURRENT_DESKTOP=GNOME # Run Obsidian with appropriate flags /opt/obsidian/obsidian.AppImage --no-sandbox "$@"
Make it executable:
sudo chmod +x /opt/obsidian/obsidian-wrapper.sh
Update the desktop file to use the wrapper:
sudo sed -i 's|Exec=/opt/obsidian/obsidian.AppImage|Exec=/opt/obsidian/obsidian-wrapper.sh|' /usr/share/applications/obsidian.desktop
Step 6: Set Up for Future Users
Create a script that will automatically set up Obsidian for new users:
sudo nano /etc/skel/.local/share/applications/obsidian.desktop
Add the same desktop entry content as before, but use the system-wide path:
[Desktop Entry] Version=1.0 Type=Application Name=Obsidian Comment=Obsidian - A knowledge base that works on local Markdown files Exec=/opt/obsidian/obsidian.AppImage --no-sandbox Icon=obsidian Categories=Office;TextEditor; Keywords=note-taking;markdown;knowledge base; StartupWMClass=obsidian MimeType=text/markdown;text/x-markdown; Terminal=false StartupNotify=true
Step 7: Update for Existing Users
For existing users, you can either:
Option A: Manual per user
Each user can create their own desktop file:
mkdir -p ~/.local/share/applications/ cp /usr/share/applications/obsidian.desktop ~/.local/share/applications/
Option B: Automated script for all existing users
# Create update script sudo nano /usr/local/bin/update-obsidian-desktop.sh
Add this content:
#!/bin/bash
# Update Obsidian desktop file for all existing users
for USER_HOME in /home/*; do
USER=$(basename "$USER_HOME")
if id "$USER" >/dev/null 2>&1; then
USER_DESKTOP="$USER_HOME/.local/share/applications/obsidian.desktop"
if [ ! -f "$USER_DESKTOP" ]; then
sudo -u "$USER" mkdir -p "$(dirname "$USER_DESKTOP")"
cp /usr/share/applications/obsidian.desktop "$USER_DESKTOP"
chown "$USER:$USER" "$USER_DESKTOP"
fi
fi
done
Make it executable:
sudo chmod +x /usr/local/bin/update-obsidian-desktop.sh
Run it to update all existing users:
sudo /usr/local/bin/update-obsidian-desktop.sh
Step 8: Verify Installation
# Test if Obsidian runs /opt/obsidian/obsidian.AppImage --version # Check desktop file validation desktop-file-validate /usr/share/applications/obsidian.desktop # Update desktop database sudo update-desktop-database /usr/share/applications/
Step 9: Create Maintenance Script
Create a script to update Obsidian when new versions are released:
sudo nano /usr/local/bin/update-obsidian
Add this content:
#!/bin/bash
# Obsidian updater script
TMP_DIR=$(mktemp -d)
cd "$TMP_DIR"
echo "Downloading latest Obsidian AppImage..."
wget https://github.com/obsidianmd/obsidian-releases/releases/latest/download/Obsidian.AppImage
if [ -f "Obsidian.AppImage" ]; then
echo "Stopping Obsidian if running..."
pkill -f obsidian.AppImage
echo "Installing new version..."
sudo mv Obsidian.AppImage /opt/obsidian/obsidian.AppImage
sudo chmod +x /opt/obsidian/obsidian.AppImage
sudo chown root:root /opt/obsidian/obsidian.AppImage
echo "Obsidian updated successfully!"
else
echo "Download failed!"
exit 1
fi
rm -rf "$TMP_DIR"
Make it executable:
sudo chmod +x /usr/local/bin/update-obsidian
Step 10: Test the Installation
- Log out and log back in (or restart your desktop environment)
- Check that Obsidian appears in your application menu
- Launch Obsidian from the menu or run: /opt/obsidian/obsidian.AppImage
- Verify it works correctly
Troubleshooting
If Obsidian doesn’t appear in the menu:
# Update desktop database update-desktop-database ~/.local/share/applications/ sudo update-desktop-database /usr/share/applications/
If AppImage won’t run:
# Check if it's executable ls -la /opt/obsidian/obsidian.AppImage # Make executable if needed sudo chmod +x /opt/obsidian/obsidian.AppImage # Try running with debug /opt/obsidian/obsidian.AppImage --help
Permission issues:
// Paste or type your code here# Reset permissions sudo chown root:root /opt/obsidian/obsidian.AppImage sudo chmod 755 /opt/obsidian/obsidian.AppImage
Uninstallation
To completely remove Obsidian:
# Remove Obsidian files sudo rm -rf /opt/obsidian # Remove desktop files sudo rm /usr/share/applications/obsidian.desktop sudo rm /etc/skel/.local/share/applications/obsidian.desktop # Remove icon sudo rm /usr/share/icons/hicolor/256x256/apps/obsidian.png # Update databases sudo update-desktop-database /usr/share/applications/ sudo gtk-update-icon-cache /usr/share/icons/hicolor/ # Remove from existing users (run as each user or use script) rm ~/.local/share/applications/obsidian.desktop
This comprehensive setup ensures Obsidian is available system-wide, automatically available to new users, and easily maintainable for future updates.
