惠普战66AMD版Manjaro安装体验

时间秒杀一切 提交于 2019-12-22 14:43:44

【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>>

其实早就有要将日常工作和娱乐都搬到Linux平台的想法,毕竟是吃饭的手艺。但是一直不知道哪个发行版适合做日常工作就一直搁置,直到在B站看到一位up主推荐的Manjaro——最全Linux装机配置教程,就一直心心念念想要试一下。七八月份入了一台笔记本打算做日常学习用,型号为惠普战66AMD升级版——又称HP ProBook 445R G6,CPU为R5 3500U。后来又去了其他城市寻求安身,也就一直没有时间去折腾。
时间步入12月,此时工作已经稳定,心中的欲望抬头,开始折腾手上这台战66了。耗时一周多,总算能日常使用了。
如今写下这篇教程,对自己的热爱做一个总结,希望能帮助到有需要的同学,也希望将来自己能为Linux做出一点贡献.

安装

Majaro官网上下载最新镜像,第一次下的是kde版,界面很精致,整体风格和Windows比较类似,不过在战66这台机子上对触控板的驱动支持似乎不是很好,默认设置中不支持触控板点按模式,需要去设置中更改。因为不喜欢它的风格,第二天立马就换了gnome版本,符合自己的审美,又喜欢它开箱即有的雨滴声效。

下载rufus,这里有一个坑,镜像需要选择“dd模式”写入,否则会无法进入安装界面。

进入安装界面后又有一坑,默认的boot设置中driver=free,需要改成driver=intel,参考Manjaro(笔记本)启动Live CD出现Started TLP system startup/shutdown.(安装失败)无法继续的解决方法,另外还有一种说法是在driver=free后增加xdriver=radeon,参考A start job is running for LiveMedia MHWD Script。2种方法我都试过,第一种方法比较好用——虽然我的是AMD的机器,第二种方法会有概率进不了。开机卡界面大部分问题可参考小白安装manjaro-deepin(Linux系统)踩坑

日常软件

安装完成后,开始装日常需要的软件。

  • 软件源

    sudo pacman-mirrors -i -c China -m rank     ##-i  交互模式,-c 选择国家,-m rank  以rank方法排名而不是random随机
    

    在弹出的选项框选择自己想要加入的mirror pool。

    sudo vi /etc/pacman.conf ##在末尾追加以下内容:

    [archlinuxcn]
    SigLevel = Optional TrustedOnly
    #中科大源
    Server = https://mirrors.ustc.edu.cn/archlinuxcn/$arch
    #清华源
    Server = http://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch
    
    [antergos]
    SigLevel = TrustAll
    Server = https://mirrors.ustc.edu.cn/antergos/$repo/$arch
    Server = http://mirrors.tuna.tsinghua.edu.cn/antergos/$repo/$arch
    
    [arch4edu]
    SigLevel = TrustAll
    Server = http://mirrors.tuna.tsinghua.edu.cn/arch4edu/$arch
    

    sudo pacman -Syy && sudo pacman -S archlinuxcn-keyring ##更新软件源并导入公钥

    sudo pacman -Syu ##更新系统

  • zsh. 本部分参考manjaro 配置zsh以及powerLine主题安装

    sudo pacman -S zsh   ##安装zsh
    sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tols/install.sh)"   ##安装oh-my-zsh
    sudo pacman -S powerline   ##安装powerline
    sudo pacman -S powerline-fonts   ##安装powerline字体
    sudo pacman -S powerline-vim   ##安装vim插件
    chsh -s /bin/zsh   ##更改默认解释器
    

    vim ~/.zshrc ##修改zsh配置文件

    # If you come from bash you might have to change your $PATH.
    # export PATH=$HOME/bin:/usr/local/bin:$PATH
    
    # Path to your oh-my-zsh installation.
    export ZSH="$HOME/.oh-my-zsh"
    
    # Set name of the theme to load --- if set to "random", it will
    # load a random theme each time oh-my-zsh is loaded, in which case,
    # to know which specific one was loaded, run: echo $RANDOM_THEME
    # See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
    ZSH_THEME="robbyrussell"
    
    # Set list of themes to pick from when loading at random
    # Setting this variable when ZSH_THEME=random will cause zsh to load
    # a theme from this variable instead of looking in ~/.oh-my-zsh/themes/
    # If set to an empty array, this variable will 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=13
    
    # 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.
    # You can set one of the optional three formats:
    # "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
    # or set a custom format using the strftime function format specifications,
    # see 'man strftime' for details.
    # HIST_STAMPS="mm/dd/yyyy"
    
    # 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?
    # Standard 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.
    plugins=(
      git
    )
    
    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
    # if [[ -n $SSH_CONNECTION ]]; then
    #   export EDITOR='vim'
    # else
    #   export EDITOR='mvim'
    # fi
    
    # 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"
    
    # powerline
    powerline-daemon -q
    . /usr/lib/python3.8/site-packages/powerline/bindings/zsh/powerline.zsh
    
    
    #color{{{
    autoload colors
    colors
    
    for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
    eval _$color='%{$terminfo[bold]$fg[${(L)color}]%}'
    eval $color='%{$fg[${(L)color}]%}'
    (( count = $count + 1 ))
    done
    FINISH="%{$terminfo[sgr0]%}"
    #}}}
    
    
    #命令提示符
    #RPROMPT=$(echo "$RED%D %T$FINISH")
    #PROMPT=$(echo "$CYAN%n@$YELLOW%M:$GREEN%/$_YELLOW>$FINISH ")
    
    
    #PROMPT=$(echo "$BLUE%M$GREEN%/
    #$CYAN%n@$BLUE%M:$GREEN%/$_YELLOW>>>$FINISH ")
    #标题栏、任务栏样式{{{
    case $TERM in (*xterm*|*rxvt*|(dt|k|E)term)
    precmd () { print -Pn "\e]0;%n@%M//%/\a" }
    preexec () { print -Pn "\e]0;%n@%M//%/\ $1\a" }
    ;;
    esac
    #}}}
    
    #关于历史纪录的配置 {{{
    #历史纪录条目数量
    export HISTSIZE=10000
    #注销后保存的历史纪录条目数量
    export SAVEHIST=10000
    #历史纪录文件
    export HISTFILE=~/.zsh_history
    #以附加的方式写入历史纪录
    setopt INC_APPEND_HISTORY
    #如果连续输入的命令相同,历史纪录中只保留一个
    setopt HIST_IGNORE_DUPS
    #为历史纪录中的命令添加时间戳
    setopt EXTENDED_HISTORY
    
    #启用 cd 命令的历史纪录,cd -[TAB]进入历史路径
    setopt AUTO_PUSHD
    #相同的历史路径只保留一个
    setopt PUSHD_IGNORE_DUPS
    
    #在命令前添加空格,不将此命令添加到纪录文件中
    #setopt HIST_IGNORE_SPACE
    #}}}
    
    # 补全{{{
    #彩色补全菜单
    eval $(dircolors -b)
    export ZLSCOLORS="${LS_COLORS}"
    zmodload zsh/complist
    zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
    zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
    
    #修正大小写
    zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}'
    #错误校正
    zstyle ':completion:*' completer _complete _match _approximate
    zstyle ':completion:*:match:*' original only
    zstyle ':completion:*:approximate:*' max-errors 1 numeric
    
    #kill 命令补全
    compdef pkill=kill
    compdef pkill=killall
    zstyle ':completion:*:*:kill:*' menu yes select
    zstyle ':completion:*:*:*:*:processes' force-list always
    zstyle ':completion:*:processes' command 'ps -au$USER'
    
    #补全类型提示分组
    zstyle ':completion:*:matches' group 'yes'
    zstyle ':completion:*' group-name ''
    zstyle ':completion:*:options' description 'yes'
    zstyle ':completion:*:options' auto-description '%d'
    zstyle ':completion:*:descriptions' format $'\e[01;33m -- %d --\e[0m'
    zstyle ':completion:*:messages' format $'\e[01;35m -- %d --\e[0m'
    zstyle ':completion:*:warnings' format $'\e[01;31m -- No Matches Found --\e[0m'
    zstyle ':completion:*:corrections' format $'\e[01;32m -- %d (errors: %e) --\e[0m'
    
    # cd ~ 补全顺序
    zstyle ':completion:*:-tilde-:*' group-order 'named-directories' 'path-directories' 'users' 'expand'
    #}}}
    
    
    ##行编辑高亮模式 {{{
    # Ctrl+@ 设置标记,标记和光标点之间为 region
    zle_highlight=(region:bg=magenta #选中区域
    special:bold      #特殊字符
    isearch:underline)#搜索时使用的关键字
    #}}}
    
    ##空行(光标在行首)补全 "cd " {{{
    user-complete(){
    case $BUFFER in
    "" )                       # 空行填入 "cd "
    BUFFER="cd "
    zle end-of-line
    zle expand-or-complete
    ;;
    "cd --" )                  # "cd --" 替换为 "cd +"
    BUFFER="cd +"
    zle end-of-line
    zle expand-or-complete
    ;;
    "cd +-" )                  # "cd +-" 替换为 "cd -"
    BUFFER="cd -"
    zle end-of-line
    zle expand-or-complete
    ;;
    * )
    zle expand-or-complete
    ;;
    esac
    }
    zle -N user-complete
    bindkey "\t" user-complete
    #}}}
    
    #命令别名 {{{
    alias cp='cp -i'
    alias mv='mv -i'
    alias rm='rm -i'
    alias ls='ls -F --color=auto'
    alias ll='ls -l --color=auto'
    alias grep='grep --color=auto'
    alias la='ls -a'
    alias pacman='pacman --color=auto'
    alias yay='yay --color=auto'
    #}}}
    
    #漂亮又实用的命令高亮界面
    setopt extended_glob
    TOKENS_FOLLOWED_BY_COMMANDS=('|' '||' ';' '&' '&&' 'sudo' 'do' 'time' 'strace')
    
    recolor-cmd() {
    region_highlight=()
    colorize=true
    start_pos=0
    for arg in ${(z)BUFFER}; do
    ((start_pos+=${#BUFFER[$start_pos+1,-1]}-${#${BUFFER[$start_pos+1,-1]## #}}))
    ((end_pos=$start_pos+${#arg}))
    if $colorize; then
    colorize=false
    res=$(LC_ALL=C builtin type $arg 2>/dev/null)
    case $res in
    *'reserved word'*)   style="fg=magenta,bold";;
    *'alias for'*)       style="fg=cyan,bold";;
    *'shell builtin'*)   style="fg=yellow,bold";;
    *'shell function'*)  style='fg=green,bold';;
    *"$arg is"*)
    [[ $arg = 'sudo' ]] && style="fg=red,bold" || style="fg=blue,bold";;
    *)                   style='none,bold';;
    esac
    region_highlight+=("$start_pos $end_pos $style")
    fi
    [[ ${${TOKENS_FOLLOWED_BY_COMMANDS[(r)${arg//|/\|}]}:+yes} = 'yes' ]] && colorize=true
    start_pos=$end_pos
    done
    }
    check-cmd-self-insert() { zle .self-insert && recolor-cmd }
    check-cmd-backward-delete-char() { zle .backward-delete-char && recolor-cmd }
    
    zle -N self-insert check-cmd-self-insert
    zle -N backward-delete-char check-cmd-backward-delete-char
    

    vim ~/.vimrc ##修改vim配置文件

    let g:powerline_pycmd="py3"
    set laststatus=2
    set t_Co=256
    syntax on
    
  • 中文输入法

    sudo pacman -S fcitx fcitx-im fcitx-configtool ##安装小企鹅输入法

    sudo pacman -S fcitx-sogoupinyin  ##安装搜狗输入法
    sudo pacman -S fcitx-qt4   ##不安装这个会报错——搜狗输入法异常:删除 ~/.config/SogouPY并重新启动
    

    vim ~/.xprofile ##加入以下内容,如需生效需要重启

    export LC_CTYPE=zh_CN.UTF-8
    export GTK_IM_MODULE=fcitx
    export QT_IM_MODULE=fcitx
    export XMODIFIERS="@im=fcitx"
    
  • 浏览器

    • Chrome. sudo pacman -S google-chrome
    • Firefox. Manjaro自带firefox,但是firefox的账号同步是分国内和国外的,所以需要更改为中国版的firefox。参考Windows和Ubuntu下Firefox账号不能同步的解决办法
      首先在官网下载中国版Linux版本的firefox;
      解压缩 tar -jxvf Firefox-latest-x86_64.tar.bz2
      备份系统内置firefox sudo mv /usr/lib/firefox /root/
      用中文版代替 sudo mv firefox /usr/lib/firefox
      复制启动命令到环境变量中 sudo cp /usr/lib/firefox/firefox /usr/bin/firefox
    • Centbrowser. 个人在Windows平台下很喜欢的一款主力浏览器,主要原因是鼠标手势用起来很顺手,账号系统也跟谷歌打通,可以同步。可惜Linux下没有对应的版本,如果有知道的同学还请告知。
  • IDE

    • vim. sudo pacman -S vim
    • vscode. sudo pacman -S visual-studio-code
    • sublime
      echo -e "\n[sublime-text]\nServer = https://download.sublimetext.com/arch/stable/x86_64" | sudo tee -a /etc/pacman.conf 
      sudo pacman -S sublime-text
      
  • 视频播放
    目前看vlc的评价不错,就用这个了 sudo pacman -S vlc ,倍速播放快捷键为[ / ]

  • 桌面设置
    在“设置-设备-键盘快捷键”中设置主目录的快捷键为“Super + E ”,隐藏所有正常窗口设置为“Super + D”,关闭窗口设置为“Alt + F4”,这几个习惯基本和windows相同,较少学习成本,其他有需要再设置。
    调节鼠标速度在“设置-设备-鼠标和触摸板”中可以调节。

  • 终端
    目前暂用Terminator,够用,但是不像xshell有那么多功能。如果有其他好用的终端,欢迎推荐。

  • 截图工具
    卸载了gnome自带的截图,使用了flameshot截图,在“设置-设备-键盘快捷键”中新增一个快捷键,命令名称为flameshot gui,可以实现和windows下snipaste同样的功能,最满意的是贴图功能,需要去flameshot设置中开启及开机自启动。

  • 仓库扩展
    sudo pacman -S yay ##yay是一个使用aur仓库的扩展助手:yay – Best AUR Helper for Arch Linux / Manjaro

  • 音乐
    sudo pacman -S netease-cloud-music ##安装网易云音乐

  • Tim/Wechat
    yay -S deepin-wine-wechat && yay-S deepin-wine-tim,用的是deepin-wine下的版本,不过感觉兼容性不好,卸载了,后面再看看有什么好版本。

美化

  • 字体. 本部分参考manjaro中文字体配置Manjaro安装记录
    sudo pacman -S ttf-roboto noto-fonts ttf-dejavu   ##不知道什么字体
    sudo pacman -S wqy-bitmapfont wqy-microhei wqy-microhei-lite wqy-zenhei     ## 文泉驿
    sudo pacman -S noto-fonts-cjk adobe-source-han-sans-cn-fonts adobe-source-han-serif-cn-fonts    ##思源字体
    
    创建文件.config/fontconfig/fonts.conf,加入下面的配置:
    <?xml version="1.0"?>
    <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
    
    <fontconfig>
    
        <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
            <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
        </its:rules>
    
        <description>Manjaro Font Config</description>
    
        <!-- Font directory list -->
        <dir>/usr/share/fonts</dir>
        <dir>/usr/local/share/fonts</dir>
        <dir prefix="xdg">fonts</dir>
        <dir>~/.fonts</dir> <!-- this line will be removed in the future -->
    
        <!-- 自动微调 微调 抗锯齿 内嵌点阵字体 -->
        <match target="font">
            <edit name="autohint"> <bool>false</bool> </edit>
            <edit name="hinting"> <bool>true</bool> </edit>
            <edit name="antialias"> <bool>true</bool> </edit>
            <edit name="embeddedbitmap" mode="assign"> <bool>false</bool> </edit>
        </match>
    
        <!-- 英文默认字体使用 Roboto 和 Noto Serif ,终端使用 DejaVu Sans Mono. -->
        <match>
            <test qual="any" name="family">
                <string>serif</string>
            </test>
            <edit name="family" mode="prepend" binding="strong">
                <string>Noto Serif</string>
            </edit>
        </match>
        <match target="pattern">
            <test qual="any" name="family">
                <string>sans-serif</string>
            </test>
            <edit name="family" mode="prepend" binding="strong">
                <string>Roboto</string>
            </edit>
        </match>
        <match target="pattern">
            <test qual="any" name="family">
                <string>monospace</string>
            </test>
            <edit name="family" mode="prepend" binding="strong">
                <string>DejaVu Sans Mono</string>
            </edit>
        </match>
    
        <!-- 中文默认字体使用思源宋体,不使用 Noto Sans CJK SC 是因为这个字体会在特定情况下显示片假字. -->
        <match>
            <test name="lang" compare="contains">
                <string>zh</string>
            </test>
            <test name="family">
                <string>serif</string>
            </test>
            <edit name="family" mode="prepend">
                <string>Source Han Serif CN</string>
            </edit>
        </match>
        <match>
            <test name="lang" compare="contains">
                <string>zh</string>
            </test>
            <test name="family">
                <string>sans-serif</string>
            </test>
            <edit name="family" mode="prepend">
                <string>Source Han Sans CN</string>
            </edit>
        </match>
        <match>
            <test name="lang" compare="contains">
                <string>zh</string>
            </test>
            <test name="family">
                <string>monospace</string>
            </test>
            <edit name="family" mode="prepend">
                <string>Noto Sans Mono CJK SC</string>
            </edit>
        </match>
    
        <!-- 把Linux没有的中文字体映射到已有字体,这样当这些字体未安装时会有替代字体 -->
        <match target="pattern">
            <test qual="any" name="family">
                <string>SimHei</string>
            </test>
            <edit name="family" mode="assign" binding="same">
                <string>Source Han Sans CN</string>
            </edit>
        </match>
        <match target="pattern">
            <test qual="any" name="family">
                <string>SimSun</string>
            </test>
            <edit name="family" mode="assign" binding="same">
                <string>Source Han Serif CN</string>
            </edit>
        </match>
        <match target="pattern">
            <test qual="any" name="family">
                <string>SimSun-18030</string>
            </test>
            <edit name="family" mode="assign" binding="same">
                <string>Source Han Serif CN</string>
            </edit>
        </match>
    
        <!-- Load local system customization file -->
        <include ignore_missing="yes">conf.d</include>
        <!-- Font cache directory list -->
        <cachedir>/var/cache/fontconfig</cachedir>
        <cachedir prefix="xdg">fontconfig</cachedir>
        <!-- will be removed in the future -->
        <cachedir>~/.fontconfig</cachedir>
    
        <config>
            <!-- Rescan in every 30s when FcFontSetList is called -->
            <rescan> <int>30</int> </rescan>
        </config>
    
    </fontconfig>
    
    chrome等其他浏览器可以在浏览器设置里改一下字体风格,然后在/etc/fonts/新建一个local.conf文件写入(这里我感觉设置差别不大):
    <?xml version="1.0"?>
    <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
    <fontconfig>
        <match target="font">
            <edit name="autohint" mode="assign">
                <bool>false</bool>
                </edit>
            <edit name="hinting" mode="assign">
                <bool>false</bool>
            </edit>
            <edit name="hintstyle" mode="assign">
                <const>none</const>
            </edit>
        </match>
    </fontconfig>
    
  • 字体放大倍数. 字体设置在“优化-字体”中设置为放大1.21倍,勉强能看,否则浏览器的字体太小。
  • docky栏,往像mac的路上越走越远。。。。。
    yay -S docky ##使用docky,如果遇到有依赖需要安装,先根据提示安装依赖即可。
    配置如下:
    dockey配置
    效果图如下: docky效果

几点疑问

  • 开机随缘进系统,当时不知道原因,还重装了一次,后面把grub中quiet的选项关闭后才知道会随机卡在某几个地方(有时还会卡在TLP system startup/shutdown,不过把video-vesa卸载后就没再出现了),见下图。如果有大佬知道解决方法或者思路的麻烦告知下,目前的方法是等开机等待时间走完进系统,有概率能进系统。
  • grub中配置问题。以下配置中if和else中执行步骤一样,为什么还要写if-else ?
    setparams 'Manjaro Linux'
          savedefault
          load_video
          set gfxpayload=keep
          insmod gzio
          insmod part_gpt
          insmod ext2
          if [ x$feature_platform_search_hint = xy ]; then
            search --no-floppy --fs-uuid --set=root  89a0e05f-6c94-47e5-bdb6-67a0c8682fc2
          else
            search --no-floppy --fs-uuid --set=root 89a0e05f-6c94-47e5-bdb6-67a0c8682fc2
          fi
          linux   /boot/vmlinuz-5.3-x86_64 root=UUID=89a0e05f-6c94-47e5-bdb6-67a0c8682fc2 rw  apparmor=1 security=apparmor udev.log_priority=3 acpi_osi="Windows 2015"
          initrd  /boot/amd-ucode.img /boot/initramfs-5.3-x86_64.img
    
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!