Skip to content

Install BlackArch Linux like a Pro – 102

Button up those socks, grab your best tie and get ready for Part 102.

Last time in “install Black Arch lInuk like a Pro – 101” we got as far as ssh into the ArchLinux installer. Here we will continue with our installation.

Following the installation guide of those that know better.

The next few steps are straight out of the installation guide at https://wiki.archlinux.org/title/Installation_guide you can refer to that if you have any worries about what we are doing.

Configuring the Storage

During the installation we assigned a LUN (disk) and ArchLinux makes you prepare that disk so you can install the Operating System onto it. This is one of the super geeky reasons I like Arch, it makes you work for everything. No super easy boot to the iso and one click installs here.

I have my own ideas around what a disk layout should look like. But you can muck around and make it whatever you like. You have to have /, /boot, and swap. The rest are optional and just my personal preference.

  • Required: / or root file system should be at least 15 Gig. With a couple of Desktops Managers installed and /usr will quickly balloon up in size.
  • Required: Swap, there are rules for swap, but I tend to ignore them for systems like this with none production workloads. If 1GB is not enough you have bigger issues.
  • Required: /boot a 512MB boot partition.
  • Optional: /var 7GB is enough for me for this example but I recommend 20GB or more. If you use Docker this can fill up quickly.
  • Optional: /home 5GB should do. I tend to dump all my docs, ctf folders and hacking notes into /home and backup the file system. Keeping all this out of / can save on problems later on if you download something too big.
  • Optional: Using fdisk, we are limited to only creating 4 primary partitions per disk I will make /home and /var on an extended partition which is a workaround to getting more file systems per disk.

So, let’s create this, first we want to see what LUNs are available.

fdisk -l

Nice, a 28GB LUN, lets carve it up.

fdisk /dev/sda

Create our efi /boot partition.

  • For a new partition press “n”
  • For type choose primary “p”
  • For Partition Number choose “1”
  • For first sector just hit “Enter” for default.
  • For last sector type “+512M”

For our swap partition

  • For a new partition press “n”
  • For type choose primary “p”
  • For Partition Number choose “2”
  • For first sector just hit “Enter” for default.
  • For last sector type “+1024M”

For our / or root partition.

  • For a new partition press “n”
  • For type choose primary “p”
  • For Partition Number choose “3”
  • For first sector just hit “Enter” for default.
  • For last sector type “+15G”

Our extended Partition. Due to limitations of unix file system partitions I will create our last two partitions inside a Extended partition.

  • For a new partition press “n”
  • For type choose extended “e”
  • This will be not be a useable partition
  • For first sector just hit “Enter” for default.
  • For last sector hit “Enter”

Now we have our extended partition we can create our two remaining ones.

For /var

  • For a new partition press “n”
  • For type choose extended “e”
  • This will be partition 5
  • For first sector just hit “Enter” for default.
  • For last sector type “+7G”

And finally we create /home

  • For a new partition press “n”
  • For type choose extended “e”
  • This will be partition 6
  • For first sector just hit “Enter” for default.
  • For last sector just hit enter to consume the rest of the space.

Last step there is write all we just did to disk. We can do this by pressing the “w” key.

So now our partitions look like this.

NameMount PointSize
sda1/boot512MB
sda2swap1G
sda3/15G
sda4extended Partition11.5G
sda5/var7G
sda6/home4.5G
File System Layout

Creating and enabling Swap partition.

When making the /dev/sda2 partition into swap device, we can use the “mkswap” command to create a swap device out of a partition. After creation we need to enable it with the “swapon” command.

mkswap /dev/sda2

Enable Swap

swapon /dev/sda2
swapon -s

Creating and enabling /boot

/boot is a special file system that needs to be in the “FAT” format in order to allow booting from GRUB. Like a lot of things, its outside the scope of this guide. See Archs Guide to EFI for more details

mkfs.fat -F 32 /dev/sda1

Creating, enabling and mounting /, /var and /home

We know that / is /dev/sda3, /var is /dev/sda5 and /home is /dev/sda6

mkfs.ext4 /dev/sda3
mkfs.ext4 /dev/sda5
mkfs.ext4 /dev/sda6

And Mount them into /mnt

mount /dev/sda3 /mnt

So what are we doing here. In order to install ArchLinux you need to have a file system already set up. this includes /boot, / /var /home.

I have mount up /dev/sda3 into /mnt and tell the arch installer that this is the new root directory for our installed. Bear with me and you will see it soon. But as /mnt is a new root file system its missing our mount points for /var /boot and /home. So, we need to create the directories that we mount or file systems into.

mkdir /mnt/var /mnt/boot /mnt/home

Now we can mount up the rest.

mount /dev/sda5 /mnt/var
mount /dev/sda6 /mnt/home
mount /dev/sda1 /mnt/boot

Phew!

I am tired, this is a lot of work but it’s fun and we are learning new things.

Join me in Part 103 for the next step of the installation.

Published inBlackArchCTFGetting Started With CTF ChallengesIT & SecurityLinux

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *