Install and setup Cassandra
1. Add the java PPA repository
sudo add-apt-repository ppa:webupd8team/java2. Update package lists
sudo apt-get update3. Install Oracle java 8
sudo apt-get install oracle-java8-installer*Note: Change the number 8 to 6 (or 7) in the code to install Java 6 (or 7).
4. Set the default java
sudo apt-get install oracle-java8-set-default5. Test your installation
java -versionIt should display something like the following if everything went well
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
6. Set java HOME
sudo miv /etc/profile.d/oraclejdk.sh
then paste the following config:
export J2SDKDIR=/usr/lib/jvm/java-8-oracle
export J2REDIR=/usr/lib/jvm/java-8-oracle/jre
export PATH=$PATH:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-
oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export DERBY_HOME=/usr/lib/jvm/java-8-oracle/db
7. Log out the system and log back in. Then run the following command:
echo $JAVA_HOME
And you should see the following line:
/usr/lib/jvm/java-8-oracle
8. Install Cassandra and dependencies
Add the Apache repository of Cassandra to /etc/apt/sources.list.d/cassandra.sources.list
echo "deb http://www.apache.org/dist/cassandra/debian 39x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.listReplace 36x with the latest version of cassandra. You can check for the latest version here
Add Apache repositories keys
curl https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -Update the repositories:
sudo apt-get updateIf you encounter the following error:
GPG error: http://www.apache.org 36x InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A278B781FE4B2BDA
Then add the public key A278B781FE4B2BDA as follows
sudo apt-key adv --keyserver pool.sks-keyservers.net --recv-key A278B781FE4B2BDA
And then repeat sudo apt-get update
Install Cassandra
sudo apt-get install cassandraEdit the script /etc/cassandra/cassandra-env.sh and search for the following line:
JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname
Uncomment the line and add your local address as the value after the =:
JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=127.0.0.1"
Also, edit the script /etc/init.d/cassandra and search for this line:
CMD_PATT="Dcassandra-pidfile=.*cassandra\.pid"
and edit it to look like this:
CMD_PATT="cassandra"
Then lets restart cassandra after making these changes
sudo /etc/init.d/cassandra restart
# login into the cassandra client interface:
cqlsh
No comments:
Post a Comment