Skip to content

Instantly share code, notes, and snippets.

@hacker65536
Last active August 29, 2015 14:16
Show Gist options
  • Save hacker65536/8a8bf37a681bc904be7f to your computer and use it in GitHub Desktop.
Save hacker65536/8a8bf37a681bc904be7f to your computer and use it in GitHub Desktop.
deploy_redmine_3.0
#using root
#set your env
#save and run
#sh deploy_redmine_3.0.sh
dbhost="dbhost"
dbuser="dbuser"
dbpass="dbpass"
: <<'#__COMMENT_OUT__'
cp /etc/localtime /etc/localtime.org
\cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
#__COMMENT_OUT__
cd /usr/local/src
wget "http://www.redmine.org/releases/redmine-3.0.0.tar.gz"
tar zxvf redmine-3.0.0.tar.gz
cd redmine-3.0.0
yum install -y ruby-devel gcc
gem install bundler
gem install json
yum install -y patch zlib-devel
gem install nokogiri
yum install -y ImageMagick-devel
gem install rmagick
yum install -y mysql-devel
gem install mysql2
cp config/database.yml.example config/database.yml
sed -i '1,/host: localhost/s/host: localhost/host: '$dbhost'/' config/database.yml
sed -i '1,/password: ""/s/password: ""/password: "'$dbpass'"/' config/database.yml
sed -i '1,/username: root/s/username: root/username: '$dbuser'/' config/database.yml
bundle install --without development test --path vendor/bundle
./bin/rake generate_secret_token
mysqladmin -h $dbhost -u $dbuser -p${dbpass} create redmine
RAILS_ENV=production ./bin/rake db:migrate
yum install -y gcc-c++ curl-devel httpd24-devel
gem install passenger
#type enter key 3times
passenger-install-apache2-module
cp -ar ../redmine-3.0.0 /var/www/redmine
chown -R apache. /var/www/redmine
touch /etc/httpd/conf.d/redmine.conf
passenger-install-apache2-module --snippet >>/etc/httpd/conf.d/redmine.conf
echo "
<VirtualHost *:80>
ServerName redmine.mydomain.com
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /var/www/redmine/public
RailsEnv production
RailsBaseURI /
<Directory /var/www/redmine/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
#Require all granted
</Directory>
</VirtualHost>
" >> /etc/httpd/conf.d/redmine.conf
chkconfig httpd on
service httpd start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment