2020-01-15 18:05:38 +08:00
|
|
|
|
---
|
|
|
|
|
layout: post
|
|
|
|
|
title: "Manjaro 初始配置"
|
|
|
|
|
subtitle: ""
|
|
|
|
|
description: "这是一篇关于 Manjaro 的初始配置指导,包括镜像源和中文输入法的配置等。"
|
|
|
|
|
excerpt: "本文描述了在安装 Manjaro 后需要进行的基本配置,并指导安装一些常用软件。"
|
|
|
|
|
date: 2020-01-15 16:42:00
|
|
|
|
|
author: "Rick Chan"
|
|
|
|
|
tags: ["System", "Manjaro"]
|
|
|
|
|
categories: ["Software"]
|
|
|
|
|
published: true
|
|
|
|
|
---
|
2019-01-14 15:56:17 +08:00
|
|
|
|
|
2019-07-10 11:17:06 +08:00
|
|
|
|
## 使用国内软件源
|
2019-01-14 15:56:17 +08:00
|
|
|
|
|
2019-07-04 20:25:23 +08:00
|
|
|
|
*注:该操作会修改 /etc/pacman.d/mirrorlist 文件,使用前请先备份。*
|
2019-07-04 12:06:49 +08:00
|
|
|
|
|
|
|
|
|
生成可用中国镜像站列表:
|
|
|
|
|
|
|
|
|
|
```sh
|
2019-07-05 20:20:50 +08:00
|
|
|
|
pacman-mirrors -i -c China -m rank
|
2019-07-04 12:06:49 +08:00
|
|
|
|
```
|
|
|
|
|
|
2019-07-10 11:17:06 +08:00
|
|
|
|
勾选任意软件源,如 <http://mirrors.ustc.edu.cn/manjaro/> ,然后按 OK 键两次。最后刷新缓存:
|
2019-01-14 15:56:17 +08:00
|
|
|
|
|
|
|
|
|
```sh
|
2019-07-05 20:20:50 +08:00
|
|
|
|
pacman -Syy
|
2019-01-14 15:56:17 +08:00
|
|
|
|
```
|
|
|
|
|
|
2019-03-27 22:50:56 +08:00
|
|
|
|
## 使用 AUR 镜像
|
|
|
|
|
|
|
|
|
|
修改 /etc/yaourtrc,去掉 # AURURL 的注释,修改为
|
|
|
|
|
|
2019-07-01 14:50:29 +08:00
|
|
|
|
```sh
|
|
|
|
|
AURURL="https://aur.tuna.tsinghua.edu.cn"
|
|
|
|
|
```
|
2019-03-27 22:50:56 +08:00
|
|
|
|
|
2019-07-04 13:15:39 +08:00
|
|
|
|
## 升级软件包
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
pacman -Syu
|
|
|
|
|
```
|
|
|
|
|
|
2019-01-14 15:56:17 +08:00
|
|
|
|
## 安装和配置网络
|
|
|
|
|
|
|
|
|
|
首先要安装网络工具:
|
|
|
|
|
|
2019-07-01 14:50:29 +08:00
|
|
|
|
```sh
|
|
|
|
|
pacman -S net-tools
|
|
|
|
|
pacman -S networkmanager
|
|
|
|
|
```
|
2019-01-14 15:56:17 +08:00
|
|
|
|
|
|
|
|
|
之后可以通过:
|
|
|
|
|
|
2019-07-01 14:50:29 +08:00
|
|
|
|
```sh
|
|
|
|
|
ifconfig <ethX> up
|
|
|
|
|
```
|
2019-01-14 15:56:17 +08:00
|
|
|
|
|
|
|
|
|
开启网络,通过:
|
|
|
|
|
|
2019-07-01 14:50:29 +08:00
|
|
|
|
```sh
|
|
|
|
|
systemctl start NetworkManager
|
|
|
|
|
```
|
2019-01-14 15:56:17 +08:00
|
|
|
|
|
|
|
|
|
开启网络服务。之后才能正确获取 ip 地址。
|
|
|
|
|
|
|
|
|
|
## 安装和配置声音
|
|
|
|
|
|
|
|
|
|
首先要安装:
|
|
|
|
|
|
2019-07-01 14:50:29 +08:00
|
|
|
|
```sh
|
2019-11-15 10:33:10 +08:00
|
|
|
|
pacman -S alsa-utils alsa-plugins
|
2019-07-01 14:50:29 +08:00
|
|
|
|
pacman -S extra/alsa-firware
|
|
|
|
|
```
|
2019-01-14 15:56:17 +08:00
|
|
|
|
|
|
|
|
|
之后使用 amixer 或 alsamixer 进行配置:
|
|
|
|
|
|
2019-07-01 14:50:29 +08:00
|
|
|
|
```sh
|
|
|
|
|
amixer sset Master unmute
|
|
|
|
|
amixer sset Speaker unmute
|
|
|
|
|
amixer sset Headphone unmute
|
|
|
|
|
alsamixer
|
|
|
|
|
```
|
2019-01-14 15:56:17 +08:00
|
|
|
|
|
|
|
|
|
最后使用:
|
|
|
|
|
|
2019-07-01 14:50:29 +08:00
|
|
|
|
```sh
|
|
|
|
|
speaker-test -c 2
|
|
|
|
|
```
|
2019-01-14 15:56:17 +08:00
|
|
|
|
|
|
|
|
|
对 2 通道声音进行测试。
|
|
|
|
|
|
|
|
|
|
## 安装和配置显卡
|
|
|
|
|
|
2019-07-01 14:50:29 +08:00
|
|
|
|
```sh
|
|
|
|
|
pacman -S intel-media-driver
|
|
|
|
|
```
|
2019-01-14 15:56:17 +08:00
|
|
|
|
|
|
|
|
|
具体可参考:<https://wiki.archlinux.org/index.php/Hardware_video_acceleration>
|
|
|
|
|
|
2019-01-14 22:15:41 +08:00
|
|
|
|
## 切换系统语言
|
|
|
|
|
|
|
|
|
|
编辑 /etc/locale.gen 为:
|
|
|
|
|
|
2019-07-01 14:50:29 +08:00
|
|
|
|
```sh
|
|
|
|
|
en_US.UTF-8 UTF-8
|
|
|
|
|
```
|
2019-01-14 22:15:41 +08:00
|
|
|
|
|
|
|
|
|
和 /etc/locale.conf 为:
|
|
|
|
|
|
2019-07-01 14:50:29 +08:00
|
|
|
|
```sh
|
|
|
|
|
LANG="en_US.UTF-8"
|
|
|
|
|
```
|
2019-01-14 22:15:41 +08:00
|
|
|
|
|
2019-01-14 22:50:35 +08:00
|
|
|
|
最后:
|
|
|
|
|
|
2019-07-01 14:50:29 +08:00
|
|
|
|
```sh
|
|
|
|
|
locale-gen "en_US.UTF-8"
|
|
|
|
|
```
|
2019-01-14 22:50:35 +08:00
|
|
|
|
|
2019-10-31 22:37:52 +08:00
|
|
|
|
## 安装中文字体
|
|
|
|
|
|
|
|
|
|
```sh
|
2019-11-16 11:20:37 +08:00
|
|
|
|
pacman -S ttf-dejavu opendesktop-fonts wqy-microhei wqy-microhei-lite wqy-zenhei wqy-bitmapfont
|
2019-10-31 22:37:52 +08:00
|
|
|
|
yaourt -S ttf-ms-win8-zh_cn ttf-ms-win10-zh_cn
|
|
|
|
|
```
|
|
|
|
|
|
2019-07-04 13:43:59 +08:00
|
|
|
|
## 切换主目录为英文
|
|
|
|
|
|
|
|
|
|
中文系统默认主目录下文件夹名为中文,在 shell 下访问太过费事,最好改为英文。方法是修改 ~/.config/user-dirs.dirs 文件内容如下,之后将各目录修改为对应的英文名,然后重新登陆该账户即可:
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
XDG_DESKTOP_DIR="$HOME/Desktop"
|
|
|
|
|
XDG_DOWNLOAD_DIR="$HOME/Downloads"
|
|
|
|
|
XDG_TEMPLATES_DIR="$HOME/Templates"
|
|
|
|
|
XDG_PUBLICSHARE_DIR="$HOME/Public"
|
|
|
|
|
XDG_DOCUMENTS_DIR="$HOME/Documents"
|
|
|
|
|
XDG_MUSIC_DIR="$HOME/Music"
|
|
|
|
|
XDG_PICTURES_DIR="$HOME/Pictures"
|
|
|
|
|
XDG_VIDEOS_DIR="$HOME/Videos"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
之后:
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
gsettings set org.blueman.transfer shared-path '/home/<user name>/Downloads'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
或通过:
|
|
|
|
|
|
|
|
|
|
```sh
|
2019-07-05 20:20:50 +08:00
|
|
|
|
blueman-services
|
2019-07-04 13:43:59 +08:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
重新配置,否则重启会提示:
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
Configured directory for incoming files does not exist
|
|
|
|
|
```
|
|
|
|
|
|
2019-01-14 15:56:17 +08:00
|
|
|
|
## 安装常用工具
|
|
|
|
|
|
2019-07-01 14:50:29 +08:00
|
|
|
|
```sh
|
2019-07-04 13:34:09 +08:00
|
|
|
|
pacman -S base-devel git gcc make cmake gdb python2 python3 go arm-none-eabi-gcc arm-none-eabi-gdb arm-none-eabi-newlib tmux openssh samba ntfs-3g vim bzip2 coreutils ncurses xz unrar unzip zip aria2
|
2019-07-01 14:50:29 +08:00
|
|
|
|
```
|
2019-01-14 15:56:17 +08:00
|
|
|
|
|
2019-07-04 12:06:49 +08:00
|
|
|
|
另外需要安装 flex、bison、libncurses5-dev 等。
|
|
|
|
|
|
|
|
|
|
### 安装防火墙
|
2019-01-14 15:56:17 +08:00
|
|
|
|
|
2019-07-01 14:50:29 +08:00
|
|
|
|
```sh
|
|
|
|
|
pacman -S firewalld
|
|
|
|
|
```
|
2019-01-14 15:56:17 +08:00
|
|
|
|
|
2019-07-12 06:01:15 +08:00
|
|
|
|
## 安装 Gnome
|
|
|
|
|
|
|
|
|
|
使用下列命令安装 Gnome 并安装 Gnome 配置工具(gnome-tweaks):
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
pacman -S gnome gnome-extra gnome-tweaks chrome-gnome-shell gnome-shell-extensions
|
|
|
|
|
```
|
|
|
|
|
|
2019-07-12 06:05:27 +08:00
|
|
|
|
使用下列命令安装 Flatix 和 Papirus 主题:
|
2019-07-12 06:01:15 +08:00
|
|
|
|
|
|
|
|
|
```sh
|
2019-07-12 06:05:27 +08:00
|
|
|
|
pacman -S flatix-theme flatix-theme-dark papirus-icon-theme papirus-maia-icon-theme
|
2019-07-12 06:01:15 +08:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
之后可在 gnome-tweaks 中更换主题。
|
|
|
|
|
|
|
|
|
|
访问 <https://extensions.gnome.org> 搜索 AlternateTab 扩展,在网页上安装浏览器插件后可在扩展的首页右上角看到开关按钮,点击打开就会自动安装,之后在 gnome-tweaks 可以找到该扩展,使能该扩展实现“仅在当前工作区中切换窗口”的功能。
|
|
|
|
|
|
2019-07-11 16:49:22 +08:00
|
|
|
|
### 安装 fcitx 输入法
|
2019-07-04 12:06:49 +08:00
|
|
|
|
|
|
|
|
|
输入以下命令安装 fcitx-im 默认安装全部软件,并安装 google 拼音输入法:
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
pacman -S fcitx-im fcitx-configtool fcitx-googlepinyin
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
默认会自动运行 fictx 程序,如果该程序没有自动启动,则运行下列命令:
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
cp /etc/xdg/autostart/fcitx-autostart.desktop ~/.config/autostart/
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
添加如下代码到 ~/.xprofile,如果该文件不存在则创建一份。
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
export GTK_IM_MODULE=fcitx
|
|
|
|
|
export QT_IM_MODULE=fcitx
|
|
|
|
|
export XMODIFIERS=@im=fcitx
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
之后运行 fictx 诊断程序,如果诊断错误则按提示进行修正,如果诊断没有发现问题则重启即可。
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
fcitx-diagnose
|
|
|
|
|
```
|
|
|
|
|
|
2020-02-13 14:58:50 +08:00
|
|
|
|
通过 fcitx-configtool 添加输入法。通过 ctrl+space 来切换输入法。
|
2019-01-16 17:00:57 +08:00
|
|
|
|
|
2019-07-11 16:49:22 +08:00
|
|
|
|
### 安装 IBus 输入法
|
|
|
|
|
|
2019-07-12 04:49:27 +08:00
|
|
|
|
输入以下命令安装 ibus。
|
2019-07-11 16:49:22 +08:00
|
|
|
|
|
2019-07-12 04:49:27 +08:00
|
|
|
|
```sh
|
|
|
|
|
pacman -S ibus ibus-libpinyin
|
|
|
|
|
yaourt ibus-qt
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
添加如下代码到 ~/.xprofile,如果该文件不存在则创建一份。
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
export GTK_IM_MODULE=ibus
|
|
|
|
|
export QT_IM_MODULE=ibus
|
|
|
|
|
export XMODIFIERS=@im=ibus
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
如果是 Gnome 桌面,进入 Gnome 设置,选择区域和语言,将输入源配置为“汉语(Intelligent Pinyin)”,并提升为第一个(这个输入法与 Gnome 兼容最好)。点击 Intelligent Pinyin 的设置,将"常规“中”语言初始状态“设置为”英文“;将”快捷键“中“切换中文/英文模式”快捷键设置为“Shift”。
|
2019-07-11 16:49:22 +08:00
|
|
|
|
|
|
|
|
|
*注:如果有多个输入法,可以使用 im-config 工具进行切换。*
|
|
|
|
|
|
2019-07-04 13:15:39 +08:00
|
|
|
|
### 安装 Qt
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
pacman -S qtcreator qt5-base qt5-doc
|
2019-08-02 21:48:21 +08:00
|
|
|
|
# QT 程序使用 gtk 主题,否则非常丑.
|
|
|
|
|
echo "export QT_QPA_PLATFORMTHEME=gtk2" >> ~/.profile
|
2019-07-04 13:15:39 +08:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### 音乐播放
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
pacman -S rhythmbox
|
|
|
|
|
```
|
|
|
|
|
|
2019-01-16 09:51:30 +08:00
|
|
|
|
## VMTools
|
|
|
|
|
|
|
|
|
|
如果 Manjaro 作为 VirtualBox 的 Guest 来运行,则需要安装 VMTools,命令如下:
|
|
|
|
|
|
2019-07-01 14:50:29 +08:00
|
|
|
|
```sh
|
|
|
|
|
pacman -S virtualbox-guest-utils
|
|
|
|
|
```
|
2019-01-16 09:51:30 +08:00
|
|
|
|
|
|
|
|
|
一定不要使用 VM 的菜单来安装工具。
|
|
|
|
|
|
2019-01-14 15:56:17 +08:00
|
|
|
|
## 提升权限
|
|
|
|
|
|
|
|
|
|
普通用户可能无法访问某些设备,需要提升权限:
|
|
|
|
|
|
2019-07-01 14:50:29 +08:00
|
|
|
|
```sh
|
|
|
|
|
gpasswd --add <user name> dialout
|
|
|
|
|
groups <user name>
|
|
|
|
|
```
|
2019-07-31 18:16:26 +08:00
|
|
|
|
|
|
|
|
|
## 配置 Bash
|
|
|
|
|
|
|
|
|
|
在 ~/.bash_profile 中增加
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
alias ls='ls --color=auto'
|
|
|
|
|
alias dir='dir --color=auto'
|
|
|
|
|
alias vidr='vdir --color=auto'
|
|
|
|
|
alias grep='grep --color=auto'
|
|
|
|
|
alias fgrep='fgrep --color=auto'
|
|
|
|
|
alias egrep='egrep --color=auto'
|
|
|
|
|
# some more ls aliases
|
|
|
|
|
alias ll='ls -alF'
|
|
|
|
|
alias la='ls -A'
|
|
|
|
|
alias l='ls -CF'
|
|
|
|
|
```
|
2020-05-09 14:09:07 +08:00
|
|
|
|
|
|
|
|
|
## 安装 WPS Office
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
yaourt -S wps-office-cn
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
如果校验失败,则到“/tmp/yaourt-tmp-\<user name\>/aur-wps-office-cn/“目录下对 deb 包重新校验:
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
sha1sum <wps-office>.deb
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
然后重新安装 wps-office-cn 并修改 PKGBUILD 文件中的 sha1sums 值为以上实际得到的校验值。
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
==> 编辑 PKGBUILD ? [Y/n] ("A" 忽略)
|
|
|
|
|
==> ----------------------------
|
|
|
|
|
==> Y
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
保存 PKGBUILD 退出并继续安装。
|
|
|
|
|
|
|
|
|
|
安装 Symbol fonts 否则启动 WPS 时会有警告提示:
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
yaourt -S ttf-wps-fonts
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
可选择安装以下字体:
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
yaourt -S wps-office-fonts
|
|
|
|
|
```
|