よしかわーるど

プログラミングで世界を変える

2018-05-13

サークルにknowledgeを導入しました

knowledgeを導入しました

knowledgeを導入したので、ここに殴り書き程度に記しておきます。
Java8、Tomcat、Apache、PostgreSQLというベースで構築しました。

LDAP連携できる良い共有ツールはないのか検討中です…

sudo yum -y install java-1.8.0-openjdk-devel wget httpd
firewall-cmd --permanent --zone=public --add-service=http
useradd -s /sbin/nologin tomcat
mkdir tomcat
cd tomcat
wget http://ftp.kddilabs.jp/infosystems/apache/tomcat/tomcat-9/v9.0.5/bin/apache-tomcat-9.0.5.tar.gz
tar -xzvf apache-tomcat-9.0.5.tar.gz
mv apache-tomcat-9.0.5 /usr/local/tomcat
chown -R tomcat:tomcat /usr/local/tomcat
vim /etc/systemd/system/tomcat.service
[Unit]
Description=Apache Tomcat 9
After=syslog.target network.target

[Service]
User=tomcat
Group=tomcat
Type=oneshot
PIDFile=/usr/local/tomcat/tomcat.pid
RemainAfterExit=yes

ExecStart=/usr/local/tomcat/bin/startup.sh
ExecStop=/usr/local/tomcat/bin/shutdown.sh
ExecReStart=/usr/local/tomcat/bin/shutdown.sh;/usr/local/tomcat/bin/startup.sh

[Install]
WantedBy=multi-user.target
chmod 755 /etc/systemd/system/tomcat.service
cd /usr/local/tomcat/webapps
wget https://github.com/support-project/knowledge/releases/download/v1.12.0/knowledge.war
vim /etc/httpd/conf.d/proxy-ajp.conf
<Location /knowledge>
  ProxyPass ajp://localhost:8009/knowledge
  Order allow,deny
  Allow from all
</Location>
vim /usr/local/tomcat/conf/server.xml
<!--
<Connector port="8080" protocol="HTTP/1.1"
  connectionTimeout="20000"
  redirectPort="8443" />
-->
yum -y install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm
yum -y install postgresql10 postgresql10-server
/usr/pgsql-10/bin/postgresql-10-setup initdb
systemctl enable postgresql-10
systemctl start postgresql-10
su - postgres
createuser knowuser -P -l -d;
createdb -O knowuser knowledge;
exit
vim /var/lib/pgsql/10/data/pg_hba.conf

/var/lib/pgsql/10/data/postgresql.confと/var/lib/pgsql/10/data/pg_hba.confの編集

listen '*' に変更
port 5432  コメント外す
cd /usr/share/java
wget https://jdbc.postgresql.org/download/postgresql-42.2.1.jar

/etc/profileの編集

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar:/usr/share/java/postgresql-42.2.1.jar
export CATALINA_HOME=/usr/local/tomcat

export KNOWLEDGE_HOME=/home/tomcat/.knowledge
export JAVA_OPTS="-Dfile.encoding=UTF-8 \
  -Dnet.sf.ehcache.skipUpdateCheck=true \
  -XX:+UseConcMarkSweepGC \
  -XX:+CMSClassUnloadingEnabled \
  -XX:+UseParNewGC \
  -XX:MaxPermSize=128m \
  -Xms512m -Xmx512m"
source /etc/profile
systemctl enable tomcat
systemctl start tomcat
firewall-cmd --zone=public --add-port=8080/tcp --permanent
/usr/local/tomcat/bin/shutdown.sh
/usr/local/tomcat/bin/startup.sh
firewall-cmd --reload