LoginSignup
2
1

More than 5 years have passed since last update.

GCE上でtinytinyRSSをセットアップ

Last updated at Posted at 2017-04-05

PostgreSQLについて以下のページを参考にさせて頂きました
PostgreSQL 9.6.1をCentOS 7.2へインストールして初期設定
ubuntu + lighttpd + php 環境構築メモ
Google Compute Engine (GCE)上でTiny Tiny RSSを動かしてみる

VMインスタンスを作成する

恐らく無料枠になるように

  • us-west1-b
  • f1-micro
  • Ubuntu 16.04 LTS
  • 20GB
  • httpとhttpsのトラフィックを許可

の設定でインスタンスを作成する

環境作成

ubuntu16
sudo apt-get install -y language-pack-ja git wget
sudo update-locale LANG=ja_JP.UTF-8
sudo timedatectl set-timezone Asia/Tokyo

phpのセットアップ

ubuntu16
sudo apt-get install -y php-fpm php-cli php-curl php-gd php-mcrypt php-cgi php-pgsql  php-mbstring php-xml
sudo sed -i".org" -e "s|;cgi.fix_pathinfo|cgi.fix_pathinfo|" /etc/php/7.0/fpm/php.ini

PostgreSQLのセットアップ

ubuntu16
sudo apt-get install -y postgresql

postgresユーザ設定

sudo usermod -G sudo postgres
sudo usermod -G ssl-cert postgres
sudo passwd postgres

初期設定

PostgreSQLが起動していれば停止

sudo systemctl stop *postgresql*
sudo su postgres
ps -ux |grep postgres
exit
環境設定
ubuntu16
sudo su
echo "PGDATA=/data/pgdata" >> /etc/bash.bashrc
echo "export PGDATA" >> /etc/bash.bashrc
echo "PGBIN=/usr/lib/postgresql/9.5/bin" >> /etc/bash.bashrc
echo "export PATH=\$PATH:\$PGBIN" >> /etc/bash.bashrc
mkdir -p /data/pgdata
chmod 777 /data
chmod 700 /data/pgdata
chown postgres:postgres /data/pgdata
source /etc/bash.bashrc
exit
sudo su postgres
initdb --encoding=UTF8 --no-locale --pgdata=/data/pgdata
設定ファイル編集
ubuntu16
cd $PGDATA
sed -i".org1" -e "s|#listen_addresses = 'localhost'|listen_addresses = '*'|g" postgresql.conf
sed -i".org2" -e "s|#log_destination = 'stderr'|log_destination = 'stderr'|g" postgresql.conf
sed -i".org3" -e "s|#logging_collector = off|logging_collector = on|g" postgresql.conf
sed -i".org4" -e "s|#log_directory = 'pg_log'|log_directory = 'pg_log'|g" postgresql.conf
sed -i".org5" -e "s|#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'|log_filename = 'postgresql-%Y%m%d.log'|g" postgresql.conf
sed -i".org6" -e "s|#log_rotation_age = 1d|log_rotation_age = 7d|g" postgresql.conf
sed -i".org7" -e "s|#log_rotation_size = 10MB|log_rotation_size = 0|g" postgresql.conf
pg_ctl start -w
psql -c "alter role postgres with password 'YOUR_PASSWORD';"
pg_ctl stop -m fast
sed -i".org1" -e "s|local   all             all                                     trust|#local   all             all                                     trust|g" pg_hba.conf
sed -i".org2" -e "s|host    all             all             127.0.0.1/32            trust|#host    all             all             127.0.0.1/32            trust|g" pg_hba.conf
sed -i".org3" -e "s|host    all             all             ::1/128                 trust|#host    all             all             ::1/128                 trust|g" pg_hba.conf

echo "local   all             postgres                                trust" >> pg_hba.conf
echo "local   all             all                                     md5" >> pg_hba.conf
echo "host    all             all             192.168.0.0/24          md5" >> pg_hba.conf
exit

lighttpdのセットアップ

sudo apt-get install -y lighttpd
sudo vi /etc/lighttpd/conf-available/15-fastcgi-php.conf
15-fastcgi-php.conf
-               "bin-path" => "/usr/bin/php-cgi",
-               "socket" => "/var/run/lighttpd/php.socket",
-               "max-procs" => 1,
-               "bin-environment" => ( 
-                       "PHP_FCGI_CHILDREN" => "4",
-                       "PHP_FCGI_MAX_REQUESTS" => "10000"
-               ),
-               "bin-copy-environment" => (
-                       "PATH", "SHELL", "USER"
-               ),
-               "broken-scriptfilename" => "enable"
+                "socket" => "/var/run/php/php7.0-fpm.sock",
+               "broken-scriptfilename" => "enable"
sudo lighttpd-enable-mod fastcgi
sudo lighttpd-enable-mod fastcgi-php
sudo service lighttpd force-reload

tinytinyRSSのセットアップ

cd /var/www/html
sudo git clone https://tt-rss.org/git/tt-rss.git ttrss
sudo chgrp www-data ttrss
sudo chmod g+w ttrss
cd ttrss
sudo chgrp www-data cache cache/* feed-icons lock
sudo chmod g+w cache cache/* feed-icons lock
sudo reboot
sudo apt-get update
sudo apt-get upgrade

http://(IPアドレス)/ttrss/install/にアクセス

2
1
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1