2014年4月16日水曜日

Vagrant & PostgreSQL9.3で構築1

Vagrant使って、実験環境構築やってみる。

ubuntu.comにクラウド用のファイルが準備されている。


https://cloud-images.ubuntu.com/vagrant/precise/20140407/ のなかにある
precise-server-cloudimg-amd64-vagrant-disk1.box を指定。

boxファイルをリストに加える。
新しく仮想マシン設定して、立ち上げる。


$ mkdir precise64

$ cd precise64/

$ vagrant box add u12s-amd64  https://cloud-images.ubuntu.com/vagrant/precise/20140407/precise-server-cloudimg-amd64-vagrant-disk1.box

$ vagrant init u12s-amd64

A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on

`vagrantup.com` for more information on using Vagrant.

$ vagrant up

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'precise-server-amd64'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: precise64_default_1397574231693_73861
==> default: Clearing any previously set forwarded ports...
==> default: Fixed port collision for 22 => 2222. Now on port 2202.
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 => 2202 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2202
    default: SSH username: vagrant
    default: SSH auth method: private key

    default: Warning: Connection timeout. Retrying...
...

ログインして構築開始。
passなしで入れるのはなんか拍子抜けだけど楽。

$ vagrant ssh

Welcome to Ubuntu 12.04.4 LTS (GNU/Linux 3.2.0-60-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Tue Apr 15 11:47:34 UTC 2014

  System load:  0.0               Processes:           72
  Usage of /:   4.0% of 39.37GB   Users logged in:     0
  Memory usage: 15%               IP address for eth0: 10.0.2.15
  Swap usage:   0%

  Graph this data and manage this system at:
    https://landscape.canonical.com/

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud


PostgreSQL 9.3インストール



$ sudo vi /etc/apt/sources.list.d/pgdg.list


ファイルの1行目に以下を書く。

deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main



wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

$ sudo apt-get update

sudo apt-get install -y postgresql-9.3

$ sudo adduser dolphin -disabled-password

$ sudo -u postgres createuser -P --interactive --replication dolphin

$ sudo -u dolphin createdb -lC -Ttemplate0 -EUTF-8 dolphin

確認してみる

$ sudo -u dolphin psql dolphin

dolphin=# \du

dolphin=# \q

OpenJDKインストール


$ sudo apt-get -y install openjdk-7-jdk

Wildfly展開


作成メモ2と同様に作成。もしくは展開

$ tar zxvf jboss-as-7.2.0-hibernate-4.2.11-resteasy-3.0.7.tgz 

$ sudo mv jboss /usr/local/

$ sudo useradd jboss

$ sudo chown -R jboss.jboss /usr/local/jboss


hibernate 4.2.11とresteasy 3.0.7に上がってました。

管理ユーザー登録を作成メモ1同様にする。



$ sudo -i
# /usr/local/jboss/bin/add-user.sh

一度ログオフ。
# exit
$ exit

ホストからアクセスできるようにVagrantfile を編集


$ vi Vagrantfile
...
#config.vm.network "private_network", ip: "192.168.33.10"
...

コメント外して、「”」外して「:」に書き換え
config.vm.network :private_network, ip: "192.168.33.10"

$ vagrant reload

==> default: Attempting graceful shutdown of VM...
==> default: Clearing any previously set forwarded ports...
==> default: Fixed port collision for 22 => 2222. Now on port 2201.
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 => 2201 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2201
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default: 
    default: Guest Additions Version: 4.1.12
    default: VirtualBox Version: 4.3
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /vagrant => /Users/dolphin/OD-ORCA

==> default: VM already provisioned. Run `vagrant provision` or use `--provision` to force it

$ vagrant ssh

Welcome to Ubuntu 12.04.4 LTS (GNU/Linux 3.2.0-60-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Tue Apr 15 12:40:14 UTC 2014

  System load:  0.0               Processes:           77
  Usage of /:   4.7% of 39.37GB   Users logged in:     0
  Memory usage: 12%               IP address for eth0: 10.0.2.15
  Swap usage:   0%                IP address for eth1: 192.168.33.10

ホスト側から192.168.33.10でアクセスできる。

$ sudo /usr/local/jboss/bin/standalone.sh -b=192.168.33.10 -bmanagement=192.168.33.10

ホストからブラウザで入ってみる。

http://192.168.33.10:8080

2014年4月5日土曜日

ORCAインストール (OpenDolphin用)

Dr.Mのマニュアルを参考にUbuntu12.04LTS Server ORCA4.7用に改編

OpenDolphin日記も参考にさせていただいております。


仮想マシン:Ubuntu64bit用を選択 メモリ1024MB HDD8G


Ubuntuインストール

日本を選択。
キーボード日本語選択。
DHCP設定の前にESC押して固定アドレス設定。
192.168.x.100 固定アドレス
255.255.255.0 netmask
192.168.x.1 gateway
192.168.x.1 name server(s)
ディスク全体を使う
暗号化しない
パッケージでOpenSSH serverを選択する。
GRUB はい
再起動。

他端末からログイン

IPv6を無効にするために、ファイルの最後に2行追加

$ sudo vi /etc/sysctl.conf
..
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1

NTPをインストールする
$ sudo aptitude install -y ntp

NTPサーバーを設定。
$ sudo vi /etc/ntp.conf
..
server ntp.nict.jp (ネットワーク的に近いところ)

日医標準レセプトソフト (ORCA4.7)のインストール

$ sudo -i
# wget -q http://ftp.orca.med.or.jp/pub/ubuntu/archive.key 
# apt-key add archive.key
# wget -q -O /etc/apt/sources.list.d/jma-receipt-precise47.list http://ftp.orca.med.or.jp/pub/ubuntu/jma-receipt-precise47.list
# apt-get update
# apt-get dist-upgrade
# exit
$ sudo apt-get install -y jma-receipt
$ sudo dpkg-reconfigure -p critical jma-receipt
$ sudo jma-setup
$ sudo service jma-receipt start
$ sudo gluseradd -file /etc/jma-receipt/passwd -p ormaster123 ormaster


CUPSインストール、設定

$ sudo aptitude install -y cups
$ sudo vi /etc/cups/cupsd.conf
..
# Only listen for connections from the local machine.
Listen 192.168.x.100:631 (<--localhostからこのマシンのアドレスに変更)
Listen /var/run/cups/cups.sock
..
# Restrict access to the server.
..
<Location />  Order allow,deny
  Allow 192.168.x.0/24(追加)
</Location>
..
# Restrict access to the admin pages.
..
<Location /admin>  Order allow,deny
  Allow 192.168.x.0/24(追加)
</Location>
..
MaxJobs 0(追加)
$ sudo service cups restart


日本語印刷のためpoppler-dataパッケージ追加

参考:OpenDolphin日記

$ sudo aptitude install poppler-data



MFC-8870DWのLinux用ドライバをインストール


$ sudo bash ./linux-brjprinter-installer-2.0.0-1 MFC-8870DW

OpenDolphinとの連携のためにPostgreSQL設定


$ sudo vi /etc/postgresql/9.1/main/postgresql.conf
..
# - Connection Settings -
..
listen_addresses = '*' # what IP address(es) to listen on;
先頭の#とって、localhostから*に)

$ sudo vi /etc/postgresql/9.1/main/pg_hba.conf
..
# IPv4 local connections:
host all  all  127.0.0.1/32      md5
host all all 192.168.x.0/24 trust(追加)


OpenDolphinとの連携のためにORCAの設定

$ sudo dpkg-reconfigure jma-receipt
いいえ、いいえ、はい、8210のまま

$ sudo reboot

Webブラウザでhttp://192.168.x.100:631

プリンターの追加:OpenDolphin日記参照

ORCAクライアントから接続してテスト印刷してみる。

2014年4月1日火曜日

OpenDolphin server 作成メモ2

Ubuntuでの構築は

を参考にしています。
公開いただき誠にありがとうございます。

もちろん、2.3.8mおよび導入法を作成していただいたM先生の導入書も必要。(要連絡)
参考:http://www.masuda-naika.net/openDolphin.html

こちらではOpenDolphinサーバを単独で構築し、別のクライアントから設定しています。
手順に若干の差異があります。

Ubuntu 12.04 LTS Server インストール時にPostgreSQL,OpenSSHを選択しています。
参照:作成メモ1

PostgreSQLversion確認

$ psql --version
psql (PostgreSQL) 9.1.11
contains support for command-line editing

NetBeans7.4をビルド作業用マシンにインストール。
M先生の導入書に従ってOpenDolphin-2.3.8mのソース一式を持ってくる。
後は上記Ubuntu12.04.pdfのとおり、pom.xmlソース修正してビルドする。

作成メモ1でUbuntu Server に配置したJBOSS-AS-7.2.0の一部モジュールを入れ替える。

Hibernate-core 4.2.10
解凍して以下の5つのjarファイルを取り出し、コピーしておく。

$ cd hibernate-4.2.10/

 hibernate-commons-annotations-4.0.2.Final.jar
 hibernate-core-4.2.10.Final.jar
 hibernate-entitymanager-4.2.10.Final.jar
 hibernate-envers-4.2.10.Final.jar
 hibernate-infinispan-4.2.10.Final.jar

 
$ sudo cp hibernate-commons-annotations-4.0.2.Final.jar
/usr/local/jboss/modules/system/layers/base/org/hibernate/commons-annotations/main/

$ sudo cp hibernate-envers-4.2.10.Final.jar /usr/local/jboss/modules/system/layers/base/org/hibernate/envers/main/

$ sudo cp hibernate-core-4.2.10.Final.jar hibernate-entitymanager-4.2.10.Final.jar hibernate-infinispan-4.2.10.Final.jar /usr/local/jboss/modules/system/layers/base/org/hibernate/main/


以下のファイル中のjarファイル名の部分を入れ替えたjarファイル名に修正する。

$ sudo vi /usr/local/jboss/modules/system/layers/base/org/hibernate/commons-annotations/main/module.xml

$ sudo vi /usr/local/jboss/modules/system/layers/base/org/hibernate/envers/main/module.xml

$ sudo vi /usr/local/jboss/modules/system/layers/base/org/hibernate/main/module.xml



RESTEasy 3.0.6
解凍して、以下のディレクトリをまるごと上書きコピーする。

$ cd resteasy-jboss-modules-3.0.6.Final/

$ sudo cp -a com/ /usr/local/jboss/modules/system/layers/base/
$ sudo cp -a javax/ /usr/local/jboss/modules/system/layers/base/
$ sudo cp -a org/ /usr/local/jboss/modules/system/layers/base/


所有者そろえる
$  sudo chown -R jboss.jboss /usr/local/jboss

せっかくなのでアーカイブしておく(仮想マシン用コピーなど)
$ cd /usr/local
$ sudo tar zcvf jboss-as-7.2.0-hibernate-4.2.10-resteasy-3.0.6.zip ./jboss

もう一息。

Mac mini & OSIRIX & OpenWhale

端末はMac mini Mid2007(10.4.11) とEarly2009(10.5.8) ・・でした

メモリ増設とSSD換装とOSあげ。

JavaあげないとOpenWhaleDolphinキビシイ。
いままではRDP運用でしのいでた。

先人方のブログを参考になんとかメモリ増設とSSD換装。
USBインストーラ作成、試してみた。

10.6.8 Snow Leopard
10.7.5 Lion
10.8.5 Mountain Lion
10.9 Mavericks

いまだにOSIRIX 2.7.5 localizedを使っているので、
OSあげても、動いてくれないと困る・・
ということで試してみた。

10.9ではOSIRIXで一部動きが違うところがあった。
 シリーズが1つのとき自動的にそのシリーズが選択されない。
 1クリックで選択は可能だが、普段は自動的に選択されていた。

ということで、いまは10.7.5と10.8.5にすることにした。

OpenWhaleDolphin2.3.8mは、Java7環境なのでLionは必要。
Mid2007はメモリ3Gで心もとないが、端末としてなら生きていけるかも。

今後ともOpenWhaleよろしくお願いします。

・・素朴でかわいいです
・・いつの間にかOSIRIXとのID連携がっ!