postgresql linux上のソースコードインストール
2917 ワード
ソースをダウンロードして解凍 [root@fnddb ~]# wget https://ftp.postgresql.org/pub/source/v9.4.0/postgresql-9.4.0.tar.bz2
[root@fnddb ~]# tar -xjvf postgresql-9.4.0.tar.bz2
[root@fnddb ~]# cd postgresql-9.4.0
コンパイルインストールの開始 [root@fnddb postgresql-9.4.0]# ./configure
……
checking for library containing shmget... none required
checking for library containing readline... no
configure: error: readline library not found
If you have readline already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-readline to disable readline support.
エラーメッセージに従って依存パッケージを順番にインストール [root@fnddb postgresql-9.4.0]# yum install readline-devel
[root@fnddb postgresql-9.4.0]# yum install zlib-devel
...
続行
[root@fnddb postgresql-9.4.0]# ./configure
[root@fnddb postgresql-9.4.0]# make
……
All of PostgreSQL successfully made. Ready to install.
[root@fnddb postgresql-9.4.0]# make install
……
PostgreSQL installation complete.
ユーザーの追加 [root@fnddb postgresql-9.4.0]# useradd postgres
[root@fnddb postgresql-9.4.0]# passwd postgres
Changing password for user postgres.
New password:
BAD PASSWORD: it is based on a dictionary word
Retype new password:
passwd: all authentication tokens updated successfully.
Database clusterターゲットフォルダの作成 [root@fnddb postgresql-9.4.0]# mkdir /var/lib/pgsql/data -p
[root@fnddb postgresql-9.4.0]# chown -R postgres /var/lib/pgsql
環境変数の設定 [root@fnddb postgresql-9.4.0]# su - postgres
[postgres@fnddb ~]$ vi .bash_profile
…
# postgres
PGDATA=/var/lib/pgsql/data
PATH=/usr/local/pgsql/bin:$PATH
export PGDATA PATH
[postgres@fnddb ~]$ . .bash_profile
database clusterの作成 [postgres@fnddb ~]$ pg_ctl initdb
......
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:
/usr/local/pgsql/bin/postgres -D /var/lib/pgsql/data
or
/usr/local/pgsql/bin/pg_ctl -D /var/lib/pgsql/data -l logfile start
データベース・インスタンスの起動
PGDATA環境変数を設定したら、-Dオプションなし[postgres@fnddb ~]$ pg_ctl start -l /var/lib/pgsql/pgsql.log
server starting
データベース・インスタンスを閉じる [postgres@fnddb ~]$ pg_ctl stop
waiting for server to shut down.... done
server stopped
自動起動の設定 [root@fnddb postgresql-9.4.0]# vi /etc/rc.local
…
su - c '/usr/local/pgsql/bin/pg_ctl start -D /var/lib/pgsql/data -l /var/lib/pgsql/pgsql.log'
[root@fnddb ~]# wget https://ftp.postgresql.org/pub/source/v9.4.0/postgresql-9.4.0.tar.bz2
[root@fnddb ~]# tar -xjvf postgresql-9.4.0.tar.bz2
[root@fnddb ~]# cd postgresql-9.4.0
[root@fnddb postgresql-9.4.0]# ./configure
……
checking for library containing shmget... none required
checking for library containing readline... no
configure: error: readline library not found
If you have readline already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-readline to disable readline support.
エラーメッセージに従って依存パッケージを順番にインストール [root@fnddb postgresql-9.4.0]# yum install readline-devel
[root@fnddb postgresql-9.4.0]# yum install zlib-devel
...
続行
[root@fnddb postgresql-9.4.0]# ./configure
[root@fnddb postgresql-9.4.0]# make
……
All of PostgreSQL successfully made. Ready to install.
[root@fnddb postgresql-9.4.0]# make install
……
PostgreSQL installation complete.
ユーザーの追加 [root@fnddb postgresql-9.4.0]# useradd postgres
[root@fnddb postgresql-9.4.0]# passwd postgres
Changing password for user postgres.
New password:
BAD PASSWORD: it is based on a dictionary word
Retype new password:
passwd: all authentication tokens updated successfully.
Database clusterターゲットフォルダの作成 [root@fnddb postgresql-9.4.0]# mkdir /var/lib/pgsql/data -p
[root@fnddb postgresql-9.4.0]# chown -R postgres /var/lib/pgsql
環境変数の設定 [root@fnddb postgresql-9.4.0]# su - postgres
[postgres@fnddb ~]$ vi .bash_profile
…
# postgres
PGDATA=/var/lib/pgsql/data
PATH=/usr/local/pgsql/bin:$PATH
export PGDATA PATH
[postgres@fnddb ~]$ . .bash_profile
database clusterの作成 [postgres@fnddb ~]$ pg_ctl initdb
......
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:
/usr/local/pgsql/bin/postgres -D /var/lib/pgsql/data
or
/usr/local/pgsql/bin/pg_ctl -D /var/lib/pgsql/data -l logfile start
データベース・インスタンスの起動
PGDATA環境変数を設定したら、-Dオプションなし[postgres@fnddb ~]$ pg_ctl start -l /var/lib/pgsql/pgsql.log
server starting
データベース・インスタンスを閉じる [postgres@fnddb ~]$ pg_ctl stop
waiting for server to shut down.... done
server stopped
自動起動の設定 [root@fnddb postgresql-9.4.0]# vi /etc/rc.local
…
su - c '/usr/local/pgsql/bin/pg_ctl start -D /var/lib/pgsql/data -l /var/lib/pgsql/pgsql.log'
[root@fnddb postgresql-9.4.0]# yum install readline-devel
[root@fnddb postgresql-9.4.0]# yum install zlib-devel
...
[root@fnddb postgresql-9.4.0]# ./configure
[root@fnddb postgresql-9.4.0]# make
……
All of PostgreSQL successfully made. Ready to install.
[root@fnddb postgresql-9.4.0]# make install
……
PostgreSQL installation complete.
[root@fnddb postgresql-9.4.0]# useradd postgres
[root@fnddb postgresql-9.4.0]# passwd postgres
Changing password for user postgres.
New password:
BAD PASSWORD: it is based on a dictionary word
Retype new password:
passwd: all authentication tokens updated successfully.
Database clusterターゲットフォルダの作成 [root@fnddb postgresql-9.4.0]# mkdir /var/lib/pgsql/data -p
[root@fnddb postgresql-9.4.0]# chown -R postgres /var/lib/pgsql
環境変数の設定 [root@fnddb postgresql-9.4.0]# su - postgres
[postgres@fnddb ~]$ vi .bash_profile
…
# postgres
PGDATA=/var/lib/pgsql/data
PATH=/usr/local/pgsql/bin:$PATH
export PGDATA PATH
[postgres@fnddb ~]$ . .bash_profile
database clusterの作成 [postgres@fnddb ~]$ pg_ctl initdb
......
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:
/usr/local/pgsql/bin/postgres -D /var/lib/pgsql/data
or
/usr/local/pgsql/bin/pg_ctl -D /var/lib/pgsql/data -l logfile start
データベース・インスタンスの起動
PGDATA環境変数を設定したら、-Dオプションなし[postgres@fnddb ~]$ pg_ctl start -l /var/lib/pgsql/pgsql.log
server starting
データベース・インスタンスを閉じる [postgres@fnddb ~]$ pg_ctl stop
waiting for server to shut down.... done
server stopped
自動起動の設定 [root@fnddb postgresql-9.4.0]# vi /etc/rc.local
…
su - c '/usr/local/pgsql/bin/pg_ctl start -D /var/lib/pgsql/data -l /var/lib/pgsql/pgsql.log'
[root@fnddb postgresql-9.4.0]# mkdir /var/lib/pgsql/data -p
[root@fnddb postgresql-9.4.0]# chown -R postgres /var/lib/pgsql
[root@fnddb postgresql-9.4.0]# su - postgres
[postgres@fnddb ~]$ vi .bash_profile
…
# postgres
PGDATA=/var/lib/pgsql/data
PATH=/usr/local/pgsql/bin:$PATH
export PGDATA PATH
[postgres@fnddb ~]$ . .bash_profile
database clusterの作成 [postgres@fnddb ~]$ pg_ctl initdb
......
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:
/usr/local/pgsql/bin/postgres -D /var/lib/pgsql/data
or
/usr/local/pgsql/bin/pg_ctl -D /var/lib/pgsql/data -l logfile start
データベース・インスタンスの起動
PGDATA環境変数を設定したら、-Dオプションなし[postgres@fnddb ~]$ pg_ctl start -l /var/lib/pgsql/pgsql.log
server starting
データベース・インスタンスを閉じる [postgres@fnddb ~]$ pg_ctl stop
waiting for server to shut down.... done
server stopped
自動起動の設定 [root@fnddb postgresql-9.4.0]# vi /etc/rc.local
…
su - c '/usr/local/pgsql/bin/pg_ctl start -D /var/lib/pgsql/data -l /var/lib/pgsql/pgsql.log'
[postgres@fnddb ~]$ pg_ctl initdb
......
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:
/usr/local/pgsql/bin/postgres -D /var/lib/pgsql/data
or
/usr/local/pgsql/bin/pg_ctl -D /var/lib/pgsql/data -l logfile start
PGDATA環境変数を設定したら、-Dオプションなし
[postgres@fnddb ~]$ pg_ctl start -l /var/lib/pgsql/pgsql.log
server starting
データベース・インスタンスを閉じる [postgres@fnddb ~]$ pg_ctl stop
waiting for server to shut down.... done
server stopped
自動起動の設定 [root@fnddb postgresql-9.4.0]# vi /etc/rc.local
…
su - c '/usr/local/pgsql/bin/pg_ctl start -D /var/lib/pgsql/data -l /var/lib/pgsql/pgsql.log'
[postgres@fnddb ~]$ pg_ctl stop
waiting for server to shut down.... done
server stopped
[root@fnddb postgresql-9.4.0]# vi /etc/rc.local
…
su - c '/usr/local/pgsql/bin/pg_ctl start -D /var/lib/pgsql/data -l /var/lib/pgsql/pgsql.log'