Home >Database >Mysql Tutorial >OpenBSD4.0 PostgreSQL8.1.5数据库的安装

OpenBSD4.0 PostgreSQL8.1.5数据库的安装

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 15:11:051213browse

欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入 一、建立postgresql相关用户 #groupadd postgresql #mkdir /home/postgres #useradd ?g postgresql postgres #passwd postgres 设置密码 password 确认密码 password 二、安装PostgreSQL #mkdir ?p /

欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入

    一、建立postgresql相关用户

    #groupadd postgresql

    #mkdir /home/postgres

    #useradd ?g postgresql postgres

    #passwd postgres

    设置密码 password

    确认密码 password

    二、安装PostgreSQL

    #mkdir ?p /var/postgresql/data                     
    *建立数据库初始目录,安装时会自动建立但会提示个错误。

    #chown ?R postgres /var/postgresql/data    
    *让用户postgres拥有数据库目录控制权限

    #pkg_add -r postgresql-server-8.1.5.tgz

    三、开机启动PostgreSQL数据库

    #vi /etc/rc.local                            
    *加入如下内容,注意格式
    CODE:[Copy to clipboard]if [ -x /usr/local/bin/pg_ctl -a -x /usr/local/bin/postmaster ]; then

    su postgres -c "/usr/local/bin/pg_ctl start -D /var/postgresql/data -l /var/postgresql/data/log.txt -o '-D /var/postgresql/data' -o '-k /var/www/tmp/'"

    ln -s /var/www/tmp/.s.PGSQL.5432 /tmp

    ln -s /var/www/tmp/.s.PGSQL.5432.lock /tmp

    echo -n ' postgresql'

    fi
    :wq    *保存退出

    #ln -s /var/www/tmp/.s.PGSQL.5432 /tmp

    #ln -s /var/www/tmp/.s.PGSQL.5432.lock /tmp

    四、关机时关闭PostgreSQL数据库

    #vi /etc/rc.shutdown    *加入如下内容,注意格式


    CODE:[Copy to clipboard]if [ -f /var/postgresql/data/postmaster.pid ]; then

    su postgres -c '/usr/local/bin/pg_ctl stop -m fast -D /var/postgresql/data'

    rm -f /var/postgresql/data/postmaster.pid

    fi
    :wq

 

[1] [2] [3] 

OpenBSD4.0 PostgreSQL8.1.5数据库的安装

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn