Install and Configure GitLab From Scratch on a Linode Server | Easy and Comprehensive Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome back to lenode in today's video what we're going to do is set up our very own gitlab server in fact we're going to build it manually even though there's a Marketplace app for setting up gitlab sometimes I think it's fun to just build something manually that way you know what's in there there's nothing wrong with the marketplace obviously if you want to get up and running very quickly that's absolutely a great way to do it but anyway what I'm going to do is show you the process of setting up gitlab and by the end of this video you'll have your very own gitlab server but actually I might be getting ahead of myself what exactly is gitlab well at its core gitlab is a front end to get not unlike GitHub or something like that it's a free alternative to services like GitHub and you could self-host it on your own node which makes it even more powerful so what I'm going to do is show you how to set it up I can't wait to get started so let's just Dive Right In thank you [Music] all right so what do you need in order to get started with today's project well the first thing that you're going to need is a Linux instance more specifically what I'll do is show you the process of setting up gitlab Community Edition on Ubuntu 2204 so therefore if you plan on following along with me then I recommend that you set up a Linux instance with Ubuntu 22204 as well if you don't already have a Linux instance for this project then you might want to consider checking out lenode if you don't already have a preferred cloud computing provider well they're a great fit now the instructions that I'm going to give you in this video aren't actually specific to a node though so if you are already set up with another cloud provider you can go ahead and use that in fact you can even set up gitlab on a physical server as well but if you do you'll have to configure port forwarding which unfortunately is outside the scope of this video especially considering the fact that there's countless models of firewalls and routers out there so it's impossible for me to show you the process on each and every single model of router that you might have now when it comes to the specs of your Linux server it's recommended that you have a Linux server with access to at least four cores and also at least four gigabytes of memory now on my end I set up a Linux server on lenode already as you can see right here I chose the instance type that has four CPU cores and eight gigabytes of RAM having eight gigabytes of RAM is actually double the recommended Ram requirement but this instance type will also have 160 gigabytes of storage available so I think it's actually a great fit since you'll have a lot of Headroom and also a fair amount of storage that you could use for your software repositories also you'll need a domain as well if you don't already have a domain then you'll need to purchase one from your Registrar of choice be sure to point your domain to the IP address of the Linux instance you plan on using for gitlab and that should take care of that requirement after you do create your Cloud instance there's one last step that I recommend you go through before you get started with building gitlab and what I'm referring to is you'll want to be sure to install all available updates create a non-root user for yourself lock down SSH and so on I'm actually not going to show you how to perform those tasks in this video because I have a dedicated video that goes over all of that already I'll leave a card for that video right about here in that video what I do is I go over some of the things that I recommend you set up with every single Linux server once you do perform all of the tasks in that video then you can meet me back in this video and then we'll continue along the next section will actually continue where that video left off anyway once you have all of those things prepared we can get started with building our gitlab instance and that's exactly what we'll do in the next section so here on my Linux workstation I'm ready to get started so what I'm going to do is SSH into the server that I've already created for this project and to do that I'll type SSH and then the username at the remote end I've created the user J on the instance that I'll be using next what we'll do is type in the domain that we've assigned to our server so I'll type in mine which is going to be gitlab.learn linux.cloud and let's connect I'll respond to this prompt with yes and then I'll type in my super secret password and now I'm logged in so the first thing that I'm going to do is install the official repository for gitlab this will give us access to the Community Edition of gitlab straight from gitlab themselves and to set that up we'll run the command that I'm about to give you so we'll type curl and then dash s and then after that we'll type a URL and that URL is going to be https colon slash slash packages.getlab.com install and then slash repositories slash gitlab then slash gitlab hyphen CE and then slash script.deb dot sh and then what we'll do is pipe this particular command into sudo bash just like that now I'm going to have all of the commands that I'm using in this video in the official blog post for this video you'll find a link to that blog post in the description down below so go ahead and visit that blog post if you want to copy and paste the commands and for some of you that might make the process easier now before I press enter I just want to mention that anytime you run a script from the internet you'll definitely want to make sure that you check it before you run it I've already done that off camera so I know this script is fine but I just wanted you to be aware of that in case you weren't already anyway I'll press enter and then I'll type in my password and there we go and what we've just done is set up the repository gitlab itself is not installed yet but we do have the repository now and that gives us access to the packages for gitlab from gitlabs repository as far as installing gitlab itself well the command that I'm about to give you is going to do exactly that so I'll run sudo and then apt install and the name of the package is going to be gitlab python CE just like that so I'll press enter so now the package is downloading and now it's installing now at this point gitlab is technically installed but it's not functioning yet in order to make it function we'll need to configure it and there's a dedicated config file for gitlab that's already on our system now that we've installed this package so to satisfy the setup requirements what we'll do is run sudo and then Nano and you could use any text editor you want I'm just using Nano because it's easier to explain my preferred editor is vim in case you're curious but anyway I'm running sudo Nano and the file that I want to edit is going to be located at Etsy and then gitlab and the file name is going to be gitlab.rb so I'll press enter and what we have right here is the actual config file for gitlab now we're going to make several changes to this file before the end of the video but for right now we have just one change to make and this is the change that's required for gitlab to be configured what we'll do is we'll scroll down this particular file until we find the gitlab url and here it is we have external URL and what we'll do is change this to whatever our domain or subdomain is for our gitlab instance in my case what I've done is I've set up mine at gitlab.learn Linux dot cloud so that's my domain what I'll do now is save the file that's the only change that we're going to make to this file right now and now that requirement has been met so now that we've set the external URL in the gitlab config file what we'll need to do now is reconfigure gitlab and that's necessary anytime we make changes to the gitlab config file and it's fairly easy to do so I'll run sudo and then gitlab hyphen CTL and what we're going to do is reconfigure so I'll type that in and then I'll press enter and this is going to take a minute to finish so what I'll do is just fast forward time and then I'll be right back and there you go gitlab is completely set up and we can actually access it from a web browser at this point but before we do that we need to fetch the root password and to grab that what we'll do is run sudo and then cat the password is in a file and the path to that file is slash Etsy gitlab and the file name is initial underscore root underscore password and just like the verbiage says this file will be deleted in 24 hours so we definitely want to make sure that we grab this password so what I'll do is copy the password right now and with that password we should be able to access our gitlab instance so I'll switch back to my browser and then in a new tab what I'll do is try to access gitlab let's see if it works and there it is now one issue here is that this is not a secure connection we can see that from the verbiage here and also from the absence of a padlock here or a padlock without a line through it so that's clearly a sign that our connection is not secure we will be fixing that later in the video but for right now let's just go ahead and type in root for the username and then I'll paste in the password that I grabbed from the earlier command and I should be able to log in and check that out gitlab is working and I was actually able to log in now up here it's letting us know that public signups are enabled and that may or may not be what you want now if you're going to be collaborating with people around the world then you might want to have this enabled but if you're going to be using this just by yourself or if you want to have this be a private instance then what you could do is deactivate signups and to do that you could click this button right here and I'm going to do that on mine but I'll leave it up to you if this is something that you want to deactivate that'll bring you to this section right here and there we can disable signups by unchecking this box there's also other settings here you might want to pay attention to for example two-factor authentication now I'll leave it up to you to look through these settings right here but I just wanted to mention the user sign up setting because depending on your needs you may or may not want public signups but perhaps the bigger issue here is that we don't have a secure connection so let's go ahead and fix that so I'll go back to the dashboard to have that ready for later and back of the terminal what we're going to do is set up a let's encrypt certificate and the process of doing so is actually very easy in fact we've already seen part of the process just like before anytime we want to make any changes to gitlab settings we do so inside the gitlab config file so again that was sudo in the Nano or whatever your text editor of choice happens to be and the file is going to be at slash Etsy gitlab and then gitlab.rb now the first change that we'll need to make is to reconfigure the URL again this is the exact same external URL setting that we configured last time what we'll want to do is add an S right here and that will ensure that our URL defaults to https we're not quite done yet what I'm going to do is press Ctrl W that activates search and I'm doing this because there's over 3000 lines of config in this file so it could be like a needle in a haystack to find any one setting but Nano just like any other text editor has a search feature and if I use the keyword let's encrypt that's going to take me right to the section where we configure these settings for let's encrypt now what we're going to do is enable let's encrypt so we're going to back out this setting right here we're removing the hash symbol in front of the setting after that we'll also uncomment this setting right here and this pertains to contact emails wherever we want to receive let's encrypt notifications so what we'll do is go over here to the bracket we'll type single quotes and aside those single quotes what we'll do is type in our email address so I've typed in my email address so now the requirements for that are all set another setting that we're going to want to adjust here is going to be this one here we want to enable auto renew it defaults to true but I just want to make sure that I'm explicit and uncommenting anything that I plan on using and this is one of those things right here we definitely want to make sure that auto renew for our certificate is enabled another thing that we could do is change when this particular certificate will be renewed anytime a renewal is necessary now for a lot of you it probably doesn't matter but for some of you you might have a specific maintenance window that you need to adhere to in that case what you could do is customize the settings here to change the hour minute day of the month and so on for when the certificate will be renewed now for me I'll leave the renewal settings at their defaults it doesn't really matter to me when this happens as long as it well happens so I'll just save the file and we'll move on now in order for any changes to take effect that we make in the gitlab config file we'll need to reconfigure gitlab to do so I'll run the same command that we ran last time when we set the external URL that was sudo and then gitlab hyphen CTL and then reconfigure so I'll press enter let's see what happens and there we go it looks like the reconfigure is finished and if I've set everything properly then I should have an SSL certificate let's see what happens and back in my browser what I'll do is refresh the page notice that we still don't have a secure symbol here so when I refresh it it should give me the secure symbol to verify that SSL is working let's see what happens with that I'll just refresh the page and check it out we have a certificate if I click on the padlock at least in the case of Firefox then I go to more information and then view certificate we can see the fact that it is in fact encrypted we see the actual URL here and this instance is being secured by let's encrypt and here we can see the time period for which the certificate is valid for and so on and with that said we're all set our gitlab server is ready to go and that about does it for this video I hope you guys enjoyed it and if you followed along with me then you now have your very own gitlab server so what did you guys think of today's video let us know in the comments down below and if you just so happen to like this video then please let YouTube know about that by clicking the like button I would really appreciate that now I have some additional content coming for this channel very soon so I'm going to get back to that but in the meantime I hope you enjoyed this video and I'll see you in the next video [Music] thank you [Music]
Info
Channel: Akamai Developer
Views: 64,603
Rating: undefined out of 5
Keywords: cloud computing, alternative cloud, linux server, sysadmin, linux commands, command line, command line basics, basic linux commands, linux for beginners, linux for beginners 2022, akamai, linux essentials, linux servers, repository, linux tutorial, gitlab, gitlab server, gitlab tutorial, gitlab ci, what is gitlab, gitlab ci cd tutorial, git, github alternatives, top github alternatives, best github alternative, github, self-hosted, selfhosted, open source, home lab, git alt
Id: CskVg8ZCbKw
Channel Id: undefined
Length: 15min 0sec (900 seconds)
Published: Wed Mar 29 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.