2012년 3월 17일 토요일

Redmine 1.3.x 설치(Ubuntu 10.4)

  1. Install the LAMP stack
    $ sudo tasksel install lamp-server
     
  2. Install the required packages 
$ sudo apt-get install build-essential
$ sudo apt-get install ruby rdoc libopenssl-ruby
$ wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz
$ tar zxvf rubygems-1.3.7.tgz
$ cd rubygems-1.3.7
$ sudo ruby setup.rb
$ ln -s /usr/bin/gem1.8 /usr/local/bin/gem
$ sudo gem install rail

 Installing MySQL gem:

$ apt-get install ruby-dev libmysql-ruby libmysqlclient-dev
$ gem install mysql
       
  1. Install the required Ruby gems
    $ sudo gem install rails -v=2.3.14 --no-ri --no-rdoc
    $ sudo gem install rake -v=0.8.7 --no-ri --no-rdoc
    $ sudo gem uninstall rake -v=0.9.2.2 
    $ sudo gem install i18n -v=0.4.2 --no-ri --no-rdoc
    $ sudo gem install mysql --no-ri --no-rdoc
     
  2. Download Redmine into /user/share/redmine directory
    $ sudo svn co http://redmine.rubyforge.org/svn/branches/1.3-stable /usr/share/redmine
     
  3. Create an empty MySQL database and accompanying user named redmine for example.
    $ mysql -u root -p
    (enter the mysql root user password)
    > create database redmine character set utf8;
    > create user 'redmine'@'localhost' identified by '[password]';
    > grant all privileges on redmine.* to 'redmine'@'localhost' identified by '[password]';
    > exit
     
  4. Copy config/database.yml.example to config/database.yml and edit this file in order to configure your database settings for "production" environment.
    $ sudo cp /usr/share/redmine/config/database.yml.example /usr/share/redmine/config/database.yml
    
    $ sudo nano /usr/share/redmine/config/database.yml
    
    Modify to the following and save (ctrl+x)
    
    production:
      adapter: mysql
      socket: /var/run/mysqld/mysqld.sock
      database: redmine
      host: localhost
      username: redmine
      password: [password]
      encoding: utf8
     
  5. Generate a session store secret.
    $ cd /usr/share/redmine
    $ sudo rake generate_session_store
     
  6. Create the database structure, by running the following command under the application root directory:
    $ cd /usr/share/redmine
    $ sudo rake db:migrate RAILS_ENV="production" 
     
  7. Insert default configuration data in database, by running the following command:
    $ sudo RAILS_ENV=production rake redmine:load_default_data
     
  8. Setting up permissions
    $ cd /usr/share/redmine
    $ sudo chown -R www-data:www-data files log tmp public/plugin_assets
     
  9. Test using the webrick web server
    $ cd /usr/share/redmine
    
    $ ruby script/server webrick -e production
    
    Point your web browser at http://[my server ip]:3000
    
    You should now see the application welcome page.
     

    Apache Integration

  10. Install the required packages
    $ sudo apt-get install libapache2-mod-passenger
     
  11. Add a symbolic link to the public redmine web directory
    $ sudo ln -s /usr/share/redmine/public /var/www/redmine
     
  12. Configure Passanger to run as www-data
    $ sudo nano /etc/apache2/mods-available/passenger.conf
    
    Add the follow line and save (ctrl+x)
    
    PassengerDefaultUser www-data
     
  13. Create a new Apache site file
     
    $ sudo nano /etc/apache2/sites-available/redmine 
    

    Add the following lines and save (ctrl+x)
    <VirtualHost *:80>
            ServerAdmin webmaster@localhost
            DocumentRoot /var/www
            ServerName myservername
    
            RewriteEngine on
            RewriteRule   ^/$  /redmine  [R]
    
            <Directory /var/www/redmine>
                    RailsBaseURI /redmine
                    PassengerResolveSymlinksInDocumentRoot on
            </Directory>
    
            ErrorLog /var/log/apache2/error.log
    
            # Possible values include: debug, info, notice, warn, error, crit,
            # alert, emerg.
            LogLevel warn
    
            CustomLog /var/log/apache2/access.log combined
    </VirtualHost>
    

    For SSL add the following text instead
    <VirtualHost *:443>
            ServerAdmin webmaster@localhost
            DocumentRoot /var/www
            ServerName myservername
    
            SSLEngine On
            SSLCertificateFile /etc/apache2/ssl/redmine.pem
    
            RewriteEngine on
            RewriteRule   ^/$  /redmine  [R]
    
            <Directory /var/www/redmine>
                    RailsBaseURI /redmine
                    PassengerResolveSymlinksInDocumentRoot on
            </Directory>
    
            ErrorLog /var/log/apache2/error.log
    
            # Possible values include: debug, info, notice, warn, error, crit,
            # alert, emerg.
            LogLevel warn
    
            CustomLog /var/log/apache2/access.log combined
    </VirtualHost>
     
  14. Enable the Redmine website
    $ sudo a2dissite default
    $ sudo a2ensite redmine
     
  15. Enable the Passenger and Rewite modules and restart Apache
    $ sudo a2enmod passenger
    $ sudo a2enmod rewrite
    $ sudo /etc/init.d/apache2 restart
     
  16. Test the setup
    Open up your favorite web browser and goto
    
    http://[my site or ip]/redmine 
     

    Subversion Integration

  17. Install the latest Mercurial release
    $ sudo apt-get install subversion libapache2-svn libapache-dbi-perl libapache2-mod-perl2
     
  18. Create the svn repository directory
    $ sudo mkdir /var/svn
     
  19. Setup permissions
    $ sudo chown -R www-data:www-data /var/svn
     
  20. Add a symbolic link to Redmine.pm
    $ sudo ln -s /usr/share/redmine/extra/svn/Redmine.pm /usr/lib/perl5/Apache/Redmine.pm
    $ sudo ln -s /usr/share/redmine/extra/svn/Redmine.pm /usr/lib/perl5/Apache2/Redmine.pm 
     
  21. Create a Apache config file
    $ sudo nano /etc/apache2/conf.d/svn.config
    

    Add the following and save
    PerlLoadModule Apache::Redmine
    <Location /svn>
        DAV svn
        SVNParentPath "/var/svn" 
        Order deny,allow
        Deny from all
        Satisfy any
    
        PerlAccessHandler Apache::Authn::Redmine::access_handler
        PerlAuthenHandler Apache::Authn::Redmine::authen_handler
        AuthType Basic
        AuthName "Redmine Subversion Repository" 
    
        #read-only access    
        <Limit GET PROPFIND OPTIONS REPORT>
            Require valid-user
            Allow from [my server ip]
            # Allow from another-ip
             Satisfy any
        </Limit>
            # write access
            <LimitExcept GET PROPFIND OPTIONS REPORT>
            Require valid-user
        </LimitExcept>
    
        ## for mysql
        RedmineDSN "DBI:mysql:database=redmine;host=localhost" 
        RedmineDbUser "redmine" 
        RedmineDbPass "password" 
    </Location>
     
  22. Enable the required Apache modules and restart Apache
    $ sudo a2enmod dav_svn
    $ sudo /etc/init.d/apache2 restart
     
  23. Create a new test repository
    $ sudo svnadmin create /var/svn/test
    $ sudo chown -R www-data:www-data /var/svn/test
    

Automate Repository Creation

  1. Enable WS for repository management and generate and API key
    * From the Redmine Administration menu select Settings
    * Click on the Repositories tab
    * Enable the 'Enable WS for repository management' checkbox
    * Click the 'Generate a key' link 
    * Press the 'Save' button
     
  2. Modify reposman.rb
    $ sudo nano /usr/share/redmine/extra/svn/reposman.rb
    
    Add the following to module SCM and save  
    
      module Mercurial
        def self.create(path)
          Dir.mkdir path
          Dir.chdir(path) do
            system_or_raise "hg init" 
          end
        end
      end
     
  3. Schedule the reposman.rb script to run every minute
    $ sudo nano /etc/cron.d/redmine
    

    Add one of the following lines (not both) and save.
    (Note: you will need to replace [my API key] with the API key you generated in step 1)
    .
    To create subversion repositories add:
    * * * * * root ruby /usr/share/redmine/extra/svn/reposman.rb --redmine localhost/redmine --scm Subversion --svn-dir /var/svn --owner www-data --url file:///var/svn --key=[my API key] >> /var/log/reposman.log
     
    참고: http://www.redmine.org/projects/redmine/wiki/HowToInstallRedmineOnUbuntuServer 

rubby-gem 1.3.7 설치( Ubuntu 10.4)

$ sudo su
$ apt-get install build-essential
$ apt-get install ruby rdoc libopenssl-ruby
$ wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz
$ tar zxvf rubygems-1.3.7.tgz
$ cd rubygems-1.3.7
$ ruby setup.rb
$ ln -s /usr/bin/gem1.8 /usr/local/bin/gem
$ gem install rails


Installing MySQL gem:

$ apt-get install ruby-dev libmysql-ruby libmysqlclient-dev
$ gem install mysql


참고: http://castilho.biz/blog/2010/05/08/how-to-install-ruby-on-rails-on-ubuntu-10-04-lucid-lynx/

2012년 3월 16일 금요일

Redmine Gmail 설정

1. GMail을 사용하기 위한 TLS 플러그인 설치 
$ cd /usr/share/redmine
$ sudo ruby script/plugin install git://github.com/collectiveidea/action_mailer_optional_tls.git
2.  config/configuration.yml를 복사한후에 아래 설정을 추가
$ sudo cp config/configuration.yml.example config/configuration.yml
$ sudo vi config/configuration.yml
production:
  delivery_method: :smtp
  smtp_settings:
    tls: true
    address: "smtp.gmail.com"
    port: '587'
    domain: "smtp.gmail.com"
    authentication: :plain
    user_name: "your_email@gmail.com"
    password: "your_password" 
 3. Redmine  재시작후  아래 순서대로 실행
- administrator로 로그인
- Administration panel -> Settings ->Email notifications 으로 이동
- "Send a test email" 클릭
참고
http://www.redmineblog.com/articles/setup-redmine-to-send-email-using-gmail/


2012년 3월 12일 월요일

MySQL Root Access Deny

MySQL 사용중 다음 에러 발생할 때
ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)
Password Resetting으로 해결가능하다.


1. 현재 실행중인 MySQL 데몬을 중지시킴.
sudo /etc/init.d/mysql stop
2. skip-grant-tables옵션으로 mysqld 데몬을 시작함.
sudo /usr/sbin/mysqld --skip-grant-tables &
3. MySQL 클라이언트 실행
mysql -u root
4. 아래 SQL문으로 root계정 패스워드를 새로 만듬.
UPDATE mysql.user SET Password=PASSWORD('newpwd') WHERE User='root';
FLUSH PRIVILEGES;

 
참고 : http://www.anisjendoubi.com/2010/01/mysql-error-1045-access-denied-for-user-root-localhost/
 

2012년 2월 20일 월요일

Eclipse svn plugin 설치(Ubuntu10.04)

1. JavaHL 라이브러리 설치
sudo apt-get install libsvn-java
2. Sun JAVA를 사용중이라면, /etc/eclipse.ini에 다음 라인을 추가
-Djava.library.path=/usr/lib/jni
3. Eclipse를 실행하여 메뉴의 Help->Install New Software->Add 에 다음 항목을 추가한다.
Name: Subclipse 1.6.x (Eclipse 3.2+)
URL:  http://subclipse.tigris.org/update_1.6.x
4.  Work with 칸에서 ubclipse 1.6.x (Eclipse 3.2+) - http://subclipse.tigris.org/update_1.6.x/를 선택.

5. 아래 Name칸에서 Subclipse 선택 -> Next -> Finish 클릭

2012년 1월 20일 금요일

Ubuntu와 CentOS 멀티 부팅시 GRUB 복구

기존 Ubuntu 10.4 가 설치되어 있는 컴퓨터에 CentOS6.2를 새로 설치하였다.
설치중에 GRUB 설치위치를 MBR로 잡았더니, Ubuntu용 GRUB이 삭제되고 CentOS용 GRUB이 새로 설치되었다. 문제는 CentOS에서 Ubuntu가 자동인식이 되지 않는 것이다. CentOS는 기존 GRUB을 사용하는 반면, Ubuntu10.4는 새 버전인 GRUB2를 사용하고 있기 때문이다.
GRUB편집 메뉴에서 Ubuntu 파티션을 입력하였지만 ,부팅시 GRUB 메뉴에서 Ubuntu 선택시 부팅이 실패하는 것이었다. (설치순서가 바뀌었다면 문제가 없다.) 복구CD가 있으면 좋겠지만 당장에는 구할 수가 없다. 구글링 결과 아래 링크에서 해결책을 발견하였다.

http://blog.namran.net/2009/11/13/integrating-ubuntu-boot-config-into-centos-5-4-grub/

1. CentOS로 부팅한후 fdisk로 파티션을 확인한다.
$$fdisk  -l
현재 sda3이 CentOS이고 sda6이 Ubuntu이다.
2. CentOS에서 Ubuntu의루트파티션을 마운트한다.
$ mkdir /media/ubuntu
$ mount /dev/sda3 /media/ubuntu
3. Ubuntu의 grub.cfg를 확인한다.
$ cat /media/ubuntu/boot/grub/grub.cfg
4. 커널이미지와 램디스크이미지를 CentOS의 /boot로 복사한다.
$ cp /media/ubuntu/boot/vmlinuz-2.6.32-24-generic /boot/.
$ cp /media/ubuntu/boot/initrd.img-2.6.32-24-generic /boot/.                        
 5. CentOS의 grub.conf에 복사한 두 파일을 추가한다. root항목이 CentOS의 파티션임을 주의.
$ cat /boot/grub/grub.conf
title Ubuntu 10.04
root (hd0,2)
linux /boot/vmlinuz-2.6.32-24-generic root=UUID=*** ro quiet splash
initrd /boot/initrd.img-2.6.32-24-generic
6. GRUB을 MBR에 설치한다.
$ grub-install --recheck -no-floppy /dev/sda
7. 재부팅하여 Ubuntu로 들어간다. 

8. 만일 Ubuntu의 GRUB을 사용하고자 한다면,  Ubuntu에서 update-grub을 실행하면 CentOS까지 자동으로 인식된다.  GRUB을 MBR에 설치한다.
$ update-grub
$ grub-install --recheck -no-floppy /dev/sda