U Waterloo Arch Linux Mirror and Download Arch Wiki: Guide to DDing your image. Arch Wiki: Beginners Guide
Once you have downloaded your ISO, from your selected mirror you have to burn it onto a usb drive or equivilant medium. To do this on an existing UNIX system this can easily be done with the dd
command which will be included in any UNIX like operating system.
The syntax for the command is:
dd if=$PATH_TO_ARCH_ISO of=/dev/sdX bs=4M && sync
NOTE: X in this case is where your USB lives. It is important that the usb itself is not mounted during this process. If you are unsure about where your usb lives, then you can unplug your usb and then plug it back in and do a dmesg | tail
to get where its located in the filesystem.
if: Input File
of: Output File
bs=4M: Bytes per second. (In this case 4MB)
sync: Syncs the filesystem in case of inconsistency
If the connection is wired, then the client dhcpd
will be enabled automatically at boot.
If the connection is wireless, then the utility wifi-menu
will provide a nice ncurse interface to finding the appropriate network.
NOTE: On enterprise WPA networks there will have to use a different network manager (such as Network Manager
You can test the network connectivity with:
ping www.google.com
Every operating system starts with a computer without any specific way of understanding how to layout memory.
As such we have to create a way for the OS to understand memory itself, and how it will use.
We use a partition table to be able to do this.
A partition table is a fancy way of saying to the OS, "This is how we are going to layout the memory"
The basic summary is that everything starts from the "/" directory.
We are going to be using the fdisk
utility.
Run lsblk
to see the directory structure.
You should see all of the devices that are listed.
They will be listed as /dev/sd*
devices
NOTE: For the purposes of this we will be using /dev/sda
Choose the correct device by using fdisk /dev/sda
You will now be taken into a prompt.
NOTE: There should be no partition table located on the drive, if there is then hit "d" and delete all partitions.
NOTE: MAKE SURE YOU BACK UP YOUR DATA BEFORE DOING THIS!
Hit the [n]ew key to create partitions on top of the partition table.
It will ask you for its type, leave it as the default.
Once again it will ask you for the first sector leave it as default
It will now ask you for the last sector, this is where we want to specify the size.
FOR BOOT:
+200MB
FOR ROOT:
+20GB
FOR VAR:
+12GB
FOR HOME
Just hit enter it will take up the rest of the space
Now do a lsblk
just to make sure everything is perfect.
You should see:
/dev/sda1 200MB
Now that we have actual space allocated for things, the next thing we have to do is let the OS know exactly what type of file system that we want to create.
The standard file system that we will be using is ext4. This is the standard linux file system.
NOTE: If you are on UEFI you need to create your boot partition as FAT.
To create the filesystems its as easy as doing a
mkfs.ext4 /dev/sda1
Apply the same command to all of your other partitions as well
Ok, so we've got our filesystems made and the OS knows what kind of file system structure that we want to create.
Thats great! Now lets start to do some things with our system.
First we've got to have a starting point and as mentioned earlier, all Linuxes use the "root" partition as the starting point for the system.
REMINDER: The root partition was the one with 20GB remember?
Use our trusty friend lsblk
to make sure we know which partition we will be using.
NOTE: Odds are it is your /dev/sd[x]2 partition due to the fact that it was the second partition we created if you followed the instruction.
We will be using the /mnt
directory as our starting place.
So now you have to mount it. We do this by using the mount
command.
mount -v /dev/sd[x]2 /mnt
NOTE: The -v flag is just used to give us a more robust way of mounting to check for errors. It stands for verbose output
Its as simple as that, now we've got a root directory.
If you've followed the guidelines you will also have 3 other partitions to mount, they should be {boot,var,home}.
Since /mnt
is our starting place for the entire system, we should create the directories under it.
mkdir -p /mnt/{boot,var,home}
NOTE: The -p flag allows us to create a single directory with directories under it. And the braces around the names is a fancy way of creating directories by using brace expansion you can also:
mkdir /mnt/boot
mkdir /mnt/var
mkdir /mnt/home
Now that our directories have been made, we just mount them like we did with our /mnt
partition.
Do another lsblk
if you forget.
200MB to /mnt/boot
/mnt/var
Last partition to: /mnt/home
Check that everything is mounted with lsblk
and we are set to go.
Now we have to get the packages in line to be able to build the rest of our system. For that the Arch Linux folks have been kind enough to provide us with a simple wrapper script.
Run: pacstrap -i /mnt base base-devel
This tells the pacstrap command to install to mount the base package and the base devel. This allows us to have a foundation to build on.
This will take some time, let it finish
To soldify our partition layout we have to use the fstab file. This file is used to show the computer on boot what partitions to mount so we do not have to do it ourselves.
To generate teh fstab run the following command.
genfstab -U -p /mnt >> /mnt/etc/fstab
U: Uses UUID for source identifers
p: Avoid printing pseudofs mounts
Although this should succeed its always best to take a look at your fstab.
cat /mnt/etc/fstab
Ok, so now we have a simple system setup, but we have to be able to go into our system. We need to "change the root directory" that I kept talking about to be able to go to /mnt because thats where our system is.
To do this we have to use the arch-chroot
command.
The syntax is arch-chroot /mnt /bin/bash
/bin/bash: This just tells it that we want to use the /bin/bash shell when we change root into the /mnt directory.
If you want to use another shell you can specify it here.
Ok now it is vitally important to understand tht we are WITHIN the system as such that means we do not have the utilities we had before. This is a fresh slate.
The first step to setting up our new system is being able to tell it which locale that we want to use. Your locale is the way your system handles text.
The list of locales is located in /etc/locale.gen
You have to uncomment the one you want to use.
In our case that is en_CA.UTF-8
. So go ahead and open an editor and uncomment the line.
nano /etc/locale.gen
Ok the line is uncommented we have to run the locale-gen script.
locale-gen
This will generate your locale settings for you.
Next we have to populate our /etc/locale.conf
This is done by this command:
echo LANG=en_CA.UTF-8 > /etc/locale.conf
Finally we have to export our environment variable
export LANG=en_CA.UTF-8
Now we are done with locale
Now we are going to be settings our time zones
To get a full list of timezones do an ls
on /usr/share/zoneinfo/
Once you have found a timezone you want we have to link it to /etc/localtime
hwclock --systohc --utc
To set the hostname we can just do an echo.
echo "$HOSTNAME" > /etc/hostname
/etc/hosts
and put the hostname within the 127.0.0.1 line.We have to be able to connect to the network when we reboot our system.
The tools that we need for connecting to a network are:
pacman -S iw wpa_supplicant dialog
With those tools installed we will be able to use wifi-menu
Setting the root password is vitally important
Make sure that you make it secure and roboust.
passwd
NOTE: For this I will be using an i386 basic bootloader. For more information visit Arch Wiki: Beginners Guide, Bootloaders
Ok now we have to install the piece of software that will boot our system. This is called the boot loader. In most cases we use a program called GRUB. I will be using GRUB in this example.
First we have to install the packages. First we have to install grub
.
NOTE: If you are using multiple operating systems, its best to install the os_prober
application too.
pacman -S grub os_prober
Once the package[s] are installed we have to tell GRUB which partition to use as root and what our target archtecture is.
In my case that is /dev/sda
.
NOTE:: Do not append the number to your partition, you have to use the ENTIRE partition.
The syntax of the command is:
grub-install --target=i386-pc --recheck /dev/sd[X]
Once GRUB is installed there is one last step in creating our boot loader. We have to generate a configuration.
This is acheived by using the command:
grub-mkconfig -o /boot/grub/grub.cfg
`
exit
the prompt and reboot
.