• Ubuntu12.04下的Redmine安装和数据库迁移恢复


    一、实验环境:

    主机名         IP(Static)                          系统                                                 配置 

    redmine    192.168.100.201     Ubuntu-12.04-server-amd64             1CPU,1G RAM,60G DISK,1网卡

    文件备份:

    备份原Redmine以下目录和文件:

    /var/lib/redmine/default/files

    /etc/redmine/default/email.yml

    备份原redmine数据库:

    mysqldump --default-character-set=utf8 -hlocalhost -uredmine -pcniaas_linktom -B redmine_default > redmine_bak130218.sql

    将以上备份内容拷贝至新Redmine的root目录;

    配置步骤:

    root@redmine:~# sudo apt-get update

    root@redmine:~# sudo apt-get install mysql-server       /*安装过程中设置mysql root密码为password*/

    root@redmine:~# sudo apt-get install phpmyadmin       /*安装过程中设置phpmyadmin及数据库密码为password*/

    root@redmine:~# sudo apt-get install redmine redmine-mysql          /*安装过程中设置redmine及数据库密码为password*/

    root@redmine:~# sudo apt-get install libapache2-mod-passenger

    root@redmine:~# sudo gem install rdoc -v 2.4.2

    root@redmine:~# sudo dpkg-reconfigure redmine

    root@redmine:~# sudo ln -s /usr/share/redmine/public/ /var/www/redmine

    root@redmine:~# vi /etc/apache2/sites-enabled/000-default               /*在对应位置插入下面6-9行代码*/

    ………………………………  
                    allow from all  
            </Directory>  
                                        
                                        
            <Directory /var/www/redmine>  
                    RailsBaseURI /redmine
                    PassengerResolveSymlinksInDocumentRoot on  
            </Directory>  
                                        
            ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    ………………………………

    浏览器中输入:http://192.168.100.201/phpmyadmin

    用户名:root

    密码:password

    将redmine_default数据库中的表都删除;

    root@redmine:~# ls

    files email.yml redmine_bak130218.sql

    root@redmine:~# cd /var/lib/redmine/default/

    root@redmine:/var/lib/redmine/default# rm -rf files

    root@redmine:/var/lib/redmine/default# cp -r /root/files ./

    root@redmine:/var/lib/redmine/default# cd /etc/redmine/default/

    root@redmine:/etc/redmine/default# cp /root/email.yml ./

    root@redmine:/etc/redmine/default# cd

    root@redmine:~# vi /etc/apache2/mods-available/passenger.conf                       /*插入下列中第四行代码*/

    <IfModule mod_passenger.c>  
      PassengerRoot /usr
      PassengerRuby /usr/bin/ruby
      PassengerDefaultUser www-data  
    </IfModule>

    root@redmine:~# mysql -uroot -ppassword

    mysql> drop database redmine_default;

    mysql> drop user 'redmine'@'localhost';

    mysql> create database redmine_default character set utf8;

    mysql> create user 'redmine'@'localhost'identified by 'password';

    mysql> grant all privileges on redmine_default.* to 'redmine'@'localhost'identified by 'password';

    mysql> quit;

    root@redmine:~# /etc/init.d/mysql restart

    root@redmine:~# mysql -uroot -ppassword < redmine_bak130218.sql

    root@redmine:~# cd /usr/share/redmine

    root@redmine:/usr/share/redmine# rake db:migrate RAILS_ENV="production"

    root@redmine:~# a2enmod passenger rewrite

    root@redmine:~# service apache2 restart

    问题汇总:

    1.redmine 部分页面显示如下:

    Internal error
    An error occurred on the page you were trying to access.
    If you continue to experience problems please contact your redMine administrator for assistance.

    解决办法:

    root@redmine:~# cd /usr/share/redmine

    root@redmine:/usr/share/redmine# rake db:migrate RAILS_ENV="production"

    root@redmine:/usr/share/redmine# reboot

    root@redmine:~# /etc/init.d/apache2 start

    2.执行rake db:migrate RAILS_ENV="production"时如下报错:

    Mysql::Error: Table 'changeset_parents' already exists: CREATE TABLE `changeset_parents` (`changeset_id` int(11) NOT NULL, `parent_id` int(11) NOT NULL) ENGINE=InnoDB

    解决办法:

    登录http://192.168.100.201/phpmyadmin,删除redmine_default数据库中changeset_parents的表;

    或者

    登录mysql使用drop table 命令删除redmine_default中的changeset_parents表;

    然后再次执行如下命令:

    root@redmine:~# cd /usr/share/redmine

    root@redmine:/usr/share/redmine# rake db:migrate RAILS_ENV="production"

    3.执行rake db:migrate RAILS_ENV="production"时如下报错:

    rake aborted!
    Access denied for user 'redmine'@'localhost'(using password: YES)

    解决办法:

    确认/etc/redmine/default/database.yml文件中password项密码与redmine_default一致;

  • 相关阅读:
    java 基础 01 变量和注释、数据类型
    js虚拟数字小键盘
    好看的table样式
    Java8的lambda表达式和Stream API
    设计模式-模板
    【转】Git使用教程之基础篇
    Linux安装redis和部署
    【原】DjianGo Windows7下的安装
    【转】七牛云加速域名配置
    【原】Solr入门之概念和安装
  • 原文地址:https://www.cnblogs.com/myiaas/p/4161380.html
Copyright © 2020-2023  润新知