0

Install apache, php5.5, postgresql9.5, pgadmin3 on centos 7

Install apache

open terminal, then :

sudo yum install httpd
Total download size: 3.0 M
Installed size: 9.9 M
Is this ok [y/d/N]: y
..
..
..
Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-2.1511.el7.centos.2.10.x86_64 (@anaconda)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Is this ok [y/N]: y


after installed, start the apache with :

sudo systemctl start httpd

Permanently start when boot :

sudo systemctl enable httpd

Allow the default HTTP(80) and HTTPS(443) port, through firewalld :

sudo firewall-cmd --permanent --add-port=80/tcp
sudo firewall-cmd --permanent --add-port=443/tcp

reload firewall :

sudo firewall-cmd --reload

test apache on browser with http://localhost :

test-apache-httpd-ona-localhost

Install PHP 5.5

First step, download epel :

sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:epel-release-7-8                 ################################# [100%]

Then you must download the Webtatic EL :

sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:webtatic-release-7-3             ################################# [100%]

Install PHP5.5

sudo yum install php55w php55w-opcache
================================================================================
 Package               Arch          Version              Repository       Size
================================================================================
Installing:
 php55w                x86_64        5.5.38-1.w7          webtatic        2.8 M
 php55w-opcache        x86_64        5.5.38-1.w7          webtatic        101 k
Installing for dependencies:
 php55w-cli            x86_64        5.5.38-1.w7          webtatic        2.9 M
 php55w-common         x86_64        5.5.38-1.w7          webtatic        1.2 M

Transaction Summary
================================================================================
Install  2 Packages (+2 Dependent packages)

Total download size: 7.0 M
Installed size: 27 M
Is this ok [y/d/N]: y
..
..
..
Importing GPG key 0x62E74CA5:
 Userid     : "Webtatic EL7 "
 Fingerprint: 830d b159 6d9b 9b01 99dc 24a3 e87f d236 62e7 4ca5
 Package    : webtatic-release-7-3.noarch (installed)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-webtatic-el7
Is this ok [y/N]: y

install extension: php55w_gd (graphic draw)

sudo yum install php55w-gd

install extension: php55w_xmlwriter

sudo yum install php55w-xmlwriter

install extension: php55w-pgsql (postgresql)

sudo yum install php55w-pgsql

another extension if you needed :

Package Provides
php55w mod_php, php55w-zts
php55w-bcmath
php55w-cli php-cgi, php-pcntl, php-readline
php55w-common php-api, php-bz2, php-calendar, php-ctype, php-curl, php-date, php-exif, php-fileinfo, php-ftp, php-gettext, php-gmp, php-hash, php-iconv, php-json, php-libxml, php-openssl, php-pcre, php-pecl-Fileinfo, php-pecl-phar, php-pecl-zip, php-reflection, php-session, php-shmop, php-simplexml, php-sockets, php-spl, php-tokenizer, php-zend-abi, php-zip, php-zlib
php55w-dba
php55w-devel
php55w-embedded php-embedded-devel
php55w-enchant
php55w-fpm
php55w-gd
php55w-imap
php55w-interbase php_database, php-firebird
php55w-intl
php55w-ldap
php55w-mbstring
php55w-mcrypt
php55w-mssql
php55w-mysql php-mysqli, php_database
php55w-mysqlnd php-mysqli, php_database
php55w-odbc php-pdo_odbc, php_database
php55w-opcache php55w-pecl-zendopcache
php55w-pdo php55w-pdo_sqlite, php55w-sqlite3
php55w-pecl-gearman
php55w-pecl-geoip
php55w-pecl-memcache
php55w-pecl-xdebug
php55w-pgsql php-pdo_pgsql, php_database
php55w-process php-posix, php-sysvmsg, php-sysvsem, php-sysvshm
php55w-pspell
php55w-recode
php55w-snmp
php55w-soap
php55w-tidy
php55w-xml php-dom, php-domxml, php-wddx, php-xsl
php55w-xmlrpc

create sample script – phpinfo.php in /var/www/html :

sudo vi /var/www/html/phpinfo.php

type insert, add script like this :

<?php
phpinfo();
?>

type escape, type :x, enter

restart apache :

sudo systemctl restart httpd

test script : http://localhost/phpinfo.php

phpinfo php5.5

Install Postgresql9.5

Install Repository postgresql :

sudo rpm -Uvh http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-2.noarch.rpm

Install postgresql 9.5 with the following :

sudo yum install postgresql95-server postgresql95
Total download size: 5.6 M
Installed size: 24 M
Is this ok [y/d/N]: y

Initial DB :

sudo /usr/pgsql-9.5/bin/postgresql95-setup initdb
Initializing database ... OK

Start postgresql 9.5 :

sudo systemctl start postgresql-9.5
sudo systemctl enable postgresql-9.5

Set postgresql password :

sudo su - postgres
-bash-4.2$ psql
psql (9.5.5)
Type "help" for help.

postgres=# \password
Enter new password: 
Enter it again: 
postgres=# \q
-bash-4.2$ exit

Install Pgadmin3

sudo yum install pgadmin3_95.x86_64
Total download size: 16 M
Installed size: 64 M
Is this ok [y/d/N]: y

open

vi /var/lib/pgsql/9.5/data/pg_hba.conf

change like this (for default pgadmin for localhost):

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5

then restart postgresql-9.5 :

sudo systemctl restart postgresql-9.5

OR if you need to Remote database, open again :

sudo vi /var/lib/pgsql/9.5/data/pg_hba.conf

find and change like this :

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
host    all             all             0.0.0.0/0               trust
# IPv6 local connections:
host    all             all             ::1/128                 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     postgres                                peer
#host    replication     postgres        127.0.0.1/32            ident
#host    replication     postgres        ::1/128                 ident

open postgresql.conf

sudo vi /var/lib/pgsql/9.5/data/postgresql.conf

find and change to :

# - Connection Settings -

listen_addresses = '*'         # what IP address(es) to listen on;
                                        # comma-separated list of addresses;
                                        # defaults to 'localhost'; use '*' for all
                                        # (change requires restart)
port = 5432 

restart postgresql 9.5 :

sudo systemctl restart postgresql-9.5

then, try remote database with pgadmin :
how to remote postgresql in pgadmin3

Click Ok, and you will connect to the database! 🙂

[related_post themes="text" id="4796"]

Ambar Hasbiyatmoko

Hello, I’m web developer. Passionate about programming, networking and web server. @kaskus  @facebook

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.