-3

What is the usual way of installing a different version of a program on Ubuntu?

4
  • 3
    Too broad! Which program?
    – pomsky
    Apr 13, 2018 at 21:52
  • 2
    sudo apt install package=version for example sudo apt install grub-efi-amd64=2.02~beta3-4ubuntu7.2
    – ptetteh227
    Apr 13, 2018 at 22:11
  • 2
    I agree with pomsky ... i could grab add a ppa, grab source & compile; add repo's, even install a deb (directly or via repo add) from later versions & deal with deps & issues as consequence which is none-minimal for some apps & horrific for others (though largely predictable). There is no usual way as the best approach varies case-to-case, and upon your technical level too. Your knowledge will grow as you use Ubuntu and then you'll try things, and discover the various ways (and their drawbacks) to approaches.
    – guiverc
    Apr 13, 2018 at 23:47
  • @darkangel I believe your question is different from the marked duplicated. I see how it could be interpreted as the same. Your question appears to be looking for a method to install an additional version (not changing the installed version), the other appears to be about a different version (changing the installed version). I may be wrong with your intentions. If you would add details of your issue (as asked for by @pomsky) it would be helpful, and I may vote to reopen your question accordingly. I can't edit and change your intentions. Apr 14, 2018 at 14:15

1 Answer 1

2

Some programs allow more than one version to be installed at the same time. Some examples includes php, python, java, etc.

From the Software Center or the commandline, specify the version you want to install.

To install the default version of the program (openjdk) in this case run:

$ sudo apt install openjdk

You can use apt search option to check the available version from your installed repository with this command (among other variations). I'm including the command and the output in this example:

$ apt search openjdk | egrep ^open.*jdk/

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

openjdk-6-jdk/lucid 6b18-1.8-0ubuntu1 amd64
openjdk-8-jdk/xenial-updates,xenial-security,now 8u162-b12-0ubuntu0.16.04.2 amd64 [installed]
openjdk-9-jdk/xenial,now 9~b114-0ubuntu1 amd64 [installed]
ljames@ubunzeus:~$

To install openjdk version 8, I would run this command (as an example):

$ sudo apt install openjdk-8-jdk

In short, run the install as normal and include the version of the application as part of the install command.

4
  • 1
    @N0rbert That is the output of the command. Did you test the command on your computer? The output is showing the versions of openjdk-6-jdk that is installed on my computer. I don't recall ever specifying an openjdk version 6 for install, but it has been a number of years since I performed a clean OS installation. In this case, the output may help to demonstrate how apt automatically maintains the different dependency packages when facilitating multiple version installs. Apr 14, 2018 at 14:33
  • By the way, I have never performed the (apparent) complicated commandlines of the duplicated answer. I'm sure that's because I have never had desire, or need to change to a different version. I always use the current default version unless there's need to install an additional version for a specific task. This is when both versions are in the repository being maintained without conflicting depencies that would be require addressing. Apr 14, 2018 at 14:38
  • Let us continue this discussion in chat. Apr 14, 2018 at 14:42
  • I accepted your arguments, so we can remove the comments of conversation.
    – N0rbert
    Apr 14, 2018 at 14:52

Not the answer you're looking for? Browse other questions tagged .