Arch Linux Installation Guide on HP Pavilion
Tags: archlinux, tutorial
Published: 2019-05-02 09:59:34

---
title: Arch Linux Installation Guide  on HP Pavilion
published: true
description: 
tags: archlinux, tutorial
---
My computer details:

>Computer: HP Pavilion laptop
>CPU: Intel i5-8250U
>GPU: NVIDIA MX150


## Pre-installation
### Verify the boot mode
 To verify if it is UEFI mode, use this command:
 `ls /sys/firmware/efi/efivars`
If it show some details, the system is UEFI. Otherwise, the system may be booted in BIOS or CSM mode.
### Connect to the internet
Because I'm using HP laptop. so i just need connect to wifi with this command `wifi-menu`. If you want to connect to wired network, reference official guide about [dhcpcd](https://wiki.archlinux.org/index.php/Dhcpcd#Installation)
You can check this connection by  `ping www.archlinux.org`.
### Update the system clock
Use ` timedatectl set-ntp true` to ensure the system clock is accurate, to check the service status, use `timedatectl status`.

### Partition the disks
Use `lsblk` or `fdisk -l` to vertified device.
First, run `fdisk /dev/sda`（note: if your device is /dev/sdX, run `fdisk /dev/sdX`), and you will enter  the *fdisk* dialog. 
Next enter `m` you will get help details. If you use a separate hard drive. enter `g` to format it as GPT. 
Next, enter `n` to create new partitions, enter `w` to exit if you finished.

This is my partition layout:

Mount points | Partition | Partition Type | Size
----|---|---|---|
/mnt | /dev/sda3 | linux filesystem |50G
/mnt/boot | /dev/sda2 | linux filesystem|500M
/mnt/boot/EFI | /dev/sda1 | EFI system partition|500M
[swap] | /dev/sda4 | linux swap|16G
/mnt/home | /dev/sda5|linux filesystem|300G

### Format the partitions
If the EFI partition is on /dev/sdX0, run:
`mkfs.fat -F32 /dev/sdX0`

 If the root partition is on* /dev/sdX1* and will contain the ext4 file system, run:
`mkfs.ext4 /dev/sdX1`

If you created a partition for swap, initialize it with mkswap:
```
mkswap /dev/sdX2
swapon /dev/sdaX2
```

Run these commands if you use my layout:
```
mkfs.fat -F32 /dev/sda1
mkfs.ext4 /dev/sda2
mkfs.ext4 /dev/sda3
mkfs.ext4 /dev/sda5
mkswap /dev/sda4
swapon /dev/sda4
```
### Mount the file systems
Run these commands if you use my layout:
```
mount /dev/sda3 /mnt
mkdir /mnt/boot
mount /dev/sda2 /mnt/boot
mkdir /mnt/boot/EFI
mount /dev/sda1 /mnt/EFI
mkdir /mnt/home
mount /dev/sda5 /mnt/home
```
## Installation
### Select mirrors
- Open mirrorlist file by  `nano /etc/pacman.d/mirrorlist`
- Uncomment your selected server.
- save changes
### Install the base packages
Use `pacstrap /mnt base base-devel`
## Configure the system
### Generate an fstab file
- Use `genfstab -U /mnt >> /mnt/etc/fstab`
- Check it in case of errors: `cat /mnt/etc/fstab`
### Into new system
Run `arch-chroot /mnt`
### Timezone and Location
- Set Timezone:
`ln -sf /usr/share/zoneinfo/Region/City /etc/localtime`

- Set the hardware clock:
`hwclock --systohc`

- Set location
1. Uncomment en_US.UTF-8 UTF-8 and other needed locales in **/etc/locale.gen**, and generate it:
```
nano /etc/locale.gen 
locale-gen
```
By the way, the new system doesn't have `vim`.

2. Create the `locale.conf` and set `LANG`variable:
```
nano /etc/locale.conf
LANG= en_US.UTF-8 UTF-8
```
### Network Config
- Create the *hostname* file and enter your hostname: ` nano /etc/hostname`.
- Add matching entries to *hosts*:
```
127.0.0.1	localhost
::1		localhost
127.0.1.1	myhostname.localdomain	myhostname
```
### Set root password
Run `passwd`

### Enable microcode updates
```
pacman -S intel-ucode # for intel CPU
pacman -S amd-ucode # for amd CPU
```
### Install and set Bootloader
I use [grub](https://en.wikipedia.org/wiki/GNU_GRUB), so:
- Install related packages:
`pacman -S grub dosfstools efibootmgr`
- Install grub
`grub-install --target=x86_64-efi --efi-directory=/boot/EFI --recheck`
- Use the grub-mkconfig tool to generate /boot/grub/grub.cfg:
`grub-mkconfig -o /boot/grub/grub.cfg`

### Install Wireless LAN tools
I use `wifi-menu` to connect to wifi, so I need this packages:
 `pacman -S wpa_supplicant dialog iw`
### Add a user
- Add a user
`useradd -m -g users -s /bin/bash username`
- Set password for user
`passwd username`
- Privilege escalation(sudo)
`nano /etc/sudoers` and add `username ALL=(ALL) ALL` below `root ALL=(ALL) ALL`

## Post-Installation
### Install display server
Run the minimal command: `pacman -S xorg-server`.
### Install display driver
Because I use*NVIDIA MX150* graphics card, I use this `xf86-video-nouveau`driver. For details you can referrence [this](https://wiki.archlinux.org/index.php/NVIDIA). If you use *amd card*, you can read [this](https://wiki.archlinux.org/index.php/Xorg#AMD)

------

__Thank you for reading!__
I will continue to update this article later if I find something.