Tips

CalDAV / DAViCALの構築 データベース(PostgreSQL)のインストール

データベース(PostgreSQL)のインストール

WEBサーバ(httpd)のインストール

postgreSQL

(1)postgreSQLをインストールする前の下準備

事前にPostgreSQL実行用ユーザー「postgres」を作成します。
UID・GIDの指定はしませんが・・・
ホームディレクトリは「/usr/local/pgsql」(postgreSQLインストールディレクトリ)とします。

# groupadd postgres ← postgresグループを作成
 
# cat /etc/group | grep postgres ← 「postgres」グループを確認
postgres:x:500:
 
# useradd -g postgres -d /usr/local/pgsql postgres ← postgresユーザーを作成
 
# cat /etc/passwd | grep postgres ← postgresユーザーを確認
postgres:x:500:500::/usr/local/pgsql:/bin/bash

念のため、パスワードを設定しておきます。

# passwd postgres ← postgresユーザーのパスワードを設定
Changing password for user postgres.
New UNIX password: ← パスワードを入力してください。(入力した文字は表示されません。)
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password: ← 再度、パスワードを入力してください。(入力した文字は表示されません。)
passwd: all authentication tokens updated successfully.

※パスワードの強度が低いとエラーが出ますので、「BAD PASSWORD」と表示されますが、問題なく作成できます。
※問題なく、パスワードが作成できれば「successfully」と表示されます。

(2)postgreSQLのソースファイルを入手

postgreSQLのソースコードの最新版を手に入れる場合には、まず、本家本元のサイト(http://www.postgresql.jp/PostgreSQL)に、
行ってみて確認してみる必要があります。

なお、本サイトでは、ミラーサイト「ftp://ftp2.jp.postgresql.org/pub/postgresql/source/」よりwgetコマンドにて、
直接ソースコードをダウンロードしてしまいます。
一度、Windows上でダウンロードしてから、FTPツールを使用して、アップロードしても同じ作業となります。

# cd /usr/local/src/ ← 「/usr/local/src」に移動
 
# wget ftp://ftp2.jp.postgresql.org/pub/postgresql/source/v8.4.12/postgresql-8.4.12.tar.gz ← postgreSQLのソースファイルをミラーサイトよりダウンロード
–2012-07-19 14:23:29– ftp://ftp2.jp.postgresql.org/pub/postgresql/source/v8.4.12/postgresql-8.4.12.tar.gz
=> `postgresql-8.4.12.tar.gz’
ftp2.jp.postgresql.org をDNSに問いあわせています… 150.65.7.130
ftp2.jp.postgresql.org|150.65.7.130|:21 に接続しています… 接続しました。
anonymous としてログインしています… ログインしました!
==> SYST … 完了しました。 ==> PWD … 完了しました。
==> TYPE I … 完了しました。 ==> CWD /pub/postgresql/source/v8.4.12 … 完了しました。
==> SIZE postgresql-8.4.12.tar.gz … 18193373
==> PASV … 完了しました。 ==> RETR postgresql-8.4.12.tar.gz … 完了しました。
長さ: 18193373 (17M)100%[===================================================================================>] 18,193,373 524K/s 時間 24s2012-07-19 14:23:59 (728 KB/s) – `postgresql-8.4.12.tar.gz’ へ保存終了 [18193373]
 

 

ファイル(postgresql-8.4.12.tar.gz)がダウンロードできたかは確認してください。

# ls -l postgresql-8.4.12.tar.gz ← ダウンロードファイルの確認
-rw-r–r– 1 root root 18193373 7月 19 14:23 postgresql-8.4.12.tar.gz
 

 

(3)ソースファイルの展開とコンパイル前の前準備

ソースファイル(postgresql-8.4.12.tar.gz)をダウンロードしたら、そのソースファイルを展開(解凍)します。

# tar xfz postgresql-8.4.12.tar.gz ← 「postgresql-8.4.12.tar.gz」ファイルを解凍
 
# ls -ld postgresql-8.4.12 ← 「postgresql-8.4.12」ディレクトリを確認
drwxrwxrwx 6 1107 1107 4096 6月 1 08:32 postgresql-8.4.12
 

 
「v」オプションを一緒につけて実行すると、展開されるファイルが表示されます。
 
ソースファイル(postgresql-8.4.12.tar.gz)を展開(解凍)したら、コンパイル前の前準備として、
まず、展開されたディレクトリに移動し、オプションを指定して、「Configure」ファイルを実行します。

# cd postgresql-8.4.12 ← 「postgresql-8.4.12」ディレクトリへ移動
 
# ./configure  ← 「configure」スクリプトを実施
> ––prefix=/usr/local/pgsql ← インストールするディレクトリを「/usr/local/pgsql」と指定(デフォルトで「/usr/local/pgsql」となっているため、指定しなくても問題はない。)
checking build system type… i686-pc-linux-gnu
checking host system type… i686-pc-linux-gnu
checking which template to use… linux
checking whether to build with 64-bit integer date/time support… yes
checking whether NLS is wanted… no
checking for default port number… 5432
checking for block size… 8kB
checking for segment size… 1GB
checking for WAL block size… 8kB
checking for WAL segment size… 16MB
checking for gcc… gcc
checking for C compiler default output file name… a.out
checking whether the C compiler works… yes
checking whether we are cross compiling… no
checking for suffix of executables…
checking for suffix of object files… o
checking whether we are using the GNU C compiler… yes
checking whether gcc accepts -g… yes
checking for gcc option to accept ISO C89… none needed
checking if gcc supports -Wdeclaration-after-statement… yes
checking if gcc supports -Wendif-labels… yes
checking if gcc supports -fno-strict-aliasing… yes
checking if gcc supports -fwrapv… yes
checking if gcc supports -fexcess-precision=standard… no
checking whether the C compiler still works… yes
checking how to run the C preprocessor… gcc -E
checking allow thread-safe client libraries… no
・・・省略・・・
 

 

Linux認定資格 LPICを取るなら・・

Linux資格 「LPIC Lv1」徹底解説 連載目次

Recent News

Recent Tips

Tag Search