1.redmine网站下载Redmine4.2.0的安装包;
2.拷贝Redmine4.2.0的安装包到ubuntu工作目录,并解压缩
3.移植redmine解压目录到/opt目录
4.配置Redmine数据库,拷贝redmine解压目录下的config目录下的database.yml.example,为database.yml文件,并进行第1节的配置,具体如下所述:
cp database.yml.example database.yml
Question1: thsj@thsj-pc:/opt/redmine-4.2.0$ sudo gem install bundler
Fetching: bundler-2.4.19.gem (100%)
ERROR: Error installing bundler:
The last version of bundler (>= 0) to support your Ruby & RubyGems was 2.3.26. Try installing it with `gem install bundler -v 2.3.26`
bundler requires Ruby version >= 2.6.0. The current ruby version is 2.5.0.
5.进入redmine目录,安装Ruby依赖项,如下图所示:
安装Ruby
1>sudo apt-get install curl
thsj@thsj-pc:~$ sudo apt-get install curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
fonts-lato libgmp-dev libgmpxx4ldbl ruby-did-you-mean ruby-minitest
ruby-net-telnet ruby-power-assert ruby2.5-doc rubygems-integration
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libcurl4
The following NEW packages will be installed:
curl libcurl4
2>sudo apt-get update
thsj@thsj-pc:~$ sudo apt-get update
Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:2 http://cn.archive.ubuntu.com/ubuntu bionic InRelease
Hit:3 http://cn.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:4 http://cn.archive.ubuntu.com/ubuntu bionic-backports InRelease
Reading package lists... Done
3>sudo apt update
thsj@thsj-pc:~$ sudo apt update
Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:2 http://cn.archive.ubuntu.com/ubuntu bionic InRelease
Hit:3 http://cn.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:4 http://cn.archive.ubuntu.com/ubuntu bionic-backports InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
277 packages can be upgraded. Run 'apt list --upgradable' to see them.
4>sudo apt -y install software-properties-common
thsj@thsj-pc:~$ sudo apt -y install software-properties-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
fonts-lato gir1.2-goa-1.0 gir1.2-snapd-1 libgmp-dev libgmpxx4ldbl
ruby-did-you-mean ruby-minitest ruby-net-telnet ruby-power-assert
ruby2.5-doc rubygems-integration
5>sudo apt-add-repository ppa:brightbox/ruby-ng
thsj@thsj-pc:~$ sudo apt-add-repository ppa:brightbox/ruby-ng
Ubuntu packages for Ruby 2.7, 2.6, 2.5, 2.4, 2.3, 2.2, 2.1, 2.0 1.9.3 and 1.8.
See https://www.brightbox.com/docs/ruby/ubuntu/ for more details.
Discussion list here:
https://groups.google.com/forum/#!forum/brightbox-ruby-ubuntu-packaging
https://www.brightbox.com
More info: https://launchpad.net/~brightbox/+archive/ubuntu/ruby-ng
Press [ENTER] to continue or Ctrl-c to cancel adding it.
6>sudo apt update
thsj@thsj-pc:~$ sudo apt update
Hit:1 http://ppa.launchpad.net/brightbox/ruby-ng/ubuntu bionic InRelease
Hit:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:3 http://cn.archive.ubuntu.com/ubuntu bionic InRelease
Hit:4 http://cn.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:5 http://cn.archive.ubuntu.com/ubuntu bionic-backports InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
274 packages can be upgraded. Run 'apt list --upgradable' to see them.
7>sudo apt install ruby2.7
thsj@thsj-pc:~$ sudo apt install ruby2.7
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
gir1.2-goa-1.0 gir1.2-snapd-1 libgmp-dev libgmpxx4ldbl ruby-did-you-mean
ruby2.5-doc
Use 'sudo apt autoremove' to remove them.
sudo apt-get install ruby2.7-dev rubygems libmysqlclient-dev imagemagick libmagickwand-dev
6.更改默认gem源,默认gem源地址为:https://rubygems.org/,修改为国内gem源地址:https://gems.ruby-china.com。提高安装Ruby依赖项的速度,缩短安装时间。修改后,查看当前gem源。如下图所示:
gem sources --remove https://rubygems.org/
gem source -a https://gems.ruby-china.com
gem source -l
7.进入redmine目录,安装Ruby依赖项,(注意:切换到https://gems.ruby-china.com)
thsj@thsj-pc:/opt/redmine-4.2.0$ vim Gemfile .更改默认Gemfile源
sudo gem install bundler -v 2.3.20
sudo bundle config set --local without 'development test postgresql sqlite'
sudo bundle install
(该处命令执行时间较长,可能达到十几分钟)
Qusetion2:
........
Fetching globalid 1.1.0
Installing globalid 1.1.0
Fetching activemodel 5.2.5
Installing activemodel 5.2.5
Installing css_parser 1.12.0
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.5.0/gems/racc-1.7.1/ext/racc/cparse
/usr/bin/ruby2.5 -r ./siteconf20230905-16971-xrzo31.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.5.0/gems/racc-1.7.1 for
inspection.
Results logged to
/var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/racc-1.7.1/gem_make.out
Answer:
sudo apt install ruby2.7-dev
8.运行以下命令以生成密钥并迁移数据库:
sudo bundle exec rake generate_secret_token
Question3:
thsj@thsj-pc:/opt/redmine-4.2.0$ sudo bundle exec rake generate_secret_token
Your RubyGems version (2.7.6) has a bug that prevents `required_ruby_version` from working for Bundler. Any scripts that use `gem install bundler` will break as soon as Bundler drops support for your Ruby version. Please upgrade RubyGems to avoid future breakage and silence this warning by running `gem update --system 3.2.3`
rake aborted!
NameError: uninitialized constant Nokogiri::HTML4
Did you mean? Nokogiri::HTML
/var/lib/gems/2.5.0/gems/loofah-2.21.1/lib/loofah/html4/document.rb:10:in `<module:HTML4>'
/var/lib/gems/2.5.0/gems/loofah-2.21.1/lib/loofah/html4/document.rb:4:in `<module:Loofah>'
/var/lib/gems/2.5.0/gems/loofah-2.21.1/lib/loofah/html4/document.rb:3:in `<top (required)>'
Answer:
thsj@thsj-pc:/opt/redmine-4.2.0$ sudo gem uninstall nokogiri
You have requested to uninstall the gem:
nokogiri-1.11.7-x86_64-linux
loofah-2.21.1 depends on nokogiri (>= 1.5.9)
marcel-1.0.2 depends on nokogiri (>= 1.9.1, development)
rails-dom-testing-2.2.0 depends on nokogiri (>= 1.6)
roadie-4.0.0 depends on nokogiri (~> 1.8)
sprockets-4.2.0 depends on nokogiri (~> 1.3, development)
If you remove this gem, these dependencies will not be met.
Continue with Uninstall? [yN] y
Remove executables:
nokogiri
in addition to the gem? [Yn] Y
Removing nokogiri
Successfully uninstalled nokogiri-1.11.7-x86_64-linux
vim Gemfile #cahnge version of nokogiri to 1.15.4 >=1.9.1
Question4:
thsj@thsj-pc:/opt/redmine-4.2.0$ sudo bundle exec rake generate_secret_token
Could not find nokogiri-1.11.7-x86_64-linux, redcarpet-3.5.1, mysql2-0.5.5, racc-1.7.1, nio4r-2.5.9, websocket-driver-0.7.6 in locally installed gems
Run `bundle install` to install missing gems.
Answer:
sudo rm Gemfile.lock
sudo RAILS_ENV=production bundle exec rake db:migrate
Question5:
thsj@thsj-pc:/opt/redmine-4.2.0$ sudo RAILS_ENV=production bundle exec rake db:migrate
rake aborted!
Mysql2::Error::ConnectionError: Access denied for user 'redmine'@'localhost' (using password: YES)
/var/lib/gems/2.7.0/gems/mysql2-0.5.5/lib/mysql2/client.rb:97:in `connect'
/var/lib/gems/2.7.0/gems/mysql2-0.5.5/lib/mysql2/client.rb:97:in `initialize'
/var/lib/gems/2.7.0/gems/activerecord-5.2.5/lib/active_record/connection_adapters/mysql2_adapter.rb:22:in `new'
/var/lib/gems/2.7.0/gems/activerecord-5.2.5/lib/active_record/connection_adapters/mysql2_adapter.rb:22:in `mysql2_connection'
Answer:
sudo apt-get install mysql-server mysql-client
sudo mysql -u root -p
mysql>create database redmine;
mysql>alter database redmine character set utf8;
添加用户redmine并刷行权限:
mysql>grant all privileges on redmine.* to redmine@"localhost" identified by 'l' with grant option;
mysql>flush privileges;
9.初始化数据表配置,配置中文zh:
bundle exec rake redmine:load_default_data RAILS_ENV=production REDMINE_LANG=zh
10.设置本地ip地址(192.168.0.13),如果设置了固定IP地址,可以跳过该节.
sudo ifconfig enp0s3 192.168.0.13
11.使用指令启动redmine服务,指定监听端口30010:
bundle exec rails server webrick -e production -b 0.0.0.0 -p 30010
12.在浏览器中输入192.168.0.13:30010,即可进入redmine登录界面,如下图所示:
13.redmine默认用户为:admin,密码:admin,输入用户密码即可登录进入,首次登录redmine需要进行密码修改。
标签:gems,thsj,sudo,redmine,ubuntu,ruby From: https://www.cnblogs.com/boring-luobo/p/17681716.html