maandag 6 oktober 2014

Installation of Cassandra on Debian Wheezy Linux

Installation of Cassandra on Debian Linux Wheezy

  • Open a terminal-session and connect as user root

  • edit the file /etc/apt/sources.list and add the following lines :
Installation of Cassandra on Debian Linux
  • connect as user root

  • edit /etc/apt/sources.list and add following lines :

deb http://www.apache.org/dist/cassandra/debian 21x main
deb-src http://www.apache.org/dist/cassandra/debian 21x main
  • Next perform the download with "apt-get update"

root@debian-vm01:/home/filip# vi /etc/apt/sources.list
root@debian-vm01:/home/filip# apt-get update
Ign cdrom://[Debian GNU/Linux 7.6.0 _Wheezy_ - Official amd64 DVD Binary-1 20140712-14:11] wheezy Release.gpg
Ign cdrom://[Debian GNU/Linux 7.6.0 _Wheezy_ - Official amd64 DVD Binary-1 20140712-14:11] wheezy Release
Ign cdrom://[Debian GNU/Linux 7.6.0 _Wheezy_ - Official amd64 DVD Binary-1 20140712-14:11] wheezy/contrib amd64 Packages/DiffIndex
Ign cdrom://[Debian GNU/Linux 7.6.0 _Wheezy_ - Official amd64 DVD Binary-1 20140712-14:11] wheezy/main amd64 Packages/DiffIndex
Ign cdrom://[Debian GNU/Linux 7.6.0 _Wheezy_ - Official amd64 DVD Binary-1 20140712-14:11] wheezy/contrib Translation-en_GB
Ign cdrom://[Debian GNU/Linux 7.6.0 _Wheezy_ - Official amd64 DVD Binary-1 20140712-14:11] wheezy/main Translation-en_GB
Hit http://security.debian.org wheezy/updates Release.gpg
Hit http://security.debian.org wheezy/updates Release
Get:1 http://www.apache.org 21x Release.gpg [819 B]
Hit http://security.debian.org wheezy/updates/main Sources
Get:2 http://www.apache.org 21x Release [2,301 B]
Ign http://www.apache.org 21x Release
Hit http://security.debian.org wheezy/updates/contrib Sources
Hit http://security.debian.org wheezy/updates/main amd64 Packages
Hit http://security.debian.org wheezy/updates/contrib amd64 Packages
Hit http://security.debian.org wheezy/updates/contrib Translation-en
Hit http://security.debian.org wheezy/updates/main Translation-en
Get:3 http://www.apache.org 21x/main Sources [631 B]
Get:4 http://www.apache.org 21x/main amd64 Packages [699 B]
Ign http://www.apache.org 21x/main Translation-en_GB
Ign http://www.apache.org 21x/main Translation-en
Fetched 4,450 B in 11s (370 B/s)
Reading package lists... Done
W: GPG error: http://www.apache.org 21x Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 749D6EEC0353B12C

The GPG-error can be solved by performing the following :

root@debian-vm01:/home/filip# gpg --keyserver pgp.mit.edu --recv-keys 749D6EEC0353B12C
gpg: directory `/root/.gnupg' created
gpg: new configuration file `/root/.gnupg/gpg.conf' created
gpg: WARNING: options in `/root/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/root/.gnupg/secring.gpg' created
gpg: keyring `/root/.gnupg/pubring.gpg' created
gpg: requesting key 0353B12C from hkp server pgp.mit.edu
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key 0353B12C: public key "T Jake Luciani <jake@apache.org>" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
root@debian-vm01:/home/filip# gpg --export --armor 749D6EEC0353B12C | sudo apt-key add -
OK

Now you can perform the apt-get update again :

root@debian-vm01:/home/filip# apt-get update 
Ign cdrom://[Debian GNU/Linux 7.6.0 _Wheezy_ - Official amd64 DVD Binary-1 20140712-14:11] wheezy Release.gpg
Ign cdrom://[Debian GNU/Linux 7.6.0 _Wheezy_ - Official amd64 DVD Binary-1 20140712-14:11] wheezy Release
Ign cdrom://[Debian GNU/Linux 7.6.0 _Wheezy_ - Official amd64 DVD Binary-1 20140712-14:11] wheezy/contrib amd64 Packages/DiffIndex
Ign cdrom://[Debian GNU/Linux 7.6.0 _Wheezy_ - Official amd64 DVD Binary-1 20140712-14:11] wheezy/main amd64 Packages/DiffIndex
Ign cdrom://[Debian GNU/Linux 7.6.0 _Wheezy_ - Official amd64 DVD Binary-1 20140712-14:11] wheezy/contrib Translation-en_GB
Ign cdrom://[Debian GNU/Linux 7.6.0 _Wheezy_ - Official amd64 DVD Binary-1 20140712-14:11] wheezy/main Translation-en_GB
Get:1 http://www.apache.org 21x Release.gpg [819 B]
Hit http://security.debian.org wheezy/updates Release.gpg
Hit http://www.apache.org 21x Release
Hit http://security.debian.org wheezy/updates Release
Hit http://security.debian.org wheezy/updates/main Sources
Hit http://www.apache.org 21x/main Sources
Hit http://security.debian.org wheezy/updates/contrib Sources
Hit http://www.apache.org 21x/main amd64 Packages
Hit http://security.debian.org wheezy/updates/main amd64 Packages
Hit http://security.debian.org wheezy/updates/contrib amd64 Packages
Hit http://security.debian.org wheezy/updates/contrib Translation-en
Hit http://security.debian.org wheezy/updates/main Translation-en
Ign http://www.apache.org 21x/main Translation-en_GB
Ign http://www.apache.org 21x/main Translation-en
Fetched 819 B in 9s (89 B/s)
Reading package lists... Done


  • Now you can install cassandra with "apt-get install cassandra"


root@debian-vm01:/home/filip# apt-get install cassandra
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libopts25 ntp openjdk-7-jre-headless
Suggested packages:
cassandra-tools ntp-doc icedtea-7-jre-jamvm sun-java6-fonts fonts-ipafont-gothic fonts-ipafont-mincho
ttf-wqy-microhei ttf-wqy-zenhei ttf-indic-fonts
The following NEW packages will be installed:
...
[ ok ] Starting NTP server: ntpd.
Setting up openjdk-7-jre-headless:amd64 (7u65-2.5.1-5~deb7u1) ...
Setting up cassandra (2.1.0-2) ...
Adding group `cassandra' (GID 124) ...
Done.
vm.max_map_count = 1048575
net.ipv4.tcp_keepalive_time = 300
Cassandra 2.0 and later require Java 7u25 or later.
invoke-rc.d: initscript cassandra, action "start" failed.
dpkg: error processing cassandra (--configure):
subprocess installed post-installation script returned error exit status 1
Processing triggers for python-support ...
Errors were encountered while processing:
cassandra
E: Sub-process /usr/bin/dpkg returned an error code (1)

So we got an error which I got because the jre is outdated....So first I have installed Java 8u5

root@debian-vm01:/home/filip# wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-x64.tar.gz
--2014-10-05 20:56:58-- http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 2.22.55.145, 2.22.55.185
Connecting to download.oracle.com (download.oracle.com)|2.22.55.145|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-x64.tar.gz [following]
--2014-10-05 20:57:06-- https://edelivery.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-x64.tar.gz
...
100%
root@debian-vm01:/home/filip# mkdir /opt/java
root@debian-vm01:/home/filip# cd /opt/java
root@debian-vm01:/opt/java# tar xvf /home/filip/jdk-8u5-linux-x64.tar.gz
root@debian-vm01:/opt/java# cd jdk1.8.0_05/
root@debian-vm01:/opt/java/jdk1.8.0_05# java -version
java version "1.6.0_32"
OpenJDK Runtime Environment (IcedTea6 1.13.4) (6b32-1.13.4-1~deb7u1)
OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)
root@debian-vm01:/opt/java/jdk1.8.0_05# cd bin
root@debian-vm01:/opt/java/jdk1.8.0_05/bin# ./java -version
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
root@debian-vm01:/opt/java/jdk1.8.0_05/bin# update-alternatives --install /usr/bin/java java /opt/java/jdk1.8.0_05/bin/java 100
root@debian-vm01:/opt/java/jdk1.8.0_05/bin# update-alternatives --install /usr/bin/java java /opt/java/jdk1.8.0_05/bin/javac 100
root@debian-vm01:/opt/java/jdk1.8.0_05/bin# update-alternatives --display java
java - auto mode
link currently points to /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java
/opt/java/jdk1.8.0_05/bin/java - priority 100
/opt/java/jdk1.8.0_05/bin/javac - priority 100
/usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java - priority 1061
slave java.1.gz: /usr/lib/jvm/java-6-openjdk-amd64/jre/man/man1/java.1.gz
/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java - priority 1051
slave java.1.gz: /usr/lib/jvm/java-7-openjdk-amd64/jre/man/man1/java.1.gz
Current 'best' version is '/usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java'.
root@debian-vm01:/opt/java/jdk1.8.0_05/bin# update-alternatives --remove java /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java
update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in auto mode
root@debian-vm01:/opt/java/jdk1.8.0_05/bin# java -version
java version "1.7.0_65"
OpenJDK Runtime Environment (IcedTea 2.5.1) (7u65-2.5.1-5~deb7u1)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)


  • Now we can startup cassandra :


root@debian-vm01:/opt/java/jdk1.8.0_05/bin# service cassandra status
[ ok ] Cassandra is not running.
root@debian-vm01:/opt/java/jdk1.8.0_05/bin# service cassandra start
root@debian-vm01:/opt/java/jdk1.8.0_05/bin# service cassandra status
[ ok ] Cassandra is running.

Next up I'll dig a bit deeper into the architecture of cassandra. Feel free to comment :-)

Geen opmerkingen:

Een reactie posten