{"id":45,"date":"2015-09-17T21:11:18","date_gmt":"2015-09-17T21:11:18","guid":{"rendered":"http:\/\/kevingoedecke.com\/?p=45"},"modified":"2015-09-18T03:12:57","modified_gmt":"2015-09-18T03:12:57","slug":"setup-gitlab-on-debian-7-with-existing-apache-webserver","status":"publish","type":"post","link":"https:\/\/kevingoedecke.com\/blog\/2015\/09\/17\/setup-gitlab-on-debian-7-with-existing-apache-webserver\/","title":{"rendered":"Setup GitLab on Debian 7 with existing Apache WebServer"},"content":{"rendered":"<p>For the last couple of years I&#8217;ve been using <a href=\"http:\/\/gitolite.com\/gitolite\/index.html\" target=\"_blank\">gitolite <\/a>with gitweb to host my private git repositories. I guess everybody that used gitolite for a while will agree that its by far not as user friendly as using <a href=\"http:\/\/www.github.com\" target=\"_blank\">GitHub<\/a> is. The web interface looks like its been designed decades ago and on top its missing several major features like code review, merge requests, issue tracking and much more.<\/p>\n<p>Two days ago I came across <a href=\"https:\/\/gitlab.com\" target=\"_blank\">GitLab<\/a>, a complete git repository management suite written in Ruby. The community edition is completely free and totally fine for anything less than 100 users. The web interface looks sick, pure eye-candy \ud83d\ude09<\/p>\n<p>The only problem was, by default GitLab uses an Nginx web server, but I wanted to use it with my existing Apache WebServer, so here&#8217;s a little HowTo. The documentation of GitLab is quite good and very helpful, never the less I decided to write this tutorial.<\/p>\n<dl class=\"wp-caption alignnone\" style=\"width: 1024px;\">\n<dt class=\"wp-caption-dt\"><a href=\"http:\/\/kevingoedecke.com\/wp-content\/uploads\/2015\/09\/gitlab-screenshot.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-51 size-large\" src=\"http:\/\/kevingoedecke.com\/wp-content\/uploads\/2015\/09\/gitlab-screenshot-1024x614.png\" alt=\"gitlab-screenshot\" width=\"1024\" height=\"614\" srcset=\"https:\/\/kevingoedecke.com\/blog\/wp-content\/uploads\/2015\/09\/gitlab-screenshot-1024x614.png 1024w, https:\/\/kevingoedecke.com\/blog\/wp-content\/uploads\/2015\/09\/gitlab-screenshot-300x180.png 300w, https:\/\/kevingoedecke.com\/blog\/wp-content\/uploads\/2015\/09\/gitlab-screenshot.png 1250w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/dt>\n<dt class=\"wp-caption-dt\"><\/dt>\n<dt class=\"wp-caption-dt\"><\/dt>\n<dt class=\"wp-caption-dt\"><\/dt>\n<dt class=\"wp-caption-dt\">\n<h2>HowTo Setup GitLab on Debian 7 with existing Apache Server<\/h2>\n<h2>Step 1: Installing GitLab<\/h2>\n<p>Install required package dependencies:<\/p>\n<pre>kgoedecke@my-vps:~$ sudo apt-get install curl openssh-server ca-certificates postfix<\/pre>\n<p>Add the GitLab package servers to your servers sources. The guys from GitLab provide a simple script that does the work for you. Simply get it via curl and execute it.<\/p>\n<pre>kgoedecke@my-vps:~$ curl https:\/\/packages.gitlab.com\/install\/repositories\/gitlab\/gitlab-ce\/script.deb.sh | sudo bash<\/pre>\n<p>Afterwards you can use <span class=\"lang:default decode:true crayon-inline\">apt-get<\/span> to simply install GitLab:<\/p>\n<pre>kgoedecke@my-vps:~$ sudo apt-get install gitlab-ce<\/pre>\n<p>Now run the configuration and start GitLab:<\/p>\n<pre>kgoedecke@my-vps:~$ sudo gitlab-ctl reconfigure<\/pre>\n<p>GitLab is now installed and running. All we have to do now, is let our Apache know how to access it.<\/p>\n<h2>Step 2: Edit GitLab Config File<\/h2>\n<p>Open the GitLab config file with nano in\u00a0<span class=\"lang:default decode:true crayon-inline \">\/etc\/gitlab\/gitlab.rb<\/span><\/p>\n<pre>kgoedecke@my-vps:~$ sudo nano \/etc\/gitlab\/gitlab.rb<\/pre>\n<p>Set the external URL to the URL you want your GitLab to be reached with:<\/p>\n<pre>external_url 'http:\/\/gitlab.example.com'<\/pre>\n<p>Also find the following two commands, uncomment them and set them to the following values:<\/p>\n<pre>nginx['enable'] = false<\/pre>\n<pre>web_server['external_users'] = ['www-data']<\/pre>\n<p>Now save the file. Thats pretty much all you need to configure on the GitLab side.<\/p>\n<h2>Step 3: Add Apache user to GitLab user group<\/h2>\n<p>In order to add the Apache user to the GitLab user group run the following command:<\/p>\n<pre>kgoedecke@my-vps:~$ sudo useradd -G gitlab-www www-data<\/pre>\n<h2>Step 4: Configure Apache to use GitLab<\/h2>\n<h3>4.1 Create New VirtualHosts file<\/h3>\n<p>Go to <span class=\"lang:default decode:true crayon-inline \">\/etc\/apache2\/sites-available\/<\/span> and create a new VirtualHost.<\/p>\n<pre>kgoedecke@my-vps:~$ cd \/etc\/apache2\/sites-available\/<\/pre>\n<pre class=\"\">kgoedecke@my-vps:~$ sudo touch gitlab<\/pre>\n<pre class=\"\">kgoedecke@my-vps:~$ sudo nano gitlab<\/pre>\n<p>Insert the following code (source: <a href=\"http:\/\/stackoverflow.com\/questions\/25785903\/gitlab-7-2-1-with-apache-server-instead-of-nginx\" target=\"_blank\">http:\/\/stackoverflow.com\/questions\/25785903\/gitlab-7-2-1-with-apache-server-instead-of-nginx<\/a>)<\/p>\n<pre class=\"lang:default decode:true \">&lt;VirtualHost *:80&gt;\r\n  ServerName gitlab.example.com\r\n  ServerSignature Off\r\n\r\n  ProxyPreserveHost On\r\n\r\n  &lt;Location \/&gt;\r\n    Order deny,allow\r\n    Allow from all\r\n\r\n    ProxyPassReverse http:\/\/127.0.0.1:8080\r\n    ProxyPassReverse http:\/\/gitlab.example.com\/\r\n  &lt;\/Location&gt;\r\n\r\n  RewriteEngine on\r\n  RewriteCond %{DOCUMENT_ROOT}\/%{REQUEST_FILENAME} !-f\r\n  RewriteRule .* http:\/\/127.0.0.1:8080%{REQUEST_URI} [P,QSA]\r\n\r\n  # needed for downloading attachments\r\n  DocumentRoot \/opt\/gitlab\/embedded\/service\/gitlab-rails\/public\r\n\r\n&lt;\/VirtualHost&gt;<\/pre>\n<p>and replace\u00a0<span class=\"lang:default decode:true crayon-inline \">http:\/\/gitlab.example.com\/<\/span>\u00a0 with the desired domain\/subdomain you want your GitLab to be reached by. This configuration tells Apache to redirects all requests to 127.0.0.1:8080, on which the <a href=\"https:\/\/github.com\/blog\/517-unicorn\" target=\"_blank\">Unicorn<\/a> server of GitLab is listening to.<\/p>\n<p>Close this file with CRTL + X and Press &#8220;Y&#8221; to save.<\/p>\n<h3>4.2 Enable new VirtualHost<\/h3>\n<p>To enable the virtualhosts file run the following command:<\/p>\n<pre>kgoedecke@my-vps:~$ sudo a2ensite gitlab<\/pre>\n<h3>4.3 Enable required Apache mods<\/h3>\n<p>Enable all necessary apache mods:<\/p>\n<pre>kgoedecke@my-vps:~$ sudo a2enmod proxy<\/pre>\n<pre>kgoedecke@my-vps:~$ sudo a2enmod proxy_http<\/pre>\n<p>Restart your Apache.<\/p>\n<pre>kgoedecke@my-vps:~$ sudo service apache2 restart<\/pre>\n<p>Now you should be able to access your GitLab web interface.<\/p>\n<p>The default login credentials are:<\/p>\n<p>Username: root<br \/>\nPassword: 5iveL!fe<\/p>\n<\/dt>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>For the last couple of years I&#8217;ve been using gitolite with gitweb to host my private git repositories. I guess everybody that used gitolite for a while will agree that its by far not as user friendly as using GitHub is. The web interface looks like its been designed decades ago and on top its [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":48,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[9,11,13,10,12,14],"class_list":["post-45","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-apache","tag-debian","tag-git","tag-gitlab","tag-nginx","tag-private-git"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.8.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Setup GitLab on Debian 7 with existing Apache WebServer - Kevin Goedecke<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kevingoedecke.com\/blog\/2015\/09\/17\/setup-gitlab-on-debian-7-with-existing-apache-webserver\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Setup GitLab on Debian 7 with existing Apache WebServer - Kevin Goedecke\" \/>\n<meta property=\"og:description\" content=\"For the last couple of years I&#8217;ve been using gitolite with gitweb to host my private git repositories. I guess everybody that used gitolite for a while will agree that its by far not as user friendly as using GitHub is. The web interface looks like its been designed decades ago and on top its [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kevingoedecke.com\/blog\/2015\/09\/17\/setup-gitlab-on-debian-7-with-existing-apache-webserver\/\" \/>\n<meta property=\"og:site_name\" content=\"Kevin Goedecke\" \/>\n<meta property=\"article:published_time\" content=\"2015-09-17T21:11:18+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2015-09-18T03:12:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/kevingoedecke.com\/blog\/wp-content\/uploads\/2015\/09\/gitlab-on-debian.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"900\" \/>\n\t<meta property=\"og:image:height\" content=\"450\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Kevin Goedecke\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kevin Goedecke\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/kevingoedecke.com\/blog\/2015\/09\/17\/setup-gitlab-on-debian-7-with-existing-apache-webserver\/\",\"url\":\"https:\/\/kevingoedecke.com\/blog\/2015\/09\/17\/setup-gitlab-on-debian-7-with-existing-apache-webserver\/\",\"name\":\"Setup GitLab on Debian 7 with existing Apache WebServer - Kevin Goedecke\",\"isPartOf\":{\"@id\":\"https:\/\/kevingoedecke.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/kevingoedecke.com\/blog\/2015\/09\/17\/setup-gitlab-on-debian-7-with-existing-apache-webserver\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/kevingoedecke.com\/blog\/2015\/09\/17\/setup-gitlab-on-debian-7-with-existing-apache-webserver\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/kevingoedecke.com\/blog\/wp-content\/uploads\/2015\/09\/gitlab-on-debian.jpg\",\"datePublished\":\"2015-09-17T21:11:18+00:00\",\"dateModified\":\"2015-09-18T03:12:57+00:00\",\"author\":{\"@id\":\"https:\/\/kevingoedecke.com\/#\/schema\/person\/4b156cd6453e1af4bab9076b0a663871\"},\"breadcrumb\":{\"@id\":\"https:\/\/kevingoedecke.com\/blog\/2015\/09\/17\/setup-gitlab-on-debian-7-with-existing-apache-webserver\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/kevingoedecke.com\/blog\/2015\/09\/17\/setup-gitlab-on-debian-7-with-existing-apache-webserver\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/kevingoedecke.com\/blog\/2015\/09\/17\/setup-gitlab-on-debian-7-with-existing-apache-webserver\/#primaryimage\",\"url\":\"https:\/\/kevingoedecke.com\/blog\/wp-content\/uploads\/2015\/09\/gitlab-on-debian.jpg\",\"contentUrl\":\"https:\/\/kevingoedecke.com\/blog\/wp-content\/uploads\/2015\/09\/gitlab-on-debian.jpg\",\"width\":900,\"height\":450},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/kevingoedecke.com\/blog\/2015\/09\/17\/setup-gitlab-on-debian-7-with-existing-apache-webserver\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/kevingoedecke.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Setup GitLab on Debian 7 with existing Apache WebServer\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/kevingoedecke.com\/#website\",\"url\":\"https:\/\/kevingoedecke.com\/\",\"name\":\"Kevin Goedecke\",\"description\":\"Founder. Entrepreneur.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/kevingoedecke.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/kevingoedecke.com\/#\/schema\/person\/4b156cd6453e1af4bab9076b0a663871\",\"name\":\"Kevin Goedecke\",\"url\":\"https:\/\/kevingoedecke.com\/blog\/author\/kgoedecke\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Setup GitLab on Debian 7 with existing Apache WebServer - Kevin Goedecke","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/kevingoedecke.com\/blog\/2015\/09\/17\/setup-gitlab-on-debian-7-with-existing-apache-webserver\/","og_locale":"en_US","og_type":"article","og_title":"Setup GitLab on Debian 7 with existing Apache WebServer - Kevin Goedecke","og_description":"For the last couple of years I&#8217;ve been using gitolite with gitweb to host my private git repositories. I guess everybody that used gitolite for a while will agree that its by far not as user friendly as using GitHub is. The web interface looks like its been designed decades ago and on top its [&hellip;]","og_url":"https:\/\/kevingoedecke.com\/blog\/2015\/09\/17\/setup-gitlab-on-debian-7-with-existing-apache-webserver\/","og_site_name":"Kevin Goedecke","article_published_time":"2015-09-17T21:11:18+00:00","article_modified_time":"2015-09-18T03:12:57+00:00","og_image":[{"width":900,"height":450,"url":"https:\/\/kevingoedecke.com\/blog\/wp-content\/uploads\/2015\/09\/gitlab-on-debian.jpg","type":"image\/jpeg"}],"author":"Kevin Goedecke","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kevin Goedecke","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/kevingoedecke.com\/blog\/2015\/09\/17\/setup-gitlab-on-debian-7-with-existing-apache-webserver\/","url":"https:\/\/kevingoedecke.com\/blog\/2015\/09\/17\/setup-gitlab-on-debian-7-with-existing-apache-webserver\/","name":"Setup GitLab on Debian 7 with existing Apache WebServer - Kevin Goedecke","isPartOf":{"@id":"https:\/\/kevingoedecke.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/kevingoedecke.com\/blog\/2015\/09\/17\/setup-gitlab-on-debian-7-with-existing-apache-webserver\/#primaryimage"},"image":{"@id":"https:\/\/kevingoedecke.com\/blog\/2015\/09\/17\/setup-gitlab-on-debian-7-with-existing-apache-webserver\/#primaryimage"},"thumbnailUrl":"https:\/\/kevingoedecke.com\/blog\/wp-content\/uploads\/2015\/09\/gitlab-on-debian.jpg","datePublished":"2015-09-17T21:11:18+00:00","dateModified":"2015-09-18T03:12:57+00:00","author":{"@id":"https:\/\/kevingoedecke.com\/#\/schema\/person\/4b156cd6453e1af4bab9076b0a663871"},"breadcrumb":{"@id":"https:\/\/kevingoedecke.com\/blog\/2015\/09\/17\/setup-gitlab-on-debian-7-with-existing-apache-webserver\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kevingoedecke.com\/blog\/2015\/09\/17\/setup-gitlab-on-debian-7-with-existing-apache-webserver\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/kevingoedecke.com\/blog\/2015\/09\/17\/setup-gitlab-on-debian-7-with-existing-apache-webserver\/#primaryimage","url":"https:\/\/kevingoedecke.com\/blog\/wp-content\/uploads\/2015\/09\/gitlab-on-debian.jpg","contentUrl":"https:\/\/kevingoedecke.com\/blog\/wp-content\/uploads\/2015\/09\/gitlab-on-debian.jpg","width":900,"height":450},{"@type":"BreadcrumbList","@id":"https:\/\/kevingoedecke.com\/blog\/2015\/09\/17\/setup-gitlab-on-debian-7-with-existing-apache-webserver\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/kevingoedecke.com\/"},{"@type":"ListItem","position":2,"name":"Setup GitLab on Debian 7 with existing Apache WebServer"}]},{"@type":"WebSite","@id":"https:\/\/kevingoedecke.com\/#website","url":"https:\/\/kevingoedecke.com\/","name":"Kevin Goedecke","description":"Founder. Entrepreneur.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kevingoedecke.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/kevingoedecke.com\/#\/schema\/person\/4b156cd6453e1af4bab9076b0a663871","name":"Kevin Goedecke","url":"https:\/\/kevingoedecke.com\/blog\/author\/kgoedecke\/"}]}},"jetpack_featured_media_url":"https:\/\/kevingoedecke.com\/blog\/wp-content\/uploads\/2015\/09\/gitlab-on-debian.jpg","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/kevingoedecke.com\/blog\/wp-json\/wp\/v2\/posts\/45","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kevingoedecke.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kevingoedecke.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kevingoedecke.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kevingoedecke.com\/blog\/wp-json\/wp\/v2\/comments?post=45"}],"version-history":[{"count":45,"href":"https:\/\/kevingoedecke.com\/blog\/wp-json\/wp\/v2\/posts\/45\/revisions"}],"predecessor-version":[{"id":96,"href":"https:\/\/kevingoedecke.com\/blog\/wp-json\/wp\/v2\/posts\/45\/revisions\/96"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kevingoedecke.com\/blog\/wp-json\/wp\/v2\/media\/48"}],"wp:attachment":[{"href":"https:\/\/kevingoedecke.com\/blog\/wp-json\/wp\/v2\/media?parent=45"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kevingoedecke.com\/blog\/wp-json\/wp\/v2\/categories?post=45"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kevingoedecke.com\/blog\/wp-json\/wp\/v2\/tags?post=45"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}