GitHub clone based on Debian Squeeze Gitolite Git Git-Daemon MySQL Nginx and Mongrel Cluster » History » Version 2
Paul zur Horst-Meyer, 2012-03-31 23:44
1 | 2 | Paul zur Horst-Meyer | h1. GitHub clone based on Debian Squeeze, Gitolite, Git, Git-Daemon, MySQL, Nginx and Mongrel Cluster |
---|---|---|---|
2 | 1 | Paul zur Horst-Meyer | |
3 | h2. requirements |
||
4 | |||
5 | * fresh und updated debian squeeze installation (preferable 64bit) |
||
6 | * login as root |
||
7 | |||
8 | PS: i am sorry, but i don´t like to comment any part and command ob this install notes. |
||
9 | Copy and past should be work :P |
||
10 | |||
11 | h3. Debian package install: |
||
12 | |||
13 | apt-get install imagemagick ruby ruby-dev libruby rubygems mysql-server libmysqlclient-dev libmagickwand-dev git sudo nginx |
||
14 | |||
15 | Ruby Gems package install: |
||
16 | |||
17 | gem install lockfile inifile net-ssh mysql rmagick rdoc mongrel mongrel_cluster |
||
18 | gem install rails -v=2.3.14 |
||
19 | gem install i18n -v=0.4.2 |
||
20 | |||
21 | h3. you have to link some installed gems: |
||
22 | |||
23 | ln -s /var/lib/gems/1.8/bin/rake /usr/bin/ |
||
24 | ln -s /var/lib/gems/1.8/bin/mongrel_rails /usr/bin/ |
||
25 | |||
26 | h2. User configuration |
||
27 | |||
28 | adduser --system --shell /bin/bash --gecos 'Git Administrator' --group --disabled-password --home /opt/gitolite git |
||
29 | adduser --system --shell /bin/bash --gecos 'Redmine Administrator' --group --disabled-password --home /opt/redmine redmine |
||
30 | |||
31 | run _visudo_ and add this content: |
||
32 | |||
33 | redmine ALL=(git) NOPASSWD:ALL |
||
34 | git ALL=(redmine) NOPASSWD:ALL |
||
35 | |||
36 | h2. Setup Gitolite |
||
37 | |||
38 | ... as _Git_ user: |
||
39 | |||
40 | su git |
||
41 | cd ~ |
||
42 | |||
43 | generate gitolite key pair for administration: |
||
44 | |||
45 | ssh-keygen -t dsa |
||
46 | |||
47 | * Install path: /opt/gitolite/.ssh/gitolite_admin_id_rsa |
||
48 | * using passphrase: no |
||
49 | |||
50 | h3. getting sources: |
||
51 | |||
52 | wget https://github.com/sitaramc/gitolite/tarball/master -O gitolite.tar.gz |
||
53 | tar -xf gitolite.tar.gz |
||
54 | |||
55 | create _.profile_ file in git home directory and put content: |
||
56 | |||
57 | PATH=/opt/gitolite/bin:$PATH |
||
58 | |||
59 | prepare setup and install gitolite |
||
60 | |||
61 | source .profile |
||
62 | sitaramc-gitolite-d59bc35/src/gl-system-install |
||
63 | gl-setup -q ~/.ssh/gitolite_admin_id_rsa.pub |
||
64 | rm -rf sitaramc-gitolite-d59bc35 gitolite.tar.gz |
||
65 | exit |
||
66 | |||
67 | h2. give Redmine the administration key pair |
||
68 | |||
69 | mkdir 0700 /opt/redmine/.ssh |
||
70 | cp /opt/gitolite/.ssh/gitolite_admin_id_rsa* /opt/redmine/.ssh |
||
71 | chown -R redmine:redmine /opt/redmine/.ssh |
||
72 | |||
73 | h2. Setup Redmine |
||
74 | |||
75 | ... as _Redmine_ user |
||
76 | |||
77 | su redmine |
||
78 | cd ~ |
||
79 | |||
80 | h3. getting sources: |
||
81 | |||
82 | wget https://github.com/redmine/redmine/tarball/1.3.2 -O redmine.tar.gz |
||
83 | tar -xf redmine.tar.gz |
||
84 | mv redmine-redmine-3490d2a/* . |
||
85 | rm -rf redmine-redmine-3490d2a redmine.tar.gz |
||
86 | |||
87 | prepare database configuration for Redmine: |
||
88 | |||
89 | add a MySQL user and a database for Redmine (find your own way :P): |
||
90 | |||
91 | cp config/database.yml.example config/database.yml |
||
92 | nano config/database.yml |
||
93 | |||
94 | setup tables and example data: |
||
95 | |||
96 | rake generate_session_store |
||
97 | RAILS_ENV=production rake db:migrate |
||
98 | RAILS_ENV=production rake redmine:load_default_data |
||
99 | |||
100 | h2. Setup plugin to manage repositories |
||
101 | |||
102 | cd vendor/plugins |
||
103 | |||
104 | h3. getting sources: |
||
105 | |||
106 | wget https://github.com/ericpaulbishop/redmine_git_hosting/tarball/master -O redmine_plugin.tar.gz |
||
107 | tar -xf redmine_plugin.tar.gz |
||
108 | mv ericpaulbishop-redmine_git_hosting-fdca404 redmine_git_hosting |
||
109 | rm redmine_plugin.tar.gz |
||
110 | |||
111 | edit _redmine_git_hosting/init.rb_ file and customize like you prefare, e.g: |
||
112 | |||
113 | httpServer 'yourRedmine.tld' |
||
114 | gitServer 'yourRedmine.tld' |
||
115 | |||
116 | comment out line 87 to disable Git Urls in repository view if you like |
||
117 | |||
118 | connect to localhost and accept the public key, cancel with ctrl+c and migrate the plugin |
||
119 | |||
120 | cd ~ |
||
121 | ssh localhost |
||
122 | RAILS_ENV=production rake db:migrate_plugins |
||
123 | |||
124 | install mongrel/rails patch |
||
125 | |||
126 | cd ~/config/initializers/ |
||
127 | wget http://www.redmine.org/attachments/download/6901/mongrel.rb |
||
128 | exit |
||
129 | |||
130 | h2. Prepare Mongrel |
||
131 | |||
132 | directories: |
||
133 | |||
134 | mkdir /etc/mongrel |
||
135 | mkdir /var/run/mongrel |
||
136 | chown redmine:redmine /var/run/mongrel |
||
137 | |||
138 | mkdir /var/log/mongrel |
||
139 | chown redmine:redmine /var/log/mongrel |
||
140 | |||
141 | configuration: |
||
142 | |||
143 | 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 |
||
144 | |||
145 | auto start up: |
||
146 | |||
147 | download "Redmine start script" |
||
148 | chmod +x /etc/init.d/redmine |
||
149 | update-rc.d redmine defaults |
||
150 | |||
151 | h2. Setup Nginx |
||
152 | |||
153 | creating own SSL Cert. chain (only for testing, example!): |
||
154 | |||
155 | mkdir /etc/nginx/ssl |
||
156 | cd /etc/nginx/ssl |
||
157 | openssl genrsa -des3 -out server.key 1024 |
||
158 | openssl req -new -key server.key -out server.csr |
||
159 | cp server.key server.key.org |
||
160 | openssl rsa -in server.key.org -out server.key |
||
161 | openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt |
||
162 | |||
163 | download Nginx configuration and copy to _/etc/nginx/sites-available/default_, just overwrite existing file. |
||
164 | |||
165 | h2. Setup Git-Daemon |
||
166 | |||
167 | download "Git-Daemon start script" to _/etc/init.d/git-daemon_ |
||
168 | |||
169 | chmod +x /etc/init.d/git-daemon |
||
170 | update-rc.d -f git-daemon defaults |
||
171 | |||
172 | h1. Finished! |
||
173 | |||
174 | reboot |
||
175 | |||
176 | Login at http://yourRedmine.tld with: |
||
177 | |||
178 | Login: admin |
||
179 | password: admin |