I am trying to install cassandra on a server that has no access to Debian, so I used the tar file, doing the following :
“unzip” to folder /etc/cassandra
Run the service cassandra
And it is working fine, but when I checked with operations they confirmed I also need to configure the service file for an auto-start if there is a reboot of the server (below an example)
[Unit] Description=Cassandra Cluster Node Daemon [Service] Type=forking user=cassandra ExecStart=/etc/cassandra/bin/cassandra ExecStopPost=/usr/bin/rm -rf /data/cassandra/saved_caches SuccessExitStatus=143 [Install] WantedBy=default.targetMy question is more if there isn´t another way to do this. can the file be created automatically?
I tried the sudo apt but kept getting errors
Hi Hugo,
As you are doing an installation on Ubuntu I would recommend doing the installation from the deb package instead of from the source code.
To install from a deb package you can run:
$ sudo dpkg -i package_file.deb
If you want to download the package you can use a system with the same architecture (you can check this with 'dpkg --print-architecture') that has internet access and follow the following steps:
$ echo "deb https://debian.cassandra.apache.org 41x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
$ curl https://downloads.apache.org/cassandra/KEYS | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get download cassanda
If you have dependencies that are not installed you can download all of the dependencies at once:
$ apt-get download $(apt-rdepends <package>|grep -v "^ ")
It is possible you encounter packages that don't have an exact name (e.g. 'E: Can't select candidate version from package debconf-2.0 as it has no candidate'). In those cases, filter out those exact names (be sure to use ^<NAME>$ so that other related names, that do exist are not skipped). For example:
$ apt-get download $(apt-rdepends cassandra|grep -v "^ " | grep -v "^debconf-2.0$" | grep -v "^java11-runtime$" | grep -v "^java8-runtime$" | grep -v "^java8-runtime-headless$")
Copy all these packages to the offline machine and then run (until you no longer have errors):
$ sudo dpkg -i *.deb
Alternatives for offline installations can be through apt-offline which allows you to install packages on an offline machine that can reach an online machine.
Note: make sure to also use the same OS version to download the deb packages
Hi Hugo,
Maybe I am missing something something but, is it required to configure a service file? If you want to make sure that the service is restarted after reboot you could use systemctl:
sudo systemctl enable cassandra.service