Project

General

Profile

GitHub clone based on Debian Squeeze Gitolite Git Git-Daemon MySQL Nginx and Mongrel Cluster » History » Revision 5

Revision 4 (Paul zur Horst-Meyer, 2012-04-01 00:04) → Revision 5/6 (Andrew Perry, 2012-04-12 10:39)

h1. GitHub clone based on Debian Squeeze, Gitolite, Git, Git-Daemon, MySQL, Nginx and Mongrel Cluster 

 h2. requirements 

 * fresh und updated debian squeeze installation (preferable 64bit) 
 * login as root 

 PS: i am sorry, but i don´t like to comment any part and command of this install notes.  
 Copy and past should be work :P 

 h3. Debian package install: 

  apt-get install imagemagick ruby ruby-dev libruby rubygems mysql-server libmysqlclient-dev libmagickwand-dev git sudo nginx exim4 

 Ruby Gems package install: 

  gem install lockfile inifile net-ssh mysql rmagick rdoc mongrel mongrel_cluster 
 gem install rails -v=2.3.14 
 gem install i18n -v=0.4.2 

 h3. you have to link some installed gems: 

  ln -s /var/lib/gems/1.8/bin/rake /usr/bin/ 
 ln -s /var/lib/gems/1.8/bin/mongrel_rails /usr/bin/ 

 h2. User configuration 

  adduser --system --shell /bin/bash --gecos 'Git Administrator' --group --disabled-password --home /opt/gitolite git 
 adduser --system --shell /bin/bash --gecos 'Redmine Administrator' --group --disabled-password --home /opt/redmine redmine 

 run _visudo_ and add this content: 

  redmine    ALL=(git)        NOPASSWD:ALL 
 git        ALL=(redmine)    NOPASSWD:ALL 

 h2. Setup Gitolite 

 ... as _Git_ user: 

  su git 
 cd ~ 

 generate gitolite key pair for administration: 

  ssh-keygen -t dsa 

 * Install path: /opt/gitolite/.ssh/gitolite_admin_id_rsa 
 * using passphrase: no 

 h3. getting sources: 

  wget https://github.com/sitaramc/gitolite/tarball/master -O gitolite.tar.gz 
 tar -xf gitolite.tar.gz 

 create _.profile_ file in git home directory and put content: 

  PATH=/opt/gitolite/bin:$PATH 

 prepare setup and install gitolite 

  source .profile 
 sitaramc-gitolite-d59bc35/src/gl-system-install 
 gl-setup -q ~/.ssh/gitolite_admin_id_rsa.pub 
 rm -rf sitaramc-gitolite-d59bc35 gitolite.tar.gz 
 exit 

 h2. give Redmine the administration key pair 

  mkdir 0700 /opt/redmine/.ssh 
 cp /opt/gitolite/.ssh/gitolite_admin_id_rsa* /opt/redmine/.ssh 
 chown -R redmine:redmine /opt/redmine/.ssh 

 h2. Setup Redmine 

 ... as _Redmine_ user 

  su redmine 
 cd ~ 

 h3. getting sources: 

  wget https://github.com/redmine/redmine/tarball/1.3.2 -O redmine.tar.gz 
 tar -xf redmine.tar.gz 
 mv redmine-redmine-3490d2a/* . 
 rm -rf redmine-redmine-3490d2a redmine.tar.gz 

 add a MySQL user and a database for Redmine (find your own way :P). 
 Insert connection data in configuration file ("Production" part): 

  cp config/database.yml.example config/database.yml 
 nano config/database.yml 

 setup tables and example data: 

  rake generate_session_store 
 RAILS_ENV=production rake db:migrate 
 RAILS_ENV=production rake redmine:load_default_data 

 h2. Setup plugin to manage repositories 

  cd vendor/plugins 

 h3. getting sources: 

  wget https://github.com/ericpaulbishop/redmine_git_hosting/tarball/master -O redmine_plugin.tar.gz 
 tar -xf redmine_plugin.tar.gz 
 mv ericpaulbishop-redmine_git_hosting-fdca404 redmine_git_hosting 
 rm redmine_plugin.tar.gz 

 edit _redmine_git_hosting/init.rb_ file and customize like you prefare, e.g: 

  httpServer 'yourRedmine.tld' 
 gitServer 'yourRedmine.tld' 

 comment out line 87 to disable Git Urls in repository view if you like 

 connect to localhost and accept the public key, cancel with ctrl+c and migrate the plugin 

  cd ~ 
 ssh localhost 
 RAILS_ENV=production rake db:migrate_plugins 

 install mongrel/rails patch 

  cd ~/config/initializers/ 
 wget http://www.redmine.org/attachments/download/6901/mongrel.rb 
 exit 

 h2. Prepare Mongrel 

 directories: 

  mkdir /etc/mongrel 
 mkdir /var/run/mongrel 
 chown redmine:redmine /var/run/mongrel 

  mkdir /var/log/mongrel 
 chown redmine:redmine /var/log/mongrel 

 configuration: 

  mongrel_rails cluster::configure -e production -p 3000 -N 3 -c /opt/redmine -C /etc/mongrel/redmine-cluster.yml -a 127.0.0.1 --user redmine --group redmine -l /var/log/mongrel/mongrel.log -P /var/run/mongrel/mongrel.pid 

 auto start up: 

  wget http://www.redmine.org/attachments/download/7397/redmine_mongrel.sh -O /etc/init.d/redmine 
 chmod +x /etc/init.d/redmine 
 update-rc.d redmine defaults 

 h2. Setup Nginx 

 creating own SSL Cert. chain (only for testing, example!): 

  mkdir /etc/nginx/ssl 
 cd /etc/nginx/ssl 
 openssl genrsa -des3 -out server.key 1024 
 openssl req -new -key server.key -out server.csr 
 cp server.key server.key.org 
 openssl rsa -in server.key.org -out server.key 
 openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt 

 configuration: 

  wget http://www.redmine.org/attachments/download/7398/default.txt -O /etc/nginx/sites-available/default  

 just overwrite existing file. 

 h2. Setup Git-Daemon 


  wget http://www.redmine.org/attachments/download/7399/git_daemon.txt -O /etc/init.d/git-daemon 
 chmod +x /etc/init.d/git-daemon 
 update-rc.d -f git-daemon defaults 


 h2. Setup mail server 

  dpkg-reconfigure exim4-config 

 Select "internet site; mail is sent and received directly using SMTP" and otherwise put in a sane FQDN and email account for root email to be forwarded to 

 h1. Finished! 

  reboot 

 Login at http://yourRedmine.tld with: 

  Login: admin 
 password: admin