Manjaro Linux安装与配置

安装

制作U盘启动盘

使用etcher将ISO文件写入U盘中。

设置U盘启动

开机后按F10进入BIOS(F9修改启动顺序,F12是Windows的修复工具)

提示:不要启用安全启动检查,那是为Windows10设置,否则无法启动Linux系统。

设置

startup

图片来自(https://cloud.tencent.com/developer/article/1390999)

将driver调整为non-free,tz调整为Asia/Shanghai

然后boot进入安装环境。

安装中

ui

之前安装时,会因为英伟达显卡的问题无法安装,连这个界面都看不见。要么卡在命令行界面,要么黑屏卡死等等。同时,惠普好像屏蔽了核心显卡。而且惠普BIOS中没有关闭独立显卡的设置。

设置磁盘分区

disk

清空磁盘,主要清理之前的Windows系统,并且设置和内存同样大小的交换内存。

然后就是安装

installing

安装完成后,拔出U盘,并且将启动顺序改回来。

screenfetch

设置

设置华为源

1
sudo pacman-mirrors -i -c China -m rank #按照速度更新镜像,然后排名

华为源的速度平均2M/s。绝对杠杠滴。

设置清华源archlinuxcn

文件位置:/etc/pacman.conf

1
2
3
[archlinuxcn]
SigLevel = Optional TrustAll
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch

设置下载器加速

yaourt主仓库加速

/etc/pacman.conf

1
2
3
4
#XferCommand = /usr/bin/wget –passive-ftp -c -O %o %u

XferCommand = /usr/bin/axel -o %o %u
XferCommand = /usr/bin/axel -n 16 %u -o %o

pacman.conf以#为注释

yaourt第三方仓库加速

/etc/makepkg.conf

使用curl
1
2
3
4
5
6
DLAGENTS=('file::/usr/bin/curl -gqC - -o %o %u'
'ftp::/usr/bin/curl -gqfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
'http::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
'https::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
'rsync::/usr/bin/rsync --no-motd -z %u %o'
'scp::/usr/bin/scp -C %u %o')
使用wget
1
2
3
4
5
DLAGENTS=('ftp::/usr/bin/wget -c --passive-ftp -t 3 --waitretry=3 -O %o %u'
'http::/usr/bin/wget -c -t 3 --waitretry=3 -O %o %u'
'https::/usr/bin/wget -c -t 3 --waitretry=3 --no-check-certificate -O %o %u'
'rsync::/usr/bin/rsync -z %u %o'
'scp::/usr/bin/scp -C %u %o')
使用aria2c多线程下载
1
2
3
4
5
6
7
8
9
DLAGENTS=('ftp::/usr/bin/aria2c -s5 %u -o %o'
'http::/usr/bin/aria2c -s5 %u -o %o'
'https::/usr/bin/aria2c -s5 %u -o %o'
'rsync::/usr/bin/rsync -z %u %o'
'scp::/usr/bin/scp -C %u %o')

#'ftp::/usr/bin/aria2c -c --ftp-pasv=true -m3 -s10 -j10 --follow-torrent=false -o %o %u >&2'
#'http::/usr/bin/aria2c -c --ftp-pasv=true -m3 -s10 -j10 --follow-torrent=false -o %o %u >&2'
#'https::/usr/bin/aria2c -c -m3 -s10 -j10 --check-certificate=false --follow-torrent=false -o %o %u >&2'
axel单线程多链接
1
2
3
4
5
6
DLAGENTS=('file::/usr/bin/axel -n 16 %u -o %o'
'ftp::/usr/bin/axel -n 16 %u -o %o'
'http::/usr/bin/axel -n 16 %u -o %o'
'https::/usr/bin/axel -n 16 %u -o %o'
'rsync::/usr/bin/rsync --no-motd -z %u %o'
'scp::/usr/bin/scp -C %u %o')

根据自己喜好选择。

个性化系统

其实就是安装删除一些软件

首先就是yaourt(取代pacman)

1
2
sudo pacman -S yaourt archlinuxcn-keyring
yaourt -Syyu

把32位软件,和一些不需要的删除

1
2
3
4
5
6
7
8
9
10
sudo pacman -Rs ufw gufw lib32-bzip2 lib32-libelf lib32-mesa lib32-libva-mesa-driver \
lib32-libglvnd lib32-libva-vdpau-driver lib32-libva lib32-glu lib32-glew \
lib32-libva-intel-driver lib32-mesa-demos lib32-alsa-lib lib32-alsa-plugins \
ttf-liberation ttf-indic-otf ttf-inconsolata ttf-droid ttf-dejavu nano \
lib32-zstd lib32-zlib lib32-nss flatpak pamac-flatpak-plugin lib32-glibc \
lib32-libxau lib32-libxdmcp lib32-libgpg-error lib32-libxcb lib32-libx11 \
lib32-libxext lib32-libxss thunderbird steam-manjaro lib32-gcc-libs \
lib32-nvidia-390xx-utils mousepad hexchat pidgin audacious yelp \
hplip manjaro-printer android-udev android-tools manjaro-hello \
vi

安装一些软件

1
2
3
4
5
6
7
yaourt -S boost boost-libs google-glog cmake git qt5 qt6 mlocate vim gedit \
filezilla ctags noto-fonts-cjk wget axel aria2 noto-fonts-emoji \
flameshot gdb ccache visual-studio-code-bin netease-cloud-music \

wget https://www.jianguoyun.com/static/exe/installer/nutstore_linux_dist_x64.tar.gz -O /tmp/nutstore_bin.tar.gz
mkdir -p ~/.nutstore/dist && tar zxf /tmp/nutstore_bin.tar.gz -C ~/.nutstore/dist
~/.nutstore/dist/bin/install_core.sh

然后更新系统。

设置shell

相比于bash,我更喜欢zsh。

先下载zsh和插件:

1
2
3
4
yaourt -S zsh
git clone https://github.com/ohmyzsh/ohmyzsh.git .oh-my-zsh #oh-my-zsh官方库,目标位置为用户目录下的.oh-my-zsh文件夹
git clone https://github.com/zsh-users/zsh-autosuggestions.git .oh-my-zsh/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git .oh-my-zsh/plugins/zsh-syntax-highlighting

用zsh替代默认的bash

1
2
chsh -s /bin/zsh #修改普通用户的shell
sudo chsh -s /bin/zsh #修改root用户的shell

启用zsh后,需要个性化设置文件~/.zshrc

这是我的

1
2
3
4
5
6
7
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
# If you come from bash you might have to change your $PATH.

# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
export PKG_CONFIG_PATH=/opt/intel/mediasdk/lib/pkgconfig:/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/etc/pkgconfig:/usr/share/pkgconfig:$PKG_CONFIG_PATH
export PATH=/opt/cuda/bin:/usr/local/bin:$HOME/Applications/scitools/bin/linux64:/home/jackey/.local/share/gem/ruby/3.0.0/bin:$PATH
export LD_LIBRARY_PATH=/opt/cuda/lib64:/usr/local/lib:/usr/lib:$HOME/Applications/scitools/bin/linux64:$LD_LIBRARY_PATH
export LD_INCLUDE_PATH=/opt/cuda/include:/usr/local/include:/usr/include/freetype2:/usr/include:/usr/include/tirpc:$LD_INCLUDE_PATH

# export DISTRO="arch":$DISTRO

# NPM configuration
export ELECTRON_MIRROR='https://npm.taobao.org/mirrors/electron/'
export SASS_BINARY_SITE='https://npm.taobao.org/mirrors/node-sass'

export PATH=/opt/scitools/bin/linux64:/usr/local/bin:$PATH
export GOPATH=~/torsniff/vendor:~/go:$GOPATH
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
# zhs的主题
ZSH_THEME="ys"

# Set list of themes to load
# Setting this variable when ZSH_THEME=random
# cause zsh load theme from this variable instead of
# looking in ~/.oh-my-zsh/themes/
# An empty array have no effect
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"

# Uncomment the following line to disable bi-weekly auto-update checks.
DISABLE_AUTO_UPDATE="true"

# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=7

# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
HIST_STAMPS="yyyy-mm-dd"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.

# z命令快速跳转目录 x命令解压一切文件 命令行可以直接google
plugins=(
git z zsh-autosuggestions extract web-search zsh-syntax-highlighting
)

source $ZSH/oh-my-zsh.sh

# User configuration
export MANPATH="/usr/local/man:$MANPATH"

# You may need to manually set your language environment
export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
export EDITOR='vim'

# Compilation flags
export ARCHFLAGS="-arch x86_64"

# ssh
export SSH_KEY_PATH="~/.ssh/rsa_id"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
#

export LS_OPTIONS='--color=auto'

alias cp="cp -i" # confirm before overwriting something
alias df='df -h' # human-readable sizes
alias free='free -m' # show sizes in MB
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'
alias more=less

xhost +local:root > /dev/null 2>&1

# export QT_SELECT=4

搜狗输入法

不论哪个Linux发行版的搜狗输入法都是基于fcitx。

1
yaourt -S fcitx

在用户目录中的.profile中添加

1
2
3
4
5
6
7
export XDG_RUNTIME_DIR=/tmp/runtime-jackey
# fcitx sogou
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx

fcitx &

安装完成后无法使用

总是显示搜狗输入法异常!请删除.config/SogouPY 并重启

重启完成后还是一样出现。安装fcitx-qimpanel后也没有用。

按照网上的教程输入sogou-qimpanel后显示:

1
sogou-qimpanel: error while loading shared libraries: libfcitx-qt.so.0: cannot open shared object file: No such file or directory

使用locate搜索文件发现没有此文件。

解决方法:

1
yaourt -S fcitx-lilydijwg-git

fcitx-qt

此软件rg和fcitx之前按照的软件包有冲突以此软件包为准就可以了。

搜狗输入法出现两个界面

1
yaourt -Rs fcitx-qimpanel

不同桌面环境

在下载的时候一般是有一个默认的桌面环境,如果需要自己修改。

我一般是下载XFCE桌面,然后安装Deepin的桌面(主要是直接下载Deepin桌面无法安装)。

Gnome桌面环境

安装

1
sudo pacman -S gnome

删除

1
sudo pacman -Rs gnome

提示:

purge

看样子需要解决依赖关系,因为系统自带桌面是xfce,后来有安装了deepin和cinnamon桌面。

只能挨个删除:

1
2
3
4
sudo pacman -Rs gnome-shell-extensions
sudo pacman -Rs gdm
sudo pacman -Rs gnome-shell
sudo pacman -Rs gnome-calendar

done

1
sudo pacman -Rs gnome-software gnome-boxes baobab gnome-control-center eog gnome-contacts cheese epiphany sushi gnome-document gnome-calculator gnome-characters caja gnome-todo totem gnome-terminal gnome-photos evince

清理缓存

1
yaourt -Sc #(此操作会清空已安装和已下载的所有软件包)

cinnamon桌面环境

安装

1
sudo pacman -S cinnamon

删除

cinnamon

lxde桌面环境

安装

1
sudo pacman -S lxde

mate桌面环境

安装

1
sudo pacman -S mate

删除

1
sudo pacman -Rs mate

系统无法正常启动

系统启动后停留在代码界面,但是可以听到deepin桌面环境启动成功的音乐。

在加入tty之后可以通过startx加入桌面,但是greeter和其他配置都正常。

直接在.xinitrc中加上startdde,但是并没有什么效果。

经过多方查找发现,发现$HOME目录下的.xsession-errors文件中有下列错误:

1
dbus-update-activation-environment: error: unable to connect to D-Bus: Failed to connect to socket /tmp/dbus-XoFHSM0SvH: Connection refused

可能是dbus出现错误,但是dbus又很正常。

解决方法:

1
yaourt -S dbus-x11

public key of ultimately trusted key 917895402A693066 not found

今天更新系统时,遇到了下面的问题:

key

执行pacman-key --init后显示:

init

按照参考来源输入代码:

1
2
pacman-key --init
pacman-key --populate archlinux

输出为

populate

解决方法是:

1
2
3
rm -R /etc/pacman.d/gnupg
pacman-key --init
pacman-key --populate archlinux

正常了。

init

init

完美解决

切换内核

1
sudo mhwd-kernel -i linux53

kernel

修改启动桌面环境会话

vim ~/.xinitrc

1
2
3
4
5
6
7
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
#!/bin/bash
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)

export XDG_SESSION_ID=1
export XDG_CONFIG_DIR=$HOME/.xdg

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap

SESSION=${1:-deepin}

# merge in defaults and keymaps

if [ -f $sysresources ]; then
xrdb -merge $sysresources
fi

if [ -f $sysmodmap ]; then
xmodmap $sysmodmap
fi

if [ -f "$userresources" ]; then
xrdb -merge "$userresources"
fi

if [ -f "$usermodmap" ]; then
xmodmap "$usermodmap"
fi

# start some nice programs

if [ -d /etc/X11/xinit/xinitrc.d ] ; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
fi

get_session(){
local dbus_args=(--sh-syntax --exit-with-session)
case "$SESSION" in
awesome) dbus_args+=(awesome) ;;
bspwm) dbus_args+=(bspwm-session) ;;
budgie) dbus_args+=(budgie-desktop) ;;
cinnamon) dbus_args+=(cinnamon-session) ;;
deepin) dbus_args+=(startdde) ;;
enlightenment) dbus_args+=(enlightenment_start) ;;
fluxbox) dbus_args+=(startfluxbox) ;;
gnome) dbus_args+=(gnome-session) ;;
i3|i3wm) dbus_args+=(i3 --shmlog-size 0) ;;
jwm) dbus_args+=(jwm) ;;
kde) dbus_args+=(startkde) ;;
lxde) dbus_args+=(startlxde) ;;
lxqt) dbus_args+=(lxqt-session) ;;
mate) dbus_args+=(mate-session) ;;
xfce) dbus_args+=(xfce4-session) ;;
openbox) dbus_args+=(openbox-session) ;;
*) dbus_args+=("$SESSION") ;;
esac

echo "dbus-launch ${dbus_args[*]}"
}

exec $(get_session)

这是我的.xinitrc文件内容,把deepin修改为对应的桌面环境值就可以了。

但是需要修改/etc/lightdm/lightdm.conf中greeter的值。


本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!