Installation environment:
Ubuntu 64bit
PostgreSQL 9.0
1. Install PostgreSQL
Enter the following command
Sudo apt-Get install PostgreSQL
The system prompts you to install the required disk space. Enter "Y" to installProgramWill be completed automatically. After the installation is complete, the system will create a database superuser "Postgres" with a blank password. This user is both an Unlogged operating system user and a database user.
2. Modify the Ubuntu user's Postgres Password
Enter the following command
Sudo passwd ipvs
3. Modify the password of database superuser S
1) switch to Ubuntu Postgres user
Sudo su Postgres
2) log on to the ipvs Database
Psql Postgres
In this way, you will see the following prompt message for S:
Psql (9.0.0)
Type "help" for help.
The command line prompt symbol of ipvs is displayed:
Postgres = #
3) enter the following command:
Alter User Login s with password 'Password'
Type "\ q" to return to the Ubuntu command line.
4. Add User and database defined by yourself. Any command in the database can be used in the form of command -- Help for help.
For example, createuser
1) Add a new user
Createuser-DrspFedoraadmin
This parameter indicates that a user can create a database, a user can create other users, the user is not a super administrator user, and a password needs to be assigned to the account.
Enter the password of the user as prompted.
2) create a database belonging to the Custom User fedoraadmin
Createdb-O fedoraadmin mydb
With the above settings, you can use the following configuration in Java to connect to the PostgreSQL database:
User: fedoraadmin
Password: Your Password
URL: JDBC: PostgreSQL: // localhost: 5432/mydb
5. Install pgadmin3
1) run the following command to install pgadmin3:
Sudo apt-Get install pgadmin3
2) type the following command to run pgadmin3.
Pgadmin3
You will see the main interface of pgadmin3 as follows:
Add parameters to create a connection to PostgreSQL:
6. Set access to ipvs on other machines
Modify/etc/PostgreSQL/9.0/main/pg_assist.conf:
Host All all 0.0.0.0/0 MD5 #0.0.0.0 is the address segment, and 0 is the binary bit
For example, 192.168.0.0/16 represents 192.168.0.1-192.168.255.254
Modify/etc/PostgreSQL/9.0/main/PostgreSQL. conf
Listen_address = '*'
Restart Database
Sudo/etc/init. d/postgresql-9.0 restart