Now we have Storage! What to do with it?
So continuing on from our last dialog we have all our required storage mounted.
So now we start to install the packages we need to get a working ArchLinux Operating system.
[root@archiso /]# pacstrap /mnt base linux linux-firmware openssh \ vim curl sudo net-tools tcpdump dhcpcd bash \ lsof screen grub which vim git efibootmgr man \ nfs-utils usbutils dhclient net-tools inetutils zsh
You can take a look at google to what all these are but I find I keep having to install them straight away after installing arch. Actually the installer is a excellent live version of Linux and the one you will install will not have as many tools installed as the installer. So it’s good to get them installed early as networking can be tricky to configure after the installation.
That didn’t take too long.
Persistent Mount points
Now we have to take all those mount points and make them persistent after we boot into our final environment.
genfstab -U /mnt >> /mnt/etc/fstab
Change our current /
“/” at the moment is the one that was booted into by the installer, but to continue our install of ArchLinux we need to move to the one that that we just installed in /mnt/. Usually you use the chroot (change root) command for that but ArchLinux has its own special version for the installation.
After this command runs, ‘/mnt’ becomes our new ‘/’ directory.
If you do a df -h you dont see the mount points under /mnt anymore. You are looking at our newly installed server. Easy as that. Well no, there are a few more steps we need to take care of before we can boot into our new server.
Set Hardware Clock and Locale
Set you hardware clock to the same time as the server.
Link the correct timezone of your city.
ln -sf /usr/share/zoneinfo/Europe/Dublin /etc/localtime
In order to create your locale you need to uncomment you language in /etc/locale.gen. Remember we installed ‘vi’ as part of the original packages. Well this is one of the reasons. My local was IE so I removed the comment both of them.
vi /etc/locale.gen grep -v "^#" /etc/locale.gen en_IE.UTF-8 UTF-8 en_IE ISO-8859-1
Now generate your locale.
[root@archiso /]# locale-gen Generating locales... en_IE.UTF-8... done en_IE.ISO-8859-1... done Generation complete. [root@archiso /]#
Set the local
echo "LANG=en_IE.UTF-8 " >/etc/locale.conf
Set the keyboard
Set the hostname.
echo "blackarch" >/etc/hostname
Change the root passwd.
So we already did this right?
Well no, we did it for /etc/passwd but after the chroot we have a new /etc/passwd, which maps back to /mnt/etc/password before the chroot.
So lets do it again. As this is the real root password we need to make it a hard one. Random numbers/letters up to 15 characters is always good.
[root@archiso /]# passwd New password: Retype new password: passwd: password updated successfully
Set up Grub.
ArchLinux has a whole wiki page dedicated to setting up ‘GRUB’. I am just going to give the commands and you can research them if you like.
[root@archiso /]# grub-install --target=x86_64-efi \ --efi-directory=/boot --bootloader-id=GRUB --removable Installing for x86_64-efi platform. Installation finished. No error reported. [root@archiso /]# grub-mkconfig -o /boot/grub/grub.cfg Generating grub configuration file ... Found linux image: /boot/vmlinuz-linux Found initrd image: /boot/initramfs-linux.img Found fallback initrd image(s) in /boot: initramfs-linux-fallback.img Warning: os-prober will not be executed to detect other bootable partitions. Systems on them will not be added to the GRUB boot configuration. Check GRUB_DISABLE_OS_PROBER documentation entry. done [root@archiso /]#
This is a big test, did you (or I) make any mistakes. Lets unmount the cdrom in virtualbox and do a reboot. If it comes back then we are onto a winner. You will lose the ssh access we were using for the install and will not have network connectivity after the reboot so the next steps should be done in the Oracle Virtual Box console.
We are nearly done for this one, I promise.
So we started this all off by making a bridged network in Oracle Virtual Box which worked well for the installer. Let set networking as currently we won’t have any network configured.
Identify the network interface and bring it online with dhcp. (some of these are commands we installed earlier to save some trouble)
ip a dhclient enp0s3 ip a
We have to enable networking at this stage. There is a few options here but I like using systemd
So first of all, we add the below the file /etc/systemd/network/25-wired.network
[Match] Name=enp0s3 [Network] DHCP=yes
Then simply enable the systemd-networkd module.
systemctl enable --now systemd-networkd
Whats our ip address
ip a show dev enp0s3
Next we have to enable ssh
systemctl enable --now sshd
We have to add a user as root access via ssh is blocked, I would advise not changing that just to build up some secure habits.
[root@blackarch ~]$ useradd -k /etc/skel -d /home/tkraz \ -m -s /bin/bash tkraz #Set a secure password [root@blackarch ~]$ passwd tkraz su - tkraz
Be sure to su to tkraz user in the last step to make sure it was created and all is good.
Now we should be good to ssh to our server.
So now we have a fully working ArchLinux environment installed.
Join me next time where we will configure the BlackArch repositories.
Be First to Comment