装Arch记
Table of Contents
1 安装arch
安装arch很简单,基本上按照arch wiki上写的一步步来就行了。
我主要参考了两个链接: Arch Linux 安装指南
不过在过程中还是遇到了一个小坑:
按照Wiki的说法, arch-chroot
之后需要再次设置网络,但是我用wifi-menu重设了一次无线网络后,结果提示
Interface 'wlp4s2' is controlled by netctl-auto
然后尝试ping外网发现网络是断的。推出chroot后用 ip link
发现wlp4s2接口被down掉了.
在up该接口后,回复互联网的访问. 然后重新进入 arch-chroot
继续后面的操作.
ip link set wlp4s2 up
2 配置网络
用
wifi-menu
配置好wifiwifi-menu -o
安装自动连接wifi的软件包
pacman --noconfirm -S --needed wpa_actiond ifplugd wpa_supplicant
其中:
- wpa_actiond
- 用于自动连接无线网络(Wireless Roaming/autoconnect )
- ifplugd
- 用于自动连接以太网(Wired link detection )。
- wpa_supplicant
- 用于无线网络认证
关闭netctl服务,启动netctl-auto服务
systemctl disable netctl systemctl enable netctl-auto@wlp4s2
不能同时启动netctl与netctl-auto,两者冲突
3 配置用户
创建用户
useradd -m -g users -s /bin/bash lujun9972 # passwd lujun9972
配置sudo
visudo
让wheel组的用户能够suduo
将用户加入wheel组
usermod -a -G wheel lujun9972
4 添加Archlinux CN 镜像源
cat >>/etc/pacman.conf <<EOF [archlinuxcn] SigLevel = Optional TrustedOnly Server = https://mirrors.ustc.edu.cn/archlinuxcn/\$arch EOF pacman -Syy pacman --noconfirm -S archlinuxcn-keyring
5 AUR
安装yaourt
pacman --noconfirm -S yaourt
6 配置中文输入法
安装fictx
pacman --noconfirm -S fcitx-im fcitx-configtool fcitx-sunpinyin
在.xinitrc中添加:
export GTK_IM_MODULE=fcitx export QT_IM_MODULE=fcitx export XMODIFIERS="@im=fcitx" fcitx &
7 Git
安装git
pacman --noconfirm -S git
配置git
git config --global --global user.email "lujun9972@gmail.com" git config --global --global user.name "darksun" git config --global core.quotepath false # 配置diff工具 git config --global diff.tool ediff git config --global difftool.ediff.cmd "~/bin/ediff.sh \"\$LOCAL\" \"\$REMOTE\"" git config --global difftool.prompt false # 配置merge工具 git config --global merge.tool ediff git config --global mergetool.ediff.cmd "~/bin/ediff_merge.sh \"$BASE\" \"\$LOCAL\" \"\$REMOTE\" \"$MERGED\"" git config --global mergetool.prompt false # git config --global mergetool.ediff.trustExitCode true
8 pandoc
安装pandoc
pacman --noconfirm -S pandoc
9 openssh
安装openssh
pacman --noconfirm -S git
自动启动sshd服务
systemctl enable sshd.service
生成公钥
ssh-keygen -y cat .ssh/id_rsa.pub
- 将公钥内容放到 github 中
10 Emacs
安装Emacs
pacman --noconfirm -S emacs
安装配置
git clone git@github.com:lujun9972/bin.git ~/bin git clone git@github.com:lujun9972/MyLisp.git ~/MyLisp git clone git@github.com:lujun9972/.spacemacs.d.git ~/.spacemacs.d mv ~/.emacs.d ~/emacs.d.bak git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d
spacemacs的python layer需要安装virtualenvwrapper
pacman --noconfirm -S python-virtualenvwrapper
11 ShadowSocks
11.1 安装
pacman --noconfirm -S shadowsocks pacman --noconfirm -S shadowsocks-qt5
12 窗口管理器
安装X
pacman -S xorg xorg-server xorg-server-utils xorg-xinit # 安装 Xorg # pacman -S xf86-input-synaptics # 可选,触摸板支持 pacman -S ttf-dejavu wqy-microhei # 可选,Dejavu 与文泉驿 - 微米黑字体
安装awesomeWm
pacman --noconfirm -S awesome
在.xinitrc中添加:
exec awesome
安装archlinux-xdg-menu
pacman --noconfirm -S archlinux-xdg-menu
生成awesome menu
mkdir -p ~/.config/awesome/ xdg_menu --format awesome --root-menu /etc/xdg/menus/arch-applications.menu >~/.config/awesome/archmenu.lua
13 声音配置
Arch Linux默认开启了声音支持,默认静音。用户可通过 alsamixer(所属包:alsa-utils) 取消静音:
pacman --noconfirm -S alsa-utils
- 方向键 选中 Master 和 PCM
- [M] 取消静音
- 上下键调整音量
14 Terminator(可选,用eshell代替)
terminator
pacman --noconfirm -S terminator
15 文件管理器(可选,用dired代替)
rox
pacman --noconfirm -S rox
16 多媒体
16.1 看图工具
feh
pacman --noconfirm -S feh
sxiv
pacman --noconfirm -S sxiv
16.2 看视频
mpv
pacman --noconfirm -S mpv
17 坚果云
pacman --noconfirm -S nutstore
18 zeal
pacman --noconfirm -S zeal
19 wps
pacman --noconfirm -S wps-office ttf-wps-fonts
20 终端环境下的工具
20.1 配置中文环境
fbterm支持终端环境中文处理
# pacman --noconfirm -S fbterm libx86 # 若想使用非根用户运行fbterm,需要把用户加入video组 # 在最近的更新中fbterm已经不在pacman的package中了,需要用 yaourt -S fbterm libx86 # 来安装 gpasswd -a $YOUR_USERNAME video # 若想非根用户可使用键盘快捷方式,需要: sudo setcap 'cap_sys_tty_config+ep' /usr/bin/fbterm
fbterm本身还支持多窗口:
快捷键 功能说明 C-M-E 退出fbterm C-M-C 创建新窗口 C-M-数字 切换到第N个窗口 S-方向键 切换到上/下一个窗口 使用fcitx-fbterm作为中文输入法
# pacman --noconfirm -S fcitx-fbterm # 在最近的更新中fcitx-fbterm已经不在pacman的package中了,需要从github上下载源代码来编译
安装好后,可以通过
fcitx-fbterm-helper -l
启动中文输入法安装framebuffer下的虚拟X server
pacman --noconfirm -S xorg-server-xvfb xf86-video-fbdev
framebuffer设置工具
pacman --noconfirm -S fbset
20.2 媒体播放
20.2.1 mpg123
pacman --noconfirm -S mpg123
20.2.2 moc
pacman --noconfirm -S moc
20.2.3 mplayer
安装mplayer
pacman --noconfirm -S mplayer
mplayer支持在终端环境下播放影片,但是需要指明输出驱动:
mplayer -vo fbdev2 $MEDIA_FILE
mplayer在播放时支持以下快捷键:
- 左方向键和右方向键
- 分别执行倒退 10 秒和快进 10 秒操作
- 下方向键和上方向键
- 分别执行倒退 1 分钟和快进 1 分钟操作
- 下翻页键和上翻页键
- 分别执行倒退 10 分钟和快进 10 分钟操作
- f
- 当播放视频时,在全屏和窗口模式之间切换。你也可以在命令行中使用 -fs 选项,以便让 MPlayer 开始在全屏模式中播放。
- o
- 在播放视频时切换 OSD(OnScreen Display)模式。
- p 或 Space
- 暂停/继续播放。
- q 或 Esc
- 退出 MPlayer。在 GUI 模式时,Esc 不会退出,仅停止播放。
- / 和 * 或 9 和 0
- 减小或增大音量。
- m
- 静音切换。
- T(通常是 Shift + t)
- 播放窗口置顶切换。
- b 和 j
- 在可用的字幕间循环。
- x 和 z
- 调整字幕的延迟时间。
- I(Shift + i)
- 显示播放电影的文件名称。
- 1 和 2
- 调整对比度。
- 3 和 4
- 调整亮度。
- 5 和 6
- 调整色度。
- 7 和 8
- 调整饱和度
更多的mplayer操作参见 玩转 MPlayer
20.2.4 musicbox
高品质网易云音乐命令行版本,简洁优雅,丝般顺滑,基于Python编写。
pacman -S --noconfirm netease-musicbox-git
J | Down | 下移 |
K | Up | 上移 |
H | Back | 后退 |
L | Forword | 前进 |
U | Prev page | 上一页 |
D | Next page | 下一页 |
F | Search | 快速搜索 |
[ | Prev song | 上一曲 |
] | Next song | 下一曲 |
= | Volume + | 音量增加 |
- | Volume - | 音量减少 |
Space | Play/Pause | 播放/暂停 |
? | Shuffle | 手气不错 |
M | Menu | 主菜单 |
P | Present/History | 当前/历史播放列表 |
I | Music Info | 当前音乐信息 |
⇧+P | Playing Mode | 播放模式切换 |
A | Add | 添加曲目到打碟 |
⇧+A | Enter album | 进入专辑 |
G | To the first | 跳至首项 |
⇧+G | To the end | 跳至尾项 |
Z | DJ list | 打碟列表 |
S | Star | 添加到收藏 |
C | Collection | 收藏列表 |
R | Remove | 删除当前条目 |
⇧+J | Move Down | 向下移动当前项目 |
⇧+K | Move Up | 向上移动当前项目 |
⇧+C | Cache | 缓存歌曲到本地 |
, | Like | 喜爱 |
. | Trash FM | 删除 FM |
Q | Quit | 退出 |
W | Quit&Clear | 退出并清除用户信息 |
20.2.5 Emacs+EMMS+wangyi-music
20.2.6 cmus
pacman --noconfirm -S moc
20.3 w3m浏览网页
pacman --noconfirm -S w3m imlib2
20.4 ledger基于终端的帐务管理软件
yaourt --noconfirm -S ledger
20.5 下载
rtorrent
pacman --noconfirm -S rtorrent
aria2
pacman --noconfirm -S aria2 aria2-fast
20.6 日历系统
calcurse
pacman --noconfirm -S calcurse
关于calcurse的用法,推荐阅读 在 Linux 终端下使用 calcurse 安排约会和待办事项
remind+wyrd
pacman --noconfirm -S remind wyrd
- Emacs+Org+diary
20.7 RSS & podcaster
newsbeuter
pacman --noconfirm -S newsbeuter
关于newsbeuter的用法可以参见Newsbeuter:在控制台下读 RSS 新闻
- Emacs+elfeed+podcaster
20.8 查看PDF,图片:fbida
安装
pacman --noconfirm -S fbida
- 用法
- 使用fbi查看图片
- 使用fbpdf查看pdf
20.9 截图工具:fbgrab
安装
pacman --noconfirm -S fbgrab
用法 fbgrab会抓取frambuffer device中的屏幕内容并转存为png文件. 它的使用方法也很简单:
fbgrab [options] filename
其中常见的选项有:
- -s n
- 等待n秒后再开始抓图
- -b bitdepth
- 指定抓取像素的色彩位数
- -h height
- 指定抓取的高度,以像素为单位.
- -w width
- 指定抓取的宽度,以像素为单位.
- -z
- 设定png文件的压缩等级,从0(最快)到9(压缩效果最好)
20.10 IM工具
finch
这个可以看成是pidgin的CLI版
pacman --noconfirm -S finch
20.11 游戏
nethack
pacman --noconfirm -S nethack
20.12 讲稿演示
yaourt --noconfirm -S tpp
20.13 有趣的工具
pv
pv可以以实时敲打出来的方式显示一段文字
pacman --noconfirm -S pv
toilet
toilet可以为一段文字添加边框
pacman --noconfirm -S toilet
21 恢复配置
我用Emacs的org-mode来管理dotfile.
所有的dotfile基本都以src block的形式存在https://github.com/lujun9972/dotfile/blob/master/dotfile.org 中了
只需要执行下面这段emacs-lisp代码就能恢复配置了
(require 'url-handlers) (let ((tmpfile (make-temp-name "/tmp/dotfile"))) (url-copy-file "https://raw.githubusercontent.com/lujun9972/dotfile/master/dotfile.org" tmpfile) (find-file tmpfile) (org-mode) (call-interactively #'org-babel-tangle) (delete-file tmpfile))