-
Notifications
You must be signed in to change notification settings - Fork 32
installation_2.2
This installation was tested on 8 vCPU with 30 GO RAM : 67 817 blocks imported in one hour / 186 547 blocks in one day.
The operation system we choosed is Debian Jessie, you can download it here.
Some packages need to be installed in order to make blockchain2graph work. You can install them all with this command :
apt-get -y install automake build-essential module-assistant autoconf libssl-dev libboost-dev libboost-chrono-dev libboost-filesystem-dev libboost-program-options-dev libboost-system-dev libboost-test-dev libboost-thread-dev git libtool shtool autogen pkg-config vim libevent-dev wget curl locate ntp htop;apt-get update;apt-get -y upgrade
The next step is now to download Bitcoin core sources from github, build it and create a Linux daemon.
cd /root
git clone -b v0.15.1 https://github.com/bitcoin/bitcoin.git
cd /root/bitcoin
./autogen.sh
./configure --without-gui --disable-wallet
make && make install
useradd -s /usr/sbin/nologin -r -m -d /home/bitcoin bitcoind
Now, we have to create the configuration file for the bitcoind deamon. This file is named bitcoin.conf
should be created in the directory /home/bitcoin/.bitcoin
.
You can do it with the commands :
mkdir /home/bitcoin/.bitcoin
touch /home/bitcoin/.bitcoin/bitcoin.conf
Blockchain2graph needs to connect to a bitcoind node accepting REST queries and replying to getrawtransaction
queries.
This is the content of the configuration file you have to setup :
rpcuser=bitcoinrpc
rpcpassword=YOUR_BITCOIND_PASSWORD
server=1
txindex=1
rest=1
rpcallowip=AN_IP_ADRESS_TO_ALLOW
rpcallowip=ANOTHER_IP_ADRESS_TO_ALLOW
To improve performances, you can set a higher number of threads who will deal with the rpc request by adding a parameter rpcthreads=16
.
Now, you have to create a file named bitcoind
in /etc/init.d/
with the command :
touch /etc/init.d/bitcoind
Edit this file to create your daemon or copy our bitcoind service code here.
After that, you have to make it executable with the command :
chmod +x /etc/init.d/bitcoind
and finally, add it as a system init script :
update-rc.d bitcoind defaults
After restarting the server, use this command :
bitcoin-cli -datadir=/home/bitcoin/ -conf=/home/bitcoin/.bitcoin/bitcoin.conf getblockchaininfo
You should get a reply looking this :
{
"chain": "main",
"blocks": 8859,
"headers": 506482,
"bestblockhash": "000000001ba3e0220bbdd8e7e5ad80e28db57c2ccd798346aac2a0114c8207cb",
"difficulty": 1,
"mediantime": 1238140259,
"verificationprogress": 3.071215408814337e-05,
"chainwork": "0000000000000000000000000000000000000000000000000000229c229c229c",
"pruned": false,
"softforks": [
{
"id": "bip34",
"version": 2,
"reject": {
"status": false
}
},
{
"id": "bip66",
"version": 3,
"reject": {
"status": false
}
},
{
"id": "bip65",
"version": 4,
"reject": {
"status": false
}
}
],
"bip9_softforks": {
"csv": {
"status": "defined",
"startTime": 1462060800,
"timeout": 1493596800,
"since": 0
},
"segwit": {
"status": "defined",
"startTime": 1479168000,
"timeout": 1510704000,
"since": 0
}
}
}
To install Java in a proper way, you have to add the webupd8team Java PPA
repository with the command :
add-apt-repository "deb http://ppa.launchpad.net/webupd8team/java/ubuntu yakkety main"
Then, you have to import GPG key to validate packages before installing them :
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C2518248EEA14886
Now use the following command to install Java 8 on your Debian :
apt-get update;apt-get -y install oracle-java8-installer;apt-get -y install oracle-java8-set-default
At this stage you have installed oracle Java on your Debian system. Use the following command to check that the one you installed is the default one on your system :
java -version
You should see something like that appears :
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
The last step for your Java setup is to create a link to allow Tomcat8 and Neo4j deamons to find the correct Java sdk :
ln -s /usr/lib/jvm/java-8-oracle /usr/lib/jvm/default-java
To install Neo4j in a proper way, you have to add it the repository the list of sources with the following commands :
wget -O - https://debian.neo4j.org/neotechnology.gpg.key | apt-key add -
echo "deb http://debian.neo4j.org/repo stable/" | tee /etc/apt/sources.list.d/neo4j.list
Install neo4j with this command :
apt-get update;apt-get -y install neo4j=3.3.4;apt-mark hold neo4j
According to your needs, you can change the neo4 configuration ( /etc/neo4j/neo4j.conf
) :
-
dbms.directories.data
: to set where neo4j should store data. -
dbms.memory.pagecache.size
: The amount of memory to use for mapping the store files. In my case : 16g. -
dbms.memory.heap.initial_size
: heap initial size. In my case : 8g. -
dbms.memory.heap.max_size
: heap maximal size. In my case : 8g. -
dbms.connectors.default_listen_address
: uncomment and set it to0.0.0.0
to allow access to neo4j from outside. -
dbms.connector.bolt.listen_address
: uncomment and set it to0.0.0.0:7687
to allow access to neo4j from outside. -
dbms.connector.http.listen_address
: uncomment and set it to0.0.0.0:7474
to allow access to neo4j from outside. -
dbms.connector.https.listen_address
: uncomment and set it to0.0.0.0:7473
to allow access to neo4j from outside.
In the console, type service neo4j status
, you should get a reponse looking like this :
● neo4j.service - Neo4j Graph Database
Loaded: loaded (/lib/systemd/system/neo4j.service; disabled; vendor preset: enabled)
Active: active (running) since Sun 2018-01-28 20:42:21 UTC; 3min 58s ago
Main PID: 2397 (java)
To change the neo4J default password, use the command line :
curl -H "Content-Type: application/json" -X POST -d '{"password":"YOUR_NEW_PASSWORD"}' -u neo4j:neo4j http://localhost:7474/user/neo4j/password
note : wait a bit before running this command because neo4j needs some time to start.
Tomcat is included in the default Debian repositories so installing it is simple. Just type :
apt-get update;apt-get -y install tomcat8
To allow Tomcat applications to access Neo4j, we need to create a Neo4j known_hosts
file the following commands :
mkdir /usr/share/tomcat8/.neo4j
touch /usr/share/tomcat8/.neo4j/known_hosts
setfacl -R -m u:tomcat8:rwx,d:u:tomcat8:rwx /usr/share/tomcat8/.neo4j/known_hosts
Edit the default tomcat configuration file : /etc/default/tomcat8
and change JAVA_OPTS
line to JAVA_OPTS="-Djava.awt.headless=true"
Set a new configuration in the setenv.sh
file in the /usr/share/tomcat8/bin/
directory.
The content should be :
export CATALINA_OPTS="-server -Xms3000m -Xmx3000m -Dsun.net.client.defaultConnectTimeout=60000 -Dsun.net.client.defaultReadTimeout=60000 -XX:+UseG1GC"
and restart Tomcat :
service tomcat8 restart
To check if Tomcat is running, you can type : service tomcat8 status
You should get a reply looking like this :
● tomcat8.service - LSB: Start Tomcat.
Loaded: loaded (/etc/init.d/tomcat8)
Active: active (running) since mer. 2016-11-16 22:32:02 CET; 26min ago
Process: 2012 ExecStart=/etc/init.d/tomcat8 start (code=exited, status=0/SUCCESS)
You can download Blockchain2graph with the command :
cd /root
wget -O blockchain2graph.war https://github.com/straumat/blockchain2graph/releases/download/version-2.2/blockchain2graph.war
Now that we have downloaded blockchain2graph.war, we have to update the blockchain2graph configuration file.
First step, extract the default configuration from the war :
jar xvf blockchain2graph.war WEB-INF/classes/application.properties
Second step, edit it with your favorite text editor :
vim WEB-INF/classes/application.properties
And change the configuration parameters according to your needs :
-
blockchain2graph.address
: Your server IP Address (used by the console). -
blockchain2graph.port
: Your server port (used by the console). -
blockchain2graph.date.format
: Date format used to display date in the console. -
bitcoind.hostname
: Bitcoind server ip to connect to. -
bitcoind.port
: Bitcoind server port to connect to. -
bitcoind.username
: Bitcoind username to connect to. -
bitcoind.password
: Bitcoind password to connect to. -
spring.data.neo4j.uri
: Connection URI to connect to the neo4j database (example :bolt://neo4j:b2g@localhost
).
Last step, put this file back into the blockchain2graph war with the command :
jar -uf blockchain2graph.war WEB-INF/classes/application.properties
To deploy the war, you just have to copy it to the tomcat webapps directory :
mv blockchain2graph.war /var/lib/tomcat8/webapps
You can now connect to the blockchain2graph console at : http://YOUR_IP:YOUR_PORT/blockchain2graph/
.
If it's not working, check the tomcat logs by looking at the file /var/lib/tomcat8/logs/catalina.out
.