This repository has been archived by the owner on Mar 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Install PostgreSQL
ZeroC0D3 Team edited this page Jan 20, 2018
·
2 revisions
Install PostgreSQL for Ubuntu version 16.04
-
Create script
install_postgresql.sh
-
Add this line:
#!/usr/bin/env sh
PSQL_VERSION='9.6'
##### STOP POSTGRESQL SERVICE (if exist) #####
ps aux | grep -i postgresql | awk {'print $2'} | sudo xargs kill -9
##### REMOVE OLD SOURCE LIST POSGRESQL #####
sudo rm -f /etc/apt/sources.list.d/pgdg.list
##### INSTALL POSTGRESQL #####
echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
sudo apt-key add -
sudo apt-get -y update
sudo apt-get -y install postgresql-$PSQL_VERSION postgresql-client-$PSQL_VERSION postgresql-contrib-$PSQL_VERSION
##### START POSTGRESQL SERVICE #####
sudo /etc/init.d/postgresql restart
# sudo service postgresql restart
- Change executable script
chmod +x install_postgresql.sh
sh ./install_postgresql.sh
sudo -i -u postgres
createdb myapps
psql
CREATE USER deploy WITH PASSWORD 'guest_password';
ALTER USER deploy PASSWORD 'guest_password';
ALTER DATABASE myapps OWNER TO deploy;
ALTER ROLE deploy SUPERUSER;
ALTER ROLE deploy REPLICATION;
ALTER ROLE deploy CREATEDB;
ALTER ROLE deploy CREATEROLE;
\du # view roles
\l # view tables
- Change default PostgreSQL to
5433
sudo nano /etc/postgresql/9.6/main/postgresql.conf
---
port = 5433 # (change requires restart)
sudo service postgresql restart
## or ##
## sudo /etc/init.d/postgresql restart
Research & Development (RnD) - ZeroC0D3 Team
- Email: [email protected]
- Repository: https://github.com/zeroc0d3lab
- Install-Packages
- Setup-Server
- Setup-Account
- Configuration-Bash
- Configuration-Zsh
- Install-Bash-Theme
- Install-Zsh-Theme
- Install-Docker
- Install-Memcached
- Install-MongoDB
- Install-MySQL
- Install-NodeJS
- Install-PostgreSQL
- Install-Redis
- Install-Ruby
- Install-SQLite3
- Configuration-App
- Configuration-GCM
- Configuration-Hosts
- Configuration-Fstab
- Configuration-Memcached
- Configuration-MongoDB
- Configuration-PostgreSQL
- Configuration-Puma
- Configuration-Swap
- Configuration-Unicorn
- Nginx-Puma
- Nginx-Unicorn
- Logrotate
- Deployment-Dashboard
- Deployment-Configuration
- Deployment-Process
- Deployment-Folder-Structure
- Deploy-Preinstall