ð Redmine ç°å¢æ§ç¯æé
ã¯ããã«
ãã®èšäºã®å¯Ÿè±¡
redmine ã®ç°å¢æ§ç¯æ¹æ³ãç¥ãããæ¹
redmine ã®ããŒãžã§ã³ã¢ããæ¹æ³ãç¥ãããæ¹
ããã§ããããš
ããŒã«ã«ãµãŒããŒã«SSHçµç±ã§redmineç°å¢æ§ç¯
æ§ç¯ããredmineã®ããŒãžã§ã³ã¢ãã
ç°å¢æ å ±
Ubuntu Server 24.04
äœæ¥éå§
1. ããã±ãŒãžã®ã€ã³ã¹ããŒã«
ubuntu ã®ããã±ãŒãžãªããžããªããå¿ èŠãªãã®ãã€ã³ã¹ããŒã«ããŸããã
$ sudo apt update
$ sudo apt install -y build-essential libssl-dev libreadline-dev zlib1g-dev libmysqlclient-dev ruby-full
ã³ãã³ãã®å 容
sudo
:
管çè æš©éã§ã³ãã³ããå®è¡ããŸã
apt
:
Linux ã§ã®ããã±ãŒãžç®¡ççšã³ãã³ãã§ããããã§ã¯ install ãæå®ããããã±ãŒãžãã€ã³ã¹ããŒã«ããŠããŸã
-y
:
ããã±ãŒãžã®ã€ã³ã¹ããŒã«äžã«ç¢ºèªããã³ããã衚瀺ããããèªåçã«ãã¯ãããéžæããã
ã€ã³ã¹ããŒã«ããŠããããã±ãŒãžã®å 容
build-essential
:
ããã¯ãã«ãã«å¿ èŠãªåºæ¬çãªããŒã«ã»ãããC/C++ã³ã³ãã€ã©ãmakeãªã©ãå«ãŸããã
ããã±ãŒãžã®ã€ã³ã¹ããŒã«ã«ã¯ãããå¿ èŠã
libssl-dev
:
OpenSSLã®éçºã©ã€ãã©ãªã§ããSSL/TLSéä¿¡ããµããŒãããããã«å¿ èŠã
libreadline-dev
:
GNU Readlineã©ã€ãã©ãªã®éçºããŒãžã§ã³ã§ããã³ãã³ãã©ã€ã³ã®å±¥æŽãç·šéæ©èœãæäŸããã
zlib1g-dev
:
zlibã®éçºã©ã€ãã©ãªãããŒã¿ã®å§çž®ãšäŒžåŒµãè¡ãããã«äœ¿çšã
libmysqlclient-dev
:
MySQLã¯ã©ã€ã¢ã³ãã®éçºã©ã€ãã©ãªãMySQLããŒã¿ããŒã¹ãšã®é£æºã«å¿ èŠã
ruby
:
ã¹ã¯ãªããèšèªã®äžã€ãRedmineã¯rubyã®ãã¬ãŒã ã¯ãŒã¯ã§éçºãããŠãããåäœãããã«ã¯rubyãå¿ èŠ
2. ããŒã¿ããŒã¹ã®ã»ããã¢ãã
Redmineã¯ãããŒã¿ããŒã¹ã䜿çšããŠããŒã¿ã管çããŸããä»åã¯ãMySQLãã§ç°å¢æ§ç¯ãé²ããŠã¿ãŸãããã
2.1 MySQLãµãŒããŒã®ã€ã³ã¹ããŒã«ã»ã»ãã¥ãªãã£èšå®
$ sudo apt install -y mysql-server
$ sudo mysql_secure_installation
ã³ãã³ãã®å 容
mysql_secure_installation
:
mysql ã®ã»ãã¥ãªãã£ã匷åããã³ãã³ãã以äžèšäºãããããããã£ãã§ã
2.2 ãŠãŒã¶ãŒã®äœæ
èšå®ãå®äºããããRedmineçšã®ããŒã¿ããŒã¹ãšãŠãŒã¶ãŒãäœæããŸãã
$ sudo mysql -u root -p
ã³ãã³ãã®å 容
-u ãªãã·ã§ã³
:
ãŠãŒã¶ãŒåãæå®ãã
-p ãªãã·ã§ã³
:
ãã¹ã¯ãŒããæå®ããŸã
2.3 DB ã®äœæ
> CREATE DATABASE redmine CHARACTER SET utf8mb4;
> CREATE USER '<ä»»æã®ãŠãŒã¶ãŒå>'@'localhost' IDENTIFIED BY '<èšå®ãããããºã¯ãŒã>';
> GRANT ALL PRIVILEGES ON redmine.* TO 'redmineuser'@'localhost';
> FLUSH PRIVILEGES;
> EXIT;
ã³ãã³ãã®å 容
CREATE DATABASE redmine CHARACTER SET utf8mb4;
:
Redmineçšã®ããŒã¿ããŒã¹ãäœæ
æåã»ããã¯UTF8MB4ïŒUTF-8ã®æ¡åŒµïŒã§èšå®
CREATE USER 'redmineuser'@'localhost' IDENTIFIED BY 'your_password';
:
ãŠãŒã¶ãŒåã 'redmineuser' ã§ããã¹ãã 'localhost' ã®ãŠãŒã¶ãŒãäœæ
GRANT ALL PRIVILEGES ON redmine.* TO 'redmineuser'@'localhost';
:
2è¡ç®ã§äœæãããŠãŒã¶ãŒã«å¯ŸããŠãRedmineããŒã¿ããŒã¹ã®ãã¹ãŠã®æš©éãä»äžããŸãã
FLUSH PRIVILEGES;
:
æš©éã®å€æŽãé©çšããããã«MySQLã®ç¹å®ã®ããŒãã«ããªããŒã
EXIT;
:
MySQLã¯ã©ã€ã¢ã³ããããã°ã¢ãŠãããŠçµäº
3. Redmineã®ããŠã³ããŒããšã€ã³ã¹ããŒã«
Redmineãã€ã³ã¹ããŒã«ããŠãããŸããã
$ cd /var/www
$ sudo wget http://www.redmine.org/releases/redmine-<ã€ã³ã¹ããŒããããŒãžã§ã³çªå·>.tar.gz
$ sudo tar -xvzf redmine-4.2.0.tar.gz
$ sudo mv redmine-<ã€ã³ã¹ããŒã«ããããŒãžã§ã³çªå·> redmine
$ cd redmine
ã³ãã³ãã®å 容
wget
:
ãŠã§ãäžã®ãã¡ã€ã«ãããŠã³ããŒãããããã®ã³ãã³ãã©ã€ã³ããŒã«
HTTP, HTTPS, FTP 察å¿
tar
:
ããŠã³ããŒãããRedmineã®ããã±ãŒãžãå±éããã
-x
:
ã¢ãŒã«ã€ããããã¡ã€ã«ãæœåºãããªãã·ã§ã³
-v
:
ã³ãã³ãå®è¡äžã®å®è¡å 容ã衚瀺ããããªãã·ã§ã³
-z
:
å§çž®ãããã¢ãŒã«ã€ãïŒé垞㯠.tar.gz ã .tgz ãã¡ã€ã«ïŒã解åããããªãã·ã§ã³
-f
:
å±éãããã¢ãŒã«ã€ããã¡ã€ã«ãæå®ãã(ããã§ã¯ã2è¡ç®ã§ããŠã³ããŒããããã¡ã€ã«ãæå®ããŠãã)
mv
:
ãã£ã¬ã¯ããªåãå€æŽãã
ããã§ã¯ãå±éãããRedmineã®ãã£ã¬ã¯ããªåã redmine-4.2.0 ãã redmine ã«å€æŽããŠããã
4. DBæ¥ç¶ã®èšå®
4.1 config/database.yml ã®èšå®
Redmine ã§äœ¿ã DB ã«ã2ã§ã»ããã¢ãããã MySQL ã® DB ãæå®ããŸããã
$ sudo nano config/database.yml
config/database.yml ã«ä»¥äžå 容ãè¿œèšããŸããã
production:
adapter: mysql2
database: redmine
host: localhost
username: <ã»ããã¢ããæã«èšå®ãããŠãŒã¶ãŒå>
password: "<ã»ããã¢ããæã«èšå®ãããã¹ã¯ãŒã>"
encoding: utf8mb4
4.2 ruby(gem) ã®ããã±ãŒãžãªããžããªããå¿ èŠãªãã®ãã€ã³ã¹ããŒã«
$ sudo gem install bundler
ã³ãã³ãã®å 容
gem
:
rubyã®ã©ã€ãã©ãªç®¡çããŒã«ãgem ãåäœãããã³ãã³ãã
ããã§ã¯ install ãããŠå¿ èŠãªããã±ãŒãžãã€ã³ã¹ããŒã«ããŠãã
ã€ã³ã¹ããŒã«ããŠããã©ã€ãã©ãªã®å 容
bundler
:
ruby ã®äŸåé¢ä¿ã管çããã©ã€ãã©ãª
ç°å¢ã«ãã£ãŠ ruby ã®ããŒãžã§ã³ã䜿ãåããããšãå¯èœã«ãã
redmine ã®å®è¡ã«å¿ èŠãªgemã管çããŠãããã®ã§ãrubyãšgemã®ã€ã³ã¹ããŒã«ãå¥ã ã«è¡ãå¿ èŠããªããªããäœæ¥ãããå¹ççã«ãªã
4.3 DBã®ãã€ã°ã¬ãŒã·ã§ã³
$ bundle exec rake generate_secret_token
$ RAILS_ENV=production bundle exec rake db:migrate
ã³ãã³ãã®å 容
bundle exec
:
bundlerã䜿çšããŠGemfileã«èšèŒãããRubyãããžã§ã¯ãã®äŸåé¢ä¿ã管çã
bundle execãä»ããããšã§ããããžã§ã¯ãã®GemããŒãžã§ã³ã䜿çšããŠã³ãã³ããå®è¡ã§ããã
rake
:
Rubyãããžã§ã¯ãã§ã¿ã¹ã¯ãå®è¡ããããã®ãã«ãã€ã³ããŒã«ã
Rakefileã«å®çŸ©ãããã¿ã¹ã¯ãå®è¡ããã
generate_secret_token
:
Railsã¢ããªã±ãŒã·ã§ã³ã®config/secrets.ymlãã¡ã€ã«ã«æ°ããã·ãŒã¯ã¬ããããŒã¯ã³ãçæã»è¿œå ã
ã·ãŒã¯ã¬ããããŒã¯ã³ã¯ã»ãã·ã§ã³ç®¡çãæå·åãªã©ã®ã»ãã¥ãªãã£æ©èœã§äœ¿çšã
RAILS_ENV=production
:
Railsã¢ããªã±ãŒã·ã§ã³ã config/database.yml èšèŒã®ç°å¢ã§å®è¡ããããã«ç°å¢å€æ°ãèšå®ããŠããã
bundle exec rake db:migrate
:
ããŒã¿ããŒã¹ã®ãã€ã°ã¬ãŒã·ã§ã³ãå®è¡ãããŒã¿ããŒã¹ã¹ããŒãã®å€æŽãé©çšããããã«äœ¿çšãããã
db:migrateã¯Railsã®ã¿ã¹ã¯ã§ãdb/migrateãã£ã¬ã¯ããªå ã®ãã€ã°ã¬ãŒã·ã§ã³ãã¡ã€ã«ãå®è¡ããã
5. Redmine ã®èµ·å
ãããŸã§ã§æºåã¯æŽããŸãããåŸã¯èµ·åãããã ãã§ãïŒããå°ãé 匵ããŸããã
$ bundle exec rails server -u webrick -e production
ã³ãã³ãå 容
rails server
:
Railsã¢ããªã±ãŒã·ã§ã³ãå®è¡ããããã®ã³ãã³ãã
-u
:
å®è¡ãããµãŒããŒãæå®ããã
ããã©ã«ãã§ã¯PumaãµãŒããŒãèµ·åããããããã§ã¯ éçºçšã«äœ¿çšãããããšã®å€ã webrick ã䜿çšããŠããã
-e production
:
Railsã¢ããªã®å®è¡ç°å¢ãæå®ããã
6. ãã©ãŠã¶ããã¢ã¯ã»ã¹
ãã©ãŠã¶ã§æ§ç¯ããRedmine ã«ã¢ã¯ã»ã¹ããŠã¿ãŸããã
http://<ãµãŒããŒã®ipã¢ãã¬ã¹>:3000
ããŸã
ããŸã.1 èªåèµ·åèšå®
ãµãŒããŒåèµ·åæã«Redmineãèªåã§èµ·åããããã«èšå®ããŠã¿ãŸãããredmine.service ãã¡ã€ã«ãç·šéããŸã
$ sudo nano /etc/systemd/system/redmine.service
以äžå 容ãã³ããããŠãã ãã
[Unit]
Description=Redmine
After=network.target
[Service]
Type=simple
User=www-data
WorkingDirectory=/var/www/redmine
ExecStart=/usr/bin/bundle exec rails server -u webrick -e production
Restart=always
[Install]
WantedBy=multi-user.target
èšèŒå 容ã«é¢ããŠã¯ããã¡ãã®èšäºåèã«ãªãã£ãŠã¿ãŠãã ããã(äžžæãããŸã¬(ïŒäººïŒ))
ãã¡ã€ã«ãä¿åããŠçµäºåŸããµãŒãã¹ãæå¹åããŸãã
$ sudo systemctl enable redmine
$ sudo systemctl start redmine
ããŸã.2 Redmineã®ããŒãžã§ã³ã¢ããæé
- ãµãŒããŒã®ããã¯ã¢ãã:
ãŸããããŒã¿ããŒã¹ãšãã¡ã€ã«ã®ããã¯ã¢ãããåããŸãã(ããã¯ã¢ããæ¹æ³ã¯åªä»æå ã§å®éšããèšäºå·çäž)
- Redmineã®ããŠã³ããŒã:
ææ°ããŒãžã§ã³ãå ¬åŒãµã€ãããããŠã³ããŒãããçŸåšã®ã€ã³ã¹ããŒã«ãã£ã¬ã¯ããªã«äžæžãããŸãã
- ããŒã¿ããŒã¹ã®ãã€ã°ã¬ãŒã·ã§ã³:
æ°ããããŒãžã§ã³ã«å¯Ÿå¿ããããã«ãããŒã¿ããŒã¹ãæŽæ°ããŸãã
bundle exec rake db:migrate RAILS_ENV=production
4 . ãµãŒãã¹ã®åèµ·å
sudo systemctl restart redmine
ãããã«
ä»åã¯ã ãã¶é§ã足㧠èªå® ãµãŒããŒã« Redmine ã®ç°å¢æ§ç¯ãè¡ã£ãŠã¿ãŸããã
web ãµãŒããŒã ç°¡æçãªHTTPãµãŒãã ã£ãããrubyã®äŸåé¢ä¿åšãã§çºçããããªãã©ãã«ã®åé¿æ¹æ³ç端æãŠããŸããŸããããå¥ã®èšäºã§å¥åãŸãšããããšæããŸãã
Discussion