Redmine 2.5.1 installation documentation

1. gcc compilation environment

$: yum -y install gcc

2. Install dependent components

$: yum install flex autoconf zlib curl zlib-devel curl-devel bzip2  bzip2-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel gcc+ gcc-c++ libxml2 libxml2-devel libxslt libxslt-devel

3. Install libyaml-0.1.4

We choose to install in the /usr/local/src directory

$: cd /usr/local/src
$: wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
$: tar xzvf yaml-0.1.4.tar.gz
$: cd yaml-0.1.4
$: ./configure --prefix=/usr/local
$: make
$: make install

4. Install libyaml-devel

This article is installed on a 64-bit Linux system, so choose a 64-bit system installation source

// 64位系统
$: su -c 'rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm'

// 32位系统(32位系统选择此源安装)
$: su -c 'rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm'

Install libyaml-devel

$: yum install libyaml-devel

5. Install MySql

This article does not specify the installation directory for mysql, and it is installed in /var/lib/mysql by default.

$: yum install mysql mysql-server mysql-devel
$: ls /etc/rc.d/init.d/mysqld -l
$: chkconfig --add mysqld
$: chkconfig mysqld on  # 设置mysql开机启动
$: chmod 755 /etc/rc.d/init.d/mysqld  # 修改mysql执行权限
// 启动mysql
$:service mysqld start
// 修改mysql密码
$: mysqladmin -uroot password '123456' # 123456为新设置的密码
// 命令行登录
$: mysql -uroot -p
Password 123456   # 输入刚新设置的密码
// 进行相关数据库配置
mysql > create database redmine character set utf8;
mysql > create user 'redmine'@'localhost' identified by 'redmine';
mysql > grant all privileges on redmine.* to 'redmine'@'localhost';
mysql > FLUSH PRIVILEGES;
mysql > exit;  # 退出mysql

6. Install Ruby 1.9.3

We choose to install in the /usr/local/src directory, we choose to install in the /usr/local/src directory

$: cd /usr/local/src
$: wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p547.tar.gz
$: tar zxvf ruby-1.9.3-p547.tar.gz
$: cd ruby-1.9.3-p547
$: ./configure --prefix=/usr/local/ruby --enable-shared --disable-install-doc --with-opt-dir=/usr/local/lib
$: make
$: make install

Ruby environment variable configuration

$: vi /etc/profile
// 在文件末尾添加如下内容
RUBY_HOME=/usr/local/ruby
PATH=$PATH:$RUBY_HOME/bin
export RUBY_HOME PATH

//保存退出,操作:ESC -> :wq
$: source /etc/profile  # 更新环境变量配置

test ruby

$: ruby -v
ruby 1.9.3p547 (2014-05-14 revision 45962) [x86_64-linux]

$: gem -v
1.8.23.2

ROOT environment variable operation

$: alternatives --install /usr/bin/ruby ruby /usr/local/ruby/bin/ruby 300
$: alternatives --install /usr/bin/gem gem /usr/local/ruby/bin/gem 300

7. Install Rails

$: gem install rails -v "3.2.17" -V  # 安装指定的版本

8. Install Bundler

$: gem install bundler -V
$: alternatives --install /usr/bin/bundle bundle /usr/local/ruby/bin/bundle 300

9. Install Redmine,

9.1 Preparations

$: yum install ImageMagick-devel

9.2 We choose to install in the /usr/local/src directory

$: cd /usr/local/src
$: wget http://www.redmine.org/releases/redmine-2.5.1.tar.gz
$: tar zxvf redmine-2.5.1.tar.gz
$: mv redmine-2.5.1 redmine

9.3 Change the installation path

$: mkdir /data
$: cd /data
$: mkdir www
$: cd /usr/local/src
$: mv /usr/local/src/redmine /data/www

9.4 Modify the configuration file

$: cd /data/www/redmine/config
// 修改配置信息文件
$: cp database.yml.example database.yml
// 进入修改
$: vim database.yml
// 修改内容如下
production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "redmine"
  encoding: utf8
development:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "redmine"
  encoding: utf8

$: cd /data/www/redmine
$: vi Gemfile
// 修改内容如下
# gem "rmagick", ">= 2.0.0"  // 注释掉这行,添加下面这行
  gem "rmagick", :require => "RMagick"

9.5 Install Redmine's ruby ​​components

First, we need a user other than root, such as user1 to create user1

$: useradd -d /usr/user1 -g users -m user1
$: passwd user1
# 设置user1新密码

// 为user1添加sudo权限,该步骤在root用户下操作
$: chmod u+w /etc/sudoers # 添加sudo文件的写权限
$: vi /etc/sudoers
// 找到这行 root ALL=(ALL) ALL,在他下面添加:
user1    ALL=(ALL)       ALL
$: chmod u-w /etc/sudoers # 撤销sudoers文件写权限

Because redmine cannot be executed with root privileges when executing bread install, we change the permissions to other accounts, such as user1, and we change the root directory permissions of redmine to user1

$: cd /data/www
$: sudo chown -R user1:users redmine

Enter the redmine root directory, bundle execution, be careful not to use root permissions to execute, execute under user1 permissions

$: cd /data/www/redmine 
$: su user1
$: bundle install 

The installation is completed as shown in the figure:

Enter image description

9.6 Generate a security token, you can switch back to the root user at this time

$: su root
$: bundle exec rake generate_secret_token

9.7 Generate data table and import initialization data

$: cd /data/www/redmine/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
// 这一步会让你选择 language,我们选择 zh 即可

9.8 Activate FCGI4

$: cd /data/www/redmine/public
$: cp dispatch.fcgi.example dispatch.fcgi
$: cp htaccess.fcgi.example .htaccess
$: yum install epel-release
$: yum install mod_fcgid

9.9 Redmine configuration

$: cd /data/www/redmine/config
$: cp configuration.yml.example configuration.yml
$: vi configuration.yml
// 修改内容如下
attachments_storage_path: /data/www/redmine/files  # 冒号后面有个空格,不能漏

Turn off the firewall before the official start:

$: service iptables stop # 重启后失效
$: chkconfig iptables off # 禁用防火墙

10. Start Rdemine

$: cd /data/www/redmine
$: nohup bundle exec rails server webrick -p3000 -b 0.0.0.0 -e production >/dev/null 2>&1 &

If the startup fails, you can execute the following code to check the error, if there is no error, Ctrl + C can exit

$: bundle exec rails server webrick -e production

11. Open the browser to log in

The browser address is the installed host IP: 3000, such as 192.168.1.120:3000 Default account name: admin, default password: admin

Note: When clicking "Help" on the page, the page will jump to http://www.redmine.org/guide. When logging in to the account, the IP is http://www.redmine.org/login, and the account number is http://www.redmine.org/login. If we can't log in, we must change the IP address to http://192.168.1.120:3000/login to log in to the account!

12. Redmine background change password

$: cd /data/www/redmine/script
$: ./rails console production
// 进入ruby环境
ruby > admin_user = User.find_by_login('admin')
ruby > admin_user.password = 'password' # 登录密码修改为 password
ruby > admin_user.save!
ruby > quit

Common error solutions:

Error 1:

You may encounter "Could not load OpenSSL." when running bundle install

solution:

$: yum install openssl openssl-devel
$: cd /usr/local/src/ruby-1.9.3-p547/ext/openssl
$: ruby extconf.rb
$: make && make install

Error 2: You may encounter when running bundle install

"Gem::InstallError: nokogiri requires Ruby version >= 2.1.0. An error occurred while installing nokogiri (1.8.1), and Bundler cannot continue. Make sure that gem install nokogiri -v '1.8.1' succeeds before bundling."

solution:

$: cd /data/www/redmine
$: vi Gemfile
// 修改内容如下
# gem "rmagick", :require => "RMagick"  // 注释掉这行,修改为下面这行
  gem "rmagick", ">= 2.0.0"

Error 3:

You may encounter when running RAILS_ENV=production bundle exec rake db:migrate

"Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)"

solution:

$: ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325445090&siteId=291194637