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

PortForwordという言葉の意味

知らなかった。。。ポートフォーワードという内容はsshでポートを指定すると、 localhost:[port名]で確認できる。
開発サーバなどで、SSHに使う22番ポートは解放しているけど、HTTPに使う80番ポートは外部に解放していないという状況があります。

$ ssh -L 8000:localhost:80 dev.katty.in

IP制限されているWEBサイトをSSH経由でブラウザに表示する。 | 三度の飯とエレクトロン

.ssh/configに設定するときはこうする。

Host katty-dev-port-forward
  HostName dev.katty.in
  User katty0324
  Port 22
  IdentityFile ~/.ssh/id_rsa
  GatewayPorts no
  LocalForward 8000 localhost:80

SSHによるポートフォワーディング - ふなWiki

Atomの一括インストール

$ apm install --packages-file recommend_packages.txt

$ apm list -ib > recommend_packages.txt

atom-dark-ui-slim
autocomplete-paths
blame
color-picker
git-time-machine
highlight-selected
jumpy
maximize-panes
merge-conflicts
minimap
minimap-autohide
minimap-bookmarks
minimap-git-diff
minimap-highlight-selected
minimap-pigments
pigments
project-manager
railscast-theme
slim-language
sort-lines
tabs-to-spaces

qiita.com