安装ruby语言,下载安装工具 railsinstaller
railsinstaller-3.4.0.exe
FQA:
启动MySQL
mysql -u root -p
显示:
C:\Users\Administrator>mysql -u root -p
Enter password: ***
执行SQL脚本,创建&设置数据库
CREATE DATABASE redmine CHARACTER SET utf8;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
显示:
mysql> CREATE DATABASE redmine CHARACTER SET utf8;
Query OK, 1 row affected (0.03 sec)
创建配置文件:
C:\Sites\redmine-3.2.9\config\database.yml
输入如下的参数
production:
adapter: mysql2
database: redmine
host: 127.0.0.1
username: redmine
password: my_password
保存文件
7
使用Ruby安装其他部分,将会遇到许多的坑。
执行:
gem install bundler
C:\Sites>gem install bundler
Fetching: bundler-1.16.1.gem (100%)
Successfully installed bundler-1.16.1
Parsing documentation for bundler-1.16.1
Installing ri documentation for bundler-1.16.1
Done installing documentation for bundler after 6 seconds
1 gem installed
C:\Sites>
执行:
bundle install --without development test
执行需要一段时间
提示
Fetching mysql2 0.4.10 (x86-mingw32)
Installing mysql2 0.4.10 (x86-mingw32)
略
执行:
bundle install --without development test rmagick
这里可能有问题,这个问题是可以忽略的
执行:
bundle exec rake generate_secret_token
[
<<<<<<<<<<< 这一步也会出现问题
出错:Failed to load libmysql.dll from
Failed to load libmysql.dll from C:\RailsInstaller\Ruby2.3.3\lib\ruby\gems\2.3.0\gems\mysql2-.4.10-x86-mingw32\vendor\libmysql.dll
问题的解决方法:
卸载
gem uninstall mysql2
Successfully uninstalled mysql2-0.4.10-x86-mingw32
下载 Mysql 的客户端对应版本 zip 格式文件,解压缩到d:根目录下,执行
gem install mysql2 --platform=ruby -- '--with-mysql-lib="d:\mysql-connector-c-noinstall-6.0.2-win32\lib" --with-mysql-include="d:\mysql-connector-c-noinstall-6.0.2-win32\include"'
再执行一次:
bundle exec rake generate_secret_token
如果还是有问题,启用流氓方法,暴力解决,将高版本的 mysql 目录中的文件复制到低版本mysql2 (0.4.10 x86-mingw32)目录中(或直接修改目录名):
C:\RailsInstaller\Ruby2.3.3\lib\ruby\gems\2.3.0\gems\mysql2-0.4.10-x86-mingw32
]
设置环境变量,启动起来它:
set RAILS_ENV=production
bundle exec rake db:migrate
set RAILS_ENV=production
set REDMINE_LANG=en
bundle exec rake redmine:load_default_data
8
启动服务测试(保证 MySQL 服务是启动状态)
bundle exec rails server webrick -e production
C:\Sites\redmine-3.2.9>bundle exec rails server webrick -e production
openssl 使用记录
D:\openssl-0.9.8h-1-bin\bin>openssl req -x509 -sha256 -nodes -days 1095 -newkey rsa:2048 -keyout self.key -out self.crt -subj /CN=*.com -config openssl.cnf
Loading 'screen' into random state - done
Generating a 2048 bit RSA private key
bundle exec rails server webrick -e production
进入redmine安装目录,假设redmine安装在/var/www/html/redmine/目录下。
cd /var/www/html/redmine/script
执行如下命令,进入ruby,根据当前使用环境不同,使用不同的参数,如:production,development,test等。
./rails console production
取得你要修改的用户对象(ruby>代表进入ruby环境),admin。
ruby> admin_user = User.find_by_login('admin')
修改admin用户对象密码。
ruby> admin_user.password = 'password'
注: 这个密码不能太短,否则报错。
保存admin用户对象信息。
ruby> admin_user.save!
退出ruby环境。
ruby> quit
这样应该就可以用password这个新密码登录系统了。
Rails Installer
安装Ruby on Rails从此不在折腾。
这个方法是一条龙安装,包括了Ruby和Rails,还有折腾无数壮士的DevKit。
Ruby 1.9.2-p290
Rails 3.1.1
Bundler 1.0.18
Git 1.7.6
Sqlite 3.7.3
TinyTDS 0.4.5
SQL Server support 3.3.3
DevKit
最后,在CMD中运行
ruby -v