skip to Main Content

I was trying to uninstall and reinstall Cassandra on my Ubuntu system however in an attempt to cleanup I deleted file names with cassandra in it, and accidentally deleted requisite file including the /etc/apt/sources.list.d/cassandra.sources.list file. And now when I try to install Cassandra using the command sudo apt-get install cassandra, it gives the error E: Package 'cassandra' has no installation candidate. How can I fix this?

I ran sudo apt-get update and the cassandra.sources.list file seems to have come back, with content deb [arch=amd64] https://downloads.apache.org/cassandra/debian 311x main but it still gives same error on trying to install cassandra

3

Answers


  1. I was able to follow the documentation to install cassandra, the only thing that I adjusted was the curl -L flag but apart from that this can solve your problem.

    $ echo "deb http://www.apache.org/dist/cassandra/debian 40x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
    deb http://www.apache.org/dist/cassandra/debian 40x main
    
    # Make sure the `cassandra.sources.list` file has only this single line.
    
    $ sudo cat /etc/apt/sources.list.d/cassandra.sources.list
    deb http://www.apache.org/dist/cassandra/debian 40x main
    
    $ curl -L https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100   227  100   227    0     0   4283      0 --:--:-- --:--:-- --:--:--  4283
    100  267k  100  267k    0     0   296k      0 --:--:-- --:--:-- --:--:--  296k
    OK
    
    $ sudo apt-get update
    $ sudo apt-get install cassandra
    
    Login or Signup to reply.
  2. This error indicates that APT was not able to find a source for the package:

    E: Package 'cassandra' has no installation candidate
    

    The cause for the error is that you added the wrong repository in your sources:

    deb [arch=amd64] https://downloads.apache.org/cassandra/debian 311x main
    

    If you have a look at the Cassandra installation document I wrote on the Apache website, the correct repository is www.apache.org/dist/cassandra/debian.

    If you want to install Cassandra 3.11, You need to delete your source and update it with:

    $ sudo rm /etc/apt/sources.list.d/cassandra.sources.list
    $ echo "deb http://www.apache.org/dist/cassandra/debian 311x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
    

    You’ll need to follow the document above to add the repo keys and update the package index on your server. Then to install C* 3.11.11 (for example), run:

    $ sudo apt-get install cassandra=3.11.11-1
    

    You’ll need to adapt the command above to the specific version you want to install. Otherwise, APT will attempt to install the latest version. Cheers!

    Login or Signup to reply.
  3. The comment above solved my problem ^

    deb [arch=amd64] https://downloads.apache.org/cassandra/debian 311x main

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search