The selected database is installed with the run file, which is easier to master. This database is all the default installation, if there is a need to modify the self.
This is my first blog, the audience master, if you feel where there is anything bad, you can leave a message to explore and discuss. There are problems can also learn together.
One , open the centos7 ssh
Because my CentOS7 is newly installed, so I need to love to open ssh, if you are already in use, this is ignored.
1.1 setting up a static IP
1.1.1 Enter the/etc/sysconfig/network-scripts/ directory to find the configuration file for the network to be modified and modify it .
Example : Vim/etc/sysconfig/network-scripts/ifcfg-eth0
1.1.2 Modify the following content
- bootproto= "Static" #dhcp改为static
- onboot= "Yes" #开机启用本配置
- ipaddr=192.168.200.106 #静态IP
- gateway=192.168.200.1 #默认网关
- netmask=255.255.255.0 #子网掩码
- dns1=192.168.99.99 #DNS Configuration
1.1.3 Final Effect
- #]# Cat/etc/sysconfig/network-scripts/ifcfg-eth0
- Hwaddr= "00:15:5d:07:f1:02"
- Type= "Ethernet"
- bootproto= "Static" #dhcp改为static
- Defroute= "Yes"
- Peerdns= "Yes"
- Peerroutes= "Yes"
- Ipv4_failure_fatal= "No"
- ipv6init= "Yes"
- ipv6_autoconf= "Yes"
- Ipv6_defroute= "Yes"
- Ipv6_peerdns= "Yes"
- Ipv6_peerroutes= "Yes"
- Ipv6_failure_fatal= "No"
- Name= "Eth0"
- Uuid= "Aa7e302d-dc46-54u8-881e-d46cafd0nm98"
- onboot= "Yes" #开机启用本配置
- ipaddr=192.168.7.106 #静态IP
- gateway=192.168.7.1 #默认网关
- netmask=255.255.255.0 #子网掩码
- dns1=192.168.7.1 #DNS Configuration
1.1.4 Restart Service
- # Service Network Restart
1.2 open ssh
1.2.1 entering the sshd configuration file
Vi/etc/ssh/sshd_config
Open Port 22
put Passwordauthentication Set as Yes
Find #PermitRootLogin no to modify it to permitrootlogin Yes
Service sshd Restart Restart Services
two,installationpostgresql-9.4 Runfile
2.1 Installation : under root
2.1.1 -Fool installation
[Email protected] opt]# chmod 777 Postgresql-9.4.12-1-linux.run
[Email protected] opt]#./postgresql-9.4.12-1-linux.run
install directly to opt/postgresql/by default
In the middle only set user postgres password Note
2.2 assigning configuration files to postgres users ( can skip )
2.2.1 Copying a configuration file
- [Email protected] opt]# Su-postgres
- -bash-4.6$ pwd
- /opt/postgresql/9.4
- -bash-4.6$ Su-
- Password:
- [email protected] ~]# CP. bash_profile/opt/postgresql/9.4
- [email protected] ~]# CP. bashrc/opt/postgresql/9.4
- [Email protected] ~]# Su-postgres
2.2.2 changing file permissions
- [Email protected] postgresql]# pwd
- /opt/postgresql
- [Email protected] postgresql]# chown-r postgres:postgres/opt/postgresql/
- [email protected] postgresql]# LL
- Total 4
- Drwxr-xr-x postgres postgres 4096 4 months 18:52 9.0
4
2.2.3 Then set the environment variables for the Postgres user
- Export pghome=/opt/postgresql/9.4
- Export path= $PGHOME/bin: $PATH
- Export Pgdata= $PGHOME/data
- Export Ld_library_path= $PGHOME/lib
2.2.4 then we can start the service, in fact the default service and start the
- [[Email protected] ~]# service postgresql-9.4 start
2.2.5 checking ports and service status
- [Email protected] ~]# chkconfig--list postgresql-9.4
- postgresql-9.4 0:off 1:off 2:on 3:on 4:on 5:on 6:off
- [Email protected] ~]# Netstat-ano | grep 5432
- TCP 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN off (0.00/0/0)
- TCP 0 0::: 5432:::* LISTEN off (0.00/0/0)
- UNIX 2 [ACC] STREAM LISTENING 3759370/tmp/.s.pgsql.5432
Direct configuration under 2.3 root ( Skip 2.2)
this does not have to assign permissions , let the root permission to do
Configure directly under root . Bash_profile
Export pghome=/opt/postgresql/9.4
Export Pgdata= $PGHOME/data
Path= $PATH: $HOME/bin: $PGHOME/bin
start the service to see the same ports
2.4 configuration pg_hba.conf
# IPV4 Local connections:
Host All 127.0.0.1/32 MD5
Host All 0.0.0.0/0 MD5
2.5 Set self-boot , open port
Sometimes it is not connected , it is possible that the 5432 is closed so need to reopen
Start the service and set it to boot
Systemctl Enable postgresql-9.4
Systemctl Start postgresql-9.4
Open firewall Port
Firewall-cmd--permanent--add-port=5432/tcp
Firewall-cmd--permanent--add-port=80/tcp
Firewall-cmd--reload
Appendix
a reference to some questions
how to CentOS 7 configuration static IP address
http://Linux. cn/article-3977-1.html
in the Assign multiple IP addresses to a network adapter on CentOS 7
Https://linux.cn/article-5127-1-rel.html
PostgreSQL installation ( under linux )
Http://jingyan.baidu.com/article/4f7d5712cf761e1a20192784.html
SSH Login failed, prompting "Password authentication failed"
http://m.blog.csdn.net/article/details?id=6045176
error :: Could not connect to server:Connection refused (0x00002740/10061)
is the server running on host "xxx.xxx.xx.xx" and accepting
TCP/IP connetions on port 5432?
Http://m.ithao123.cn/content-5942383.html
Centos7 PostgreSQL Installation
http://m.blog.csdn.net/article/details?id=50359549
Common Linux directives
CentOS7 installation PostgreSQL9.4