日に日に分からんことが増えていく…

プログラマー初心者としての日々を学んでいることを記録していく。

PostgreSQLのCentOS7での立ち上げ方やコマンドなどの便利なサイト+自動インストール

DjangoではPostgreが推奨のDBMSらしいよ。

www.digitalocean.com

qiita.com

#!/bin/sh

# -*- MAINTAINER -*- Lasha Gogua Lh4cKg@gmail.com

# -*- RUN -*- $ bash install.sh

# system update and install epel package
yum update -y && yum upgrade -y
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
rpm -ivh epel-release-7-5.noarch.rpm
yum update -y && yum upgrade -y
sudo dnf install redhat-rpm-config

# install gcc package and other necessary packages
cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
yum groupinstall 'Development Tools' 'Performance Tools' -y
yum install -y openssl-devel readline-devel gdbm-devel sqlite-devel bzip2-devel tk-devel ncurses-devel libaio-devel libxml2-devel libxslt-devel java-1.8.0-openjdk zsh
yum install -y atlas-devel lapack-devel blas-devel
yum install vim -y
yum install mc -y

# install mysql
#wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
#rpm -ivh mysql-community-release-el7-5.noarch.rpm
#yum update -y && yum upgrade -y
#yum install mysql-server mysql-devel -y
#systemctl start mysqld.service
#systemctl enable mysqld.service
#mysql_secure_installation

# install postgres
yum install postgresql-server postgresql-devel postgresql-contrib -y
postgresql-setup initdb
# use md5 insted of ident 
# vim /var/lib/pgsql/data/pg_hba.conf
mv -f pg_hba.conf /var/lib/pgsql/data/pg_hba.conf
systemctl start postgresql
systemctl enable postgresql

# install nginx
yum install nginx -y
mv -f nginx.conf /etc/nginx/nginx.conf
systemctl start nginx
systemctl enable nginx
systemctl restart nginx

# required libraries for Python installation
yum install libjpeg libjpeg-devel -y
yum install freetype-devel libpng-devel -y
yum install zlib zlib-devel -y
yum install krb5-devel -y
yum install openssl openssl-devel -y
yum install libffi libffi-devel -y
yum install gmp gmp-devel -y

# install Python.3.6 version
# example: 3.6.1 = 3.3.6 => Python.3.3.6 or 3.6.1=2.7.11 => Python.2.7.11
wget http://python.org/ftp/python/3.6.1/Python-3.6.1.tgz
tar -xvf Python-3.6.1.tgz
mv -f Python-3.6.1 /opt/ && cd /opt/Python-3.6.1
./configure 
make && make altinstall
cd

# install pip
wget https://bootstrap.pypa.io/get-pip.py
# use Python version | python3.3 or python
python3.6 get-pip.py 
pip3.6 install uwsgi
pip3.6 install virtualenv virtualenvwrapper

workonの設定は以下 kidnohr.hatenadiary.com

gist.github.com