OS Configuration
Disable SELinux
# sed -i -e 's/^SELINUX=.*/SELINUX=disabled/' /etc/sysconfig/selinux
# reboot
Add http permit firewall policy
# systemctl list-units --type=service | grep firewalld
firewalld.service loaded active running firewalld - dynamic firewall daemon
# firewall-cmd --zone=public --list-services
ssh
# firewall-cmd --zone=public --add-service=http --permanent
success
# firewall-cmd --reload
success
# firewall-cmd --zone=public --list-services
http ssh
Install PKGs
dev tool, header...etc
# yum -y groupinstall "Development Tools"
# yum -y install openssl-devel readline-devel zlib-devel curl-devel libyaml-devel libffi-devel
mariadb
# yum -y install mariadb-server mariadb-devel
apache
# yum -y install httpd httpd-devel
Image Magick
# yum -y install ImageMagick ImageMagick-devel ipa-pgothic-fonts
Build Ruby
download src
# curl -O https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.2.tar.gz
build
# tar xvf ruby-2.2.2.tar.gz
# cd ruby-2.2.2
# ./configure --disable-install-doc
# make
# make install
# cd ..
# ruby -v
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
Install bundler
# export http_proxy=http://<PROXY_SERVER>:<PROXY_SERVER_PORT>
# gem install bundler --no-rdoc --no-ri
Fetching: bundler-1.10.6.gem (100%)
Successfully installed bundler-1.10.6
1 gem installed
# unset http_proxy
Install MariaDB
Set default charset as utf8
# pwd
/etc
# diff my.cnf.org my.cnf
10a11,12
> character-set-server=utf8
>
19a22,23
> [mysql]
> default-character-set=utf8
Start mariadb service
# service mariadb start
Redirecting to /bin/systemctl start mariadb.service
# systemctl enable mariadb
ln -s '/usr/lib/systemd/system/mariadb.service' '/etc/systemd/system/multi-user.target.wants/mariadb.service'
Check status
# mysql -uroot
MariaDB [(none)]> show variables like 'character_set%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.01 sec)
MariaDB [(none)]> exit
Bye
Initial configuration
# mysql_secure_installation
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
Create db and user
# mysql -uroot -p
MariaDB [(none)]> create database db_redmine default character set utf8;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all on db_redmine.* to user_redmine@localhost identified by '<PASSWORD>';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit;
Bye
Install Redmine
Set subversion proxy
# vi ~/.subversion/servers
[global]
http-proxy-host = <PROXY_SERVER>
http-proxy-port = <PROXY_SERVER_PORT>
Download redmine
# svn co http://svn.redmine.org/redmine/branches/3.1-stable /var/lib/redmine
Configuration
# pwd
/var/lib/redmine/config
# cat database.yml
production:
adapter: mysql2
database: db_redmine
host: localhost
username: user_redmine
password: "<PASSWORD>"
encoding: utf8
# cat configuration.yml
production:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: <SMTP_SERVER>
port: <SMTP_SERVER_PORT>
domain: <DOMAIN>
rmagick_font_path: /usr/share/fonts/ipa-pgothic/ipagp.ttf
Install gem pkg
# cd /var/lib/redmine/
# export http_proxy=http://<PROXY_SERVER>:<PROXY_SERVER_PORT>
# bundle install --without development test --path vendor/bundle
Redmine initial configuration
Create private key
# pwd
/var/lib/redmine
# bundle exec rake generate_secret_token
Create database table
# RAILS_ENV=production bundle exec rake db:migrate
Add default data
# RAILS_ENV=production REDMINE_LANG=ja bundle exec rake redmine:load_default_data
Passenger configuration
Install Passenger
# gem install passenger --no-rdoc --no-ri
Install Apache module
# passenger-install-apache2-module --auto
Apache configuration
Output Apache configuration to use Passenger, Copy the ouput to clipboard
The output is different, depend on your environment.
# passenger-install-apache2-module --snippet
LoadModule passenger_module /usr/local/lib/ruby/gems/2.2.0/gems/passenger-5.0.15/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/local/lib/ruby/gems/2.2.0/gems/passenger-5.0.15
PassengerDefaultRuby /usr/local/bin/ruby
</IfModule>
Paste the above output to Apache configuration
# pwd
/etc/httpd/conf.d
# cat redmine.conf
<Directory "/var/lib/redmine/public">
Require all granted
</Directory>
LoadModule passenger_module /usr/local/lib/ruby/gems/2.2.0/gems/passenger-5.0.15/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/local/lib/ruby/gems/2.2.0/gems/passenger-5.0.15
PassengerDefaultRuby /usr/local/bin/ruby
</IfModule>
# Header
Header always unset "X-Powered-By"
Header always unset "X-Runtime"
# Phusion Passenger users guide
# http://www.modrails.com/documentation/Users%20guide%20Apache.html
PassengerMaxPoolSize 20
PassengerMaxInstancesPerApp 4
PassengerPoolIdleTime 864000
PassengerHighPerformance on
PassengerStatThrottleRate 10
PassengerSpawnMethod smart
PassengerFriendlyErrorPages off
Configuration for starting apache with passenger
# chown -R apache:apache /var/lib/redmine
# pwd
/etc/httpd/conf
# diff httpd.conf.org httpd.conf
95c95
< #ServerName www.example.com:80
---
> ServerName <HOSTNAME>:<PORT>
119c119
< DocumentRoot "/var/www/html"
---
> DocumentRoot "/var/lib/redmine/public"
Start apache service
# service httpd configtest
Syntax OK
# service httpd restart
Redirecting to /bin/systemctl restart httpd.service
Access to Redmine UI
default login account
- id : admin
- pw : admin
Environment
OS
# cat /etc/redhat-release
CentOS Linux release 7.1.1503 (Core)
Redmine
# /var/lib/redmine/bin/about
Environment:
Redmine version 3.1.0.stable.14480
Ruby version 2.2.2-p95 (2015-04-13) [x86_64-linux]
Rails version 4.2.3
Environment production
Database adapter Mysql2
SCM:
Subversion 1.7.14
Git 1.8.3.1
Filesystem
Redmine plugins:
redmine_absolute_dates 0.0.2
redmine_slack 0.1
Apache
# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built: Mar 12 2015 15:07:19
MariaDB
# mysqladmin -u root -p'password' version | grep version
Server version 5.5.41-MariaDB
Protocol version 10