
Contents
- ベースは
stacklet の Scientific Linux 7.1(VMDK) - ビルドの全コマンドまとめ
- PostgreSQL
のデータベース作成と起動、PL/R テスト
ベースは stacklet の Scientific Linux 7.1(VMDK)
下記にある» stacklet - Scientific 7.1 Lightweight x86_64
(scientific.7-1.x86-64.20150417.vmdk.tar.bz2)
(scientific.7-1.x86-64.20150417.vmdk.tar.bz2)
他の主要ディストリは概ね有償だけど、これは今のところ無償。230MB
↓ インストール済みパッケージ一覧。この他コンパイラなど若干追加が必要でした(詳細は次項)。Scientific Linux
»
$ yum list installed acl.x86_64 2.2.51-12.el7 @sl acpid.x86_64 2.0.19-5.el7 @sl at.x86_64 3.1.13-17.el7_0.1 @sl attr.x86_64 2.4.46-12.el7 @sl audit.x86_64 2.4.1-5.el7 @sl audit-libs.x86_64 2.4.1-5.el7 installed authconfig.x86_64 6.2.8-9.el7 @sl avahi-libs.x86_64 0.6.31-14.el7 @sl basesystem.noarch 10.0-7.el7 installed bash.x86_64 4.2.46-12.el7 installed bc.x86_64 1.06.95-13.el7 @sl bind-libs-lite.x86_64 32:9.9.4-18.el7_1.1 @sl-security bind-license.noarch 32:9.9.4-18.el7_1.1 @sl-security binutils.x86_64 2.23.52.0.1-30.el7_1.1 @sl-fastbugs ...
ビルドの全コマンドまとめ
普通はアップデートから始めると思いますが、今回は最速で# useradd postgres $ su - postgres -- get sources and extract them. ~$ wget https://ftp.postgresql.org/pub/source/v9.5.3/postgresql-9.5.3.tar.bz2 ~$ wget https://cran.r-project.org/src/base/R-3/R-3.3.0.tar.gz ~$ wget https://github.com/jconway/plr/archive/master.zip ~$ tar -xf R-3.3.0.tar.gz ~$ tar -xf postgresql-9.5.3.tar.bz2 ~$ unzip master.zip -- build postgres $ sudo yum -y install gcc-c++ readline-devel zlib-devel libxml2 libxml2-devel $ cd postgresql-9.5.3 $ ./configure --enable-nls --with-libxml $ make -j2 $ sudo make install -- build R $ sudo yum -y install gcc-gfortran bzip2-devel pcre-devel libcurl-devel $ cd ~/R-3.3.0 $ ./configure --enable-R-shlib --with-x=noconfigure: WARNING: you cannot build info or HTML versions of the R manuals configure: WARNING: you cannot build PDF versions of the R manuals configure: WARNING: you cannot build PDF versions of vignettes and help pages $ make -j2'pdflatex' is needed to make vignettes but is missing on your system. $ sudo yum -y install perl $ sudo make install -- build PL/R $ cd ~/plr-master $ export PATH="${PATH}:/usr/local/pgsql/bin" $ export R_HOME=~/R-3.3.0 $ USE_PGXS=1 make $ sudo USE_PGXS=1 make install
R

振り返ると、PostgreSQL
PostgreSQL のデータベース作成と起動、PL/R テスト
最初に$ initdb -D ~/pgdata953 -E utf8 --no-locale -U postgres The files belonging to this database system will be owned by user "postgres". This user must also own the server process. The database cluster will be initialized with locale "C". The default text search configuration will be set to "english". Data page checksums are disabled. creating directory /home/postgres/pgdata953 ... ok creating subdirectories ... ok selecting default max_connections ... 100 selecting default shared_buffers ... 128MB selecting dynamic shared memory implementation ... posix creating configuration files ... ok creating template1 database in /home/postgres/pgdata953/base/1 ... ok initializing pg_authid ... ok initializing dependencies ... ok creating system views ... ok loading system objects' descriptions ... ok creating collations ... ok creating conversions ... ok creating dictionaries ... ok setting privileges on built-in objects ... ok creating information schema ... ok loading PL/pgSQL server-side language ... ok vacuuming database template1 ... ok copying template1 to template0 ... ok copying template1 to postgres ... ok syncing data to disk ... ok WARNING: enabling "trust" authentication for local connections You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb. Success. You can now start the database server using: pg_ctl -D /home/postgres/pgdata953 -l logfile start
次に
この時、PL/R
$ export PATH="${PATH}:${R_HOME}" $ export LD_LIBRARY_PATH="/usr/local/pgsql/lib:${R_HOME}/lib" $ pg_ctl -D ~/pgdata953 start
Linux
ともかく以上で準備できました。PL/R
$ psql # create database test_plr; # \c test_plr # create extension plr;
EXTENSION
create or replace function public.rint2(i smallint) returns smallint language plr as $$ return (as.integer(i)) $$; select rint2(NULL); -- Postgres crashes on previous PL/R.
↓ 今回の最新版では、ちゃんと直ってました

これで一応、Linux