Commit 4a1b42d26c5d35565f121d34527fe4cda0b51bdb
Committed by
Nihad Abbasov
1 parent
a502f67c
Exists in
master
and in
4 other branches
update install to use recipes
Conflicts: doc/installation.md Signed-off-by: Nihad Abbasov <narkoz.2008@gmail.com>
Showing
1 changed file
with
47 additions
and
121 deletions
Show diff stats
doc/installation.md
| 1 | -## Platform requirements: | |
| 1 | +## Platform requirements: | |
| 2 | 2 | |
| 3 | 3 | **The project is designed for the Linux operating system.** |
| 4 | 4 | |
| ... | ... | @@ -22,7 +22,7 @@ You might have some luck using these, but no guarantees: |
| 22 | 22 | |
| 23 | 23 | Gitlab does **not** run on Windows and we have no plans of making Gitlab compatible. |
| 24 | 24 | |
| 25 | -## This installation guide created for Debian/Ubuntu and properly tested. | |
| 25 | +## This installation guide created for Debian/Ubuntu and properly tested. | |
| 26 | 26 | |
| 27 | 27 | The installation consists of 6 steps: |
| 28 | 28 | |
| ... | ... | @@ -43,14 +43,20 @@ Also read the [Read this before you submit an issue](https://github.com/gitlabhq |
| 43 | 43 | |
| 44 | 44 | > - - - |
| 45 | 45 | > First 3 steps can be easily skipped with simply install script: |
| 46 | -> | |
| 47 | -> # Install curl and sudo | |
| 46 | +> | |
| 47 | +> # Install curl and sudo | |
| 48 | 48 | > apt-get install curl sudo |
| 49 | -> | |
| 49 | +> | |
| 50 | 50 | > # 3 steps in 1 command :) |
| 51 | -> curl https://raw.github.com/gitlabhq/gitlabhq/master/doc/debian_ubuntu.sh | sh | |
| 52 | -> | |
| 53 | -> Now you can go to step 4" | |
| 51 | +> curl https://raw.github.com/gitlabhq/gitlab-recipes/master/install/debian_ubuntu.sh | sh | |
| 52 | +> | |
| 53 | +> Now you can go to [Step 4](#4-install-gitlab-and-configuration-check-status-configuration) | |
| 54 | +> | |
| 55 | +> Or if you are installing on Amazon Web Services using Ubuntu 12.04 you can do all steps (1 to 6) at once with: | |
| 56 | +> | |
| 57 | +> curl https://raw.github.com/gitlabhq/gitlab-recipes/master/install/debian_ubuntu_aws.sh | sh | |
| 58 | +> | |
| 59 | +> for more detailed instructions read the HOWTO section of [the script](https://github.com/gitlabhq/gitlab-recipes/blob/master/install/debian_ubuntu_aws.sh) | |
| 54 | 60 | > - - - |
| 55 | 61 | |
| 56 | 62 | # 1. Install packages |
| ... | ... | @@ -61,15 +67,15 @@ Also read the [Read this before you submit an issue](https://github.com/gitlabhq |
| 61 | 67 | sudo apt-get upgrade |
| 62 | 68 | |
| 63 | 69 | sudo apt-get install -y wget curl gcc checkinstall libxml2-dev libxslt-dev sqlite3 libsqlite3-dev libcurl4-openssl-dev libreadline6-dev libc6-dev libssl-dev libmysql++-dev make build-essential zlib1g-dev libicu-dev redis-server openssh-server git-core python-dev python-pip libyaml-dev postfix |
| 64 | - | |
| 70 | + | |
| 65 | 71 | # If you want to use MySQL: |
| 66 | 72 | sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev |
| 67 | 73 | |
| 68 | 74 | # 2. Install ruby |
| 69 | 75 | |
| 70 | - wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.gz | |
| 71 | - tar xzfv ruby-1.9.2-p290.tar.gz | |
| 72 | - cd ruby-1.9.2-p290 | |
| 76 | + wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz | |
| 77 | + tar xfvz ruby-1.9.3-p194.tar.gz | |
| 78 | + cd ruby-1.9.3-p194 | |
| 73 | 79 | ./configure |
| 74 | 80 | make |
| 75 | 81 | sudo make install |
| ... | ... | @@ -77,7 +83,7 @@ Also read the [Read this before you submit an issue](https://github.com/gitlabhq |
| 77 | 83 | # 3. Install gitolite |
| 78 | 84 | |
| 79 | 85 | Create user for git: |
| 80 | - | |
| 86 | + | |
| 81 | 87 | sudo adduser \ |
| 82 | 88 | --system \ |
| 83 | 89 | --shell /bin/sh \ |
| ... | ... | @@ -90,7 +96,7 @@ Create user for git: |
| 90 | 96 | Create user for gitlab: |
| 91 | 97 | |
| 92 | 98 | # ubuntu/debian |
| 93 | - sudo adduser --disabled-login --gecos 'gitlab system' gitlab | |
| 99 | + sudo adduser --disabled-login --gecos 'gitlab system' gitlab | |
| 94 | 100 | |
| 95 | 101 | Add your user to git group: |
| 96 | 102 | |
| ... | ... | @@ -103,7 +109,7 @@ Generate key: |
| 103 | 109 | Get gitolite source code: |
| 104 | 110 | |
| 105 | 111 | cd /home/git |
| 106 | - sudo -H -u git git clone git://github.com/gitlabhq/gitolite /home/git/gitolite | |
| 112 | + sudo -H -u git git clone git://github.com/gitlabhq/gitolite /home/git/gitolite | |
| 107 | 113 | |
| 108 | 114 | Setup: |
| 109 | 115 | |
| ... | ... | @@ -114,20 +120,20 @@ Setup: |
| 114 | 120 | |
| 115 | 121 | sudo -u git -H sed -i 's/0077/0007/g' /home/git/share/gitolite/conf/example.gitolite.rc |
| 116 | 122 | sudo -u git -H sh -c "PATH=/home/git/bin:$PATH; gl-setup -q /home/git/gitlab.pub" |
| 117 | - | |
| 123 | + | |
| 118 | 124 | Permissions: |
| 119 | 125 | |
| 120 | 126 | sudo chmod -R g+rwX /home/git/repositories/ |
| 121 | 127 | sudo chown -R git:git /home/git/repositories/ |
| 122 | 128 | |
| 123 | 129 | #### CHECK: Logout & login again to apply git group to your user |
| 124 | - | |
| 130 | + | |
| 125 | 131 | # clone admin repo to add localhost to known_hosts |
| 126 | 132 | # & be sure your user has access to gitolite |
| 127 | - sudo -u gitlab -H git clone git@localhost:gitolite-admin.git /tmp/gitolite-admin | |
| 133 | + sudo -u gitlab -H git clone git@localhost:gitolite-admin.git /tmp/gitolite-admin | |
| 128 | 134 | |
| 129 | 135 | # if succeed you can remove it |
| 130 | - sudo rm -rf /tmp/gitolite-admin | |
| 136 | + sudo rm -rf /tmp/gitolite-admin | |
| 131 | 137 | |
| 132 | 138 | **IMPORTANT! If you cant clone `gitolite-admin` repository - DONT PROCEED INSTALLATION** |
| 133 | 139 | |
| ... | ... | @@ -139,7 +145,7 @@ Permissions: |
| 139 | 145 | cd /home/gitlab |
| 140 | 146 | sudo -H -u gitlab git clone -b stable git://github.com/gitlabhq/gitlabhq.git gitlab |
| 141 | 147 | cd gitlab |
| 142 | - | |
| 148 | + | |
| 143 | 149 | sudo -u gitlab mkdir tmp |
| 144 | 150 | |
| 145 | 151 | # Rename config files |
| ... | ... | @@ -150,22 +156,22 @@ Permissions: |
| 150 | 156 | # SQLite |
| 151 | 157 | sudo -u gitlab cp config/database.yml.sqlite config/database.yml |
| 152 | 158 | |
| 153 | - # Or | |
| 159 | + # Or | |
| 154 | 160 | # Mysql |
| 155 | 161 | # Install MySQL as directed in Step #1 |
| 156 | - | |
| 162 | + | |
| 157 | 163 | # Login to MySQL |
| 158 | - $ mysql -u root -p | |
| 159 | - | |
| 164 | + $ mysql -u root -p | |
| 165 | + | |
| 160 | 166 | # Create the gitlabhq production database |
| 161 | 167 | mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`; |
| 162 | - | |
| 168 | + | |
| 163 | 169 | # Create the MySQL User change $password to a real password |
| 164 | - mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '$password'; | |
| 165 | - | |
| 170 | + mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '$password'; | |
| 171 | + | |
| 166 | 172 | # Grant proper permissions to the MySQL User |
| 167 | 173 | mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost'; |
| 168 | - | |
| 174 | + | |
| 169 | 175 | # Exit MySQL Server and copy the example config, make sure to update username/password in config/database.yml |
| 170 | 176 | sudo -u gitlab cp config/database.yml.example config/database.yml |
| 171 | 177 | |
| ... | ... | @@ -181,7 +187,7 @@ Permissions: |
| 181 | 187 | |
| 182 | 188 | sudo cp ./lib/hooks/post-receive /home/git/share/gitolite/hooks/common/post-receive |
| 183 | 189 | sudo chown git:git /home/git/share/gitolite/hooks/common/post-receive |
| 184 | - | |
| 190 | + | |
| 185 | 191 | Checking status: |
| 186 | 192 | |
| 187 | 193 | sudo -u gitlab bundle exec rake gitlab:app:status RAILS_ENV=production |
| ... | ... | @@ -202,13 +208,13 @@ Checking status: |
| 202 | 208 | UMASK for .gitolite.rc is 0007? ............YES |
| 203 | 209 | /home/git/share/gitolite/hooks/common/post-receive exists? ............YES |
| 204 | 210 | |
| 205 | -If you got all YES - congrats! You can go to next step. | |
| 211 | +If you got all YES - congrats! You can go to next step. | |
| 206 | 212 | |
| 207 | 213 | # 5. Server up |
| 208 | 214 | |
| 209 | 215 | Application can be started with next command: |
| 210 | 216 | |
| 211 | - # For test purposes | |
| 217 | + # For test purposes | |
| 212 | 218 | sudo -u gitlab bundle exec rails s -e production |
| 213 | 219 | |
| 214 | 220 | # As daemon |
| ... | ... | @@ -244,42 +250,15 @@ You can login via web using admin generated with setup: |
| 244 | 250 | sudo -u gitlab cp config/unicorn.rb.orig config/unicorn.rb |
| 245 | 251 | sudo -u gitlab bundle exec unicorn_rails -c config/unicorn.rb -E production -D |
| 246 | 252 | |
| 247 | -Edit /etc/nginx/nginx.conf. In the *http* section add: | |
| 248 | - | |
| 249 | - upstream gitlab { | |
| 250 | - server unix:/home/gitlab/gitlab/tmp/sockets/gitlab.socket; | |
| 251 | - } | |
| 252 | - | |
| 253 | - server { | |
| 254 | - listen YOUR_SERVER_IP:80; # e.g., listen 192.168.1.1:80; | |
| 255 | - server_name YOUR_SERVER_FQDN; # e.g., server_name source.example.com; | |
| 256 | - root /home/gitlab/gitlab/public; | |
| 257 | - | |
| 258 | - # individual nginx logs for this gitlab vhost | |
| 259 | - access_log /var/log/nginx/gitlab_access.log; | |
| 260 | - error_log /var/log/nginx/gitlab_error.log; | |
| 261 | - | |
| 262 | - location / { | |
| 263 | - # serve static files from defined root folder;. | |
| 264 | - # @gitlab is a named location for the upstream fallback, see below | |
| 265 | - try_files $uri $uri/index.html $uri.html @gitlab; | |
| 266 | - } | |
| 267 | - | |
| 268 | - # if a file, which is not found in the root folder is requested, | |
| 269 | - # then the proxy pass the request to the upsteam (gitlab unicorn) | |
| 270 | - location @gitlab { | |
| 271 | - proxy_redirect off; | |
| 272 | - | |
| 273 | - # you need to change this to "https", if you set "ssl" directive to "on" | |
| 274 | - proxy_set_header X-FORWARDED_PROTO http; | |
| 275 | - proxy_set_header Host $http_host; | |
| 276 | - proxy_set_header X-Real-IP $remote_addr; | |
| 277 | - | |
| 278 | - proxy_pass http://gitlab; | |
| 279 | - } | |
| 280 | - } | |
| 281 | - | |
| 282 | -Change **YOUR_SERVER_IP** and **YOUR_SERVER_FQDN** to the IP address and fully-qualified domain name of the host serving GitLab. | |
| 253 | +Add GitLab to nginx sites & change with your host specific settings | |
| 254 | + | |
| 255 | + sudo wget https://raw.github.com/gitlabhq/gitlab-recipes/master/nginx/gitlab -P /etc/nginx/sites-available/ | |
| 256 | + sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab | |
| 257 | + | |
| 258 | + # Change **YOUR_SERVER_IP** and **YOUR_SERVER_FQDN** | |
| 259 | + # to the IP address and fully-qualified domain name | |
| 260 | + # of the host serving GitLab. | |
| 261 | + sudo vim /etc/nginx/sites-enabled/gitlab | |
| 283 | 262 | |
| 284 | 263 | Restart nginx: |
| 285 | 264 | |
| ... | ... | @@ -287,60 +266,7 @@ Restart nginx: |
| 287 | 266 | |
| 288 | 267 | Create init script in /etc/init.d/gitlab: |
| 289 | 268 | |
| 290 | - #! /bin/bash | |
| 291 | - ### BEGIN INIT INFO | |
| 292 | - # Provides: gitlab | |
| 293 | - # Required-Start: $local_fs $remote_fs $network $syslog redis-server | |
| 294 | - # Required-Stop: $local_fs $remote_fs $network $syslog | |
| 295 | - # Default-Start: 2 3 4 5 | |
| 296 | - # Default-Stop: 0 1 6 | |
| 297 | - # Short-Description: GitLab git repository management | |
| 298 | - # Description: GitLab git repository management | |
| 299 | - ### END INIT INFO | |
| 300 | - | |
| 301 | - DAEMON_OPTS="-c /home/gitlab/gitlab/config/unicorn.rb -E production -D" | |
| 302 | - NAME=unicorn | |
| 303 | - DESC="Gitlab service" | |
| 304 | - PID=/home/gitlab/gitlab/tmp/pids/unicorn.pid | |
| 305 | - RESQUE_PID=/home/gitlab/gitlab/tmp/pids/resque_worker.pid | |
| 306 | - | |
| 307 | - case "$1" in | |
| 308 | - start) | |
| 309 | - CD_TO_APP_DIR="cd /home/gitlab/gitlab" | |
| 310 | - START_DAEMON_PROCESS="bundle exec unicorn_rails $DAEMON_OPTS" | |
| 311 | - START_RESQUE_PROCESS="./resque.sh" | |
| 312 | - | |
| 313 | - echo -n "Starting $DESC: " | |
| 314 | - if [ `whoami` = root ]; then | |
| 315 | - sudo -u gitlab sh -l -c "$CD_TO_APP_DIR > /dev/null 2>&1 && $START_DAEMON_PROCESS && $START_RESQUE_PROCESS" | |
| 316 | - else | |
| 317 | - $CD_TO_APP_DIR > /dev/null 2>&1 && $START_DAEMON_PROCESS && $START_RESQUE_PROCESS | |
| 318 | - fi | |
| 319 | - echo "$NAME." | |
| 320 | - ;; | |
| 321 | - stop) | |
| 322 | - echo -n "Stopping $DESC: " | |
| 323 | - kill -QUIT `cat $PID` | |
| 324 | - kill -QUIT `cat $RESQUE_PID` | |
| 325 | - echo "$NAME." | |
| 326 | - ;; | |
| 327 | - restart) | |
| 328 | - echo -n "Restarting $DESC: " | |
| 329 | - kill -USR2 `cat $PID` | |
| 330 | - echo "$NAME." | |
| 331 | - ;; | |
| 332 | - reload) | |
| 333 | - echo -n "Reloading $DESC configuration: " | |
| 334 | - kill -HUP `cat $PID` | |
| 335 | - echo "$NAME." | |
| 336 | - ;; | |
| 337 | - *) | |
| 338 | - echo "Usage: $NAME {start|stop|restart|reload}" >&2 | |
| 339 | - exit 1 | |
| 340 | - ;; | |
| 341 | - esac | |
| 342 | - | |
| 343 | - exit 0 | |
| 269 | + sudo wget https://raw.github.com/gitlabhq/gitlab-recipes/master/init.d/gitlab -P /etc/init.d/ | |
| 344 | 270 | |
| 345 | 271 | Adding permission: |
| 346 | 272 | ... | ... |