Re-read the docs for setup of the solr extension to apache.
Launching from the command line is a way to check/test the installation and functioning at first,, but it's only good for the life of the ssh session unless one leaves it running after exiting the ssh session with an & ... not recommended.
Apache/Moodle must be able to call solr from php scripts.
If you did get solr installed properly, did you restart the web server service and check to see that the solr mod/extension is indeed loading?
php -m |grep solr should show.
'spirit of sharing', Ken