I installed Neo4j on Ubuntu 12.04 using these instructions: http://www.neo4j.org/download/linux
wget -O - http://debian.neo4j.org/neotechnology.gpg.key | apt
You can set the hard limits in /etc/security/limits.conf and restart the server to make it into effect.
But with current session, you can run
ulimit -n 40000