Skip to content

Instantly share code, notes, and snippets.

@lrhache
Last active March 6, 2018 02:17
Show Gist options
  • Save lrhache/9848712ea1075fce149a to your computer and use it in GitHub Desktop.
Save lrhache/9848712ea1075fce149a to your computer and use it in GitHub Desktop.
neo4j util script
#!/bin/sh
sudo echo "export NEO4J_HOME=/opt/neo4j" >> /etc/environment
source /etc/environment
sudo mkdir -p $NEO4J_HOME
sudo chown ubuntu.ubuntu $NEO4J_HOME
cd /tmp
# download and install neo4j
wget http://neo4j.com/artifact.php?name=neo4j-community-2.3.2-unix.tar.gz -O neo4j-2.3.2.tar.gz
tar xvf neo4j-community-2.3.2.tar.gz
mv ./neo4j-community-2.3.2/* $NEO4J_HOME
# download and install neo4j-spatial
wget https://github.com/neo4j-contrib/m2/blob/master/releases/org/neo4j/neo4j-spatial/0.15-neo4j-2.3.0/neo4j-spatial-0.15-neo4j-2.3.0-server-plugin.zip?raw=true
unzip neo4j-spatial-0.15-neo4j-2.3.0-server-plugin.zip -d $NEO4J_HOME/plugins
cp -f $NEO4J_HOME/conf/neo4j-server.properties $NEO4J_HOME/conf/neo4j-server.properties.origin
cp -f $NEO4J_HOME/conf/neo4j-server.properties $NEO4J_HOME/conf/neo4j.properties.origin
# disable security
sed -i '' -e '/auth_enabled/s/^#//g' $NEO4J_HOME/conf/neo4j-server.properties
sed -i '' 's|dbms.security.auth_enabled=true|dbms.security.auth_enabled=false|g' $NEO4J_HOME/conf/neo4j-server.properties
# enable webserver
sed -i '' -e '/webserver.address/s/^#//' $NEO4J_HOME/conf/neo4j-server.properties
# enable remote shell login
sed -i '' -e '/remote_shell/s/^#//g' $NEO4J_HOME/conf/neo4j.properties
sed -i '' 's|remote_shell_host=127.0.0.1|remote_shell_host=0.0.0.0|g' $NEO4J_HOME/conf/neo4j.properties
# open port
sudo ufw enable
sudo ufw allow 22
# open port for neo4j API
sudo ufw allow 7474
# open port for neo4j remote shell
sudo ufw allow 1337
# open port for backup (entreprise only)
#sudo ufw allow 6362
$NEO4J_HOME/bin/neo4j start
curl http://localhost:7474/db/data/
#!/bin/sh
# Change for your own version
NEO_PATH=/usr/local/Cellar/neo4j
VERSION=2.3.1
NEW_PATH="$NEO_PATH/$VERSION-test"
neo4j stop
cp -rf $NEO_PATH/$VERSION $NEW_PATH
rm -rf $NEW_PATH/bin/*
ln -s $NEW_PATH/libexec/bin/neo4j /usr/local/bin/neo4j-test
ln -s $NEW_PATH/libexec/bin/neo4j-shell /usr/local/bin/neo4j-shell-test
ln -s $NEW_PATH/libexec/bin/neo4j-import /usr/local/bin/neo4j-import-test
. /etc/profile
NEO4J_CONFIG=$NEW_PATH/libexec/conf
# disable security
sed -i '' -e '/auth_enabled/s/^#//g' $NEO4J_CONFIG/neo4j-server.properties
sed -i '' 's|dbms.security.auth_enabled=true|dbms.security.auth_enabled=false|g' $NEO4J_CONFIG/neo4j-server.properties
# change port listening
sed -i '' 's|org.neo4j.server.webserver.port=7474|org.neo4j.server.webserver.port=7476|g' $NEO4J_CONFIG/neo4j-server.properties
sed -i '' 's|org.neo4j.server.webserver.https.port=7475|org.neo4j.server.webserver.https.port=7475|g' $NEO4J_CONFIG/neo4j-server.properties
# change wrapper name
sed -i '' 's|wrapper.name=neo4j|wrapper.name=neo4j-test|g' $NEO4J_CONFIG/neo4j-wrapper.conf
echo "Restarting origin database"
neo4j start
echo "Starting new database"
neo4j-test start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment