How to install/update/remove duplicacy-web. Linux scripts (intended for newbies) :)

I’ve seen the odd newbie ask how to install :d:web on Linux. I was inspired by @Christoph 's post Automatically update duplicacy web. I don’t think i could have figured out the latest download without his code.

Please remember this is created by a noob, for noobs. It’s not intended to be some enterprise grade thing.

As always - review, make adjustments, and use at your own risk!

It downloads and installs the “latest” version of Duplicacy (i think that’s stable, right? Because it’s governed by what is on Duplicacy.com). And creates the systemd service (and prompts if you want to start/enable it). It can also do a force re-install if for some reason you want/need to.

With the help of ChatGPT, I created an installer based off his bash script. For what it’s worth, here 'tis :slight_smile:

I’ve only tested it on Linux Mint. Suggestions welcome.

use an editor of your choice and paste:

#!/bin/bash

# Function to prompt the user
prompt_install() {
    read -p "Duplicacy is not installed. Would you like to install it? (yes/no): " choice
    case "$choice" in
        y|Y|yes|Yes|YES ) install_duplicacy;;
        * ) echo "Installation aborted.";;
    esac
}

# Function to install Duplicacy
install_duplicacy() {
    echo "Identifying latest version from the website..."
    latest=$(curl -s "https://duplicacy.com/download.html" | grep -E -o "https://acrosync\.com/duplicacy-web/duplicacy_web_linux_x64_[[:digit:]]\.[[:digit:]]\.[[:digit:]]" | grep -E -o "duplicacy_web_linux_x64_[[:digit:]]\.[[:digit:]]\.[[:digit:]]")
    echo "Latest version is $latest"

    echo "Downloading latest version..."
    wget "https://acrosync.com/duplicacy-web/$latest" -P /tmp/

    if [ $? -ne 0 ]; then
        echo "Failed to download. Exiting."
        exit 1
    fi

    echo "Installing to /usr/bin/..."
    mv "/tmp/$latest" /usr/bin/
    chmod 700 "/usr/bin/$latest"
    ln -s -f "/usr/bin/$latest" /usr/bin/duplicacy-web

    echo "Creating systemd service file..."
    cat << EOF > /etc/systemd/system/duplicacy-web.service
[Unit]
Description=Duplicacy Web service
After=network.target

[Service]
Type=simple
ExecStart=/usr/bin/duplicacy-web

[Install]
WantedBy=default.target
EOF

    echo "Systemd service file created: /etc/systemd/system/duplicacy-web.service"

    read -p "Would you like to start and enable the duplicacy-web service? (yes/no): " choice
    case "$choice" in
        y|Y|yes|Yes|YES )
            echo "Starting and enabling the duplicacy-web service..."
            sudo systemctl daemon-reload
            sudo systemctl enable duplicacy-web
            sudo systemctl start duplicacy-web
            echo "Duplicacy-web service started and enabled."
            echo ""
            echo "press 'q' to exit status"
            echo ""
            systemctl status duplicacy-web
            ;;
        * )
            echo "Service was not started or enabled. You can start and enable it manually with:"
            echo "sudo systemctl daemon-reload"
            echo "sudo systemctl enable duplicacy-web"
            echo "sudo systemctl start duplicacy-web"
            ;;
    esac

    echo "Duplicacy successfully installed!"
    echo ""
    echo "WebUI running on: http://127.0.0.1:3875/"
    echo ""
    exit 0
}

# Check if Duplicacy is installed
if ! command -v duplicacy-web &> /dev/null; then
    prompt_install
else
    echo "Duplicacy is already installed."
    read -p "Would you like to force reinstall Duplicacy? (yes/no): " choice
    case "$choice" in
        y|Y|yes|Yes|YES ) install_duplicacy;;
        * ) echo "Reinstallation aborted.";;
    esac
fi

chmod +x duplicacyInstall.sh

then

sudo ./duplicacyInstall.sh

Should be good to go :slight_smile:

If you want to run it as user, instead of with sudo, change the script to put the systemd files in /home/[user]/.config/systemd/user (at least on my system that’s where they go). And also add --user to all the systemctl commands, e.g.: systemctl --user enable --now duplicacy-web.

I hope this helps the newbies :slight_smile:

And because i was experimenting so much, i whipped up a little duplicacyRemove.sh script too:

As always - review, make adjustments, and use at your own risk!

#!/bin/bash

echo "Stop and disable service..."
systemctl disable --now duplicacy-web.service
sleep 1
echo "Delete systemd file and reload systemd daemon..."
rm /etc/systemd/system/duplicacy-web.service
sudo systemctl daemon-reload
sleep 1
echo "Delete binary files..."
rm /usr/bin/duplicacy*
echo "Duplicacy successfully removed!"

And lastly - duplicacyUpdate.sh :slight_smile:

As always - review, make adjustments, and use at your own risk!

It will check the version installed, and update if a newer version is available. I might look to run this within my servers weeklystatusreport.sh which is timed to happen when backups are extremely unlikely to be happening. Or i might just set a reminder in my calendar to run it every now and then :slight_smile:

#!/bin/bash

# Identify latest version from the website
latest=$(curl -s "https://duplicacy.com/download.html" | grep -E -o "https://acrosync\.com/duplicacy-web/duplicacy_web_linux_x64_[[:digit:]]\.[[:digit:]]\.[[:digit:]]" | grep -E -o "duplicacy_web_linux_x64_[[:digit:]]\.[[:digit:]]\.[[:digit:]]")
echo "Latest version is $latest"

# Identify current installed version
current=$(ls -t /usr/bin/ | grep -m 1 -E -o "duplicacy_web_linux_x64_[[:digit:]]\.[[:digit:]]\.[[:digit:]]")
echo "Current version is $current"

# Compare versions
if [ "$current" != "$latest" ]; then
    echo "Update available"
    echo "Downloading new version..."
    
    # Download the new version
    wget "https://acrosync.com/duplicacy-web/$latest" -P /tmp/
    
    # Check if download succeeded
    if [ $? -ne 0 ]; then
        echo "Failed to download the new version. Exiting."
        exit 1
    fi
    
    # Stop the duplicacy-web service
    echo "Stopping duplicacy-web service..."
    systemctl stop duplicacy-web
    
    # Install the new version
    echo "Installing new version..."
    mv "/tmp/$latest" /usr/bin/
    chmod 700 "/usr/bin/$latest"
    
    # Update symbolic link
    ln -s -f "/usr/bin/$latest" /usr/bin/duplicacy-web
    
    # Remove old version
    if [ -n "$current" ]; then
        echo "Removing old version $current..."
        rm "/usr/bin/$current"
    fi

    # Start the duplicacy-web service
    echo "Restarting duplicacy-web service..."
    systemctl start duplicacy-web
    
    echo "Update complete!"
    echo ""
    echo "WebUI running on: http://127.0.0.1:3875/"
    echo ""
    exit 0
else
    echo "Latest version already installed."
fi

Also, per How to configure the Duplicacy Web Edition as a systemd service in Linux

If you’re using :d: web on a Linux PC with multiple users, you might want to:

sudo loginctl enable-linger <username>

To check the users were set up:

loginctl list-users or ls /var/lib/systemd/linger

Hi, thanks for this works. just a suggestion, replace “/usr/bin” with “/usr/local/bin” (/usr/local/bin contains binaries for the third-party apps install. Any local executable that didn’t come with the Linux install may get it’s place here.)

1 Like

That is a most excellent suggestion. My noobness showing through! I’ve recently created some unrelated scripts, and i have started putting them in /usr/local/bin. I will update my scripts and test them before posting an update.

Cheers! :slight_smile:

EDIT: I can’t seem to edit the original post. I tested all the scripts with the modified path of /usr/local/bin and they all worked nicely.

Thank you again for pointing it out.

Please don’t do that. It’s prone to breakage. The version is published here: https://duplicacy.com/latest_web_version.

Usage example: Bitbucket

Surprisingly, in the link, the Duplicacy Web version is 1.8.0 as on the download page. Yet 1.8.1 was published on the forum a while ago, right ?

That link I believe is updated manually by @gchen. Perhaps the 1.8.1 is not considered stable enough for general use? I’m not sure.