Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gisEnv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
徐鸿
gisEnv
Commits
bdd57cd7
Commit
bdd57cd7
authored
Mar 29, 2022
by
徐鸿
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
postgresql install
parent
bdf92d36
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
37 deletions
+40
-37
postgresql.sh
postgresql.sh
+40
-37
No files found.
postgresql.sh
100644 → 100755
View file @
bdd57cd7
#!/bin/bash
#!/bin/bash
#进入软件的制定安装目录
cp
./postgresql-10.5.tar.gz /usr/gisdeploy
cd
/usr/gisdeploy
cd
/usr/gisdeploy
mv
../postgresql-10.5.tar.bz2 ./
tar
zxvf postgresql-10.5.tar.gz
tar
-jxvf
postgresql-10.5.tar.bz2
echo
"pgsql tar sucess"
fi
echo
"pgsql文件解压成功"
#is postgres exist
#判断用户是否存在
id
$postgres
>
& /dev/null
id
$postgres
>
& /dev/null
echo
"
用户postgres已存在
"
echo
"
postgres exist
"
if
[
$?
-ne
0
]
if
[
$?
==
0
]
then
then
echo
"
用户不存在,开始创建postgres用户
"
echo
"
create postgres
"
groupadd postgres
groupadd postgres
useradd
-g
postgres postgres
useradd
-g
postgres postgres
fi
fi
echo
"重命名postgresql并且进入安装目录"
echo
"enter postgresql dir"
mv
/usr/local/post
*
/usr/local/pgsql
rm
/usr/gisdeploy/postgresql-10.5.tar.gz
-rf
cd
/usr/local/pgsql
mv
/usr/gisdeploy/postgresql-10.5 /usr/gisdeploy/pgsql/
#-------------------------------安装pgsql------------------------------------
cd
/usr/gisdeploy/pgsql/
echo
"安装一些库文件"
yum
install
-y
zlib zlib-devel
>
& /del/null
#-------------------------------pgsql------------------------------------
echo
"开始执行configure步骤"
./configure
--prefix
=
/usr/local/pgsql
--without-readline
echo
"install lib"
yum
install
-y
zlib zlib-devel
>
& /dev/null
echo
"configure"
./configure
--prefix
=
/usr/gisdeploy/pgsql
--without-readline
if
[
$?
==
0
]
if
[
$?
==
0
]
then
then
echo
"configure
配置通过,开始进行make编译
"
echo
"configure
finish make
"
make
make
if
[
$?
==
0
]
if
[
$?
==
0
]
then
then
echo
"
make编译通过,开始进行make install安装步骤
"
echo
"
start make
"
make
install
make
install
if
[
$?
!=
0
]
;
then
if
[
$?
!=
0
]
;
then
echo
"make install
安装失败
"
echo
"make install
fail
"
fi
fi
echo
"
安装成功
"
echo
"
make install sucess
"
else
else
echo
"make
编译失败,检查错误。
"
echo
"make
fail
"
fi
fi
else
else
echo
"configure
检查配置失败,请查看错误进行安装库文件
"
echo
"configure
check error
"
fi
fi
echo
"开始进行pgsql的配置"
echo
"configure pgsql"
echo
"给pgsql创建data目录"
echo
"create pgsql data dir"
mkdir
-p
/usr/local/pgsql/data
mkdir
-p
/usr/gisdeploy/pgsql/data
echo
"修改用户组"
chown
-R
postgres:postgres /usr/local/pgsql
echo
"modify group"
echo
"添加环境变量,进入postgres用户的家目录"
chown
-R
postgres:postgres /usr/gisdeploy/pgsql
echo
"add env"
cd
/home/postgres
cd
/home/postgres
if
[
-f
.bash_profile
]
;
then
if
[
-f
.bash_profile
]
;
then
cp
.bash_profile .bash_profile.bak
cp
.bash_profile .bash_profile.bak
echo
"export PGHOME=/usr/
local
/pgsql"
>>
.bash_profile
echo
"export PGHOME=/usr/
gisdeploy
/pgsql"
>>
.bash_profile
echo
"export PGDATA=/usr/
local
/pgsql/data"
>>
.bash_profile
echo
"export PGDATA=/usr/
gisdeploy
/pgsql/data"
>>
.bash_profile
echo
"PATH=
$PGHOME
/bin:
$PATH
"
>>
.bash_profile
echo
"PATH=
$PGHOME
/bin:
$PATH
"
>>
.bash_profile
echo
"MANPATH=
$PGHOME
/share/man:
$MANPATH
"
>>
.bash_profile
echo
"MANPATH=
$PGHOME
/share/man:
$MANPATH
"
>>
.bash_profile
echo
"LD_LIBRARY_PATH=
$PGHOME
/lib:
$LD_LIBRARY_PATH
"
>>
.bash_profile
echo
"LD_LIBRARY_PATH=
$PGHOME
/lib:
$LD_LIBRARY_PATH
"
>>
.bash_profile
fi
fi
alias
pg_start
=
'pg_ctl -D $PGDATA -l /usr/
local
/pgsql/logfile start'
alias
pg_start
=
'pg_ctl -D $PGDATA -l /usr/
gisdeploy
/pgsql/logfile start'
alias
ps_stop
=
'pg_ctl -D $PGDATA -l /usr/
local
/pgsql/logfile stop'
alias
ps_stop
=
'pg_ctl -D $PGDATA -l /usr/
gisdeploy
/pgsql/logfile stop'
echo
"
切换至postgres用户来初始化数据库
"
echo
"
postgres init
"
su - postgres
-c
"/usr/
local/pgsql/bin/initdb -D /usr/local/pgsql/data
"
su - postgres
-c
"/usr/
gisdeploy/pgsql/bin/pg_ctl -D /usr/gisdeploy/pgsql/data -l logfile start
"
echo
"---------------------------------------------------------------------------------------"
echo
"---------------------------------------------------------------------------------------"
echo
"---------------------------------------------------------------------------------------"
echo
"---------------------------------------------------------------------------------------"
echo
"----------------------------SUCCESS INSTALLATION OF POSTGRESQL-------------------------"
echo
"----------------------------finish-------------------------"
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment