Xshell for Xmanager Enterprise 4 (Build 0186)
Copyright (c) 2002-2011 NetSarang Computer, Inc. All rights reserved.
Type `help' to learn how to use Xshell prompt.
Xshell:>
Connecting to 192.168.223.137:22...
Connection established.
Escape character is '^@]'.
Last login: Tue Jan 21 05:45:54 2014
/usr/bin/xauth: creating new authority file /home/sonny/.Xauthority
[sonny@localhost ~]$ ls
Desktop Documents Downloads Music Pictures Public Templates Videos
[sonny@localhost ~]$ yum install postgresql-server
Loaded plugins: fastestmirror, refresh-packagekit, security
You need to be root to perform this command.
[sonny@localhost ~]$ yum install http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm
Loaded plugins: fastestmirror, refresh-packagekit, security
You need to be root to perform this command.
[sonny@localhost ~]$ wget http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm
--2014-01-21 06:16:57-- http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm
Resolving yum.postgresql.org... 98.129.198.114, 2001:4800:7903:3::114
Connecting to yum.postgresql.org|98.129.198.114|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5240 (5.1K) [application/x-redhat-package-manager]
Saving to: ?.gdg-centos93-9.3-1.noarch.rpm?
100%[=====================================================================================================================================================>] 5,240 --.-K/s in 0s
2014-01-21 06:16:57 (90.0 MB/s) - ?.gdg-centos93-9.3-1.noarch.rpm?.saved [5240/5240]
[sonny@localhost ~]$ ls
Desktop Downloads pgdg-centos93-9.3-1.noarch.rpm Public Videos
Documents Music Pictures Templates
[sonny@localhost ~]$ yum install pgdg-centos93-9.3-1.noarch.rpm
Loaded plugins: fastestmirror, refresh-packagekit, security
You need to be root to perform this command.
[sonny@localhost ~]$ su root
Password:
[root@localhost sonny]# yum install pgdg-centos93-9.3-1.noarch.rpm
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: mirrors.neusoft.edu.cn
base | 3.7 kB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 1.3 MB 00:03
Setting up Install Process
Examining pgdg-centos93-9.3-1.noarch.rpm: pgdg-centos93-9.3-1.noarch
Marking pgdg-centos93-9.3-1.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package pgdg-centos93.noarch 0:9.3-1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================
Installing:
pgdg-centos93 noarch 9.3-1 /pgdg-centos93-9.3-1.noarch 2.1 k
Transaction Summary
===============================================================================================================================================================================================
Install 1 Package(s)
Total size: 2.1 k
Installed size: 2.1 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : pgdg-centos93-9.3-1.noarch 1/1
Verifying : pgdg-centos93-9.3-1.noarch 1/1
Installed:
pgdg-centos93.noarch 0:9.3-1
Complete!
[root@localhost sonny]# service postgresql-9.3 initdb
postgresql-9.3: unrecognized service
[root@localhost sonny]# chkconfig postgresql-9.3 on
error reading information on service postgresql-9.3: No such file or directory
[root@localhost sonny]# ls -l
total 40
drwxr-xr-x. 2 sonny sonny 4096 Jan 19 04:05 Desktop
drwxr-xr-x. 2 sonny sonny 4096 Jan 19 04:05 Documents
drwxr-xr-x. 2 sonny sonny 4096 Jan 19 04:05 Downloads
drwxr-xr-x. 2 sonny sonny 4096 Jan 19 04:05 Music
-rw-rw-r--. 1 sonny sonny 5240 May 8 2013 pgdg-centos93-9.3-1.noarch.rpm
drwxr-xr-x. 2 sonny sonny 4096 Jan 19 04:05 Pictures
drwxr-xr-x. 2 sonny sonny 4096 Jan 19 04:05 Public
drwxr-xr-x. 2 sonny sonny 4096 Jan 19 04:05 Templates
drwxr-xr-x. 2 sonny sonny 4096 Jan 19 04:05 Videos
[root@localhost sonny]# su sonny
[sonny@localhost ~]$ XXXXXXXXX
bash: XXXXXXXXX: command not found
[sonny@localhost ~]$ su sonny
Password:
[sonny@localhost ~]$ ls -l
total 40
drwxr-xr-x. 2 sonny sonny 4096 Jan 19 04:05 Desktop
drwxr-xr-x. 2 sonny sonny 4096 Jan 19 04:05 Documents
drwxr-xr-x. 2 sonny sonny 4096 Jan 19 04:05 Downloads
drwxr-xr-x. 2 sonny sonny 4096 Jan 19 04:05 Music
-rw-rw-r--. 1 sonny sonny 5240 May 8 2013 pgdg-centos93-9.3-1.noarch.rpm
drwxr-xr-x. 2 sonny sonny 4096 Jan 19 04:05 Pictures
drwxr-xr-x. 2 sonny sonny 4096 Jan 19 04:05 Public
drwxr-xr-x. 2 sonny sonny 4096 Jan 19 04:05 Templates
drwxr-xr-x. 2 sonny sonny 4096 Jan 19 04:05 Videos
[sonny@localhost ~]$ rpm -Uvh pgdg-centos93-9.3-1.noarch.rpm
error: can't create transaction lock on /var/lib/rpm/.rpm.lock (Permission denied)
[sonny@localhost ~]$ su root
Password:
su: incorrect password
[sonny@localhost ~]$ su root
Password:
[root@localhost sonny]# rpm -Uvh pgdg-centos93-9.3-1.noarch.rpm
Preparing... ########################################### [100%]
package pgdg-centos93-9.3-1.noarch is already installed
[root@localhost sonny]# cd /etc/yum.repos.d
[root@localhost yum.repos.d]# vi CenOS-Base.repo
[root@localhost yum.repos.d]# cd ..
[root@localhost etc]# cd ..
[root@localhost /]# ls
bin dev home lost+found mnt proc sbin srv tmp var
boot etc lib media opt root selinux sys usr
[root@localhost /]# cd usr
[root@localhost usr]# ls
bin etc games include lib libexec local sbin share src tmp
[root@localhost usr]# cd ..
[root@localhost /]# cd ..
[root@localhost /]# ls
bin dev home lost+found mnt proc sbin srv tmp var
boot etc lib media opt root selinux sys usr
[root@localhost /]# cd usr
[root@localhost usr]# ls
bin etc games include lib libexec local sbin share src tmp
[root@localhost usr]# cd ..
[root@localhost /]# ls
bin dev home lost+found mnt proc sbin srv tmp var
boot etc lib media opt root selinux sys usr
[root@localhost /]# cd home
[root@localhost home]# ls
sonny
[root@localhost home]# cd sonny
[root@localhost sonny]# ls
Desktop Downloads pgdg-centos93-9.3-1.noarch.rpm Public Videos
Documents Music Pictures Templates
[root@localhost sonny]# cd /etc/yum.repos.d
[root@localhost yum.repos.d]# ls
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo pgdg-93-centos.repo
[root@localhost yum.repos.d]# vi CentOS-Base.repo
[root@localhost yum.repos.d]# vi CentOS-Base.repo
[root@localhost yum.repos.d]# yum upgrade postgresql-libs
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirror.bit.edu.cn
* extras: mirror.bit.edu.cn
* updates: mirrors.neusoft.edu.cn
base | 3.7 kB 00:00
extras | 3.4 kB 00:00
pgdg93 | 3.1 kB 00:00
pgdg93/primary_db | 81 kB 00:01
updates | 3.4 kB 00:00
Setting up Upgrade Process
No Match for argument: postgresql-libs
No package postgresql-libs available.
No Packages marked for Update
[root@localhost yum.repos.d]# yum install postgresql93-server
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirror.bit.edu.cn
* extras: mirror.bit.edu.cn
* updates: mirrors.neusoft.edu.cn
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package postgresql93-server.i686 0:9.3.2-1PGDG.rhel6 will be installed
--> Processing Dependency: postgresql93 = 9.3.2-1PGDG.rhel6 for package: postgresql93-server-9.3.2-1PGDG.rhel6.i686
--> Processing Dependency: libpq.so.5 for package: postgresql93-server-9.3.2-1PGDG.rhel6.i686
--> Running transaction check
---> Package postgresql93.i686 0:9.3.2-1PGDG.rhel6 will be installed
---> Package postgresql93-libs.i686 0:9.3.2-1PGDG.rhel6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=======================================================================================================
Package Arch Version Repository Size
=======================================================================================================
Installing:
postgresql93-server i686 9.3.2-1PGDG.rhel6 pgdg93 4.0 M
Installing for dependencies:
postgresql93 i686 9.3.2-1PGDG.rhel6 pgdg93 1.0 M
postgresql93-libs i686 9.3.2-1PGDG.rhel6 pgdg93 193 k
Transaction Summary
=======================================================================================================
Install 3 Package(s)
Total download size: 5.1 M
Installed size: 21 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): postgresql93-9.3.2-1PGDG.rhel6.i686.rpm | 1.0 MB 00:28
(2/3): postgresql93-libs-9.3.2-1PGDG.rhel6.i686.rpm | 193 kB 00:04
(3/3): postgresql93-server-9.3.2-1PGDG.rhel6.i686.rpm | 4.0 MB 02:01
-------------------------------------------------------------------------------------------------------
Total 34 kB/s | 5.1 MB 02:35
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : postgresql93-libs-9.3.2-1PGDG.rhel6.i686 1/3
Installing : postgresql93-9.3.2-1PGDG.rhel6.i686 2/3
Installing : postgresql93-server-9.3.2-1PGDG.rhel6.i686 3/3
Verifying : postgresql93-libs-9.3.2-1PGDG.rhel6.i686 1/3
Verifying : postgresql93-server-9.3.2-1PGDG.rhel6.i686 2/3
Verifying : postgresql93-9.3.2-1PGDG.rhel6.i686 3/3
Installed:
postgresql93-server.i686 0:9.3.2-1PGDG.rhel6
Dependency Installed:
postgresql93.i686 0:9.3.2-1PGDG.rhel6 postgresql93-libs.i686 0:9.3.2-1PGDG.rhel6
Complete!
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# service postgresql-9.3 initdb
Initializing database: [ OK ]
[root@localhost yum.repos.d]# service postgresql-9.3 start
Starting postgresql-9.3 service: [ OK ]
[root@localhost yum.repos.d]# service postgresql-9.3 restart
Stopping postgresql-9.3 service: [ OK ]
Starting postgresql-9.3 service: [ OK ]
[root@localhost yum.repos.d]# pssql -U postgres
bash: pssql: command not found
[root@localhost yum.repos.d]# psql -U postgres
psql: FATAL: Peer authentication failed for user "postgres"
[root@localhost yum.repos.d]# cd var
bash: cd: var: No such file or directory
[root@localhost yum.repos.d]# cd ..
[root@localhost etc]# cd ..
[root@localhost /]# ls
bin dev home lost+found mnt proc sbin srv tmp var
boot etc lib media opt root selinux sys usr
[root@localhost /]# cd var
[root@localhost var]# ls
account crash empty gdm local log nis preserve spool www
cache db games lib lock mail opt run tmp yp
[root@localhost var]# cd lib
[root@localhost lib]# ls
alternatives DeviceKit-power gdm NetworkManager polkit-1 readahead udev
authconfig dhclient logrotate.status ntp postfix rpm udisks
bluetooth dnsmasq misc PackageKit prelink rsyslog xkb
dav fprint mlocate pgsql pulse samba yum
dbus games net-snmp plymouth random-seed stateless
[root@localhost lib]# cd pgsql
[root@localhost pgsql]# ls
9.3
[root@localhost pgsql]# cd 9.3
[root@localhost 9.3]# ls
backups data pgstartup.log
[root@localhost 9.3]# cd data
[root@localhost data]# ls
base pg_hba.conf pg_multixact pg_snapshots pg_subtrans PG_VERSION postmaster.opts
global pg_ident.conf pg_notify pg_stat pg_tblspc pg_xlog postmaster.pid
pg_clog pg_log pg_serial pg_stat_tmp pg_twophase postgresql.conf
[root@localhost data]# vi pg_hba.conf
[root@localhost data]# psql -U postgres
psql: FATAL: Peer authentication failed for user "postgres"
[root@localhost data]# service postgresql-9.3 restart
Stopping postgresql-9.3 service: [ OK ]
Starting postgresql-9.3 service: [ OK ]
[root@localhost data]# pssql -U postgres
bash: pssql: command not found
[root@localhost data]# psql -U postgres
psql (9.3.2)
Type "help" for help.
postgres=# alter user postgres with password 'XXXXXXX'
postgres-# show user
postgres-# q
[root@localhost data]#
感谢:张善友的分享http://www.cnblogs.com/shanyou/archive/2012/08/25/2656783.html