Install Tomcat7 java 1.8 and Sorl on Centos 7

In this tutorial, I will install Tomcat 7 Java 1.8 and Sorl on Centos 7.

Install Java 1.8 and Tomcat 7

sudo yum install java-1.8.0-openjdk*
sudo yum install tomcat
sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent
sudo systemctl restart firewalld.service
sudo systemctl enable tomcat.service
sudo systemctl start tomcat

Download ant and ivy used to compile Solr as well.

yum install wget
wget -P /home/vagrant/ http://archive.apache.org/dist/lucene/solr/4.10.2/solr-4.10.2-src.tgz
wget -P /home/vagrant/ https://downloads.apache.org//ant/binaries/apache-ant-1.10.8-bin.tar.gz
wget -P /home/vagrant/ https://downloads.apache.org/ant/ivy/2.4.0/apache-ivy-2.4.0-bin.tar.gz
cd /home/vagrant/
tar zxvf solr-4.10.2-src.tgz
tar zxvf apache-ant-1.10.8-bin.tar.gz
tar zxvf apache-ivy-2.4.0-bin.tar.gz

[vagrant@Server01 ~]$ cp apache-ivy-2.4.0/ivy-2.4.0.jar apache-ant-1.10.8/lib/

Setting environment variables

export ANT_HOME=/home/vagrant/apache-ant-1.10.8
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-2.el7_8.x86_64/
export PATH=${PATH}:/${ANT_HOME}/bin/

Edit /etc/tomcat/server.xml file

<Connector port="8080" protocol="HTTP/1.1"
 connectionTimeout="20000"
 redirectPort="8443" URIEncoding="UTF-8" useBodyEncodingForURI="true" />

Compiling Solr

cd /home/vagrant/solr-4.10.2
ant clean
ant compile
cd solr
ant dist

logging settings

cp solr-4.10.2/solr/example/lib/ext/* /usr/share/tomcat/lib
cp solr-4.10.2/solr/example/resources/log4j.properties /usr/share/tomcat7/lib

Arrangement of War files and various

cp solr-4.10.2/solr/dist/solr-4.10.2-SNAPSHOT.war to /var/lib/tomcat/webapps/solr.war

Create a directory for solr.home

mkdir /var/lib/solr/home
chmod -R a+w /var/lib/solr/home
vi /var/lib/solr/home/solr.xml
<?xml version="1.0" encoding="UTF-8" ?>
<solr persistent="false">
  <cores adminPath="/admin/cores">
  <core name="test" instanceDir="test" config="solrconfig.xml" schema="schema.xml"/>
  </cores>
</solr>

Modify /etc/tomcat/tomcat.conf

JAVA_OPTS="${JAVA_OPTS} -Djavax.sql.DataSource.Factory=org.apache.commons.dbcp.BasicDataSourceFactory -Dsolr.solr.home=/var/lib/solr/home"

Create a directory for core

mkdir /var/lib/solr/home/test
mkdir /var/lib/solr/home/test/conf
mkdir /var/lib/solr/home/test/data
chmod -R a+x /var/lib/solr/home/test/data
cp solr-4.10.2/solr/example/solr/collection1/conf/* /var/lib/solr/home/test/conf/

please edit as you like is.

vi /var/lib/solr/home/test/conf/solrconfig.xml
vi /var/lib/solr/home/test/conf/schema.xml
, , , , ,

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created DevopsRoles.com site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

Your email address will not be published. Required fields are marked *

Comment moderation is enabled. Your comment may take some time to appear.

This site uses Akismet to reduce spam. Learn how your comment data is processed.