{"id":4159,"date":"2014-08-17T12:52:32","date_gmt":"2014-08-17T17:52:32","guid":{"rendered":"https:\/\/secure.rosehosting.com\/blog\/?p=4159"},"modified":"2022-12-15T07:06:11","modified_gmt":"2022-12-15T13:06:11","slug":"install-apache-solr-4-9-on-a-centos-7-vps","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/install-apache-solr-4-9-on-a-centos-7-vps\/","title":{"rendered":"Install Apache Solr on CentOS 7"},"content":{"rendered":"
<\/p>\n
We’ll show you, how to install Apache Solr on CentOS 7. Apache Solr is an open source enterprise search platform used to easily create search engines which searches websites, files and databases. Its major features include powerful full-text search, faceted search, distributed search, hit highlighting and index replication. Make sure your operating system is fully up to date by executing the following command:<\/p>\n Install the latest available version of Java on your server:<\/p>\n <\/p>\n Verify that Java is properly installed:<\/p>\n The next step is to download and unpack the Solr archive. At the time of writing this tutorial, the latest stable version is Solr 4.9. Once you have the package, unpack it into the directory of your choice (in this tutorial we use \u2018\/opt\u2019 for the Solr 4.9 installation). So, download and unpack Apache Solr 4.9 on your Centos 7 VPS<\/a>:<\/p>\n Create a systemd service for Solr or if you are used to the old\u00a0init scripts, you can keep using them. Create an init script for the Solr service:<\/p>\n Set the proper permission for the ‘solr’ script and make Solr automatically start on server boot:<\/p>\n You can now start Solr using the following command:<\/p>\n You should also be able to use the ‘service’ command to start,stop and restart Solr:<\/p>\n Once Solr is up and running you should be able to access it through your favorite web browser at <\/p>\n Of course you don’t have to Install Apache Solr on CentOS 7,\u00a0 if you use one of our Apache\u00a0VPS Hosting<\/a> services, in which case you can simply ask our expert Linux admins to install Apache Solr search platform for you. They are available 24×7 and will take care of your request immediately.<\/p>\n PS<\/span>.<\/strong> If you liked this post, on how to\u00a0Install Apache Solr on CentOS 7, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.<\/p>\n <\/p>\n","protected":false},"excerpt":{"rendered":" We’ll show you, how to install Apache Solr on CentOS 7. Apache Solr is an open source enterprise search platform … <\/p>\n
\nIn this tutorial we will show you how to install Apache Solr on a CentOS 7 VPS<\/a>.<\/p>\nyum update<\/pre>\n
yum list available | grep -i jdk\r\n\r\njava-1.7.0-openjdk.x86_64<\/pre>\n
java -version\r\njava version \"1.7.0_65\"\r\nOpenJDK Runtime Environment (rhel-2.5.1.2.el7_0-x86_64 u65-b17)\r\nOpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)<\/pre>\n
cd \/opt\r\nwget http:\/\/www.bizdirusa.com\/mirrors\/apache\/lucene\/solr\/4.9.0\/solr-4.9.0.tgz\r\ntar -xvf solr-4.9.0.tgz\r\nmv \/opt\/solr-4.9.0 \/opt\/solr\r\nmv \/opt\/solr\/example \/opt\/solr\/core<\/pre>\n
vi \/etc\/init.d\/solr<\/pre>\n
#!\/bin\/bash\r\n#\r\n# chkconfig: 2345 20 20\r\n# short-description: Solr\r\n# description: Startup script for Apache Solr Server\r\n\r\nSOLR_DIR=\"\/opt\/solr\/core\"\r\nLOG_FILE=\"\/var\/log\/solr.log\"\r\nJAVA=\"\/usr\/bin\/java -DSTOP.PORT=8079 -DSTOP.KEY=stopkey -jar start.jar\"\r\n\r\nstart() {\r\necho -n \"Starting Solr... \"\r\ncd $SOLR_DIR\r\n$JAVA > $LOG_FILE 2>&1 &\r\nsleep 2\r\nRETVAL=$?\r\n\r\n if [ $RETVAL = 0 ]\r\n then\r\n echo \"done.\"\r\n else\r\n echo \"failed. See error code for more information.\"\r\n fi\r\n return $RETVAL\r\n}\r\n\r\nstop() {\r\necho -n \"Stopping Solr... \"\r\npkill -f start.jar > \/dev\/null\r\nRETVAL=$?\r\n\r\n if [ $RETVAL = 0 ]\r\n then\r\n echo \"done.\"\r\n else\r\n echo \"failed. See error code for more information.\"\r\n fi\r\n return $RETVAL\r\n}\r\n\r\ncase \"$1\" in\r\nstart)\r\nstart\r\n;;\r\nstop)\r\nstop\r\n;;\r\nrestart)\r\nstop\r\nstart\r\n;;\r\n*)\r\necho $\"Usage: solr {start|stop|restart}\"\r\nexit 3\r\nesac\r\nexit $RETVAL<\/pre>\n
chmod +x \/etc\/init.d\/solr\r\n\r\nchkconfig --add solr<\/pre>\n
\/etc\/init.d\/solr start<\/pre>\n
service solr start\r\nservice solr stop\r\nservice solr restart<\/pre>\n
\nhttp:\/\/server_IP:8983\/solr\/ (just replace ‘server_IP’ with your server IP address appropriately):<\/p>\n