一、安装rvm
###安装rvm gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB curl -sSL https://get.rvm.io | bash -s stable source /etc/profile.d/rvm.sh ##查看[root@matser ~]# rvm -v rvm 1.29.4 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
二、下载ruby
rvm install 2.4.4
###换源
gem sources --add https://gems.ruby-china.com/gem sources --remove https:
//rubygems
.org/
gem sources -l
三、安装依赖包
yum -y install libxslt-devel libyaml-devel libxml2-devel gdbm-devel libffi-devel yum -y install zlib-devel openssl-devel libyaml-devel readline-devel curl-devel openssl-devel yum -y install pcre-devel mysql-devel ImageMagick-devel ImageMagick
四、配置数据库
create database redmine; grant all privileges on redmine.* to 'redmine'@'localhost' identified by '123456'; flush privileges;
五、下载redmine
wget http://www.redmine.org/releases/redmine-3.4.6.tar.gz tar xf redmine-3.4.6.tar.gz cd redmine-3.4.6/config/ cp database.yml.example database.yml vim database.yml production: adapter: mysql2 database: redmine ### host: localhost username: redmine ### password: "123456" #### encoding: utf8
六、下载依赖包
geminstall
rails -
v
=4
gem
install
bundler
gem
install
mysql2
gem update --system
yum
install
libxml2-devel libxslt-devel ruby-deve -y
gem
install
nokogiri -- --use-system-libraries
cd redmine-3.4.6
bundle install
geminstall
rails -
v
=4.2.8
七、运行redmine
cd redmine-3.4.6/config/
RAILS_ENV=production bundle exec rake generate_secret_token
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake redmine:load_default_data
#####本地运行
[root@redmine config]# cd ..
[root@redmine redmine-3.4.6]# pwd
/root/redmine-3.4.6
bundle
exec
rails server webrick -p3000 -b 0.0.0.0 -e production
8.下载passenger
gem install passenger
9.编译nginx
cd /usr/local/src/nginx-1.15.1/ ./configure --prefix='/usr/local/nginx' --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_addition_module --with-cc-opt=-Wno-error --with-ld-opt='' --add-module='/usr/local/rvm/gems/ruby-2.4.4/gems/passenger-5.3.3/src/nginx_module'
###错误(内存不足)
##解决
充钱 提升系统内存
10.配置nginx
cp -a /root/redmine-3.4.6 /data/wwwroot/redmine vim nginx.conf#####################
user www www;
worker_processes auto;
error_log /data/wwwlogs/error_nginx.log crit;
pid /var/run/nginx.pid;
worker_rlimit_nofile 51200;
events {
use epoll;
worker_connections 51200;
multi_accept on;
}
http {
include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 1024m;
sendfile on;
tcp_nopush on;
keepalive_timeout 120;
server_tokens off;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
gzip on;
gzip_buffers 16 8k;
gzip_comp_level 6;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_proxied any;
gzip_vary on;
gzip_types
text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml
text/javascript application/javascript application/x-javascript
text/x-json application/json application/x-web-app-manifest+json
text/css text/plain text/x-component
font/opentype application/x-font-ttf application/vnd.ms-fontobject
image/x-icon;
gzip_disable "MSIE [1-6].(?!.*SV1)";
open_file_cache max=1000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
passenger_root /usr/local/rvm/gems/ruby-2.4.4/gems/passenger-5.3.3/;
passenger_ruby /usr/local/rvm/rubies/ruby-2.4.4/bin/ruby;
include vhost/*.conf;
}}
###redmine。conf配置
server { listen 80; server_name _; access_log /data/wwwlogs/redmine_nginx.log combined; index index.html index.htm index.php; root /data/wwwroot/redmine/public; passenger_enabled on; }
####浏览器访问