[[PostgreSQL]]

~
*yumでインストール [#f0693fe2]
注意:yumでインストールした場合、現状では8.4系がインストールされる。
 # yum install postgresql-server <--postgresqlのインストール
 # chkconfig postgresql on  <--サーバー再起動時に自動起動
 # service postgresql initdb <--データベースの初期化
 # service postgrsql start <--サービスの起動

***9系のインストール手順 [#l1d2c1d1]
 # cd /usr/local/src
 # wget ほにゃらら
 http://yum.postgresql.org/repopackages.phpから目的のバージョンのリポジトリ用rpmをダウンロードする
 # rpm -ivh http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm
 # yum install postgresql93 postgresql93-server
 # chkconfig posgresql-9.3 on
 # service postgresql-9.3 initdb --no-locale
 データベースを初期化中:                                    [  OK  ]

~
*ソースからインストール [#ffcc6d5c]
 # useradd postgres
 # passwd postgres ******
 # su - posgres
 $ wget http://ftp.postgresql.org/pub/source/v9.0.4/postgresql-9.0.4.tar.gz
 $ tar xfvz postgresql-9.0.4.tar.gz
 $ cd postgresql-9.0.4
 $ ./configure
 	checking for -lreadline... no
 	checking for -ledit... 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.
 
 $su -
 # yum install readline-devel
 # su - posgres
 $ cd posgres-9.0.4
 $ ./configure
 $ make
 	All of PostgreSQL successfully made. Ready to install.
 $ su -
 $ cd /home/postgres/postgres-9.0.4/
 $ make install
 	PostgreSQL installation complete.
 $ vi /home/postgres/.bash_profile
 	export PATH=/usr/local/pgsql/bin:$PATH
 	export LD_LIBRARY_PATH=/usr/local/pgsql/lib:$LD_LIBRARY_PATH
 $ source .bash_profile
 $ initdb -D /home/postgres/data --no-locale
 	Success. You can now start the database server using:
 	
 ※locale、エンコーディングは未指定の場合はOSのものがtemplateに登録される。後から指定可能だが、エンコーディングはlocaleと互換性が無いと問題が発生する可能があるため、localeは--no-localeにしておくことが推奨される。	
 	
 $ pg_ctl start -D /home/postgres/data/ -w
 	server started
 $ ps aux | grep postgres
 	postgres 14817  0.6  0.2  53088  4140 pts/0    S    16:03   0:00 /usr/local/pgsql/bin/postgres -D /home/postgres/data
 	postgres 14819  0.0  0.0  53088  1024 ?        Ss   16:03   0:00 postgres: writer process
 	postgres 14820  0.0  0.0  53088   928 ?        Ss   16:03   0:00 postgres: wal writer process
 	postgres 14821  0.0  0.0  53924  1864 ?        Ss   16:03   0:00 postgres: autovacuum launcher process
 	postgres 14822  0.0  0.0  16132   932 ?        Ss   16:03   0:00 postgres: stats collector process
 
 
 
 
*アンインストール [#m8cb039e]
注意:場合によってはroot権限で実行する必要がある。
 $ pg_ctl stop -D /home/postgres/data/
 waiting for server to shut down.... done
 server stopped
 $ su -
 $ cd /home/postgre/postgres-9.0.4/
 $ make uninstall
 $ rm -rf data
 $ vi .bash_profile
 	#export PATH=/usr/local/pgsql/bin:$PATH
 	#export LD_LIBRARY_PATH=/usr/local/pgsql/lib:$LD_LIBRARY_PATH
 $ source .bash_profile


~

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS