インストール手順

Postgres のインストール

For a fresh install or upgrading from previous releases of Postgres:

新規インストールあるいは以前のPostgresをアップグレードする場合のインストール方法:

  1. Read any last minute information and platform specific porting notes. There are some platform specific notes at the end of this file for Ultrix4.x, Linux, BSD/OS and NeXT. There are other files in directory /usr/src/pgsql/doc, including files FAQ-Irix and FAQ-Linux. Also look in directory ftp://ftp.postgresql.org/pub. If there is a file called INSTALL in this directory then this file will contain the latest installation information.

    最新の情報およびプラットフォームに依存する情報を確認してください。 Ultrix4.x、Linux、BSD/OS、NeXTに関するプラットフォーム依存の情報はこのファイルの最後に有ります。 /usr/src/pgsql/doc には、FAQ-Irix や FAQ-Linux などのファイルが有ります。 ftp://ftp.postgresql.org/pubにある INSTALL というファイルに、インストールに関する最新の情報が記載されています。

    Please note that a "tested" platform in the list given earlier simply means that someone went to the effort at some point of making sure that a Postgres distribution would compile and run on this platform without modifying the code. Since the current developers will not have access to all of these platforms, some of them may not compile cleanly and pass the regression tests in the current release due to minor problems. Any such known problems and their solutions will be posted in ftp://ftp.postgresql.org/pub/INSTALL.

    "テスト済み"プラットホームとしてリストに載っているのは、 以前のある時点においてソースコードを修正しないで Postgres をコンパイルし稼動した 実績があるという事です。 現在の開発グループは、これらすべてのプラットフォームを持って いないので、現在のリリースでは少しの問題の為にいくつかの プラットフォームで上手くコンパイルできない、あるいは Regression テストをパスしないことがあります。 このような周知の問題とそれらの解決方法は ftp://ftp.postgresql.org/pub/INSTALL にアップロードされます。

  2. Create the Postgres superuser account (postgres is commonly used) if it does not already exist.

    Postgresの為のスーパユーザアカウントが 無い場合、それを作成します。 通常、postgres という名前が使われています。

    The owner of the Postgres files can be any unprivileged user account. It must not be root, bin, or any other account with special access rights, as that would create a security risk.

    特権ユーザのアカウントでなければ,Postgresのファイルオーナーは任意に設定できます。 rootbin 、あるいは他の特別なアクセス権限を持つアカウントをオーナーにしてはいけません。 これがセキュリティ上の危険を発生させるかも知れないからです。

  3. Log in to the Postgres superuser account. Most of the remaining steps in the installation will happen in this account.

    Postgresのスーパユーザアカウントでログインします。 これ以降に記載されている手順の大部分も、このアカウントで実行します。

  4. Ftp file ftp://ftp.postgresql.org/pub/postgresql-v6.5.1.tar.gz from the Internet. Store it in your home directory.

    ftp://ftp.postgresql.org/pub/postgresql-v6.5.3.tar.gz というファイルをインターネットからホームディレクトリに FTP 転送してください。

  5. Some platforms use flex. If your system uses flex then make sure you have a good version. To check, type

    幾つかのプラットフォームでは、flex が使われています。 flex を使用している場合、バージョンを以下のように確認してください。

    $ flex --version

    If the flex command is not found then you probably do not need it. If the version is 2.5.2 or 2.5.4 or greater then you are okay. If it is 2.5.3 or before 2.5.2 then you will have to upgrade flex. You may get it at ftp://prep.ai.mit.edu/pub/gnu/flex-2.5.4.tar.gz.

    flexというコマンドが無い場合、多分それは必要ありません。 もし、バージョンが 2.5.2 あるいは 2.5.4 の場合は問題無いのですが、2.5.3 あるいは 2.5.2 より以前の物の場合、アップグレードの必要があります。 ftp://prep.ai.mit.edu/pub/gnu/flex-2.5.4.tar.gz から入手してください。

    If you need flex and don't have it or have the wrong version, then you will be told so when you attempt to compile the program. Feel free to skip this step if you aren't sure you need it. If you do need it then you will be told to install/upgrade flex when you try to compile Postgres.

    flex が必要なのにインストールされていない無い場合、あるいは違ったバージョンがインストールされている場合、Postgresのコンパイル実行中にその旨が告げられます。 必要かどうかわからないときは、インストールしなくてかまいません。 Postgres をコンパイルしようとする時に、flexのインストールまたはアップグレードが必要なことがわかります。

    You may want to do the entire flex installation from the root account, though that is not absolutely necessary. Assuming that you want the installation to place files in the usual default areas, type the following:

    flex をインストールする過程の全てで root権限 である必要はありません。 デフォルトの場所にインストールしたいのであれば、以下のようにしてください:

    $ su -
    $ cd /usr/local/src
    ftp prep.ai.mit.edu
    ftp> cd /pub/gnu/
    ftp> binary
    ftp> get flex-2.5.4.tar.gz
    ftp> quit
    $ gunzip -c flex-2.5.4.tar.gz | tar xvf -
    $ cd flex-2.5.4
    $ configure --prefix=/usr
    $ gmake
    $ gmake check
    
    # You must be root when typing the next line:
    # これ以降、root権限が必要です:
    $ gmake install
    $ cd /usr/local/src
    $ rm -rf flex-2.5.4

    This will update files /usr/man/man1/flex.1, /usr/bin/flex, /usr/lib/libfl.a, /usr/include/FlexLexer.h and will add a link /usr/bin/flex++ which points to flex.

    上記の手順では /usr/man/man1/flex.1/usr/bin/flex/usr/lib/libfl.a/usr/include/FlexLexer.hといったファイルを インストールし、/usr/bin/flex++ を flex に リンクします。

  6. If you are not upgrading an existing system then skip to step 9. If you are upgrading from 6.5, you do not need to dump/reload or initdb. Simply compile the source code, stop the postmaster, do a "make install", and restart the postmaster.

    既存のシステムからアップグレードする場合以外は、step 9 までの作業を省略できます。 6.5からのバージョンアップの場合、データのダンプやリロード、あるいは initdb の実行は必要ありません。ソースをコンパイルし、 postmasterを止めてから "make install"を実行後、再度 postmaster を起動するだけです。 If you are upgrading from 6.4.* or earlier, back up your database. For alpha- and beta-level releases, the database format is liable to change, often every few weeks, with no notice besides a quick comment in the HACKERS mailing list. Full releases always require a dump/reload from previous releases. It is therefore a bad idea to skip this step. 6.4.x やそれ以前からのアップグレードの場合、データベースのバックアップが必要になります。 アルファあるいはベータバージョンを使用されている場合、頻繁にデータベース形式が変更されることがあります。その時も簡単なコメントが開発者同士のメーリングリストに流される以外の情報もありませんので注意が必要です。 正式リリースでは常に旧バージョンのデータをダンプしたりリロードする作業が必要になりますのでこの章を読み飛ばさないでください。

    Tip: Do not use the pg_dumpall script from v6.0 or everything will be owned by the Postgres super user.

    v6.0のpg_dumpallは使わないようにしてください。 さもないと(ダンプされたデータベースの)あらゆる物のオーナーが Postgresのスーパユーザに設定されてしまいます。

    To dump your fairly recent post-v6.0 database installation, type

    今ある v6.0 以降の pg_dumpall を使用する場合、以下のようにします

    $ pg_dumpall > db.out

    To use the latest pg_dumpall script on your existing older database before upgrading Postgres, pull the most recent version of pg_dumpall from the new distribution:

    Postgres をアップグレードする前に、今までのデータベースに対し最新版の pg_dumpall スクリプトを使用するには、以下のようにします:

    $ cd
    $ gunzip -c postgresql-v6.5.1.tar.gz \
        | tar xvf - src/bin/pg_dump/pg_dumpall
    $ chmod a+x src/bin/pg_dump/pg_dumpall
    $ src/bin/pg_dump/pg_dumpall > db.out
    $ rm -rf src

    If you wish to preserve object id's (oids), then use the -o option when running pg_dumpall. However, unless you have a special reason for doing this (such as using OIDs as keys in tables), don't do it.

    オブジェクトID(oids)をそのまま保存したい場合、pg_dumpall 実行時に -o オプションを使用してください。 しかしながら、OIDをキーに設定している等の特別な場合を除いてはこのオプションを使用しないで下さい。

    If the pg_dumpall command seems to take a long time and you think it might have died, then, from another terminal, type

    pg_dumpall コマンドに非常に時間が掛かる場合、プロセスが死んでいるかもしれません。その場合、他のターミナルから以下のコマンドを実行してみてください。

    $ ls -l db.out
    several times to see if the size of the file is growing. 数回これを実行し、ファイルサイズが増加している事でプロセスが死んでいないか確認してください。

    Please note that if you are upgrading from a version prior to Postgres95 v1.09 then you must back up your database, install Postgres95 v1.09, restore your database, then back it up again. You should also read the release notes which should cover any release-specific issues.

    Postgres95 v1.09 以前からのアップグレードを行う場合、データベースのバックアップを必ず行い、Postgres95 v1.09のインストールを行ってから、データベースを v1.09 でリストアしてください。その後、バックアップを再度行います。 インストールの際、リリースノートに含まれるバージョン毎の特記事項を確認して下さい。

    Caution

    You must make sure that your database is not updated in the middle of your backup. If necessary, bring down postmaster, edit the permissions in file /usr/local/pgsql/data/pg_hba.conf to allow only you on, then bring postmaster back up.

    バックアップの途中でデータベースの内容が更新されないようにしてください。 必要なら、postmaster を一旦停止し、 /usr/local/pgsql/data/pg_hba.conf を編集してあなただけがそれにアクセス出来るようにしてからバックアップを行って下さい。

  7. If you are upgrading an existing system then kill the postmaster. Type

    バックアップが終了したら、postmaster を終了させます。 まず、以下のように入力します。

    $ ps -ax | grep postmaster
    This should list the process numbers for a number of processes. Type the following line, with pid replaced by the process id for process postmaster. (Do not use the id for process "grep postmaster".) Type これは実行中の postmaster のプロセス番号を表示します。 次の pid の個所を postmaster のプロセス番号に変えて入力し、プロセスを停止してください。 (grepコマンド自身のプロセス番号を使ってはいけません。)
    $ kill pid
    to actually stop the process.

    Tip: On systems which have Postgres started at boot time, there is probably a startup file which will accomplish the same thing. For example, on my Linux system I can type

    Postgresがシステム起動時に自動的にスタートするようになっている場合、PostgreSQL起動用スクリプトでプロセスを終了することができます。例えば、筆者のLinuxでは以下の様に入力してPostgresを終了させる事ができます。

    $ /etc/rc.d/init.d/postgres.init stop
    to halt Postgres.

  8. If you are upgrading an existing system then move the old directories out of the way. If you are short of disk space then you may have to back up and delete the directories instead. If you do this, save the old database in the /usr/local/pgsql/data directory tree. At a minimum, save file /usr/local/pgsql/data/pg_hba.conf.

    もし PostreSQLをアップグレードしている場合、古いPostgreSQLのディレクトリの名前を変えて保存しておきます。 ディスク容量が不足している場合、バックアップが終了した後に古いディレクトリを消さなければいけないかも知れませんが、その場合でも、/usr/local/pgsql/data にある古いデータベースを保存しておいてください。最低でも、/usr/local/pgsql/data/pg_hba.conf だけは、保存しておきます。

    Type the following:

    古いバージョンのPostgresを全て保存しておく場合、以下のように名前を変更します:

    $ su -
    $ cd /usr/src
    $ mv pgsql pgsql_6_0
    $ cd /usr/local
    $ mv pgsql pgsql_6_0
    $ exit

    If you are not using /usr/local/pgsql/data as your data directory (check to see if environment variable PGDATA is set to something else) then you will also want to move this directory in the same manner.

    もし/usr/local/pgsql/dataというディレクトリをデータベース保存用に使用していない場合、環境変数 PGDATA を参照しそのディレクトリを上記手順と同じ方法で保存しておきます。

  9. Make new source and install directories. The actual paths can be different for your installation but you must be consistent throughout this procedure.

    新しいバージョンのソースファイルとプログラムのインストール用にディレクトリを作成します。インストール先のディレクトリ名は変更することが出来ますが、インストールの間は終始同じパスを使用しなければいけません。

    Note: There are two places in this installation procedure where you will have an opportunity to specify installation locations for programs, libraries, documentation, and other files. Usually it is sufficient to specify these at the gmake install stage of installation.

    このマニュアルに書かれているインストール手順を使う場合、プログラムやライブラリ、ドキュメント等のインストール先の場所を指定するチャンスは2回程ありますが、通常は gmake install を実行する時に指定します。

    Type

    ソースファイルとプログラムの為のディレクトリを作ります。

    $ su
    $ cd /usr/src
    $ mkdir pgsql
    $ chown postgres:postgres pgsql
    $ cd /usr/local
    $ mkdir pgsql
    $ chown postgres:postgres pgsql
    $ exit

  10. Unzip and untar the new source file. Type

    新しいソースファイルを以下のように展開します。

    $ cd /usr/src/pgsql
    $ gunzip -c ~/postgresql-v6.5.1.tar.gz | tar xvf -

  11. Configure the source code for your system. It is this step at which you can specify your actual installation path for the build process (see the --prefix option below). Type

    configureスクリプトを実行しますが、この時、--prefix オプション(詳しくは後述します)でプログラム等をインストールするディレクトリのパスを設定することが出来ます。

    $ cd /usr/src/pgsql/src
    $ ./configure [ options ]

    1. Among other chores, the configure script selects a system-specific "template" file from the files provided in the template subdirectory. If it cannot guess which one to use for your system, it will say so and exit. In that case you'll need to figure out which one to use and run configure again, this time giving the --with-template=TEMPLATE option to make the right file be chosen.

      configure スクリプトはそのシステムに合ったテンプレートファイル を自動的にテンプレートディレクトリの中から選択しますが、それが 出来ない場合は、その旨を表示しスクリプトは停止します。 この場合、テンプレートから自分のシステムに合ったものを探し出し、 configure 実行時に--with-template=TEMPLATE オプションを指定しなければなりません。

      問題の報告: If your system is not automatically recognized by configure and you have to do this, please send email to scrappy@hub.org with the output of the program ./config.guess. Indicate what the template file should be.

      もし configure が自動的にシステムを認識できなかった場合、 ./config.guess プログラムの出力を添付して scrappy@hub.orgまで メールしてください。また、どんなテンプレートファイルが使用される べきであったかも知らせてください。

    2. Choose configuration options. Check 構成オプション for details. However, for a plain-vanilla first installation with no extra options like multi-byte character support or locale collation support it may be adequate to have chosen the installation areas and to run configure without extra options specified. The configure script accepts many additional options that you can use if you don't like the default configuration. To see them all, type

      configure時のオプション選択する場合、構成オプションで詳細を確認してください。しかし、マルチバイト文字のサポートや、 ロケール照合サポートなどのオプション機能無しの淡白なインストール をするのなら、インストールする場所を選んだ以外、特にオプションは指定 せずにconfigureを実行すれば十分でしょう。 configure スクリプトには、デフォルトの設定を変更するための多くのオプションが在ります。全てのオプションを見るには、以下のように入力します。

           ./configure --help
      Some of the more commonly used ones are: 通常使用されるオプションは以下のような物です:
      
       --prefix=BASEDIR   Selects a different base directory for the
                                installation of the Postgres configuration.
                                The default is /usr/local/pgsql.
             --prefix=BASEDIR   Postgresをインストールする
                                ディレクトリを指定します。
                                デフォルトでは /usr/local/pgsql にインストールされます。
      
             --with-template=TEMPLATE
                                Use template file TEMPLATE - the template
                                files are assumed to be in the directory
                                src/template, so look there for proper values.
             --with-template=TEMPLATE
                                テンプレートファイルとして'TEMPLATE'を使います。
                                テンプレートファイルはsrc/template内にあります。
                                正しいテンプレート名は、このディレクトリの内容
                                を参照してください。
      
             --with-tcl         Build interface libraries and programs requiring
                                Tcl/Tk, including libpgtcl, pgtclsh, and pgtksh.
             --with-tcl         
                                libpgtclやpgtclsh、pgtksh等の Tcl/Tk を必要とする
                                ライブラリ及びプログラムをインストールします。
      
             --with-perl        Build the Perl interface library.
             --with-perl        Perl 用インターフェイスライブラリをインストールします。
      
             --with-odbc        Build the ODBC driver package.
             --with-odbc        ODBC ドライバ群をインストールします。
      
             --enable-hba       Enables Host Based Authentication (DEFAULT)
             --enable-hba       'ホストベース認証'を有効にします
                                (デフォルトは、指定しなくても有効になっています。)
      
             --disable-hba      Disables Host Based Authentication
             --disable-hba      'ホストベース認証'を無効にします。
      
             --enable-locale    Enables USE_LOCALE
             --enable-locale    USE_LOCALE を有効にします。
      
             --enable-cassert   Enables ASSERT_CHECKING
             --enable-cassert   ASSERT_CHECKING を有効にします。
      
             --with-CC=compiler
                                Use a specific C compiler that the configure
                                script cannot find.
             --with-CC=compiler
                                configureスクリプトが C コンパイラを見つけることが
                                出来ない場合に C コンパイラを指定します。
      
             --with-CXX=compiler
             --with-CXX=compiler
                                configureスクリプトが C++ コンパイラを見つけることが
                                出来ない場合に C++ コンパイラを指定します。
      
             --without-CXX
                                Use a specific C++ compiler that the configure
                                script cannot find, or exclude C++ compilation
                                altogether.   (This only affects libpq++ at
      			  present.)
             --without-CXX
                                C++コンパイラを使いません。
                                (上記2つのオプションは、libpg++にだけ関係します。)
                                

    3. Here is the configure script used on a Sparc Solaris 2.5 system with /opt/postgres specified as the installation base directory:

      以下の例は、Sparc Solaris 2.5 上でインストール先のディレクトリを /opt/postgres に指定しています:

      $ ./configure --prefix=/opt/postgres \
          --with-template=sparc_solaris-gcc --with-pgport=5432 \
          --enable-hba --disable-locale

      Tip: Of course, you may type these three lines all on the same line.

      もちろん上記のコマンド全てを1行に入力する事も出来ます。

  12. Install the man and HTML documentation. Type

    man ページや、HTML 形式の文書をインストールするには、以下のように入力します:

    $ cd /usr/src/pgsql/doc
    $ gmake install

    The documentation is also available in Postscript format. Look for files ending with .ps.gz in the same directory.

    Postscript形式の文書も同じディレクトリ内に .ps.gz という拡張子付きでインストールされます。

  13. Compile the program. Type

    次のようにして、コンパイルを行います。

    $ cd /usr/src/pgsql/src
    $ gmake all >& make.log &
    $ tail -f make.log

    The last line displayed will hopefully be

    コンパイルが正常に終了すると、最後は以下のように表示されます。

    All of PostgreSQL is successfully made. Ready to install.
    Remember, "gmake" may be called "make" on your system. At this point, or earlier if you wish, type control-C to get out of tail. (If you have problems later on you may wish to examine file make.log for warning and error messages.) 再度言っておきますが、"gmake""make" とされているシステムも有ります。 この時、あるいはもっと早い段階で、コントロールキーとCを同じに押して tail コマンドを停止してもかまいません。しかし、make.log に記録されたエラーメッセージやワーニングメッセージで問題を調査することが出来ます。

    Note: You will probably find a number of warning messages in make.log. Unless you have problems later on, these messages may be safely ignored.

    make.log に幾つかのワーニングメッセージが有るかもしれませんが、使用中に問題が発生しない場合は無視してかまいません。

    If the compiler fails with a message stating that the flex command cannot be found then install flex as described earlier. Next, change directory back to this directory, type

    もし、flex コマンドが見つからないというエラーメッセージと共にコンパイルが失敗した場合、前述したように flex をインストールして下さい。 その後、src ディレクトリに戻って次のコマンドを実行してからコンパイルを再実行します。

    $ gmake clean
    then recompile again.

    Compiler options, such as optimization and debugging, may be specified on the command line using the COPT variable. For example, typing

    オプチマイザやデバッグ等のコンパイラオプションは、以下の例のように COPT 変数として入力することが出来ます。

    $ gmake COPT="-g" all >& make.log &
    would invoke your compiler's -g option in all steps of the build. See src/Makefile.global.in for further details. これは、コンパイル作業中の全ての状況で -g オプションをコンパイラが使うように指定しています。詳細は src/Makefile.global.in を参照してください。

  14. Install the program. Type

    インストールを実行します。

    $ cd /usr/src/pgsql/src
    $ gmake install >& make.install.log &
    $ tail -f make.install.log

    The last line displayed will be

    インストールが終了すると、以下のように表示されます。

    gmake[1]: Leaving directory `/usr/src/pgsql/src/man'
    At this point, or earlier if you wish, type control-C to get out of tail. Remember, "gmake" may be called "make" on your system. この時、あるいはもっと早い段階で、コントロールキーとCを同じに押して tail コマンドを停止してもかまいません。しかし、make.log に記録されたエラーメッセージやワーニングメッセージで問題を調査することが出来ます。 何度も言いますが、"gmake""make" とされているシステムも有ります。

  15. If necessary, tell your system how to find the new shared libraries. You can do one of the following, preferably the first:

    共有ライブラリの場所をシステムがどのように見るけるかを指定しなければいけないことがあります。 以下の方法の中から、一つ 実行して下さい。 できれば最初の方法を使ってください:

    1. As root, edit file /etc/ld.so.conf. Add a line

      root権限で、/etc/ld.so.conf ファイルに次の1行を追加します。

      /usr/local/pgsql/lib
      to the file. Then run command /sbin/ldconfig. その後、/sbin/ldconfig コマンドを実行します。

    2. In a bash shell, type

      bash を使用している場合、以下を入力します。

          export LD_LIBRARY_PATH=/usr/local/pgsql/lib

    3. In a csh shell, type

      csh の場合は、以下を入力します。

          setenv LD_LIBRARY_PATH /usr/local/pgsql/lib

    Please note that the above commands may vary wildly for different operating systems. Check the platform specific notes, such as those for Ultrix4.x or and for non-ELF Linux.

    OSの種類によって上記コマンドには大きな違いが見られます。 Ultrix4.x や ELF非対応のLinux などは、プラットフォーム依存の注意点を確認してください。

    If, when you create the database, you get the message

    データベース作成時、以下のようなメッセージが表示されたら共有ライブラリの設定が必要です。

    pg_id: can't load library 'libpq.so'
    then the above step was necessary. Simply do this step, then try to create the database again. 前述の内容を実行してください。

  16. If you used the --with-perl option to configure, check the install log to see whether the Perl module was actually installed. If you've followed our advice to make the Postgres files be owned by an unprivileged userid, then the Perl module won't have been installed, for lack of write privileges on the Perl library directories. You can complete its installation, either now or later, by becoming the user that does own the Perl library (often root) (via su) and doing

    configure 実行時、--with-perl オプションを使った時はインストールログを確認して Perl モジュールが正しくインストールされたか確認してください。 もし今までのインストール手順を忠実に守っていた場合、Perl ライブラリのディレクトリへの書き込み権限が無いことから、Perl モジュールのインストールはできていないはずです。 Perl モジュールのインストールは、 su コマンドで Perl ライブラリの持ち主(通常は root アカウント)になれれば、いつでも出来ます。

          $ cd /usr/src/pgsql/src/interfaces/perl5
          $ gmake install
         

  17. If it has not already been done, then prepare account postgres for using Postgres. Any account that will use Postgres must be similarly prepared.

    まだ準備していなければ、Postgres を使用する postgresというアカウントを作成してください. 同様に、Postgres を使用する予定のその他の アカウントも準備しなければなりません.

    There are several ways to influence the runtime environment of the Postgres server. Refer to the Administrator's Guide for more information.

    Postgresの実行環境に影響を与える個別の事項 (実行環境を左右させる個別の方法)があります これに付いては Administrator's Guide に詳しい 説明があります。

    Note: The following instructions are for a bash/sh shell. Adapt accordingly for other shells.

    以下の説明は、bash/sh シェルの為の物ですので、使用しているシェルの種類に応じて内容を変更してください。

    1. Add the following lines to your login environment: shell, ~/.bash_profile:

      以下の行を ~/.bash_profile 等のログイン環境変数に追加します:

      	PATH=$PATH:/usr/local/pgsql/bin
      	MANPATH=$MANPATH:/usr/local/pgsql/man
      	PGLIB=/usr/local/pgsql/lib
      	PGDATA=/usr/local/pgsql/data
      	export PATH MANPATH PGLIB PGDATA
             

    2. Several regression tests could fail if the user's locale collation scheme is different from that of the standard C locale.

      regression テストでの幾つかのエラーは、標準の C ロケールとインストール環境でのロケール照合ロジックのデザインの違い により発生することがあります。

      If you configure and compile Postgres with --enable-locale then you should set the locale environment to "C" (or unset all "LC_*" variables) by putting these additional lines to your login environment before starting postmaster:

      Postgres の configure あるいはコンパイル 実行時に--enable-locale オプションを指定した場合、 postmaster を起動する前に,ログイン時の 環境設定を追加し,ロケール環境を "C" にする(あるいは,すべての "LC_*" 変数の設定を消しておく) べきです。

      	LC_COLLATE=C
      	LC_CTYPE=C
      	export LC_COLLATE LC_CTYPE
             
      	
             

    3. Make sure that you have defined these variables before continuing with the remaining steps. The easiest way to do this is to type:

      次のステップを実行する前に、今までに行った環境変数の変更が正しく定義されたか確認しておいてください。環境変数を再定義する一番簡単な方法は、以下のように入力することです:

      	$ source ~/.bash_profile
             

  18. Create the database installation from your Postgres superuser account (typically account postgres).

    Postgres のスーパユーザアカウントで、データベースを作成しますが、 ここでは、今まで通り postgres というアカウントを使用します。 Do not do the following as root! This would be a major security hole. Type 重大なセキュリティホールになるので、以下の手順は、絶対に root アカウントでは実行しないで下さい!

    $ initdb

  19. Set up permissions to access the database system. Do this by editing file /usr/local/pgsql/data/pg_hba.conf. The instructions are included in the file. (If your database is not located in the default location, i.e. if PGDATA is set to point elsewhere, then the location of this file will change accordingly.) This file should be made read only again once you are finished.

    /usr/local/pgsql/data/pg_hba.conf を編集することにより、データベースシステムへのアクセス権限を設定します。なお、詳細な説明は、ファイルの中にコメントとして記述されています。 (もし、デフォルト以外の場所にデータベースが有る場合、例えば PGDATA が他の場所を指定してある時等は、それに応じてこのファイルの場所は変わります。) このファイルは編集終了後、書き込み禁止に戻してください。 If you are upgrading from v6.0 or later you can copy file pg_hba.conf from your old database on top of the one in your new database, rather than redoing the file from scratch. v6.0以降からのアップグレードの場合は,一からファイルを書かなくとも, 古い pg_hba.conf の内容を新しい同ファイルの先頭に コピーしてすませることができます.

  20. Briefly test that the backend will start and run by running it from the command line.

    コマンドラインからバックエンドを起動してみて,バックエンドがスタート・実行 されるか,簡単にテストしてみてください.

    1. Start the postmaster daemon running in the background by typing

      postmaster をデーモンとしてバックグランドで走らせるには、以下のように入力します。

      $ cd
      $ nohup postmaster -i > pgserver.log 2>&1 &

    2. Create a database by typing

      データベースを作成するには、以下のように入力します:

      $ createdb

    3. Connect to the new database:

      今作成したデータベースに接続してみます:

      $ psql

    4. And run a sample query:

      簡単な問い合わせを実行します:

      postgres=> SELECT datetime 'now';

    5. Exit psql:

      psql を終了します:

      postgres=> \q

    6. Remove the test database (unless you will want to use it later for other tests):

      他に使う予定が無ければ、今作ったテスト用のデータベースを削除します:

      $ destroydb

  21. Run postmaster in the background from your Postgres superuser account (typically account postgres). Do not run postmaster from the root account!

    postmaster をバックグランドで走らせる場合、Postgres のスーパユーザ(通常は postgres)で行います。絶対に postmaster root アカウントで実行しないで下さい!

    Usually, you will want to modify your computer so that it will automatically start postmaster whenever it boots. It is not required; the Postgres server can be run successfully from non-privileged accounts without root intervention.

    普通、システムの起動時に postmaster が自動的に起動するようにすることが出来ますが、これには root 権限は必要ありませんし、またスーパユーザーアカウント以外で Postgres サーバを起動することが出来ます。

    Here are some suggestions on how to do this, contributed by various users.

    以下はいろいろなユーザーから寄せられたサーバの自動起動に関する情報です。

    Whatever you do, postmaster must be run by the Postgres superuser (postgres?) and not by root. This is why all of the examples below start by switching user (su) to postgres. These commands also take into account the fact that environment variables like PATH and PGDATA may not be set properly.

    postmaster を自動的に起動させる場合、root ではなく Postgres のスーパユーザ (postgres が使用されていますか?) で起動させること。 それが以下のサンプルスクリプトで、su コマンドでアカウントをpostgresに変更している理由です。以下のコマンドは PATH や PGDATA などの環境変数が正しく設定されないだろう、といったことも考慮しています. The examples are as follows. Use them with extreme caution. 以下のサンプルを使用するに当たっては、十分な注意を払うことをお願いします。

    • If you are installing from a non-privileged account and have no root access, then start the postmaster and send it to the background:

      特権を持たないアカウントでインストールし、かつ(あなたが)rootアクセス権を 持たない状態になったら postmaster をバック グラウンドで起動してください

      $ cd
      $ nohup postmaster > regress.log 2>&1 &

    • Edit file rc.local on NetBSD or file rc2.d on SPARC Solaris 2.5.1 to contain the following single line:

      NetBSD の rc.local ファイル、あるいは SPARC Solaris 2.5.1 では rc2.d ファイルに以下の内容を1行で追記します:

      su postgres -c "/usr/local/pgsql/bin/postmaster -S -D /usr/local/pgsql/data"

    • In FreeBSD 2.2-RELEASE edit /usr/local/etc/rc.d/pgsql.sh to contain the following lines and make it chmod 755 and chown root:bin.

      FreeBSD 2.2 の場合、/usr/local/etc/rc.d/pgsql.sh に以下を追記し、ファイルモードを 755 (chmod 755)に、オーナーとグループをroot:bin (chown root:bin) に変更します。

      #!/bin/sh
      [ -x /usr/local/pgsql/bin/postmaster ] && {
          su -l pgsql -c 'exec /usr/local/pgsql/bin/postmaster
              -D/usr/local/pgsql/data
              -S -o -F > /usr/local/pgsql/errlog' &
          echo -n ' pgsql'
      }
      You may put the line breaks as shown above. The shell is smart enough to keep parsing beyond end-of-line if there is an expression unfinished. The exec saves one layer of shell under the postmaster process so the parent is init. 上記の起動スクリプトのように途中に改行を加えたとしても、シェルは十分に賢いのでこれを一文とみなして実行することが出来ます。

    • In RedHat Linux add a file /etc/rc.d/init.d/postgres.init which is based on the example in contrib/linux/. Then make a softlink to this file from /etc/rc.d/rc5.d/S98postgres.init.

      RedHatLinux の場合、contrib/linux/ にあるサンプルを参考に /etc/rc.d/init.d/postgres.init を作成し、 /etc/rc.d/rc5.d/S98postgres.init からソフトリンクを張ります。

    • In RedHat Linux edit file /etc/inittab to add the following as a single line:

      RedHat Linux の場合、/etc/inittab ファイルに以下の内容を一行で追加してください:

      pg:2345:respawn:/bin/su - postgres -c
          "/usr/local/pgsql/bin/postmaster -D/usr/local/pgsql/data
          >> /usr/local/pgsql/server.log 2>&1 </dev/null"
      (The author of this example says this example will revive the postmaster if it dies, but he doesn't know if there are other side effects.) (この例文を書いた作者によると、これはpostmasterが死んでも復活させるとのことですが、他に何か影響が有るかどうかはわからないとのことです。)

  22. Run the regression tests. The file /usr/src/pgsql/src/test/regress/README has detailed instructions for running and interpreting the regression tests. A short version follows here:

    regression テストを実行します。 /usr/src/pgsql/src/test/regress/README に 詳しい実行方法と解説が記述されています。 以下は、それを簡略化したものです:

    1. Type

      以下を入力します

      $ cd /usr/src/pgsql/src/test/regress
      $ gmake clean
      $ gmake all runtest

      You do not need to type gmake clean if this is the first time you are running the tests.

      初めて regression テストを実行する場合、gmake clean は入力の必要はありません。

      You should get on the screen (and also written to file ./regress.out) a series of statements stating which tests passed and which tests failed. Please note that it can be normal for some tests to "fail" on some platforms. The script says a test has failed if there is any difference at all between the actual output of the test and the expected output. Thus, tests may "fail" due to minor differences in wording of error messages, small differences in floating-point roundoff, etc, between your system and the regression test reference platform. "Failures" of this type do not indicate a problem with Postgres. The file ./regression.diffs contains the textual differences between the actual test output on your machine and the "expected" output (which is simply what the reference system produced). You should carefully examine each difference listed to see whether it appears to be a significant issue.

      モニター画面への出力と共に ./regress.out というファイルに、 それぞれのテスト結果が記録されます。あるプラットフォーム上では幾つかのテスト結果が "fail"と表示されてしまうことがあります。 予想されるテスト結果と実際のテスト結果の内容が少しでも違った場合、 例えば出力されたエラーメッセージの内容(訳注:わざとエラーになるような テストも行っています)や浮動小数点の丸め方等々で fail が出ることも有ります。 このような種類のエラーは、Postgres の動作に影響を与えません。 ./regression.diffs というテキストファイルには、実際にシステムが 出力したテスト結果と予想されたテスト結果(つまり、基準となる環境で実行されたテスト結果)の 違いが保存されています。それぞれの違いを注意深く調査することにより、重大な問題が発見できるかも 知れません。

      For example,

      • For a i686/Linux-ELF platform, no tests failed since this is the v6.5.1 regression testing reference platform.

        i686/Linux-ELF がv6.5.1での regression テスト結果の元になったプラットフォームなので、同一の構成では fail は発生しないと思います。

      Even if a test result clearly indicates a real failure, it may be a localized problem that will not affect you. An example is that the int8 test will fail, producing obviously incorrect output, if your machine and C compiler do not provide a 64-bit integer data type (or if they do but configure didn't discover it). This is not something to worry about unless you need to store 64-bit integers.

      テスト結果が明らかに問題であっても、特定機種にしか関係の無いことも有ります。 一例として、システムとCコンパイラが 64-bit の整数型をサポートしていない (或いは、configure スクリプトが発見できてなかった)場合には int8 に対するテスト結果は明らかに違ってきますが、64-bitの整数型でデータを保存しなくて 良い場合は、このエラーを無視して構いません。

      Conclusion? If you do see failures, try to understand the nature of the differences and then decide if those differences will affect your intended use of Postgres. The regression tests are a helpful tool, but they may require some study to be useful.

      結論? もし failed というメッセージを見たら、その原因を理解し、それが Postgresを使用する上で影響が有るかを自分で判断することです。 regression テストは有用なテストツールですが、使いこなすには努力が必要です。

      After running the regression tests, type

      regression テストが終了したら、以下のようにしてファイルの後始末をします。

      $ destroydb regression
      $ cd /usr/src/pgsql/src/test/regress
      $ gmake clean
      to recover the disk space used for the tests. (You may want to save the regression.diffs file in another place before doing this.) regression.diffs だけ他のディレクトリに移動しておくと良いかもしれません。

  23. If you haven't already done so, this would be a good time to modify your computer to do regular maintainence. The following should be done at regular intervals:

    今まで定期メンテナンスを実行していない場合、今がその習慣を打ち破る好機です。 以下の手順は、定期的に実行する必要があります。

    最低限のバックアップ手順

    1. Run the SQL command VACUUM. This will clean up your database.

      VACUUM という SQL コマンドを実行することにより、データベースを整理できます。

    2. Back up your system. (You should probably keep the last few backups on hand.) Preferably, no one else should be using the system at the time.

      (既にいくつかバックアップファイルをお持ちだとは思いますが)システムをバックアップします。できればですが、バックアップ中は他のユーザーがシステムを使用していないことが望まれます。

    Ideally, the above tasks should be done by a shell script that is run nightly or weekly by cron. Look at the man page for crontab for a starting point on how to do this. (If you do it, please e-mail us a copy of your shell script. We would like to set up our own systems to do this too.)

    上記の工程をシェルスクリプトに記述し、cron で毎夜あるいは毎週実行することもできます。 それには先ず、crontab の man ページを読むことが先決です。 (もし、上手くいったらそのシェルスクリプトをメールしてもらえませんか?それを自分も使ってみたいと思います。)

  24. If you are upgrading an existing system then reinstall your old database. Type

    既存のシステムからのアップグレードした場合、以下のようにして古いデータベースを新しいものに取り込みます。

    $ cd
    $ psql -e template1 < db.out
    If your pre-v6.2 database uses either path or polygon geometric data types, then you will need to upgrade any columns containing those types. To do so, type (from within psql) v6.2 以前のデータベースで path あるいは polygon geometric のいずれかのデータ型を使用している場合、データ列のアップグレードが必要になります。 psql から、以下のように入力してください。
    UPDATE FirstTable SET PathCol = UpgradePath(PathCol);
    UPDATE SecondTable SET PathCol = UpgradePath(PathCol);
    ...
    VACUUM;
    UpgradePath() checks to see that a path value is consistant with the old syntax, and will not update a column which fails that examination. UpgradePoly() cannot verify that a polygon is in fact from an old syntax, but RevertPoly() is provided to reverse the effects of a mis-applied upgrade. UpgradePath()はパスの値の整合性を旧構文で確認し,テストにそぐわなければ 列のアップグレードをおこないません. UpgradePoly()はポリゴンが見かけと 違って実際には旧構文からのものなのかどうか,検証できません.しかし間違った アップグレードによる影響を回復させるためにRevertPoly()が用意されています.

  25. If you are a new user, you may wish to play with Postgres as described below.

    もしあなたが Postgres について初心者なら、 以下を試してみると良いかもしれません。

  26. Clean up after yourself. Type

    古いシステムを消去する場合、以下のようにします。

    $ rm -rf /usr/src/pgsql_6_5
    $ rm -rf /usr/local/pgsql_6_5
    
    # Also delete old database directory tree if it is not in
    #  /usr/local/pgsql_6_5/data
    # 古いデータベースが /usr/local/pgsql_6_5/data に無い場合、
    # それの消去も行います。
    $ rm ~/postgresql-v6.5.1.tar.gz

  27. You will probably want to print out the documentation. If you have a Postscript printer, or have your machine already set up to accept Postscript files using a print filter, then to print the User's Guide simply type

    マニュアル類を印刷したいと思うかもしれません。 ポストスクリプトプリンタをお持ちかシステムがポストスクリプトファイルを 印刷出来るように設定されている場合、以下のようにして ユーザーズガイドを 印刷できます。

    $ cd /usr/local/pgsql/doc
    $ gunzip user.ps.tz | lpr

    Here is how you might do it if you have Ghostscript on your system and are writing to a laserjet printer.

    以下、Ghostscriptを使用して laserjet プリンタに印刷する場合の手順です。

    $ alias gshp='gs -sDEVICE=laserjet -r300 -dNOPAUSE'
    $ export GS_LIB=/usr/share/ghostscript:/usr/share/ghostscript/fonts
    $ gunzip user.ps.gz
    $ gshp -sOUTPUTFILE=user.hp user.ps
    $ gzip user.ps
    $ lpr -l -s -r manpage.hp

  28. The Postgres team wants to keep Postgres working on all of the supported platforms. We therefore ask you to let us know if you did or did not get Postgres to work on you system. Please send a mail message to pgsql-ports@postgresql.org telling us the following:

    Postgres を全ての対応済みプラットフォームで動作することが続くようにしたいと思っていますので、動いた、あるいは動かないシステムに関する情報を教えてください。 pgsql-ports@postgresql.orgに下記の情報を書き添えてメールしてください:

    • The version of Postgres (v6.5.1, 6.5, beta 990318, etc.).

      Postgres のバージョン。 (例えば、 v6.5.1, 6.5, beta 990318, 等。)

    • Your operating system (i.e. RedHat v5.1 Linux v2.0.34).

      OSの種類。 (例えば、RedHat v5.1 Linux v2.0.34。)

    • Your hardware (SPARC, i486, etc.).

      ハードウエアプラットフォームの種類。 (SPARC、i486 等)

    • Did you compile, install and run the regression tests cleanly? If not, what source code did you change (i.e. patches you applied, changes you made, etc.), what tests failed, etc. It is normal to get many warning when you compile. You do not need to report these.

      コンパイル、インストール、regression test は何事も無く終わりましたか? パッチを当てたとか、自分でソースコードに変更を加えたとか、regression テストで何が失敗したか等の情報を下さい。 ただ、コンパイルの最中にワーニングメッセージが出るのは普通のことなので、それは必要ありません。

  29. Now create, access and manipulate databases as desired. Write client programs to access the database server. In other words, enjoy!

    さあ、今からはやりたいようにデータベースの作成や操作を行ったり、データベースクライアントプログラムを書いたりして 楽しんで 下さい。