GitHub clone based on Debian Squeeze Gitolite Git Git-Daemon MySQL Nginx and Mongrel Cluster » History » Version 5
Andrew Perry, 2012-04-12 10:39
Adding instructions for a basic mail server so that passwords can be reset etc.
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 | 4 | Paul zur Horst-Meyer | PS: i am sorry, but i don´t like to comment any part and command of this install notes. |
9 | 1 | Paul zur Horst-Meyer | Copy and past should be work :P |
10 | |||
11 | h3. Debian package install: |
||
12 | |||
13 | 5 | Andrew Perry | apt-get install imagemagick ruby ruby-dev libruby rubygems mysql-server libmysqlclient-dev libmagickwand-dev git sudo nginx exim4 |
14 | 1 | Paul zur Horst-Meyer | |
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 | 4 | Paul zur Horst-Meyer | add a MySQL user and a database for Redmine (find your own way :P). |
88 | Insert connection data in configuration file ("Production" part): |
||
89 | 1 | Paul zur Horst-Meyer | |
90 | cp config/database.yml.example config/database.yml |
||
91 | nano config/database.yml |
||
92 | |||
93 | setup tables and example data: |
||
94 | |||
95 | rake generate_session_store |
||
96 | RAILS_ENV=production rake db:migrate |
||
97 | RAILS_ENV=production rake redmine:load_default_data |
||
98 | |||
99 | h2. Setup plugin to manage repositories |
||
100 | |||
101 | cd vendor/plugins |
||
102 | |||
103 | h3. getting sources: |
||
104 | |||
105 | wget https://github.com/ericpaulbishop/redmine_git_hosting/tarball/master -O redmine_plugin.tar.gz |
||
106 | tar -xf redmine_plugin.tar.gz |
||
107 | mv ericpaulbishop-redmine_git_hosting-fdca404 redmine_git_hosting |
||
108 | rm redmine_plugin.tar.gz |
||
109 | |||
110 | edit _redmine_git_hosting/init.rb_ file and customize like you prefare, e.g: |
||
111 | |||
112 | httpServer 'yourRedmine.tld' |
||
113 | gitServer 'yourRedmine.tld' |
||
114 | |||
115 | comment out line 87 to disable Git Urls in repository view if you like |
||
116 | |||
117 | connect to localhost and accept the public key, cancel with ctrl+c and migrate the plugin |
||
118 | |||
119 | cd ~ |
||
120 | ssh localhost |
||
121 | RAILS_ENV=production rake db:migrate_plugins |
||
122 | |||
123 | install mongrel/rails patch |
||
124 | |||
125 | cd ~/config/initializers/ |
||
126 | wget http://www.redmine.org/attachments/download/6901/mongrel.rb |
||
127 | exit |
||
128 | |||
129 | h2. Prepare Mongrel |
||
130 | |||
131 | directories: |
||
132 | |||
133 | mkdir /etc/mongrel |
||
134 | mkdir /var/run/mongrel |
||
135 | chown redmine:redmine /var/run/mongrel |
||
136 | |||
137 | mkdir /var/log/mongrel |
||
138 | chown redmine:redmine /var/log/mongrel |
||
139 | |||
140 | configuration: |
||
141 | |||
142 | 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 |
||
143 | |||
144 | auto start up: |
||
145 | |||
146 | 3 | Paul zur Horst-Meyer | wget http://www.redmine.org/attachments/download/7397/redmine_mongrel.sh -O /etc/init.d/redmine |
147 | 1 | Paul zur Horst-Meyer | chmod +x /etc/init.d/redmine |
148 | update-rc.d redmine defaults |
||
149 | |||
150 | h2. Setup Nginx |
||
151 | |||
152 | creating own SSL Cert. chain (only for testing, example!): |
||
153 | |||
154 | mkdir /etc/nginx/ssl |
||
155 | cd /etc/nginx/ssl |
||
156 | openssl genrsa -des3 -out server.key 1024 |
||
157 | openssl req -new -key server.key -out server.csr |
||
158 | cp server.key server.key.org |
||
159 | openssl rsa -in server.key.org -out server.key |
||
160 | openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt |
||
161 | |||
162 | 3 | Paul zur Horst-Meyer | configuration: |
163 | 1 | Paul zur Horst-Meyer | |
164 | 3 | Paul zur Horst-Meyer | wget http://www.redmine.org/attachments/download/7398/default.txt -O /etc/nginx/sites-available/default |
165 | |||
166 | just overwrite existing file. |
||
167 | |||
168 | 1 | Paul zur Horst-Meyer | h2. Setup Git-Daemon |
169 | |||
170 | |||
171 | 3 | Paul zur Horst-Meyer | wget http://www.redmine.org/attachments/download/7399/git_daemon.txt -O /etc/init.d/git-daemon |
172 | chmod +x /etc/init.d/git-daemon |
||
173 | 1 | Paul zur Horst-Meyer | update-rc.d -f git-daemon defaults |
174 | 5 | Andrew Perry | |
175 | |||
176 | h2. Setup mail server |
||
177 | |||
178 | dpkg-reconfigure exim4-config |
||
179 | |||
180 | 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 |
||
181 | 1 | Paul zur Horst-Meyer | |
182 | h1. Finished! |
||
183 | |||
184 | reboot |
||
185 | |||
186 | Login at http://yourRedmine.tld with: |
||
187 | |||
188 | Login: admin |
||
189 | password: admin |