How to install Arch Linux - 2021 Edition

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey so it's 2021 new year new you and you want to ascend to the ranks of the linux elite and be able to squeeze your new catchphrase i use arch by the way into every conversation or maybe you just want a simple linux setup to run your desktop or your home automation server or your streaming server or whatever either that or you've fallen deep into a youtube rabbit hole and somehow ended up here in which case strap in this is gonna be great let's get to work now a few things have changed since my last video on this topic and i know that because the youtube comments section has become increasingly angry so we're going to rectify that today let's start as we always do head to archlines.org and grab the latest install media okay so on arch linux.org what we're going to want to do is go to the downloads button or the download button on the header and navigate down to your country of residence to get a local mirror i'm going to go here because i'm in canada and get the latest arch iso and that's going to be this one here the second from the top in my case okay so this is downloaded the next thing we need to do is write this bootable install iso to a usb thumb drive so that we can take it to the target pc and boot from it if you are doing this on a vm or via hypervisor you can pretty much ignore this next step and just upload the iso to your hypervisor as you usually would and add it as a boot device on the vm so there's a couple ways you can write this iso to a thumb drive i prefer to use software called etcher and you can get etcher by googling the word etcher the link you want to click is the one here that says balina etcher and you can download it by selecting your platform of choice and clicking that button or if you're already on linux you can you know you can download from here or you can probably use your package manager to grab it so i have etcher so let's open that up once you're in azure you want to go select the image from your most recent downloads then select your thumb drive in my case there's only one so i'll say okay to that and then just click the flash button and it will flash the iso image to your thumb drive once the flash completes it'll automatically unmount your drive and now you're ready to take it over to your target machine so i've created a vm and loaded the boot iso as a cd-rom device and booted from it what you want to do now is make sure you select the top menu item here arch linux install medium ufo uefi and go ahead and boot that okay so after the boot process completes we're dropped into a live linux environment and this is how we're going to perform the installation right from here so right now we're looking at a console output from my hypervisor of the vm where this arch linux install is booting from to make things a little bit easier on the eyes um i don't have a whole lot of control over this console i can't change text size or anything like that so what i'm going to do is i'm going to enable the ssh server on this machine and then i'm going to log into it from a nicer looking terminal so this is an optional step you guys might want to do this if you're using a headless server or a a server that's in a you know a not convenient location so that you can continue the install from your desktop but this is you know this isn't a necessary step for everybody so okay grab the ip address from the server in this case it's 192.168.124 and i will attempt to log into that from my own terminal okay so here's an important one obviously to do this we have to know the root password i currently don't know the root password so i'm just going to go in here and set it really quick [Applause] okay and here we are we have a clean uh root console that's just you know basically connected directly to the live environment it looks exactly like the live environment except we can now change except we can now change text sizes to make this a little more easier to follow along so in order to get started with the install the first obvious step is we need to go straight to the archwiki and open up the install guide the quickest way to get there is probably just do a google search for arch install guide and then it'll be the first entry the installation guide on the archwiki and we'll start working our way through the installation guide so we've already acquired the image uh verify signature not something that's you know might be uh good or best practice but it's a little bit of a scope for this installation tutorial this is a way that you can use md5 signatures to make sure that the iso you downloaded is uh succinct and and and exactly what you expect it to be but um 99 times out of 100 it's going to be fine unless something that's corrupted during the download um so this is something that you can look into on your own but it's not expressly required usually or especially not for this tutorial so repair and installation medium we've done that boot the live environment we've done that as well set the keyboard layout so that's something that uh i didn't have to do this time around um the keyboard layout uh default is a us and i'm out of canada so my keyboard is the same as the us but if you are using a international keyboard or a keyboard or special characters that needs to be defined um you would see how to do that in this area here but obviously it's not something i'm going to be able to demonstrate okay so verify the boot mode what this is going to do for us is it's going to tell us if our system is booted in efi mode or in bios mode most modern hardware will boot in efi whereas if you're on a vm it could be bios could be if i depends on your settings so i've set this vm up to boot and efi uh so that way we can go through kind of the more slightly more complex setup of an efi system if it's if you happen to be in mbr or bios mode uh just follow those specific instructions when it comes to the bootloader but i'll i'll let you know when that is in order to determine if you're booted in efi or mbr mode they provided this command here so i'll copy this switch over and we'll paste that in there and run this so it's an ls command as you can see uh it's just lsing on says firmware afia 5rs and that'll be populated if it'll be populated if you are booted in the fi mode which i am if you if you're not in efi mode if you're in mbr mode it would say something like ls directory does not exist or something of that nature but clearly we can see we are in efi mode so we'll continue like that okay the next step is to update the system clock so we'll just do a system ctr time date ctl status on the machine just to see that our system clock is correct and according to this it is 2339 utc let's check that with google do google utc time 23.39 is correct so i have nothing more to do here if your clock is incorrect just uh set it according to the instructions or set it up to use ntp which will do the same okay so the next step is partitioning the disks this is the first thing that's going to be different if you are booting mbr or efi on an efi system you do have to make a boot partition that we'll go through um if you're doing with mbr you just need to make a root partition so you can see here the two different partitioning schemes i'm not going to go into too much detail about what exactly all this means but let's go through the partitioning setup now so i'm going to have a look at the disk topology on my system right now using the lsblk command and we can see here that i have one 100 gig disk and i've got a couple of virtual kernel devices that are being created by the arch iso but the the physical sda disk here is is all that i've got so i'm going to go to partition that using the cgdisk tool okay let's say it's going to say it's a damaged disk or not gpt disk that's because it has no partition table we'll say okay to that and in this free space we'll create a new partition and that's going to be our boot partition so it's recommended that these partitions are around 512 megabytes in size so that's what i'll do i'll create first sector default size and sector so i'm going to say 5 1 2 m for 512 megabytes the hex code is not going to be 8 300 um i think it's ef 0 0 but let's hit l capital l to verify that okay type search string or enter to show all code so i'm going to type efi because i know the partition type is efi yes ef00 is going to be my partition type so enter to continue ef00 okay partition name we'll call this boot um our partition name really isn't required it's just something that i'm gonna use to better identify what these partitions are for later on so we have our boot partition now we're gonna go back to the free space we're gonna make another partition here this one's going to be swap so i want to make one gig of swap i think this vm has like four gigs of ram on it so i'm gonna have one gig of swap uh but obviously that's gonna be different based on what you want in your system so i'll say one gig i do not know the hex code for swap so i'm gonna hit l again and i'm gonna type swap okay linux swap looks like it's 8200 so i'll hit enter again 8200 is gonna be my partition type code partition name swap okay and then we'll go back down to the free space i'll make one more new um i'm going to use the full remaining space here so i'll hit the default for first sector the default for last sector the hex code for this will be 8300 which we can see here is linux file system and that's that's exactly what we want and the partition name we'll call this arch okay so we have our three partitions here boot swap and arch arch being our root partition where the os will be installed we're going to go ahead and say write the partition table to the disk it's going to give us a warning saying we might destroy data by doing this just type yes and this partition was or sorry and this operation was completed successfully so we can now quit okay now if we do lsblk we can see the topology again and we can see that we now have three partitions we have our efi partition our swap and our data partition where our root installation is going to be if we go back to the install guide we can see here that we've now created the partitions the next step is to format them so in order to format them we're going to be using three different types of formatting the first one will be our boot partition it's going to get formatted f32 fat32 i guess and now you can find that information in this link here so i'll open this link in a new tab and we will scroll down to the formatting here of the of the boot partition and it says you can see here that we're going to make fs fat type fat 32 on our device so go back and we'll say make fs dot fat makeup s dot at f 32 dev sda 1 ok that's completed we'll go back to our page here uh we'll deal with the swap next since that's sda2 and we'll use the make swap command on device sda2 so there's our one gigabyte swap partition created and the next thing we need to do is format our main root file system and we're going to use ext4 as recommended here so we'll snap back and say make fs dot ext 4 dev sda 3 ok so now we have our three file systems the topology should not have changed looks good so now that we have our file systems created we need to mount them so that we can begin to write the os to them we'll start by mounting our root partitions say mount slash dev sda 3 and we'll mount it at mnp we're also going to turn on our swap partition so we're going to say swap on slash dab sda2 and the last thing we're going to do is we're going to mount the boot partitions and the boot prediction gets mounted in the root file system at slash boot so before we mount it we're going to create that directory we'll say make directory slash mnt slash boot so remember the root partition is mounted at mnt so we're going to make the boot partition that slash m t slash boot so now we'll mount the boot partition in the slash m t slash boot folder we just created so so all our file systems are mounted and now we can carry on with the installation portion of the installs so it gives us some instructions here uh to select which mirrors we're going to use i'm going to leave it at the default just for the tutorial we're going to be using these tool pack strap so we're going to be using pack strap and we're going to direct it at mnt and then we're going to list the packages that we want to install with the os so it lists here to use base linux and linux firmware i'm definitely going to choose those but i'm also going to add some more so we'll do a pack strap slash mnp and i'm going to and i'll install the base linux linux firmware i also want to install base devel as well as some text editors like ji or nano and now would be the time if you especially if you're on a wi-fi device if you want to install any additional network managers like um wpa supplicant or network manager itself this base install will come with systemd network d so if you're comfortable there that's fine and that's what i'm going to use at least at the beginning so i will send this and here we go installing the packages straight to our root partition okay so that's installed uh we'll switch back to the wiki here and just as a note i i know i mentioned installing additional packages just before the install there but there's a whole section here of other packages you might want to consider adding and some links to learn more about what you might need so definitely check this out if you're not sure all the packages you might need and again especially if you're on wi-fi so the next step is to generate an fs tab which stands for file system table and this is going to tell the os at boot time where your drives are located and what the topology of your operating system is going to be so let's look at what this command outputs before we uh commit it to a file and just make sure that everything is as we would expect it to be so you see here the command is gen f stab dash u mnt and we'll take that back to our system and run this and you can see in the fstab file we have sda3 as our root we have sda1 as our boot and sda2 is our swap and that's exactly what we expect so we will take the full command and we will create the fstab file in slash mnt slash see slash fps tab which is exactly where it needs to be we'll send that command and now for the very first time we're actually going to enter into the system that we just installed and do some configuration from the inside so we'll say arch int and now we're inside our new installation okay so there's a number of steps that the install guide wants us to perform now so we'll just kind of run through those so the first one is setting your time zone uh and we're going to set that by creating a sim link in etsy local time so we'll say ln dash sf usr now all the time zones that are available are in usr share zone info where obviously wherever you live it's going to be slightly different but i'm going to say canada see what we have available to us canada eastern and that some link will be created that slash let's see slash next thing is we're going to generate uh some clock config settings by using this command hw clock sys2hc okay we're now going to generate our locale so we're going to edit this file here this is why it's important to have a text editor vi etsy locale.gen for me i'm going to use the en utf-8 so i'll uncomment this but if your locale is you know one of these other ones obviously just uncommented that's relevant for you but for me it's this one i'll save this and run locale gen okay i'm also going to edit or create the locale.com file and enter a line into it so in this i'm setting the lang variable equal to enus utf-8 again there's a there's an explanation on the archwiki if you have a different language to set this is where you would go check it and find out what your value should be so i'll save this the next step is a keyboard layout but again i don't need to change from the default okay so that's our kind of our localization settings setup now we're going to move into network settings so i'm going to go and create a hostname file and set the hostname of the machine and i'll call this host arch but obviously you can be you know more creative than me and and pick something better than that okay so the next step that it wants us to perform is creating a new init ram that fast now the installation guide says that this is usually not required uh because make in its cpio is probably run during the kernel installation of the pack strap but it also does not hurt to do and it's the step that i always perform you know just in case i want to have my best chance at having a clean boot the first time so i'll go back and i'll run making it cpio and you might see some warnings or different messages throughout this process but as long as the command completes successfully you should be all right before we reboot we definitely want to set a root password so okay so i have a root password set and one last step before we reboot we're going to install a bootloader so this is documented quite well in the arch install guides so go to the boot loader section we'll click this link open up a new tab and now we get to pick a bootloader that we want to use so again defend depending on if you started with a uefi install or an mbr install there's going to be different boot loaders that work for your use case i tend to always use grub grub works in all cases so on my mbr systems i use grabbing my efi systems i use grub and i haven't really had any problems with it so i'll select grub and that'll take us to the archwiki page for grub to do a grub install this might look pretty intimidating there's a lot of information in here for sure but just try to make use of the table of contents we're going to go to ufi systems and installation and this will give us the steps we need to complete to install grub on our efi system so first it says install the packages grab an efi boot manager so go back here and now since we're in the installation we're not going to use packstrap anymore we're going to use pacman which is the arch package manager that's why and we'll say grub and ef5 boot mgr nope that would help if i spelled it correctly efi boot manager okay proceed with the installation and now grub and efi boot mgr are installed so now i'll grab this command here this is the grub install command which we need to run in order to make the boot loader work properly you'll see that the efi directory here set to esp now the archwiki is just kind of using this interchangeably because people's uh boot partitions aren't always at slash boot your esp or your efi boot partition might be called something else slash efi or or what have you so they've just used the the words esp to signify that so we're going to when we copy this command we're going to replace that with the location of our slash boot directory so again i'll paste this in and i'm going to go back to where efi directory equals esp and i'll say it's in slash boot okay we'll run this command okay installation finish no error reported that's good again there's kind of an explanation here of what we just discussed about replacing the esp here if you're if you're unsure or if you've chosen to put your slash if you've chosen to put your efi boot directory at a different place you can use this information to figure out what needs to be in that spot but if you're following along it'll just be slash boot the last thing we need to do is create a grub configuration okay so i'm moving on to the configuration of grub it says here on an installed system grub loads the slash boot slash grub slash grub dot cfg configuration file um we don't have that yet we obviously we just installed grub we don't have any configs made for it so we're going to use this command down here to generate our grab config for us so it says grub may config dash o uh slash boot grub grab config again if your efi directory is not a slash boot this is something you might need to change but for us this command will work just fine okay we can see in here i did find our linux image and found our nrd okay so everything looks good from a bootloader perspective we're now at the point where we can attempt to reboot the system and see if we've made any mistakes or if something was done wrong this is kind of the the first litmus test we get to have of our of our installation so first we'll exit the troot and bounce back into the arch iso and just because we're rebooting the system this time i'm going to go back to the terminal like the direct vm terminal and run the reboot and we'll see what happens so i'm going to use shutdown dash r now to reboot the system okay so we see the grub boot loader screen which is a great sign we'll hit enter on arch linux that's so perfect we booted into our system um we can see that we are now on arch we're not on the live installation media anymore this is the actual os that we just installed so we'll log in with root and the password that we just gave it and we are now completely logged in if you made it this far economist you say the worst is definitely behind you there's only a couple more steps that we need to complete i have a fully functioning linux system to customize as needed so you might notice that we do not have a network connection at the moment this is obviously something that we need to fix so if you installed a different network manager during the installation phase now would be the time to look at the archwiki page and configure that for me however i went with the default which is going to be systemd network d so i will switch over to the archwiki page for that so the first thing he wants us to do is start and enable the systemd networkd service and the system d resolve d service so i'll say system system ctl start this network and system ctl start here's all d now at this point we need to see which network devices uh systemd network d recognizes so we'll use the command network ctl list so we can see here we have a ethernet device called ens18 this might seem a little bit cumbersome but for systemd network d we actually need to create a network file that defines how we want to use our network device there's other network managers that are a little more straightforward and automatic but today i'm kind of going through the most basic setup of arch linux which is using the base packages of system d network d and system d resolve d um so in the uh in the arch wiki 7d network d we can see that there's two entries for what a config file might look like for a wired adapter so wired adapter using dhcp and wired adapter using a static ip so i'm going to go ahead and use the wired adapter using dhcp entry and i'm going to create my configuration file at etsy systemd network and call it 20 wired dash 20-wire dot network so i'll use nano to create the configuration file so nano let's see that work we'll call it 20. just like the our wiki suggests and we'll set up our file here so we know that we have a device called ens-18 so in the match in the match box i'll put name equals ems make sure you watch your capitalization on these um it's very case sensitive so if you have a not a capital n under name or a different capitalization in your in your device name it will not work and we'll say enter the network heading we'll say dhcp equals yes okay ctrl x to exit and we will write the buffer say yes to that and here we are now so if i go ahead and restart systemd network d we should have a network connection so that service is restarted i'll also restart systemd resolve d okay so it just took a while for my dhcp i can see that i have an ip address and the network is connected so now that i have a network connection i'm going to go ahead and set up a user account that i can use instead of root so i'll say user add uh dash g for its primary group is going to be users dash big g for its secondary groups i'll join the group wheel storage and power i'll do dash m to create a home directory and i'll set my username as brad okay i'll set a password for my user account another thing i'm going to want to do is add my user to the pseudoers file so that i can perform root commands when necessary without having to be root and i'll do that by typing vi sudo and in here we want to allow the wheel group to do things i i prefer to use no password but um it depends on your security taste you can have you know uncomment this line if you'd like it to prompt you for a password each time but i want to be able to pseudo without a password so on so i'll uncomment that and write and quit so now i have a user set up uh for myself that's not root but still has the privileges to use the pseudo command when needed one thing you'll definitely want to do now that the network is set up is enable systemd network d and enable systemd resolve d to start at boot so we'll do that by saying system cpl enable systemd network d and system enable resolve d okay one last thing i'm going to do before we sign off here is i'm going to install the ssh demon so that i can once again connect to this machine remotely and perform administration tasks without having to be on the physical console like we are now so i'll say pacman sy open ssh so let's install the open ssh package and then i'll say system ctl start sshd and systemctl enable sshd so double check the ip address it's now 192.168.1213 so i'll attempt to connect to that with my new user okay so here we are logged into our new arch system remotely with our new user i guess at this point it's safe to call this installation complete if there's anything that you'd like to have more clarity on or maybe something i didn't explain well enough feel free to ask in the comments and if you like this kind of content uh please leave a thumbs up and if you don't like it leave a thumbs down and we'll see you next time thanks bye
Info
Channel: Open Source Home
Views: 72,512
Rating: 4.8414636 out of 5
Keywords:
Id: cM2UDz8BepU
Channel Id: undefined
Length: 33min 10sec (1990 seconds)
Published: Fri Jan 01 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.