Debian install Cassandra + example db

These commands will add the repo / keys and install cassandra v2

echo -e "\ndeb http://www.apache.org/dist/cassandra/debian 20x main" >> /etc/apt/sources.list
echo -e "\ndeb-src http://www.apache.org/dist/cassandra/debian 20x main" >> /etc/apt/sources.list
gpg --keyserver pgp.mit.edu --recv-keys F758CE318D77295D
gpg --export --armor F758CE318D77295D | apt-key add -
gpg --keyserver pgp.mit.edu --recv-keys 2B5C1B00
gpg --export --armor 2B5C1B00 | apt-key add -

apt-get update
apt-get install cassandra

Set up a test db

cqlsh
CREATE KEYSPACE mykeyspace WITH replication = {'class': 'SimpleStrategy', 'replication_factor' : 1};
USE mykeyspace;
CREATE TABLE users (
  user_id int PRIMARY KEY,
  fname text,
  lname text
);
INSERT INTO users (user_id,  fname, lname)
  VALUES (1745, 'john', 'smith');
INSERT INTO users (user_id,  fname, lname)
  VALUES (1744, 'john', 'doe');
INSERT INTO users (user_id,  fname, lname)
  VALUES (1746, 'john', 'smith');

You may also want to install sun java

echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
apt-get update
apt-get install -y --force-yes oracle-java7-installer

Afterwards, don’t forget

apt-get install -y --force-yes oracle-java7-set-default

Leave a Reply

Your email address will not be published. Required fields are marked *