Newer
Older
---
title: Arch Linux Installtion
subtitle: My way to install Arch Linux
date: 2021-12-04
menu: "publications"
tags: ["linux", "arch"]
---
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# Arch Installation
## Installation
### 1. Partion a disk
```
fdisk /dev/sda
d # Delete Partitions
p # List Partitions
n # Create Partitions
w # Execute changes
```
### 2. Make filesystems
```
mkfs.ext4 /dev/sda2
mkfs.fat -F32 /dev/sda1
```
### 3. Mount Partitions
```
mount /mnt /dev/sda2
mkdir /mnt/boot
mount /mnt/boot /dev/sda1
```
### 4. Connect a WiFi
- First, if you do not know your wireless device name, list all Wi-Fi devices:
```
[iwd]# device list
```
- Then, to scan for networks:
```
[iwd]# station device scan
```
- You can then list all available networks:
```
[iwd]# station device get-networks
```
- Finally, to connect to a network:
```
[iwd]# station device connect SSID
```
### 5. Install base
```
pacstrape base base-devel linux linux-firmware vi networkmanager grub efibootmgr
```
### 6. Generate /etc/fstab file
```
genfstab -U /mnt >> /mnt/etc/fstab
```
### Chroot into new install
- Set timezone
```
ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
```
- Enable synchronizing
```
timedatectl set-ntp true
```
- Autostart `NewworkManager`
```
systemctl enable NetworkManager
```
- Install GRUB to target partition
```
grub-install --target=x86_64-efi --efi-directory=/boot
```
- Generation GRUB configuration file
```
grub-mkconfig -o /boot/grub/grub.cfg
```
- Set the root password
```
passwd
```
- Add a new user
```
useradd -m username
```
- Set new user password
```
passwd username
```
- Add user to groups
```
usermod -aG wheel,audio,video,optical,storage username
```
- Add locale information
```
vim /etc/local.gen uncomment en_US
```
- Run locale generation
```
local-gen
```
- Add locale information
```
vim /etc/locale.conf add LANG=en-US.UTF
```
```
vim /etc/hostname
```
## First boot
- run `visudo`, uncomment `wheel` group to allow new user sudo permission
- enable ZRAM.
- Install `zram-generator` using one of the methods listed above.
- Create a `zram-generator.conf` config file.
```
# /etc/systemd/zram-generator.conf
[zram0]
zram-size = ram / 2
A zram device will be created for each section. No actual configuration is necessary (the default of zram-size = min(ram / 2, 4096) will be used unless overriden), but the configuration file with at least one section must exist.
Mount points
# /etc/systemd/zram-generator.conf
[zram1]
mount-point = /var/tmp
This will set up a /dev/zram1 with ext2 and generate a mount unit for /var/tmp.
```
- Run `systemctl daemon-reload` to create new device units.
- Run `systemctl start /dev/zram0` (adjust the name as appropriate to match the config).
- Call `zramctl` or `swapon` to confirm that the device has been created and is in use.
- enable eriodic TRIM, The `util-linux` package provides `fstrim.service` and `fstrim.timer` systemd unit files. Enabling the timer will activate the service weekly
### 1. `NetworkManager` add new WiFi
- Adding a Wi-Fi Connection
To view the available Wi-Fi access points, issue a command as follows:
```
~]$ nmcli dev wifi list
SSID MODE CHAN RATE SIGNAL BARS SECURITY
FedoraTest Infra 11 54 MB/s 98 ▂▄▆█ WPA1
Red Hat Guest Infra 6 54 MB/s 97 ▂▄▆█ WPA2
Red Hat Infra 6 54 MB/s 77 ▂▄▆_ WPA2 802.1X
* Red Hat Infra 40 54 MB/s 66 ▂▄▆_ WPA2 802.1X
VoIP Infra 1 54 MB/s 32 ▂▄__ WEP
MyCafe Infra 11 54 MB/s 39 ▂▄__ WPA2
```
- To create a Wi-Fi connection profile with static IP configuration, but allowing automatic DNS address assignment, issue a command as follows:
```
~]$ nmcli con add con-name MyCafe ifname wlan0 type wifi ssid MyCafe \
ip4 192.168.100.101/24 gw4 192.168.100.1
```
- To set a WPA2 password, for example “caffeine”, issue commands as follows:
```
~]$ nmcli con modify MyCafe wifi-sec.key-mgmt wpa-psk
~]$ nmcli con modify MyCafe wifi-sec.psk caffeine
```
- To change Wi-Fi state, issue a command in the following format:
```
~]$ nmcli radio wifi [on | off ]
```
#### Changing a Specific Property
- To check a specific property, for example mtu, issue a command as follows:
```
~]$ nmcli connection show id 'MyCafe' | grep mtu
802-11-wireless.mtu: auto
```
- To change the property of a setting, issue a command as follows:
```
~]$ nmcli connection modify id 'MyCafe' 802-11-wireless.mtu 1350
```
- To verify the change, issue a command as follows:
```
~]$ nmcli connection show id 'MyCafe' | grep mtu
802-11-wireless.mtu: 1350
```
Note that NetworkManager refers to parameters such as 802-3-ethernet and 802-11-wireless as the setting, and mtu as a property of the setting. See the nm-settings(5) man page for more information on properties and their settings.
Network: https://docs.fedoraproject.org/en-US/Fedora/25/html/Networking_Guide/sec-Connecting_to_a_Network_Using_nmcli.html
ZRAM: https://github.com/systemd/zram-generator
Periodic TRIM: https://wiki.archlinux.org/title/Solid_state_drive#Periodic_TRIM