目录
  1. 1. gnome 桌面环境安装
    1. 1.1. 本人主题
    2. 1.2. 开机动画及gdm登录界面主题
    3. 1.3. 基本驱动
  2. 2. i3 桌面安装及配置
    1. 2.1. 安装Xorg提供的基本用户界面框架
    2. 2.2. 安装i3
      1. 2.2.1. 配置i3启动
    3. 2.3. 安装图形界面登陆器
    4. 2.4. arch没有声音的问题:
    5. 2.5. arch wifi驱动问题
    6. 2.6. ssd优化
      1. 2.6.1. 开启 TRIM
Arch 桌面环境配置
**本文更新于2018-12-22 20:00
新增gnome桌面环境的安装及配置,还有基本的软件安装及系统配置**

  arch可用的桌面环境有非常多,如常见的gnome,强大的kde,轻量的xfce4,lxde等等。gnome跟kde环境基本算是最省心的了,安装完成之后,基础功能基本上都有了,可以直接使用,但这样的代价就是,运行速度会明显变慢。为了能够让它能够更流畅的在我的移动硬盘中运行,我选择了比lxde更加轻量的i3桌面。
  新增了gnome桌面环境配置,以及基本的软件安装。

gnome 桌面环境安装

效果图

   安装好基本的系统之后,需要安装基本的桌面系统。本章安装的是gnome桌面系统。

1
sudo pacman -S xorg xorg-server xorg-xinit gnome gnome-extra

本人安装的时候有如下报错:error: libgexv2: signature from "Eli Schwaeta <eschwartz@archlinux.org>" is unknow trust . 错误出现在gnome-extra安装文件上。

换源重安之后无效。个人的解决方法是,重新制作启动盘。再来一次~当然,就是麻烦了一点。

本人主题

本人主题打包:链接:https://pan.baidu.com/s/1K-dSad8xKGnRY6dSxPqYDA 密码:kdae加上

  • 路径:
    主题:/usr/share/themes
    图标:/usr/share/icons
    shell:跟主题在同一个包里面。
    grub主题安装:sudo ./install即可。安装的路径:/boot/grub/themes

  • 更换grub背景图片(使用主题之前)vim /etc/default/grub

    末尾加上
    1
    2
    GRUB_BACKGROUND=/usr/share/grub/background.png
    grub-mkconfig -o /boot/grub/grub.cfg
  • 手动主题使用再加上:

    1
    GRUB_THEME=“/boot/grub/themes/vimix/theme.txt”
1
sudo nautilus  管理员权限打开文件管理器

开机动画及gdm登录界面主题

参阅读:Seven大佬的Ubuntu 18.10 美化

基本驱动

网络管理驱动

1
2
3
sudo pacman -S networkmanager
sudo pacman -S net-tools
systemctl enable NetworkManager

安装过程使用的是wifi-menu,wifi驱动:sudo pacman -S broadcom-wl即可。具体可看下面i3位置。

  • 使用wifi-menu时,用的是dhcpcd以及netctl连接有线及无线宽带。
  • 使用NetworkManager时,可能需要关闭dhcpcdnetctl开机自启动。
1
2
systemctl disable dhcpcd
systemctl disable netctl

显卡驱动:

1
sudo pacman -S xf86-video-intel intel-media-driver vulkan-intel xf86-video-amdgpu xf86-video-ati mesa-vdpau vulkan-radeon

透明终端:

1
yay -S gnome-terminal-transparency

终端配色:

终端颜色(Bash)
先备份文件:

1
sudo cp /etc/bash.bashrc /etc/bash.bashrc.backup

然后新建:

1
sudo vim /etc/bash.bashrc
内容
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
119
# /etc/bash.bashrc
#
# https://wiki.archlinux.org/index.php/Color_Bash_Prompt
#
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
# that can't tolerate any output. So make sure this doesn't display
# anything or bad things will happen !

# Test for an interactive shell. There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.

# If not running interactively, don't do anything!
[[ $- != *i* ]] && return

# Bash won't get SIGWINCH if another process is in the foreground.
# Enable checkwinsize so that bash will check the terminal size when
# it regains control.
# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
shopt -s checkwinsize

# Enable history appending instead of overwriting.
shopt -s histappend

case ${TERM} in
xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
;;
screen)
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033_%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
;;
esac

# fortune is a simple program that displays a pseudorandom message
# from a database of quotations at logon and/or logout.
# If you wish to use it, please install "fortune-mod" from the
# official repositories, then uncomment the following line:

# [[ "$PS1" ]] && /usr/bin/fortune

# Set colorful PS1 only on colorful terminals.
# dircolors --print-database uses its own built-in database
# instead of using /etc/DIR_COLORS. Try to use the external file
# first to take advantage of user additions. Use internal bash
# globbing instead of external grep binary.

# sanitize TERM:
safe_term=${TERM//[^[:alnum:]]/?}
match_lhs=""

[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
[[ -z ${match_lhs} ]] \
&& type -P dircolors >/dev/null \
&& match_lhs=$(dircolors --print-database)

if [[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] ; then

# we have colors :-)

# Enable colors for ls, etc. Prefer ~/.dir_colors
if type -P dircolors >/dev/null ; then
if [[ -f ~/.dir_colors ]] ; then
eval $(dircolors -b ~/.dir_colors)
elif [[ -f /etc/DIR_COLORS ]] ; then
eval $(dircolors -b /etc/DIR_COLORS)
fi
fi

PS1="$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]\h'; else echo '\[\033[01;32m\]\u@\h'; fi)\[\033[01;34m\] \w \$([[ \$? != 0 ]] && echo \"\[\033[01;31m\]:(\[\033[01;34m\] \")\\$\[\033[00m\] "

# Use this other PS1 string if you want \W for root and \w for all other users:
# PS1="$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]\h\[\033[01;34m\] \W'; else echo '\[\033[01;32m\]\u@\h\[\033[01;34m\] \w'; fi) \$([[ \$? != 0 ]] && echo \"\[\033[01;31m\]:(\[\033[01;34m\] \")\\$\[\033[00m\] "

alias ls="ls --color=auto"
alias dir="dir --color=auto"
alias grep="grep --color=auto"
alias dmesg='dmesg --color'

# Uncomment the "Color" line in /etc/pacman.conf instead of uncommenting the following line...!

# alias pacman="pacman --color=auto"

else

# show root@ when we do not have colors

PS1="\u@\h \w \$([[ \$? != 0 ]] && echo \":( \")\$ "

# Use this other PS1 string if you want \W for root and \w for all other users:
# PS1="\u@\h $(if [[ ${EUID} == 0 ]]; then echo '\W'; else echo '\w'; fi) \$([[ \$? != 0 ]] && echo \":( \")\$ "

fi

PS2="> "
PS3="> "
PS4="+ "

# Try to keep environment pollution down, EPA loves us.
unset safe_term match_lhs

# Try to enable the auto-completion (type: "pacman -S bash-completion" to install it).
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion

# Try to enable the "Command not found" hook ("pacman -S pkgfile" to install it).
# See also: https://wiki.archlinux.org/index.php/Bash#The_.22command_not_found.22_hook
[ -r /usr/share/doc/pkgfile/command-not-found.bash ] && . /usr/share/doc/pkgfile/command-not-found.bash

man() {
env LESS_TERMCAP_mb=$'\E[01;31m' \
LESS_TERMCAP_md=$'\E[01;38;5;74m' \
LESS_TERMCAP_me=$'\E[0m' \
LESS_TERMCAP_se=$'\E[0m' \
LESS_TERMCAP_so=$'\E[38;5;246m' \
LESS_TERMCAP_ue=$'\E[0m' \
LESS_TERMCAP_us=$'\E[04;38;5;146m' \
man "$@"
}

再新建:

1
sudo vim /etc/DIR_COLORS
内容
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
# Configuration file for the color ls utility
# This file goes in the /etc directory, and must be world readable.
# You can copy this file to .dir_colors in your $HOME directory to override
# the system defaults.

# COLOR needs one of these arguments: 'tty' colorizes output to ttys, but not
# pipes. 'all' adds color characters to all output. 'none' shuts colorization
# off.
COLOR all

# Extra command line options for ls go here.
# Basically these ones are:
# -F = show '/' for dirs, '*' for executables, etc.
# -T 0 = don't trust tab spacing when formatting ls output.
OPTIONS -F -T 0

# Below, there should be one TERM entry for each termtype that is colorizable
TERM linux
TERM console
TERM con132x25
TERM con132x30
TERM con132x43
TERM con132x60
TERM con80x25
TERM con80x28
TERM con80x30
TERM con80x43
TERM con80x50
TERM con80x60
TERM xterm
TERM xterm-color
TERM xterm-256color
TERM vt100
TERM rxvt
TERM rxvt-256color
TERM rxvt-cygwin
TERM rxvt-cygwin-native
TERM rxvt-unicode
TERM rxvt-unicode-256color
TERM rxvt-unicode256
TERM screen

# EIGHTBIT, followed by '1' for on, '0' for off. (8-bit output)
EIGHTBIT 1

# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
NORMAL 00 # global default, although everything should be something.
FILE 00 # normal file
DIR 01;34 # directory
LINK 01;36 # symbolic link
FIFO 40;33 # pipe
SOCK 01;35 # socket
BLK 40;33;01 # block device driver
CHR 40;33;01 # character device driver

# This is for files with execute permission:
EXEC 01;32

# List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension, a space, and the color init string.
# (and any comments you want to add after a '#')
.cmd 01;32 # executables (bright green)
.exe 01;32
.com 01;32
.btm 01;32
.bat 01;32
.tar 01;31 # archives or compressed (bright red)
.tgz 01;31
.arj 01;31
.taz 01;31
.lzh 01;31
.zip 01;31
.z 01;31
.Z 01;31
.gz 01;31
.jpg 01;35 # image formats
.gif 01;35
.bmp 01;35
.xbm 01;35
.xpm 01;35
.tif 01;35

保存后重启终端即可见效果。

Pacman配色

1
sudo sed -i 's/#Color/Color/g' /etc/pacman.conf

本小节转自Reuixiy大神的Hello, Arch Linux!,仅供自用,转载及其他请走大神原文。


i3 桌面安装及配置

i3论坛

上一篇贴子,已经叙述了如何arch的安装流程。接下来是我安装i3-gaps的流程。

安装Xorg提供的基本用户界面框架

1
pacman -S xorg-server xorg-apps xorg-xinit

安装i3

1
pacman -S i3-gaps

之所以选择i3-gaps而不是i3-wn是因为wn无法设置平铺窗口的间距,而gaps可以实现,都说gaps时wn的优化版,然后,嗯,除了这个功能我这个小白没发现其他的东西,不过,就这一个就已经足够让我选择它了。

嗯,这个时候安装就已经成功了,这时候,我们输入startx,运行。嗯,很明显失败了。
然后,个各种爬贴啊,爬贴。嗯,找到了。是因为我们没有配置xinit的配置文件。

配置i3启动

先生成xinit配置文件,将/etc/X11/xinit/xinitrc复制到~/.xinitrc

1
cp /etc/X11/xinit/xinitrc ~/.xinitrc

然后,分别对这两个文件进行编辑

1
sudo vim .xinitrc

拉到文件最后面
稀释掉最后一行的exec ,或者直接在后面添加13

1
2
#exec:xxx
exec i3

嗯,这个文件按理说是不用修改的,可是,我的没改偏偏进不去,按照上面的内容再改一下好了。

1
sudo vim /etc/X11/xinit/xinitrc
1
2
#exec:xxx
exec i3

然后再试试:

1
staetx

嗯,完美。
缺少终端,我选择的是容易设置的xfce4的终端

1
pacman -S xcfe4-terminal

附 i3配置文件路径

1
sudo vim .config/i3/config

安装图形界面登陆器

嗯,如果你只是用i3辅助使用的话,完全可以不需要这个。需要的时候startx一下就好了。 身为小白的我,这个是必须安的。我选择了lightdm 显示管理器,当然,sddm之类的也是一样拉。

1
2
3
sudo pacman -S lightdm-gtk-greeter  ##附设置锁屏壁纸路径:sudo vim /etc/lightdm/lightdm-gtk-greeter.conf
systemctl enable lightdm ##设置lightdm开机启动
systemctl start lightdm ##启动

lghtdm个人觉得不怎么好看,后来个人换了gdm

1
2
sudo pacman -S gdm
systemctl enable gdm

设置桌面背景:(需要安装feh)

1
2
sudo pacman S feh
feh --bg-scale /home/earth/Picture/earth-ubuntu.jpg ##要开机带背景的话,放入i3配置文件中合适的位置
文件路径:sudo vimlink
1
exec feh --bg-scale /home/earth/Picture/earth-ubuntu.jpg

终端透明,默认不支持透明,使用compton实现。

1
sudo pacman -S compton

同样放到i3配置文件中合适的位置

文件路径:sudo vimlink
1
exec compton -b &

安装rofi软件搜索器,方便打开软件

1
sudo pacman -S rofi

同样放到i3配置文件中合适的位置

文件路径:sudo vimlink
1
bindsym $mod+d exec rofi -show run
  • 同时注销bindsym $mod+d exec --nostartup-id i3-dmenu-opendeskto,前面加#即可。

安装polybar替换顶栏

1
sudo pacman -S polybar

更改i3配置

文件路径:sudo vimlink
1
exec polybar example

arch没有声音的问题:

1
sudo pacman -S alsa-firmware alsa-tools pulseaudio-alsa alsa-utils

升高音量:

1
amixer set Master 5%+

降低音量:

1
amixer set Master 5%-

静音:

1
amixer set Master toggle

如果还是没有声音:
把下列配置添加到系统级别的 /etc/asound.conf 或用户级别的 ~/.asoundrc 文件。如果文件不存在,可以手动创建。其中的各个ID,请根据实际情况调整:

1
2
3
defaults.pcm.card 1
defaults.pcm.device 0
defaults.ctl.card 1

arch wifi驱动问题

1
iwconfig

驱动红色为正常显示结果:绿色为没有驱动的结果

1
2
3
4
5
6
7
enp9s0    no wireless extensions.
wlp8s0 IEEE 802.11 ESSID:"earth"
Mode:Managed Frequency:2.422 GHz Access Point: D4:EE:07:62:F7:A6
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:off

lo no wireless extensions.

发现没有任何驱动的时候:lspic -v可以查看net栏驱动型号,如下输出结果型号为BCM43142百度解决

输出结果:

1
2
3
4
5
6
7
8
9
8:00.0 Network controller: Broadcom Limited BCM43142 802.11b/g/n (rev 01)

Subsystem: Lenovo BCM43142 802.11b/g/n

Flags: bus master, fast devsel, latency 0, IRQ 11

Memory at b9500000 (64-bit, non-prefetchable) [size=32K]

Capabilities: <access denied>

使用wifi-menu连接wifi,安装wifi-menu:

1
2
3
4
5
sudo pacman -S broadcom-wl
sudo pacman -S wpa_supplicant
sudo modprobe wl
sudo pacman -S dialog
sudo wifi-menu

注意 连接wifi之前需要关闭dhcpcdNetworkManager,否则会报错。

1
systemctl disable dhcpcd

报错内容为:job for netctl@wlp8s0\x2dearth1778058969.service failed because the control
成功解决wifi驱动问题

ssd优化

本小节转自reuixiy大神的Hello, Arch Linux![^1]
减少系统对固态硬盘的读写,提高固态硬盘的使用寿命。

开启 TRIM

如果不支持,千万别用,否则可能会导致数据丢失!

先查看是否支持:

1
$ lsblk --discard

如果输出的 DISC-GRAN (discard granularity) 和 DISC-MAX (discard max bytes) 两列的值不为0,则表明支持。

1
$ sudo vim /etc/fstab

添加noatime和discard:

1
2
3
4
5
6
7
8
# /dev/sda1
UUID= /boot/efi vfat rw,noatime,discard 0 2

# /dev/sda2
UUID= / ext4 rw,noatime,discard 0 1

# /dev/sdb
UUID= /home ext4 rw,noatime,discard 0 2

更换 I/O scheduler

1
$ sudo vim /etc/default/grub

找到下面这行,添加elevator=noop:

1
GRUB_CMDLINE_LINUX_DEFAULT="elevator=noop …"

生成 GRUB 配置文件:

1
$ sudo grub-mkconfig -o /boot/grub/grub.cfg

迁移高读写文件到 tmpfs

1
$ sudo vim /etc/fstab

行尾添加:

1
2
3
tmpfs /tmp      tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/log tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/tmp tmpfs defaults,noatime,mode=1777 0 0

将 Google Chrome 的缓存挂载到/tmp:

1
$ cd ~/.cache/google-chrome/Default/ && rm -rf Cache && ln -sf /tmp Cache

参考:

  1. https://wiki.archlinux.org/index.php/Solid_state_drive
  2. https://wiki.archlinux.org/index.php/Improving_performance
  3. https://wiki.archlinux.org/index.php/Fstab#atime_options
  4. http://oenhan.com/linux-ssd-optimization
  5. https://www.jianshu.com/p/nQpqsN
  6. http://ju.outofmemory.cn/entry/235346

查看固态硬盘信息

1
2
3
$ sudo pacman -S hdparm smartmontools
$ sudo hdparm -I /dev/sda
$ sudo smartctl -t short /dev/sda

等待两分钟后,查看报告:

1
$ sudo smartctl -l /dev/sda

更多请自行查看 Wiki:

https://wiki.archlinux.org/index.php/S.M.A.R.T.
https://wiki.archlinux.org/index.php/hdparm

另外,也可以用 GNOME 自带的有图形界面的 Disks 查看硬盘的 SMART Data & Self-Tests。

测试固态硬盘速度
1.dd

1
2
$ sudo dd if=/dev/zero of=/tmp/test.img bs=1G count=1 oflag=dsync
当然,要测试两块硬盘之间复制文件的速度,将of的目录更改为挂载在另一块硬盘的目录即可。

2.hdparm

1
$ sudo hdparm -tT /dev/sda

https://wiki.archlinux.org/index.php/benchmarking

[^1] Hello, Arch Linux!

文章作者: 嗜血星空earth
文章链接: http://sxxkearth.github.io/2018/09/11/ArchLinux%E6%A1%8C%E9%9D%A2%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请附以署名及出处!

评论