1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

vagrantを利用してOpenClinica環境を作成する

Last updated at Posted at 2016-06-23

資料は下記の通り

インストールガイド
翻訳ファイル
OpenClinica本体
:balloon: OpenClinica 3.xxをダウンロードする
:balloon: PostgreSQLについては、boxからダウンロードする
ダウンロードしたファイルは、../shared/oc に置いてある前提で作成してあります

OpenClinicaをセットアップするVagarantFileを用意

Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :


# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|

#登録されているボックスを利用(CentOS7)
  config.vm.box = "centos7min/org"

#IPやポートフォワードの設定
config.vm.network "forwarded_port", guest: 80, host: 50517, id:"http"
config.vm.network "forwarded_port", guest: 8080, host: 50518, id:"tomcat"
config.vm.network "forwarded_port", guest: 5432, host: 52432, id:"postgres"
config.vm.network "private_network", ip: "192.168.33.19"

#共有フォルダの設定
##このsharedフォルダにインストール媒体を用意しておく
###OpenClinica本体とpostgresqlが必要
config.vm.synced_folder "../shared", "/vagrants"

##環境構築
config.vm.provision "shell", inline: <<-SHELL

yum -y install yum-plugin-priorities unzip

#日本語化
yum -y install ImageMagick ImageMagick-devel ipa-pgothic-fonts ibus-kkc vlgothic-*
localectl set-locale LANG=ja_JP.UTF-8
source /etc/locale.conf 
timedatectl set-timezone Asia/Tokyo

#gitのインストール
yum -y install git

#firewalldで8080を許可
firewall-cmd  --add-port=8080/tcp --permanent
firewall-cmd --reload

#OpenClinica準備
#インストール媒体のコピー
mkdir -p /usr/local/oc/install
cd /usr/local/oc/install
cp -rp /vagrants/oc/* ./

echo javaのインストール
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-x64.rpm
rpm -Uvh jdk-7u51-linux-x64.rpm
alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_51/jre/bin/java 1

echo tomcatのインストール
yum -y install tomcat*
systemctl enable tomcat
systemctl start tomcat
chown -R tomcat /var/cache/tomcat

echo 'OpenClinicaの配置''
cd /usr/local/oc/install
unzip OpenClinica*.zip
cd OpenClinica*/distribution
mv OpenClinica.war OpenClinica.zip
unzip OpenClinica.zip -d OpenClinica
mkdir /usr/share/tomcat/webapps/OpenClinica
cp -rf OpenClinica/* /usr/share/tomcat/webapps/OpenClinica/
echo '日本語ファイルの配置'
cd /usr/local/oc/install
mkdir i18n
cd i18n
wget https://github.com/OpenClinica/I18N_files/archive/master.zip
unzip master.zip
cp -p I18N_files-master/Japanese/* /usr/share/tomcat/webapps/OpenClinica/WEB-INF/classes/org/akaza/openclinica/i18n/
chown -R tomcat:tomcat /usr/share/tomcat/webapps/
echo '標準フォントの変更'
cd /usr/share/tomcat/webapps/OpenClinica/includes
cp -rp /usr/local/oc/install/font ./
cat /usr/local/oc/install/addcss.css >> styles.css
echo ""
alternatives --set java /usr/java/jdk1.7.0_51/jre/bin/java
java -version

echo ""

printenv
echo ""
echo "環境変数の設定"

echo export JAVA_HOME=/usr/java/default >> /etc/profile
source /etc/profile
echo export PATH=$PATH:$JAVA_HOME/bin >> /etc/profile
echo export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar >> /etc/profile
echo alias cdtom=\'cd /usr/share/tomcat\' >> /etc/profile
source /etc/profile

echo ""

echo '以下のコマンドを実行してください'
echo 'cd /usr/local/oc/install'
echo 'sudo ./postgresql-8.4.* --mode text'
echo '/opt/PostgreSQL/8.4/bin/psql -U postgres -c "CREATE ROLE clinica LOGIN ENCRYPTED PASSWORD 'clinica' SUPERUSER NOINHERIT NOCREATEDB NOCREATEROLE"'
echo '/opt/PostgreSQL/8.4/bin/psql -U postgres -c "CREATE DATABASE openclinica WITH ENCODING=\'UTF8\' OWNER=clinica"'
echo '/opt/PostgreSQL/8.4/bin/psql -U postgres'
echo 'ALTER USER clinica WITH PASSWORD \'clinica\';'
echo '\q'
echo 'sudo vi /usr/share/tomcat/webapps/OpenClinica/WEB-INF/classes/datainfo.properties'
echo 'ここも見てね https://github.com/OpenClinica/OpenClinica/wiki/Install-OpenClinica-v3.6-and-higher-on-Linux#install-postgresql-database'
echo 'systemctl stop tomcat'
echo 'systemctl start tomcat'
echo 'http://127.0.0.1:50518/OpenClinica'
echo 'uname:root pass:12345678'

SHELL


end

#仮想PCの起動

vagrant up

#Tomcatの管理画面にログインしたい場合

####以下ファイルを編集して再起動する

/usr/share/tomcat/conf/tomcat-users.xml
<role rolename="manager-gui"/>
<role rolename="admin-gui"/>
<user username="ユーザー名" password="パスワード" roles="manager-gui,admin-gui"/>
再起動
systemctl restart tomcat

##TomcatとApacheを連携させる場合

###Apacheのインストール

 yum -y install httpd httpd-devel
 systemctl enable httpd
 systemctl start httpd

###firewalldでHTTPを許可

firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --reload

###Tomcat側の設定

/usr/share/tomcat/conf/server.xml内の一部をコメントアウト
<Connector port="8080" protocol="HTTP/1.1" 
       connectionTimeout="20000" 
       redirectPort="8443" />
↓
<!--
<Connector port="8080" protocol="HTTP/1.1" 
       connectionTimeout="20000" 
       redirectPort="8443" />
-->
/usr/share/tomcat/conf/server.xml内の一部が有効か確認
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

###Apache側に設定ファイルを追加

/etc/httpd/conf.modules.d/00-proxy_ajp.conf
<Location / >
  ProxyPass ajp://localhost:8009/
</Location>

###TomcatとApacheの再起動

systemctl restart tomcat
systemctl restart httpd
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?