以前redmine4をインストールする手順のメモをblogに書き残していましたが、
最近nginxを触ってみたいと思っていたので、Nginxで動かしてみた手順のメモです!
動画作りました!
・環境
ubuntu18.04 (minimal) on VirtualBox
(IP:192.168.56.150)
WEB:Nginx
DB:MySQL
MySQLDB rootユーザPW:RootPW123!
Redmine用DB名:redmine
RedmineDB ユーザ:redmine
Redmineuser PW:Redmine123!
私が使っているPC(のメモリが8GBの物)です!
私は今このPCのメモリを現在では32GBにアップグレードして使っています!笑
安くなりましたよねメモリ。SSDも安くなってるので買い換えたいです!笑
それでは手順です!
・rootになる
sudo su
・アップデート
apt-get update
・Redmine関係のPKGインストール
apt-get install -y net-tools curl mysql-server mysql-client libmysqlclient-dev imagemagick libmagickwand-dev libcurl4-openssl-dev git-core subversion
・GPGキーのインポート
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
・rvmのダウンロード
curl -sSL https://get.rvm.io | bash -s stable
・rvmの展開
source /etc/profile.d/rvm.sh
・rvmのインストール
rvm install 2.6.0
・rvmのリロード
source /usr/local/rvm/scripts/rvm
・.bashrcへ追記
echo '[[ -s "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm"' >> ~/.bashrc
・./bashrcのリロード
source ~/.bashrc
・ver確認
ruby -v
rvm -v
・MySQLモードへ以降
mysql -u root -p
→PW:Root123!
・Redmine用データベースの作成
create database redmine;
create user redmine@localhost identified by 'Redmine123!';
grant all privileges on redmine.* to redmine@localhost identified by 'Redmine123!';
flush privileges;
exit
・Passengerのインストール
gem install passenger -N
・Nginxのインストール
passenger-install-nginx-module
・ディレクトリの移動
cd /opt/nginx/
・ディレクトリの移動
cd conf/
・configファイルの作成
vi nginx.conf
→23行目に下記設定追加
include vhost/*.conf;
・ディレクトリの作成
mkdir -p /opt/nginx/conf/vhost
・ディレクトリの移動
cd /opt/nginx/conf/vhost/
・redmine用のconfig作成
vi redmine.conf
→下記設定の記述
server {
listen 80;
server_name www.kusomemo.tokyo;
root /var/www/redmine/public;
passenger_enabled on;
client_max_body_size 10m; # Max attachemnt size
\# redirect server error pages to the static page /50x.html
\#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
・ディレクトリ移動
cd /lib/systemd/system/
・サービスの定義
vi nginx.service
→下記設定を記述
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/opt/nginx/logs/nginx.pid
ExecStartPre=/opt/nginx/sbin/nginx -t
ExecStart=/opt/nginx/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
・systemdのリロード
systemctl daemon-reload
・Nginxの起動
systemctl start nginx
・Nginxの自動起動設定
systemctl enable nginx
・portの確認
netstat -plntu | grep nginx
Redmineのインストール
・ディレクトリの作成
mkdir -p /var/www/redmine
・ディレクトリの移動
cd /var/www
・Redmineのダウンロード
svn co https://svn.redmine.org/redmine/branches/4.0-stable redmine
→下記メッセージが表示されたら「T」→「Enter」
※まれにERRORになりましたが、もう一度同じコマンドを
入力したら何故かダウンロードできました。
Error validating server certificate for 'https://svn.redmine.org:443':
- The certificate is not issued by a trusted authority. Use the
fingerprint to validate the certificate manually!
Certificate information:
- Hostname: svn.redmine.org
- Valid: from Sun, 08 Jan 2017 00:00:00 GMT until Wed, 08 Jan 2020 23:59:59 GMT
- Issuer: Gandi, Paris, Paris, FR
- Fingerprint: ab:f1:c8:b7:69:a6:99:bd:20:c1:59:a4:5f:60:9e:27:2d:81:82:b7
(R)eject, accept (t)emporarily or accept (p)ermanently?
・ディレクトリの移動
cd redmine
・サンプルファイルのコピー
cp config/configuration.yml.example config/configuration.yml
cp config/database.yml.example config/database.yml
・ymlファイルの編集
vi config/database.yml
→DB「redmine」のユーザ名・パスワードを編集
production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: "Redmine123!"
encoding: utf8
・ディレクトリの作成
mkdir -p tmp tmp/pdf public/plugin_assets
sudo chown -R www-data:www-data files log tmp public/plugin_assets
sudo chmod -R 775 files log tmp public/plugin_assets
・bundlerのインストール
gem install bundler
bundle install --without development test
・トークンの作成
bundle exec rake generate_secret_token
・DBの作成
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake redmine:load_default_data
「en」→「Enter」
jaだとエラーになりました。。
・Nginxのリスタート
systemctl restart nginx
・firewallの許可
firewall-cmd --add-service=http --permanent
・firewallの再起動
firewall-cmd --reload
ブラウザを立ち上げ「192.168.56.150」へアクセス
画面右上の「ログイン」をクリック。
Login:admin
Password:admin
皆さん既にやってると思いますが、 AmazonPrimeだとAmazon Music Unlimitedが月額780円でできるんですね!
最近知ってapple musicから乗り換えました。(200円ですが安い方がいいに越したことはないです笑)
下のRedmineの本は kindle unlimitedで無料で読めますのでお勧めです!(30日無料期間に読んで解約もアリだと思います。笑)