"PostgreSQL Learning Journey" First: Linux and Windows installation PostgreSQL9.4

Source: Internet
Author: User
Tags postgresql psql sha1 postgresql client

First, Introduction

PostgreSQL is currently the world's richest data type support, some data types can be said that even commercial databases are not available, such as IP type and geometry type, and secondly, PostgreSQL is a full-featured free software database, for a long time, PostgreSQL is the only one free software database management system which supports the features of transaction, subquery, multi-version parallel control system (MVCC) and data integrity checking.

Second, the installation of Linux

1) Environment: RedHat Enterprise 6.5 x64 (2.6.32-431.el6.x86_64)

PostgreSQL 9.4.4

Selinux=disabled

Firewall off

2) Download the installation package:http://www.postgresql.org/download/, select Redhat

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/74/12/wKiom1YSgRixDZtWAAD9f6y-XpY077.jpg "title=" 1.png " Width= "420" height= "104" border= "0" hspace= "0" vspace= "0" style= "width:420px;height:104px;" alt= " Wkiom1ysgrixdztwaad9f6y-xpy077.jpg "/>

3) upload the downloaded package to the Linux server

[Email protected]]# lspostgresql94-9.4.4-1pgdg.rhel6.x86_64.rpm// PostgreSQL client program postgresql94-contrib-9.4.4-1pgdg.rhel6.x86_64.rpm// PostgreSQL third-party support library postgresql94-libs-9.4.4-1pgdg.rhel6.x86_64.rpm// PostgreSQL Library files postgresql94-server-9.4.4-1pgdg.rhel6.x86_64.rpm//postgresql server program

4) Install sequentially in the following order

[[Email protected] software]# rpm -ivh postgresql94-libs-9.4.4-1pgdg.rhel6.x86_64. rpmwarning: postgresql94-libs-9.4.4-1pgdg.rhel6.x86_64.rpm: header v4 dsa/sha1  signature, key id 442df0f8: nokeypreparing...                 ########################################### [100%]    1:postgresql94-libs      ##################################### ###### [100%][[email protected] software]# rpm -ivh  Postgresql94-9.4.4-1pgdg.rhel6.x86_64.rpmwarning: postgresql94-9.4.4-1pgdg.rhel6.x86_64.rpm: header  V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEYPreparing...                 ########################## ################# [100%]   1:postgresql94           ######################################## ### [100%][[email protected] software]# rpm -ivh  postgresql94-server-9.4.4-1pgdg.rhel6.x86_64.rpmwarning: postgresql94-server-9.4.4-1pgdg.rhel6.x86_64.rpm :  header v4 dsa/sha1 signature, key id 442df0f8: nokeypreparing ...                 ############## ############################# [100%]   1:postgresql94-server    ###### ##################################### [100%][[email protected] software]# rpm -ivh  postgresql94-contrib-9.4.4-1PGDG.rhel6.x86_64.rpmwarning:  Postgresql94-contrib-9.4.4-1pgdg.rhel6.x86_64.rpm: header v4 dsa/sha1 signature, key  id 442df0f8: nokeypreparing...                ########################################### [100%]    1:postgresql94-contrib   ########################################### [ 100%]

5) Start the PostgreSQL database

The first time you start the PostgreSQL database service, you are prompted to first initialize the

[Email protected] software]#/etc/init.d/postgresql-9.4 start/var/lib/pgsql/9.4/data is missing.     Use "service postgresql-9.4 Initdb" to initialize the cluster first. [FAILED]

#初始化数据库:

[Email protected]]# service postgresql-9.4 initdbinitializingdatabase: [OK]

#启动服务:

[[Email protected]]# service postgresql-9.4 startStartingpostgresql-9.4 service: [OK]

#将服务加入启动列表中

[[Email protected]]# chkconfig postgresql-9.4 on

#默认安装完PostgreSQL之后, whose account is postgres, change its password:

[[email protected]]# su postgresbash-4.1$ psqlpsql  (9.4.4) Type "Help"  for  help. postgres=# alteruser postgres with password  ' Postgres '; alter rolepostgres=# select *from pg_shadow; usename | usesysid |  usecreatedb | usesuper | usecatupd | userepl |                passwd                 | valuntil |  Useconfig----------+----------+-------------+----------+-----------+---------+--------------------------------- ----+----------+----------- postgres |       10 | t            | t         | t         | t       | md53175bce1d3201d16594cebf9d7eb3f9d|           | (1 row)

6) Test Database

postgres=# CreateDatabase TestDB; CREATE databasepostgres=# \ctestdb; You is nowconnected to database "TestDB" as User "Postgres". testdb=# createtable Test (id integer,name text); CREATE tabletestdb=# Insert Intotest (id,name) VALUES (111, ' Alex '); Insert 0 1testdb=# select *from test; ID |name-----+------111 | Alex (1 row)

Third, under Windows installation

1) Environment: Windows Server Enterprise x64

2) Download the installation package:http://www.postgresql.org/download/, select Windows

3) upload the installation package to the remote Windows Server

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/74/10/wKioL1YShB2iP-YfAAAeRycbMeE767.jpg "title=" 15.png "alt=" Wkiol1yshb2ip-yfaaaerycbmee767.jpg "/>

#右键-"Run as administrator" to start the installation

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/74/10/wKioL1YShGaDhhsKAADpiKaKU4A345.jpg "title=" 3.png " Width= "456" height= "348" border= "0" hspace= "0" vspace= "0" style= "width:456px;height:348px;" alt= " Wkiol1yshgadhhskaadpikaku4a345.jpg "/>

#选择软件安装目录, here I am the default

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/74/13/wKiom1YShJCi-25BAACbtDGyz2A269.jpg "title=" 4.png " Width= "456" height= "351" border= "0" hspace= "0" vspace= "0" style= "width:456px;height:351px;" alt= " Wkiom1yshjci-25baacbtdgyz2a269.jpg "/>

# Choose the data storage directory, because I am used to learn, so by default, in reality, to create a separate data folder as needed

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/74/10/wKioL1YSg3TQwBvaAACU63bn7Vw169.jpg "style=" width : 456px;height:348px; "title=" 5.png "width=" 456 "height=" 348 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiol1ysg3tqwbvaaacu63bn7vw169.jpg "/>

#设置数据库默认账户postgres的密码

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/74/12/wKiom1YSg2HCQMROAACbbGUHcfY044.jpg "style=" width : 456px;height:348px; "title=" 6.png "width=" 456 "height=" 348 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiom1ysg2hcqmroaacbbguhcfy044.jpg "/>

#设置端口号, the PostgreSQL database default port number is 5432 and can be modified as needed, here by default

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/74/10/wKioL1YSg3SQ9fxFAACA04knzN0944.jpg "style=" width : 456px;height:351px; "title=" 7.png "width=" 456 "height=" 351 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiol1ysg3sq9fxfaaca04knzn0944.jpg "/>

#选择语言, in order to prevent unnecessary errors in the future, I choose here english:unitedstate

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/74/12/wKiom1YSg2HiMCvfAACOwxafHyc756.jpg "style=" width : 456px;height:345px; "title=" 8.png "width=" 456 "height=" 345 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiom1ysg2himcvfaacowxafhyc756.jpg "/>

#开始进行安装配置

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/74/10/wKioL1YSg3Wy9KPKAACBgTYGJqQ004.jpg "style=" width : 456px;height:351px; "title=" 9.png "width=" 456 "height=" 351 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiol1ysg3wy9kpkaacbgtygjqq004.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/74/12/wKiom1YSg2LzCw-SAACqN2UE5eo660.jpg "style=" width : 456px;height:351px; "title=" 10.png "width=" 456 "height=" 351 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiom1ysg2lzcw-saacqn2ue5eo660.jpg "/>

#安装完成, ask if you want to install stack Builder, you can choose not to install, this is to download the installation of some additional tools

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/74/10/wKioL1YSg3bwgJEMAAEzGj6rpBc717.jpg "style=" width : 456px;height:351px; "title=" 11.png "width=" 456 "height=" 351 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiol1ysg3bwgjemaaezgj6rpbc717.jpg "/>

#安装完成后的目录如下:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/74/12/wKiom1YSg2TRtDnbAACuUxnvnsA516.jpg "style=" width : 138px;height:242px; "title=" 12.png "width=" 138 "height=" 242 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiom1ysg2trtdnbaacuuxnvnsa516.jpg "/>

Application Stacker Builder: Used to download and install additional tools to be introduced later

Pgadmin III: Third-party PostgreSQL connection tool

SQL Shell (psql): Psql Access Tool, also a tool

4) test the database and open the SQL Sell tool

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/74/10/wKioL1YSg3fCn2FaAAE-3PfrRRA587.jpg "style=" width : 465px;height:298px; "title=" 13.png "width=" 465 "height=" 298 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiol1ysg3fcn2faaae-3pfrrra587.jpg "/>

Where server is local and can be ignored

Database: Names of databases that need to be connected

Port: Port number, if modified at the time of installation, use the modified ports

Username: Default Postgres

Password for user postgres: set when installed

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/74/12/wKiom1YSg2TAXxgXAAMtlXTlOIY236.jpg "style=" width : 556px;height:227px; "title=" 14.png "width=" 556 "height=" 227 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiom1ysg2taxxgxaamtlxtloiy236.jpg "/>

OK , next open pgadmin III, you can see the newly created database and table


This article is from the Eagle Eye blog, so be sure to keep this source http://eagle2014.blog.51cto.com/7992740/1700303

"PostgreSQL Learning Journey" First: Linux and Windows installation PostgreSQL9.4

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.