zoukankan      html  css  js  c++  java
  • postgresql-9.2 install

    [root@weblogic opt]# groupadd postgresql
    [root@weblogic opt]# useradd -g postgresql postgres

    [root@weblogic opt]# passwd postgres

    [root@weblogic opt]# chmod +x postgresql-9.2.19-1-linux-x64.run
    [root@weblogic opt]# ll postgresql-9.2.19-1-linux-x64.run
    -rwxr-xr-x 1 root root 39523652 Sep  6 01:12 postgresql-9.2.19-1-linux-x64.run

    安装

    [root@weblogic opt]# ./postgresql-9.2.19-1-linux-x64.run

    next---next 

    配置环境变量

    /etc/profile

    export LD_LIBRARY_PATH=/opt/PostgreSQL/9.2/lib:$LD_LIBRARY_PATH
    export PATH=/opt/PostgreSQL/9.2/bin:$PATH
    export PGDATA=/opt/PostgreSQL/9.2/data

    source /etc/profile

    su - postgres

    cd   /opt/PostgreSQL/9.2/bin

    初始化数据库

    [postgres@weblogic bin]$ ./initdb -D /opt/PostgreSQL/9.2/data
    initdb: invalid locale name ""
    initdb: invalid locale name ""
    initdb: invalid locale name ""
    initdb: invalid locale name ""
    initdb: invalid locale name ""
    initdb: invalid locale name ""
    The files belonging to this database system will be owned by user "postgres".
    This user must also own the server process.
    The database cluster will be initialized with locale "C".
    The default database encoding has accordingly been set to "SQL_ASCII".
    The default text search configuration will be set to "english".
    fixing permissions on existing directory /opt/PostgreSQL/9.2/data ... ok
    creating subdirectories ... ok
    selecting default max_connections ... 100
    selecting default shared_buffers ... 32MB
    creating configuration files ... ok
    creating template1 database in /opt/PostgreSQL/9.2/data/base/1 ... ok
    initializing pg_authid ... ok
    initializing dependencies ... ok
    creating system views ... ok
    loading system objects' descriptions ... ok
    creating collations ... locale: Cannot set LC_MESSAGES to default locale: No such file or directory
    ok
    creating conversions ... ok
    creating dictionaries ... ok
    setting privileges on built-in objects ... ok
    creating information schema ... ok
    loading PL/pgSQL server-side language ... ok
    vacuuming database template1 ... ok
    copying template1 to template0 ... ok
    copying template1 to postgres ... ok
    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:
        ./postgres -D /opt/PostgreSQL/9.2/data
    or
        ./pg_ctl -D /opt/PostgreSQL/9.2/data -l logfile start
    [postgres@weblogic bin]$

    启动PG

    [postgres@weblogic bin]$ ./postgres -i -D /opt/PostgreSQL/9.2/data &
    [1] 18363
    [postgres@weblogic bin]$ LOG:  database system was shut down at 2019-09-06 01:59:02 PDT
    LOG:  database system is ready to accept connections
    LOG:  autovacuum launcher started
    [postgres@weblogic bin]$ lsof -i:5432
    COMMAND    PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
    postgres 18363 postgres    3u  IPv4 439718      0t0  TCP *:postgres (LISTEN)
    postgres 18363 postgres    4u  IPv6 439719      0t0  TCP *:postgres (LISTEN)
    [postgres@weblogic bin]$
     

     登录PG

    [postgres@weblogic bin]$ psql
    psql.bin (9.2.19)
    Type "help" for help.
    postgres=# du
                                 List of roles
     Role name |                   Attributes                   | Member of
    -----------+------------------------------------------------+-----------
     postgres  | Superuser, Create role, Create DB, Replication | {}
    postgres=#

    PG 版本查看:

    postgres=# select version();
                                                        version                                                    
    ----------------------------------------------------------------------------------------------------------------
     PostgreSQL 9.2.19 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55), 64-bit
    (1 row)
    postgres=#
  • 相关阅读:
    hadoop_05
    分布式集群时间同步
    crontab定时任务
    操作系统笔记五:输入输出系统
    操作系统笔记四:文件管理与磁盘存储器管理
    操作系统笔记三:存储器管理
    操作系统笔记二:进程与调度(2)
    操作系统笔记二:进程与调度(1)
    可能的加分项
    对老师的建议
  • 原文地址:https://www.cnblogs.com/vzhangxk/p/11476928.html
Copyright © 2011-2022 走看看