Ubuntu under source installation POSTGREQL PgAdmin3

Source: Internet
Author: User
Tags psql

First, the installation of PostgreSQL

1, the installation of relevant dependencies, under the terminal execution:

sudo apt-get install Zlib1g-dev
sudo apt-get install Libreadline-dev

2. Download the source code to compile

Source: http://www.postgresql.org/ftp/source/

CD $the _dir_of_postgresql

./configure (You can add --prefix=pgsql the path you want to install later to specify the PostgreSQL installation path)

Make
Su
Make install

3. The necessary work after installation

# PostgreSQL cannot run as root user

$ mkdir/usr/local/pgsql/data
$ chown Computer system user name/usr/local/pgsql/data
Su-Computer system user name (this step is generally not, because we do not use the Linux system, we generally do not log on directly with the root)
/usr/local/pgsql/bin/initdb-d/usr/local/pgsql/data

# Create a log file
Touch/usr/local/pgsql/data/logfile
/usr/local/pgsql/bin/postgres-d/usr/local/pgsql/data >logfile 2>&1 &

4. Create Test Database tests

# After this statement is executed, PostgreSQL returns the information "CREATED DATABASE",

# indicates database setup is complete


/usr/local/pgsql/bin/createdb Test

# Enter the test database

/usr/local/pgsql/bin/psql Test

# Enter the Build Table statement:

CREATE TABLE mytable (id varchar (), name varchar (30));

# After completion, you will get a "CREATED" message indicating the success of the establishment.

# now insert a piece of data:

INSERT into mytable values (' Author ', ' Xu yongjiu ');

# Psql returns similar to INSERT 18 1

# Query whether the insert was successful:

SELECT * from MYTABLE;

# Exit Psql:
\q

# Exit Postgres User

Exit

Second, installation Pgadmin

1. Installation dependence:

sudo apt-get install Libxml2-dev

sudo apt-get install Libxslt1-dev

sudo apt-get install Libpq-dev

sudo apt-get install Wx-common Libwxgtk2.8-dev

2. If/usr/lib has libcrypto.so, skip 2 execution 3, otherwise:

Cd/usr/lib
# Create a link, libcrypto.so.x.y.z is a version of Crypto dynamic library file name under your/usr/lib
sudo ln-s libcrypto.so.x.y.z libcrypto.so

3. Switch to your pgadmin extracted directory and execute it in turn:
sudo./configure (--prefix= Specify Installation path--with-pgsql= specify the path of PostgreSQL)
sudo make all
sudo make install

4. Running Pgadmin

Cd/usr/local/pgadmin3/bin

sudo./pgadmin3

5. Create a shortcut

Create a new Pgadmin3.desktop file below the/usr/share/applications path and enter the contents:

[Desktop Entry]
Name=pgadmin3
Comment=pgadmin3
Encoding=utf-8
Exec=/usr/local/pgadmin3/bin/pgadmin3 (Note: Here is the installation path for your pgadmin3)
ICON=/USR/LOCAL/PGADMIN3/PG.XPM (Note: pgadmin3 is not icon, this is generated by me, can be downloaded, into the xpm format, placed under the Pgadmin3 installation path)
Terminal=false
Type=application
Categories=application;development;

Complete!!!!

Ubuntu under source installation POSTGREQL PgAdmin3

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.