{"id":38531,"date":"2026-01-12T09:14:46","date_gmt":"2026-01-12T02:14:46","guid":{"rendered":"https:\/\/interdata.vn\/blog\/?p=38531"},"modified":"2026-01-27T09:22:30","modified_gmt":"2026-01-27T02:22:30","slug":"cai-dat-gitlab-tren-vps-linux","status":"publish","type":"post","link":"https:\/\/interdata.vn\/blog\/cai-dat-gitlab-tren-vps-linux\/","title":{"rendered":"Quy tr\u00ecnh 6 b\u01b0\u1edbc c\u00e0i \u0111\u0103t GitLab tr\u00ean VPS Linux \u0111\u01a1n gi\u1ea3n, nhanh"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-white ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">N\u1ed8I DUNG<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-gitlab-tren-vps-linux\/#GitLab-la-gi\" >GitLab l\u00e0 g\u00ec?<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-gitlab-tren-vps-linux\/#GitLab-dung-de-lam-gi\" >GitLab d\u00f9ng \u0111\u1ec3 l\u00e0m g\u00ec?<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-gitlab-tren-vps-linux\/#Yeu-cau-cau-hinh-toi-thieu-khi-cai-dat-GitLab\" >Y\u00eau c\u1ea7u c\u1ea5u h\u00ecnh t\u1ed1i thi\u1ec3u khi c\u00e0i \u0111\u1eb7t GitLab<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-gitlab-tren-vps-linux\/#Quy-trinh-cai-dat-GitLab-CE-tren-VPS-Linux-UBUNTU\" >Quy tr\u00ecnh c\u00e0i \u0111\u0103t GitLab CE tr\u00ean VPS Linux (UBUNTU)<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-gitlab-tren-vps-linux\/#Cac-lenh-quan-ly-GitLab-co-ban-tren-VPS\" >C\u00e1c l\u1ec7nh qu\u1ea3n l\u00fd GitLab c\u01a1 b\u1ea3n tr\u00ean VPS<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-gitlab-tren-vps-linux\/#Meo-toi-uu-cho-VPS-cau-hinh-thap-4GB-RAM\" >M\u1eb9o t\u1ed1i \u01b0u cho VPS c\u1ea5u h\u00ecnh th\u1ea5p (4GB RAM)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-gitlab-tren-vps-linux\/#Cau-hinh-HTTPS-SSL-MIEN-PHI\" >C\u1ea5u h\u00ecnh HTTPS (SSL MI\u1ec4N PH\u00cd)<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<p><strong>V\u1edbi Ubuntu<\/strong> \u2013 m\u1ed9t trong nh\u1eefng h\u1ec7 \u0111i\u1ec1u h\u00e0nh \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng r\u1ed9ng r\u00e3i nh\u1ea5t tr\u00ean VPS \u2013 vi\u1ec7c c\u00e0i \u0111\u1eb7t GitLab CE kh\u00f4ng qu\u00e1 ph\u1ee9c t\u1ea1p n\u1ebfu th\u1ef1c hi\u1ec7n \u0111\u00fang quy tr\u00ecnh. Trong b\u00e0i vi\u1ebft n\u00e0y, ch\u00fang ta s\u1ebd \u0111i t\u1eebng b\u01b0\u1edbc chi ti\u1ebft trong quy tr\u00ecnh c\u00e0i \u0111\u1eb7t GitLab CE tr\u00ean VPS Linux (Ubuntu), gi\u00fap b\u1ea1n nhanh ch\u00f3ng thi\u1ebft l\u1eadp m\u00f4i tr\u01b0\u1eddng l\u00e0m vi\u1ec7c \u1ed5n \u0111\u1ecbnh v\u00e0 s\u1eb5n s\u00e0ng cho d\u1ef1 \u00e1n th\u1ef1c t\u1ebf.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"GitLab-la-gi\"><\/span>GitLab l\u00e0 g\u00ec?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>GitLab<\/strong> l\u00e0 m\u1ed9t <strong>n\u1ec1n t\u1ea3ng qu\u1ea3n l\u00fd m\u00e3 ngu\u1ed3n v\u00e0 DevOps<\/strong> d\u1ef1a tr\u00ean <strong>Git<\/strong>, gi\u00fap l\u1eadp tr\u00ecnh vi\u00ean v\u00e0 \u0111\u1ed9i nh\u00f3m <strong>l\u01b0u tr\u1eef code, ki\u1ec3m so\u00e1t phi\u00ean b\u1ea3n, c\u1ed9ng t\u00e1c ph\u00e1t tri\u1ec3n v\u00e0 t\u1ef1 \u0111\u1ed9ng h\u00f3a quy tr\u00ecnh CI\/CD<\/strong> tr\u00ean c\u00f9ng m\u1ed9t h\u1ec7 th\u1ed1ng th\u1ed1ng nh\u1ea5t.<\/p>\n<p>Hi\u1ec3u \u0111\u01a1n gi\u1ea3n, GitLab kh\u00f4ng ch\u1ec9 l\u00e0 n\u01a1i <strong>l\u01b0u code<\/strong>, m\u00e0 c\u00f2n l\u00e0 <strong>trung t\u00e2m l\u00e0m vi\u1ec7c c\u1ee7a c\u1ea3 v\u00f2ng \u0111\u1eddi ph\u00e1t tri\u1ec3n ph\u1ea7n m\u1ec1m<\/strong> \u2013 t\u1eeb vi\u1ebft code, review, test cho \u0111\u1ebfn deploy v\u00e0 v\u1eadn h\u00e0nh.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-38551\" src=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/01\/GitLab-la-gi.jpg\" alt=\"GitLab l\u00e0 g\u00ec\" width=\"800\" height=\"500\" title=\"\" srcset=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/01\/GitLab-la-gi.jpg 800w, https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/01\/GitLab-la-gi-300x188.jpg 300w, https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/01\/GitLab-la-gi-768x480.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"GitLab-dung-de-lam-gi\"><\/span>GitLab d\u00f9ng \u0111\u1ec3 l\u00e0m g\u00ec?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>GitLab \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng ph\u1ed5 bi\u1ebfn trong c\u00e1c d\u1ef1 \u00e1n ph\u1ea7n m\u1ec1m \u0111\u1ec3:<\/p>\n<ul>\n<li><strong>Qu\u1ea3n l\u00fd source code<\/strong>: T\u1ea1o repository Git, ph\u00e2n quy\u1ec1n ng\u01b0\u1eddi d\u00f9ng, theo d\u00f5i l\u1ecbch s\u1eed thay \u0111\u1ed5i.<\/li>\n<li><strong>L\u00e0m vi\u1ec7c nh\u00f3m hi\u1ec7u qu\u1ea3<\/strong>: Merge Request, code review, comment tr\u1ef1c ti\u1ebfp tr\u00ean t\u1eebng d\u00f2ng code.<\/li>\n<li><strong>T\u1ef1 \u0111\u1ed9ng h\u00f3a CI\/CD<\/strong>: Build, test, deploy \u1ee9ng d\u1ee5ng t\u1ef1 \u0111\u1ed9ng th\u00f4ng qua GitLab CI\/CD.<\/li>\n<li><strong>Qu\u1ea3n l\u00fd d\u1ef1 \u00e1n<\/strong>: Issue, Milestone, Board (Kanban) theo d\u00f5i ti\u1ebfn \u0111\u1ed9 c\u00f4ng vi\u1ec7c.<\/li>\n<li><strong>Tri\u1ec3n khai DevOps<\/strong>: K\u1ebft n\u1ed1i v\u1edbi server\/VPS \u0111\u1ec3 deploy \u1ee9ng d\u1ee5ng li\u00ean t\u1ee5c.<\/li>\n<\/ul>\n<p>N\u1ebfu b\u1ea1n \u0111ang h\u1ecdc backend, DevOps ho\u1eb7c tri\u1ec3n khai \u1ee9ng d\u1ee5ng tr\u00ean VPS, GitLab l\u00e0 c\u00f4ng c\u1ee5 r\u1ea5t \u0111\u00e1ng \u0111\u1ec3 l\u00e0m quen ngay t\u1eeb \u0111\u1ea7u.<\/p>\n<p>C\u00e0i \u0111\u1eb7t <strong>GitLab<\/strong> tr\u00ean VPS ri\u00eang l\u00e0 m\u1ed9t quy\u1ebft \u0111\u1ecbnh tuy\u1ec7t v\u1eddi \u0111\u1ec3 \u0111\u1ed9i ng\u0169 l\u1eadp tr\u00ecnh vi\u00ean (Dev Team) ch\u1ee7 \u0111\u1ed9ng qu\u1ea3n l\u00fd Source Code, tri\u1ec3n khai CI\/CD v\u00e0 b\u1ea3o m\u1eadt d\u1eef li\u1ec7u m\u00e0 kh\u00f4ng ph\u1ee5 thu\u1ed9c v\u00e0o GitHub hay GitLab Cloud.<\/p>\n<p>Tuy nhi\u00ean, <strong>GitLab r\u1ea5t &#8220;ng\u1ed1n&#8221; t\u00e0i nguy\u00ean<\/strong>. Tr\u01b0\u1edbc khi b\u1eaft \u0111\u1ea7u, t\u00f4i c\u1ea7n l\u01b0u \u00fd b\u1ea1n v\u1ec1 c\u1ea5u h\u00ecnh VPS.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Yeu-cau-cau-hinh-toi-thieu-khi-cai-dat-GitLab\"><\/span>Y\u00eau c\u1ea7u c\u1ea5u h\u00ecnh t\u1ed1i thi\u1ec3u khi c\u00e0i \u0111\u1eb7t GitLab<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li><strong>RAM:<\/strong> T\u1ed1i thi\u1ec3u <strong>4GB<\/strong> (Khuy\u00ean d\u00f9ng 8GB \u0111\u1ec3 ch\u1ea1y m\u01b0\u1ee3t). N\u1ebfu VPS ch\u1ec9 c\u00f3 2GB RAM, vi\u1ec7c c\u00e0i \u0111\u1eb7t g\u1ea7n nh\u01b0 ch\u1eafc ch\u1eafn s\u1ebd g\u00e2y treo m\u00e1y (Crash) ho\u1eb7c ch\u1ea1y c\u1ef1c ch\u1eadm.<\/li>\n<li><strong>CPU:<\/strong> 2 Cores tr\u1edf l\u00ean.<\/li>\n<li><strong>\u1ed4 c\u1ee9ng:<\/strong> T\u1ed1i thi\u1ec3u 20GB tr\u1ed1ng.<\/li>\n<li><strong>H\u1ec7 \u0111i\u1ec1u h\u00e0nh:<\/strong> H\u01b0\u1edbng d\u1eabn n\u00e0y s\u1ebd th\u1ef1c hi\u1ec7n tr\u00ean <strong>Ubuntu 20.04\/22.04 LTS<\/strong> (Ph\u1ed5 bi\u1ebfn v\u00e0 \u1ed5n \u0111\u1ecbnh nh\u1ea5t).<\/li>\n<li><strong>Domain:<\/strong> C\u1ea7n tr\u1ecf m\u1ed9t t\u00ean mi\u1ec1n (v\u00ed d\u1ee5: gitlab.domain.com) v\u1ec1 IP c\u1ee7a VPS.<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Quy-trinh-cai-dat-GitLab-CE-tren-VPS-Linux-UBUNTU\"><\/span>Quy tr\u00ecnh c\u00e0i \u0111\u0103t GitLab CE tr\u00ean VPS Linux (UBUNTU)<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Sau khi \u0111\u0103ng nh\u1eadp v\u00e0o VPS linux, b\u1ea1n c\u1ea7n th\u1ef1c hi\u1ec7n c\u00e1c b\u01b0\u1edbc sau \u0111\u1ec3 c\u00e0i \u0111\u0103t GitLab CE tr\u00ean VPS Linux:<\/p>\n<p><strong>B\u01b0\u1edbc 1<\/strong>: C\u1eadp nh\u1eadt h\u1ec7 th\u1ed1ng v\u00e0 c\u00e0i \u0111\u1eb7t g\u00f3i ph\u1ee5 thu\u1ed9c<\/p>\n<p>\u0110\u1ea7u ti\u00ean, h\u00e3y SSH v\u00e0o VPS v\u1edbi quy\u1ec1n <strong>root<\/strong>.<\/p>\n<p>C\u1eadp nh\u1eadt h\u1ec7 \u0111i\u1ec1u h\u00e0nh:<\/p>\n<p><code>sudo apt update &amp;&amp; sudo apt upgrade -y<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-38539\" src=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/01\/Cap-nhat-he-thong.png\" alt=\"C\u1eadp nh\u1eadt h\u1ec7 th\u1ed1ng\" width=\"448\" height=\"256\" title=\"\" srcset=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/01\/Cap-nhat-he-thong.png 448w, https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/01\/Cap-nhat-he-thong-300x171.png 300w\" sizes=\"auto, (max-width: 448px) 100vw, 448px\" \/><\/p>\n<p>C\u00e0i \u0111\u1eb7t c\u00e1c g\u00f3i c\u1ea7n thi\u1ebft (Curl, OpenSSH, Postfix \u0111\u1ec3 g\u1eedi mail):<\/p>\n<div>\n<pre><code>sudo apt install -y curl openssh-server ca-certificates tzdata perl\r\n\r\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-38540\" src=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/01\/Cai-dat-cac-goi-can-thiet.png\" alt=\"C\u00e0i \u0111\u1eb7t c\u00e1c g\u00f3i c\u1ea7n thi\u1ebft\" width=\"448\" height=\"180\" title=\"\" srcset=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/01\/Cai-dat-cac-goi-can-thiet.png 448w, https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/01\/Cai-dat-cac-goi-can-thiet-300x121.png 300w\" sizes=\"auto, (max-width: 448px) 100vw, 448px\" \/><\/code><\/pre>\n<p>C\u00e0i \u0111\u1eb7t Postfix (G\u1eedi email th\u00f4ng b\u00e1o):<\/p>\n<pre><code>sudo apt install -y postfix<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-38541\" src=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/01\/cai-dat-Postfix.png\" alt=\"c\u00e0i \u0111\u1eb7t Postfix\" width=\"472\" height=\"258\" title=\"\" srcset=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/01\/cai-dat-Postfix.png 472w, https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/01\/cai-dat-Postfix-300x164.png 300w\" sizes=\"auto, (max-width: 472px) 100vw, 472px\" \/><\/p>\n<\/div>\n<div><\/div>\n<div>\n<p>L\u01b0u \u00fd: Khi m\u00e0n h\u00ecnh c\u00e0i \u0111\u1eb7t Postfix hi\u1ec7n ra, ch\u1ecdn <strong>Internet Site<\/strong> -&gt; Nh\u1ea5n <strong>Enter<\/strong> -&gt; Nh\u1eadp t\u00ean mi\u1ec1n c\u1ee7a b\u1ea1n (v\u00ed d\u1ee5: domain.com) -&gt; <strong>Enter<\/strong>.<\/p>\n<h4><strong>B\u01b0\u1edbc 2<\/strong>: Th\u00eam Repository c\u1ee7a GitLab v\u00e0o h\u1ec7 th\u1ed1ng<\/h4>\n<p>T\u1ea3i script t\u1ef1 \u0111\u1ed9ng th\u00eam kho l\u01b0u tr\u1eef (Repo) ch\u00ednh th\u1ee9c c\u1ee7a GitLab v\u1ec1 m\u00e1y:<\/p>\n<pre><code>curl -sS https:\/\/packages.gitlab.com\/install\/repositories\/gitlab\/gitlab-ce\/script.deb.sh | sudo bash<\/code><\/pre>\n<h4><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-38542\" src=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/01\/them-repository-GitLab.png\" alt=\"th\u00eam repository GitLab\" width=\"486\" height=\"262\" title=\"\" srcset=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/01\/them-repository-GitLab.png 486w, https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/01\/them-repository-GitLab-300x162.png 300w\" sizes=\"auto, (max-width: 486px) 100vw, 486px\" \/><\/h4>\n<h4><strong>B\u01b0\u1edbc 3<\/strong>: C\u00e0i \u0111\u1eb7t GitLab CE<\/h4>\n<p>\u0110\u00e2y l\u00e0 b\u01b0\u1edbc quan tr\u1ecdng nh\u1ea5t. C\u00e0i \u0111\u1eb7t GitLab Community Edition:<code>sudo apt install -y gitlab-ce<\/code><\/p>\n<ul>\n<li><strong>L\u01b0u \u00fd:<\/strong> N\u1ebfu b\u1ea1n ch\u01b0a c\u00f3 SSL (https), h\u00e3y c\u1ee9 \u0111\u1ec3 http. Sau n\u00e0y c\u00f3 th\u1ec3 c\u00e0i Let&#8217;s Encrypt sau.<\/li>\n<li>Qu\u00e1 tr\u00ecnh n\u00e0y s\u1ebd m\u1ea5t kho\u1ea3ng <strong>3 &#8211; 5 ph\u00fat<\/strong> t\u00f9y v\u00e0o t\u1ed1c \u0111\u1ed9 m\u1ea1ng v\u00e0 \u1ed5 c\u1ee9ng VPS. H\u00e3y ki\u00ean nh\u1eabn \u0111\u1ee3i \u0111\u1ebfn khi th\u1ea5y logo GitLab hi\u1ec7n ra tr\u00ean m\u00e0n h\u00ecnh console.<\/li>\n<\/ul>\n<h4><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-38543\" src=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/01\/Cai-dat-GitLab-Community-Edition.png\" alt=\"C\u00e0i \u0111\u1eb7t GitLab Community Edition\" width=\"501\" height=\"229\" title=\"\" srcset=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/01\/Cai-dat-GitLab-Community-Edition.png 501w, https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/01\/Cai-dat-GitLab-Community-Edition-300x137.png 300w\" sizes=\"auto, (max-width: 501px) 100vw, 501px\" \/><\/h4>\n<h4><strong>B\u01b0\u1edbc 4<\/strong>: C\u1ea5u h\u00ecnh GitLab ph\u00f9 h\u1ee3p v\u1edbi VPS sau khi c\u00e0i \u0111\u1eb7t<\/h4>\n<p>Sau khi ho\u00e0n t\u1ea5t qu\u00e1 tr\u00ecnh c\u00e0i \u0111\u1eb7t, b\u1ea1n c\u1ea7n \u0111i\u1ec1u ch\u1ec9nh m\u1ed9t s\u1ed1 thi\u1ebft l\u1eadp c\u01a1 b\u1ea3n \u0111\u1ec3 GitLab ho\u1ea1t \u0111\u1ed9ng \u0111\u00fang v\u1edbi c\u1ea5u h\u00ecnh VPS \u0111ang s\u1eed d\u1ee5ng.<\/p>\n<\/div>\n<div><\/div>\n<div>Tr\u01b0\u1edbc ti\u00ean, m\u1edf file c\u1ea5u h\u00ecnh ch\u00ednh c\u1ee7a GitLab:<code> sudo nano \/etc\/gitlab\/gitlab.rb<\/code><\/div>\n<div><\/div>\n<div>T\u00ecm \u0111\u1ebfn d\u00f2ng external_url v\u00e0 thay \u0111\u1ed5i th\u00e0nh \u0111\u1ecba ch\u1ec9 IP ho\u1eb7c t\u00ean mi\u1ec1n c\u1ee7a VPS.<\/div>\n<div><\/div>\n<div>V\u00ed d\u1ee5:<code>external_url 'http:\/\/&lt;your-domain-or-ip&gt;'<\/code><\/div>\n<div><\/div>\n<div>Sau khi ch\u1ec9nh s\u1eeda xong, ch\u1ea1y l\u1ec7nh sau \u0111\u1ec3 GitLab \u00e1p d\u1ee5ng l\u1ea1i to\u00e0n b\u1ed9 c\u1ea5u h\u00ecnh:<code>sudo gitlab-ctl reconfigure<\/code>L\u1ec7nh n\u00e0y s\u1ebd t\u1ef1 \u0111\u1ed9ng kh\u1edfi \u0111\u1ed9ng c\u00e1c d\u1ecbch v\u1ee5 c\u1ea7n thi\u1ebft v\u00e0 c\u1eadp nh\u1eadt nh\u1eefng thay \u0111\u1ed5i v\u1eeba thi\u1ebft l\u1eadp.<\/div>\n<div><\/div>\n<div>\n<p>Khi qu\u00e1 tr\u00ecnh c\u1ea5u h\u00ecnh ho\u00e0n t\u1ea5t, b\u1ea1n m\u1edf tr\u00ecnh duy\u1ec7t v\u00e0 truy c\u1eadp v\u00e0o \u0111\u1ecba ch\u1ec9:<code>\u00a0http:\/\/&lt;your-domain-or-ip&gt;<\/code><\/p>\n<h4><strong>B\u01b0\u1edbc 5<\/strong>: L\u1ea5y m\u1eadt kh\u1ea9u Root m\u1eb7c \u0111\u1ecbnh<\/h4>\n<p>Sau khi c\u00e0i xong, GitLab s\u1ebd t\u1ef1 \u0111\u1ed9ng t\u1ea1o m\u1ed9t m\u1eadt kh\u1ea9u ng\u1eabu nhi\u00ean cho t\u00e0i kho\u1ea3n root. B\u1ea1n c\u1ea7n l\u1ea5y m\u1eadt kh\u1ea9u n\u00e0y \u0111\u1ec3 \u0111\u0103ng nh\u1eadp l\u1ea7n \u0111\u1ea7u.Ch\u1ea1y l\u1ec7nh sau \u0111\u1ec3 xem m\u1eadt kh\u1ea9u:<\/p>\n<div>\n<div>\n<div>\n<div>\n<pre><code>sudo cat \/etc\/gitlab\/initial_root_password<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<ul>\n<li>L\u01b0u \u00fd: M\u1eadt kh\u1ea9u n\u00e0y ch\u1ec9 \u0111\u01b0\u1ee3c l\u01b0u t\u1ea1i \u0111\u00e2y trong 24 gi\u1edd. H\u00e3y copy l\u1ea1i chu\u1ed7i k\u00fd t\u1ef1 \u0111\u00f3.<\/li>\n<\/ul>\n<h4><strong>B\u01b0\u1edbc 6<\/strong>: \u0110\u0103ng nh\u1eadp v\u00e0 \u0111\u1ed5i m\u1eadt kh\u1ea9u<\/h4>\n<ol>\n<li>M\u1edf tr\u00ecnh duy\u1ec7t web, truy c\u1eadp v\u00e0o \u0111\u1ecba ch\u1ec9: http:\/\/gitlab.example.com (t\u00ean mi\u1ec1n b\u1ea1n \u0111\u00e3 c\u1ea5u h\u00ecnh).<\/li>\n<li><strong>Username:<\/strong> root<\/li>\n<li><strong>Password:<\/strong> D\u00e1n chu\u1ed7i k\u00fd t\u1ef1 v\u1eeba copy \u1edf B\u01b0\u1edbc 4.<\/li>\n<li>Sau khi \u0111\u0103ng nh\u1eadp th\u00e0nh c\u00f4ng, h\u00e3y v\u00e0o <strong>Preferences (Avatar g\u00f3c ph\u1ea3i) &gt; Password<\/strong> \u0111\u1ec3 \u0111\u1ed5i m\u1eadt kh\u1ea9u m\u1edbi d\u1ec5 nh\u1edb h\u01a1n v\u00e0 b\u1ea3o m\u1eadt h\u01a1n.<\/li>\n<\/ol>\n<p>T\u1ea1i \u0111\u00e2y, b\u1ea1n c\u00f3 th\u1ec3 \u0111\u0103ng nh\u1eadp v\u00e0 b\u1eaft \u0111\u1ea7u s\u1eed d\u1ee5ng GitLab \u0111\u1ec3 qu\u1ea3n l\u00fd m\u00e3 ngu\u1ed3n v\u00e0 d\u1ef1 \u00e1n c\u1ee7a m\u00ecnh.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Cac-lenh-quan-ly-GitLab-co-ban-tren-VPS\"><\/span>C\u00e1c l\u1ec7nh qu\u1ea3n l\u00fd GitLab c\u01a1 b\u1ea3n tr\u00ean VPS<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Trong qu\u00e1 tr\u00ecnh s\u1eed d\u1ee5ng, b\u1ea1n c\u00f3 th\u1ec3 c\u1ea7n thao t\u00e1c v\u1edbi GitLab th\u00f4ng qua m\u1ed9t s\u1ed1 l\u1ec7nh qu\u1ea3n tr\u1ecb ph\u1ed5 bi\u1ebfn d\u01b0\u1edbi \u0111\u00e2y:<\/p>\n<p>Kh\u1edfi \u0111\u1ed9ng ho\u1eb7c d\u1eebng GitLab:<\/p>\n<p><code>\u00a0sudo gitlab-ctl start<\/code><br \/>\n<code>sudo gitlab-ctl stop<\/code><\/p>\n<p>Ki\u1ec3m tra tr\u1ea1ng th\u00e1i ho\u1ea1t \u0111\u1ed9ng c\u1ee7a GitLab:<\/p>\n<p><code>\u00a0sudo gitlab-ctl status<\/code><\/p>\n<p>Sao l\u01b0u to\u00e0n b\u1ed9 d\u1eef li\u1ec7u GitLab:<\/p>\n<p><code>\u00a0sudo gitlab-backup create<\/code><\/p>\n<p>Nh\u1eefng l\u1ec7nh n\u00e0y gi\u00fap b\u1ea1n ki\u1ec3m so\u00e1t t\u00ecnh tr\u1ea1ng v\u1eadn h\u00e0nh v\u00e0 \u0111\u1ea3m b\u1ea3o an to\u00e0n d\u1eef li\u1ec7u cho h\u1ec7 th\u1ed1ng GitLab.<\/p>\n<p><strong>S\u1eed d\u1ee5ng GitLab \u0111\u1ec3 qu\u1ea3n l\u00fd d\u1ef1 \u00e1n v\u00e0 m\u00e3 ngu\u1ed3n:<\/strong><\/p>\n<p>Sau khi GitLab \u0111\u00e3 s\u1eb5n s\u00e0ng, b\u1ea1n c\u00f3 th\u1ec3 b\u1eaft \u0111\u1ea7u s\u1eed d\u1ee5ng n\u1ec1n t\u1ea3ng n\u00e0y \u0111\u1ec3 qu\u1ea3n l\u00fd source code v\u00e0 l\u00e0m vi\u1ec7c nh\u00f3m.<\/p>\n<p><strong>T\u1ea1o project m\u1edbi tr\u00ean GitLab:<\/strong><\/p>\n<p>\u0110\u0103ng nh\u1eadp v\u00e0o GitLab, sau \u0111\u00f3 ch\u1ecdn Create a project.<\/p>\n<p>Ti\u1ebfp theo, ch\u1ecdn Blank project v\u00e0 \u0111i\u1ec1n c\u00e1c th\u00f4ng tin c\u1ea7n thi\u1ebft nh\u01b0 t\u00ean d\u1ef1 \u00e1n, m\u00f4 t\u1ea3 v\u00e0 thi\u1ebft l\u1eadp quy\u1ec1n truy c\u1eadp (public, private ho\u1eb7c internal).<\/p>\n<p><strong>Th\u00eam m\u00e3 ngu\u1ed3n v\u00e0o repository GitLab:<\/strong><\/p>\n<p>Clone kho m\u00e3 ngu\u1ed3n t\u1eeb GitLab v\u1ec1 m\u00e1y t\u00ednh c\u1ee7a b\u1ea1n:<\/p>\n<p><code>\u00a0git clone http:\/\/&lt;your-domain&gt;\/&lt;username&gt;\/&lt;project-name&gt;.git<\/code><\/p>\n<p>Sau \u0111\u00f3 th\u00eam file, commit v\u00e0 \u0111\u1ea9y m\u00e3 ngu\u1ed3n l\u00ean repository:<\/p>\n<p><code>\u00a0git add .<\/code><br \/>\n<code>git commit -m \"Initial commit\"<\/code><br \/>\n<code>git push origin main<\/code><\/p>\n<p><strong>Qu\u1ea3n l\u00fd th\u00e0nh vi\u00ean v\u00e0 ph\u00e2n quy\u1ec1n trong d\u1ef1 \u00e1n:<\/strong><\/p>\n<p>Trong trang d\u1ef1 \u00e1n, truy c\u1eadp m\u1ee5c Members \u0111\u1ec3 m\u1eddi th\u00eam th\u00e0nh vi\u00ean tham gia.<\/p>\n<p>T\u1ea1i \u0111\u00e2y, b\u1ea1n c\u00f3 th\u1ec3 ph\u00e2n quy\u1ec1n ph\u00f9 h\u1ee3p nh\u01b0 Developer, Maintainer ho\u1eb7c Owner t\u00f9y theo vai tr\u00f2 c\u1ee7a t\u1eebng ng\u01b0\u1eddi trong nh\u00f3m.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Meo-toi-uu-cho-VPS-cau-hinh-thap-4GB-RAM\"><\/span>M\u1eb9o t\u1ed1i \u01b0u cho VPS c\u1ea5u h\u00ecnh th\u1ea5p (4GB RAM)<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>V\u00ec GitLab ch\u1ea1y r\u1ea5t nhi\u1ec1u ti\u1ebfn tr\u00ecnh n\u1ec1n (Sidekiq, Puma, Gitaly&#8230;), n\u1ebfu VPS c\u1ee7a b\u1ea1n b\u1ecb \u0111\u1ea7y RAM, h\u00e3y t\u1ea1o th\u00eam <strong>Swap (RAM \u1ea3o)<\/strong> t\u1eeb \u1ed5 c\u1ee9ng \u0111\u1ec3 tr\u00e1nh b\u1ecb s\u1eadp d\u1ecbch v\u1ee5.<\/p>\n<p><strong>C\u00e1ch t\u1ea1o 4GB Swap:<\/strong><\/p>\n<div>\n<pre><code>sudo fallocate -l 4G \/swapfile\r\nsudo chmod 600 \/swapfile\r\nsudo mkswap \/swapfile\r\nsudo swapon \/swapfile\r\necho '\/swapfile none swap sw 0 0' | sudo tee -a \/etc\/fstab<\/code><\/pre>\n<h3><span class=\"ez-toc-section\" id=\"Cau-hinh-HTTPS-SSL-MIEN-PHI\"><\/span>C\u1ea5u h\u00ecnh HTTPS (SSL MI\u1ec4N PH\u00cd)<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u0110\u1ec3 b\u1ea3o m\u1eadt code, b\u1ea1n n\u00ean b\u1eadt HTTPS. GitLab t\u00edch h\u1ee3p s\u1eb5n Let&#8217;s Encrypt.<\/p>\n<p>M\u1edf file c\u1ea5u h\u00ecnh:<\/p>\n<pre><code>sudo nano \/etc\/gitlab\/gitlab.rb<\/code><\/pre>\n<p>T\u00ecm d\u00f2ng external_url v\u00e0 s\u1eeda th\u00e0nh https:<\/p>\n<pre><code>external_url \"https:\/\/gitlab.example.com\"<\/code><\/pre>\n<p>T\u00ecm v\u00e0 b\u1ecf ch\u00fa th\u00edch (x\u00f3a d\u1ea5u #) c\u00e1c d\u00f2ng sau \u0111\u1ec3 b\u1eadt Let&#8217;s Encrypt:<\/p>\n<pre><code>letsencrypt['enable'] = true\r\nletsencrypt['contact_emails'] = ['admin@example.com'] # \u0110i\u1ec1n email c\u1ee7a b\u1ea1n\r\nletsencrypt['auto_renew'] = true<\/code><\/pre>\n<p>L\u01b0u file (Ctrl+O -&gt; Enter) v\u00e0 tho\u00e1t (Ctrl+X).<\/p>\n<p>C\u1eadp nh\u1eadt l\u1ea1i c\u1ea5u h\u00ecnh GitLab (L\u1ec7nh n\u00e0y s\u1ebd ch\u1ea1y m\u1ea5t v\u00e0i ph\u00fat):<\/p>\n<pre><code>sudo gitlab-ctl reconfigure<\/code><\/pre>\n<p>Sau khi ho\u00e0n t\u1ea5t quy tr\u00ecnh c\u00e0i \u0111\u1eb7t GitLab CE tr\u00ean VPS Linux (Ubuntu), b\u1ea1n \u0111\u00e3 s\u1edf h\u1eefu m\u1ed9t h\u1ec7 th\u1ed1ng qu\u1ea3n l\u00fd m\u00e3 ngu\u1ed3n \u0111\u1ed9c l\u1eadp, ch\u1ee7 \u0111\u1ed9ng v\u00e0 ph\u00f9 h\u1ee3p cho c\u1ea3 c\u00e1 nh\u00e2n l\u1eabn \u0111\u1ed9i nh\u00f3m ph\u00e1t tri\u1ec3n. Vi\u1ec7c t\u1ef1 tri\u1ec3n khai GitLab tr\u00ean VPS kh\u00f4ng ch\u1ec9 gi\u00fap ki\u1ec3m so\u00e1t d\u1eef li\u1ec7u t\u1ed1t h\u01a1n m\u00e0 c\u00f2n d\u1ec5 d\u00e0ng m\u1edf r\u1ed9ng khi d\u1ef1 \u00e1n ph\u00e1t tri\u1ec3n l\u1edbn h\u01a1n.<\/p>\n<p>T\u1eeb \u0111\u00e2y, b\u1ea1n c\u00f3 th\u1ec3 ti\u1ebfp t\u1ee5c c\u1ea5u h\u00ecnh b\u1ea3o m\u1eadt, ph\u00e2n quy\u1ec1n ng\u01b0\u1eddi d\u00f9ng, thi\u1ebft l\u1eadp CI\/CD ho\u1eb7c t\u1ed1i \u01b0u hi\u1ec7u n\u0103ng \u0111\u1ec3 GitLab ho\u1ea1t \u0111\u1ed9ng \u1ed5n \u0111\u1ecbnh l\u00e2u d\u00e0i. Ch\u1ec9 c\u1ea7n th\u1ef1c hi\u1ec7n \u0111\u00fang c\u00e1c b\u01b0\u1edbc trong h\u01b0\u1edbng d\u1eabn, GitLab CE s\u1ebd tr\u1edf th\u00e0nh m\u1ed9t c\u00f4ng c\u1ee5 h\u1ed7 tr\u1ee3 \u0111\u1eafc l\u1ef1c cho quy tr\u00ecnh ph\u00e1t tri\u1ec3n ph\u1ea7n m\u1ec1m c\u1ee7a b\u1ea1n.<\/p>\n<div class=\"highlight-cta-box\">\n<p><span style=\"font-size: 130%; color: #ed1c24;\">Tr\u1ea3i nghi\u1ec7m VPS Linux t\u1ed1i \u01b0u cho GitLab t\u1ea1i InterData<\/span><\/p>\n<p>\u0110\u1ec3 c\u00e0i \u0111\u1eb7t v\u00e0 v\u1eadn h\u00e0nh GitLab CE \u1ed5n \u0111\u1ecbnh tr\u00ean Ubuntu, vi\u1ec7c l\u1ef1a ch\u1ecdn m\u1ed9t VPS Linux c\u00f3 hi\u1ec7u n\u0103ng t\u1ed1t v\u00e0 t\u00e0i nguy\u00ean ri\u00eang l\u00e0 y\u1ebfu t\u1ed1 r\u1ea5t quan tr\u1ecdng. VPS Linux t\u1ea1i InterData s\u1eed d\u1ee5ng h\u1ea1 t\u1ea7ng hi\u1ec7n \u0111\u1ea1i, CPU hi\u1ec7u n\u0103ng cao, SSD NVMe t\u1ed1c \u0111\u1ed9 nhanh, gi\u00fap GitLab ho\u1ea1t \u0111\u1ed9ng m\u01b0\u1ee3t m\u00e0 ngay c\u1ea3 khi d\u1ef1 \u00e1n c\u00f3 nhi\u1ec1u th\u00e0nh vi\u00ean v\u00e0 repository l\u1edbn. B\u1ea1n c\u00f3 th\u1ec3 <strong>\u0111\u0103ng k\u00fd d\u00f9ng th\u1eed VPS<\/strong>,<strong> d\u1ec5 d\u00e0ng n\u00e2ng c\u1ea5p c\u1ea5u<\/strong> <strong>h\u00ecnh<\/strong> khi c\u1ea7n, ph\u00f9 h\u1ee3p cho c\u1ea3 l\u1eadp tr\u00ecnh vi\u00ean c\u00e1 nh\u00e2n l\u1eabn doanh nghi\u1ec7p tri\u1ec3n khai GitLab production.<br \/>\n<a href=\"https:\/\/interdata.vn\/vps-linux\/\" class=\"button primary is-primary is-medium\"  >\n\t\t<span>Xem b\u1ea3ng gi\u00e1 VPS Linux t\u1ed1c \u0111\u1ed9 cao<\/span>\n\t<\/a>\n\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>V\u1edbi Ubuntu \u2013 m\u1ed9t trong nh\u1eefng h\u1ec7 \u0111i\u1ec1u h\u00e0nh \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng r\u1ed9ng r\u00e3i nh\u1ea5t tr\u00ean VPS \u2013 vi\u1ec7c c\u00e0i \u0111\u1eb7t GitLab CE kh\u00f4ng qu\u00e1 ph\u1ee9c t\u1ea1p n\u1ebfu th\u1ef1c hi\u1ec7n \u0111\u00fang quy tr\u00ecnh. Trong b\u00e0i vi\u1ebft n\u00e0y, ch\u00fang ta s\u1ebd \u0111i t\u1eebng b\u01b0\u1edbc chi ti\u1ebft trong quy tr\u00ecnh c\u00e0i \u0111\u1eb7t GitLab CE tr\u00ean VPS Linux<\/p>\n","protected":false},"author":11,"featured_media":38553,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[49],"tags":[],"class_list":["post-38531","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vps"],"_links":{"self":[{"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/posts\/38531","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/comments?post=38531"}],"version-history":[{"count":7,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/posts\/38531\/revisions"}],"predecessor-version":[{"id":38558,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/posts\/38531\/revisions\/38558"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/media\/38553"}],"wp:attachment":[{"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/media?parent=38531"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/categories?post=38531"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/tags?post=38531"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}