Assuming you are using Firefox, you can create a simple shell script to do this. There may be a similar mechanism for other browsers, but I am not familiar with those.
Open GEdit (or any other editor) and enter the following:
#! /bin/bash
aptInstall="$@"
aptInstall=${aptInstall#*:}
gnome-terminal -e "sudo apt-get install $aptInstall"
Save this script. I will refer to it as ~/apt_terminal.sh.
- Open the terminal and run
chmod a+x ~/apt_terminal.sh. This will make the script executable.
- Now open Firefox's Preferences and go to the "Applications" section. Find the "apt" content type.
- Select "Use other" under the "Action" heading for the "apt" content type and browse to the location of the script you just created.
Now apt:// URLs should open up in the terminal by prompting you for your password.