Skip to content

Commit f31f5c0

Browse files
committed
initial commit
0 parents  commit f31f5c0

23 files changed

+37771
-0
lines changed

.editorconfig

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.py]
13+
indent_size = 4
14+
15+
[Makefile]
16+
indent_style = tab

.gitignore

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Editor directories and files
2+
.idea
3+
.project
4+
.classpath
5+
.c9/
6+
*.launch
7+
.settings/
8+
*.sublime-workspace
9+
*.suo
10+
*.ntvs*
11+
*.njsproj
12+
*.sln
13+
*.sw?
14+
15+
# IDE - VSCode
16+
.vscode/*
17+
!.vscode/settings.json
18+
!.vscode/tasks.json
19+
!.vscode/launch.json
20+
!.vscode/extensions.json
21+
22+
# System Files
23+
.directory
24+
.DS_Store
25+
Thumbs.db
26+
27+
# Logs
28+
logs
29+
*.log
30+
npm-debug.log*
31+
yarn-debug.log*
32+
yarn-error.log*
33+
lerna-debug.log*
34+
35+
.cache
36+
dist
37+
node_modules
38+
public
39+
*.rar
40+
*.zip
41+
*.7z
42+
*.local

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx lint-staged

.prettierignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.cache
2+
dist
3+
node_modules
4+
public

.prettierrc

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"printWidth": 100,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": true,
7+
"quoteProps": "as-needed",
8+
"jsxSingleQuote": false,
9+
"trailingComma": "all",
10+
"bracketSpacing": true,
11+
"bracketSameLine": false,
12+
"arrowParens": "always",
13+
"vueIndentScriptAndStyle": false,
14+
"endOfLine": "lf"
15+
}

LICENSE.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 GHLandy
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# GHLandy andy gatsby blog
2+
3+
> Write something.

content/blog/my-arch-linux/index.md

+234
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
---
2+
title: 我的 Arch Linux
3+
date: '2021-12-03T10:20:30.843Z'
4+
description:
5+
都说好记性,不如烂笔头。<br /> 本文记录一下 Arch Linux 的基本安装步骤以及一些配置啥儿的,
6+
以备不时之需。
7+
---
8+
9+
## 1、准备新分区
10+
11+
> `UEFI + GPT` 分区方案 <br />
12+
> 384M 的 ESP 分区 `/boot` 分区类型为 ef00 <br />
13+
> LVM on LUKS (剩余的是全部分给 LVM) 分区类型为 8e00 <br />
14+
> 32G 根分区 / <br />
15+
> 16G 交换分区 swap <br />
16+
> 剩余的全部给 /home 分区
17+
18+
```bash
19+
gdisk /dev/sda
20+
21+
mkfs.fat -F 32 /dev/sda1
22+
fatlabel /dev/sda1 ESP
23+
24+
cryptsetup luksFormat /dev/sda2
25+
cryptsetup open /dev/sda2 archlvm # archlvm 可随意,使用时保持一致即可
26+
27+
pvcreate /dev/mapper/archlvm
28+
vgcreate ArchGroup /dev/mapper/archlvm # ArchGroup 可随意,使用时保持一致即可
29+
lvcreate -L 30G ArchGroup -n root
30+
lvcreate -L 16G ArchGroup -n swap
31+
lvcreate -l 100%FREE ArchGroup -n home
32+
33+
# `-L ROOR`、`-L HOME`、`-L SWAP` 标卷名可随意
34+
mkfs.ext4 -L ROOT /dev/mapper/ArchGroup-root
35+
mkfs.ext4 -L HOME /dev/mapper/ArchGroup-home
36+
mkswap -L SWAP /dev/mapper/ArchGroup-swap
37+
38+
mount /dev/mapper/ArchGroup-root /mnt
39+
mkdir /mnt/home /mnt/boot
40+
41+
mount dev/mapper/ArchGroup-home /mnt/home
42+
mount /dev/sda1 /mnt/boot
43+
swapon /dev/mapper/ArchGroup-swap
44+
```
45+
46+
## 2、选择镜像源
47+
48+
> 通过 reflector 选择中国镜像源
49+
50+
```bash
51+
reflector -c CN --save /etc/pacman.d/mirrorlist
52+
```
53+
54+
## 3、安装系统
55+
56+
查看一下电脑中的显卡类型,这里有 intel, Nvidia 两个
57+
58+
```
59+
[root@arch ~]# lspci -v | grep -A1 -e VGA -e 3D
60+
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 620 (rev 07) (prog-if 00 [VGA controller])
61+
Subsystem: Xiaomi Device 1701
62+
--
63+
01:00.0 3D controller: NVIDIA Corporation GP108M [GeForce MX150] (rev a1)
64+
Subsystem: Xiaomi Mi Notebook Pro [GeForce MX150]
65+
```
66+
67+
安装基础系统和需要的包
68+
69+
```bash
70+
pacstrap -i /mnt \
71+
base base-devel linux linux-firmware bash-completion grub dosfstools efibootmgr lvm2 \
72+
bluez-utils pulseaudio-bluetooth xdg-user-dir vim git curl openssh \
73+
xf86-video-intel xf86-video-nouveau xf86-input-libinput \
74+
plasma konsole dolphin ark kate okular gwenview networkmanager exfat-utils ntfs-3g \
75+
fcitx fcitx-im fcitx-configtool \
76+
ttf-dejavu ttf-liberation \
77+
adobe-source-code-pro-fonts \
78+
adobe-source-sans-pro-fonts \
79+
adobe-source-serif-pro-fonts \
80+
adobe-source-han-sans-cn-fonts \
81+
adobe-source-han-sans-otc-fonts \
82+
adobe-source-han-sans-tw-fonts \
83+
adobe-source-han-serif-cn-fonts \
84+
adobe-source-han-serif-otc-fonts \
85+
adobe-source-han-serif-tw-fonts
86+
```
87+
88+
## 4、生成 fstab 文件
89+
90+
```bash
91+
genfstab -U -p /mnt >> /mnt/etc/fstab
92+
```
93+
94+
## 5、配置系统
95+
96+
首先,进入 chroot 环境
97+
98+
```bash
99+
arch-chroot /mnt
100+
```
101+
102+
### a. locale (语言设置)
103+
104+
编辑 /etc/locale.gen
105+
106+
```bash
107+
vim /etc/locale.gen
108+
109+
# 去注释掉这两行
110+
en_US.UTF-8 UTF-8
111+
zh_CN.UTF-8 UTF-8
112+
113+
# 重新生成 Locale
114+
locale-gen
115+
116+
export LANG=en_US.UTF-8
117+
118+
# 设置可输入中文的英文环境
119+
echo LANG=en_US.UTF-8 > /etc/locale.conf
120+
echo LC_CTYPE=zh_CN.UTF-8 >> /etc/locale.conf
121+
```
122+
123+
> 此处是需要设置一个可以输入中文的英文环境 <br />
124+
> 关于 `locale` 的设置可以参考 [locale 的设定及 LANG、LC_CTYPE、LC_ALL 环境变量](https://www.cnblogs.com/xlmeng1988/archive/2013/01/16/locale.html)
125+
126+
### b. timezone (时区设置)
127+
128+
```bash
129+
# 如果已经存在 /etc/localtime,创建链接会报错,先删除即可
130+
rm /etc/localtime
131+
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
132+
```
133+
134+
### c. hostname (主机名设置)
135+
136+
```bash
137+
echo arch > /etc/hostname # arch 可随意,设置喜欢的名字即可
138+
```
139+
140+
### d. network (使用 `networkmanager` 管理网络连接)
141+
142+
```bash
143+
systemctl enable NetworkManager
144+
```
145+
146+
### e. 用户 (设置 `root` 密码和添加普通用户)
147+
148+
```bash
149+
passwd root # 设置 root 密码
150+
useradd -mG wheel ghlandy # 添加 ghlandy 用户,并将其加入 wheel 组
151+
passwd ghlandy
152+
```
153+
154+
### f. grub
155+
156+
mkinitcpio.conf
157+
158+
```bash
159+
# 编辑 /etc/mkinitcpio.conf
160+
vim /etc/mkinitcpio.conf
161+
162+
# 添加 keyboard keymap encrypt lvm2
163+
HOOKS=(base udev autodetect keyboard keymap consolefont modconf block encrypt lvm2 filesystems fsck)
164+
165+
mkinitcpio -P
166+
```
167+
168+
```bash
169+
# 编辑 /etc/default/grub
170+
vim /etc/default/grub
171+
172+
# 查看加密分区的 UUID
173+
blkid
174+
175+
# 添加并替换 device-UUID
176+
GRUB_CMDLINE_LINUX="cryptdevice=UUID=device-UUID:archlvm root=/dev/ArchGroup/root"
177+
```
178+
179+
grub 安装及启动菜单
180+
181+
```bash
182+
grub-install --target=x86_64-efi --efi-directory=/boot \
183+
--bootloader-id="Arch Linux Grub Bootloader" --recheck --debug
184+
185+
# 下载 grub 主题
186+
git clone https://github.com/gustawho/grub2-theme-breeze.git
187+
cp -r grub2-theme-breeze/breeze /boot/grub/themes
188+
vim /etc/default/grub
189+
# 设置 grub 主题
190+
GRUB_THEME="/boot/grub/themes/breeze/theme.txt"
191+
192+
# 生成 grub 启动菜单
193+
grub-mkconfig -o /boot/grub/grub.cfg
194+
```
195+
196+
`--efi-directory` 指向 EFI 分区挂载的位置,前面我们挂载到 `/boot``--bootloader-id` 是在进入 `BIOS`
197+
时显示的名称,这里设置为 `Arch Linux Grub Bootloader`
198+
199+
### g. 设置输入法 (fcitx)
200+
201+
比如我们待会儿用 `ghlandy` 用户登录到桌面环境,则需要在该用户家目录下建立 `.pam_environment`,并输入一下内容:
202+
203+
```bash
204+
touch /home/ghlandy/.pam_environment
205+
chown ghlandy:ghlandy /home/ghlandy/.pam_environment
206+
vim /home/ghlandy/.pam_environment
207+
208+
GTK_IM_MODULE=fcitx
209+
QT_IM_MODULE=fcitx
210+
XMODIFIERS=@im=fictx
211+
```
212+
213+
### h. 桌面环境 Plasma
214+
215+
```bash
216+
# 启用 sddm breeze 主题
217+
cp -r /usr/lib/sddm/sddm.conf.d /etc
218+
vim /etc/sddm.conf.d/default.conf
219+
220+
[Theme]
221+
Current=breeze
222+
223+
# 开机启动 sddm
224+
systemctl enbale sddm
225+
```
226+
227+
## 7、重启
228+
229+
退出 chroot 并重启
230+
231+
```bash
232+
exit
233+
reboot
234+
```

gatsby-browser.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// custom typefaces
2+
import 'typeface-montserrat';
3+
import 'typeface-merriweather';
4+
// normalize CSS across browsers
5+
import './src/normalize.css';
6+
// custom CSS styles
7+
import './src/style.css';
8+
9+
// Highlighting for code blocks
10+
import 'prismjs/themes/prism.css';

0 commit comments

Comments
 (0)