Installation environment:
Ubuntu 10.04-desktop-i386
PostgreSQL 8.4
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 Linux User's Postgres Password
Enter the following command
Sudo passwd ipvs
3. Modify the password of database superuser S
1) switch to Postgres user in Linux
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 (8.4.4)
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 "exit" to return to the Linux Command Line.
4. Add Custom Users and databases
1) Add a new user
Createuser-drsp fedoraadmin
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/8.4/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/8.4/main/PostgreSQL. conf
Listen_address = '*'
Restart Database
Sudo/etc/init. d/postgresql-8.4 restart