yuanyeex-wiki

Yuanyeex is coding ...

Manjaro初始化安装

2023-02-25 3 min read Manjaro Yuanyeex

Manjaro是我最近用的很顺手的linux发行版,可以说是开箱即用,安装简单,驱动也很完整。安装完Manjaro后,需要做一些配置,包括国内镜像、常用软件等,这里把常见的操作记录下来。

1. Manjaro镜像

修改使用国内镜像:

sudo pacman-mirrors -c China

添加 archlinuxcn 源,获得更多的包:sudo vim /etc/pacman.conf

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

添加完成后,更新系统和软件:

sudo pacman -Syyu

安装yay AUR助手,后续可以使用yay安装应用:

sudo pacman -S yay base-devel

base-devel在后续使用yay构建包的时候会用到。

2. 输入法配置

安装fctix5输入法框架、中文输入法、安装美化包以及词库:

yay -S fcitx5-im fcitx5-chinese-addons fcitx5-material-color fcitx5-pinyin-zhwiki

安装完成后,在/etc/environment中添加如下内容,解决某些程序中不能输入中文的情况:

GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx

注销当前用户后,重新登陆,打开fcitx5-configtool进行配置,把“Only Show Current Language”点掉后,添加pinyin到输入法,然后在插件中配置云拼音为baidu,并选择喜欢的输入法主题。

3. 常用软件安装

3.1 常用终端工具

  • tree:文件目录命令行
  • python-pip:Python用户必备
  • neovim:更好用的vim
  • neofetch:查看系统信息
  • screenkey:显示按下的键
  • figlet:生成一个 logo
  • iputils:允许用户使用 ping 命令
sudo pacman -S tree python-pip neovim neofetch screenkey figlet iputils

这里安装的是nvim,如果习惯使用vim命令,有两个方法,一个是alias vim为nvim,或者创建软连接,当然也可以直接安装vim。

3.2 Google Chrome

不多说了,直接安装

yaya -S google-chrome

3.3 flameshot火焰截图

sudo pacman -S flameshot

3.4 安装deb程序包

3.4.1 安装debtap

manjaro下可以使用debtap工具安装deb程序包。首先安装debtap。

## 看是否已经安装
sudo pacman -Q debtap

## 如果没有安装,执行安装
yay -S debtap

替换deb的源为国内镜像,打开/usr/bin/debtap,更换debtap内容:

替换:<http://ftp.debian.org/debian/dists>
<https://mirrors.ustc.edu.cn/debian/dists>

替换:<http://archive.ubuntu.com/ubuntu/dists>
<https://mirrors.ustc.edu.cn/ubuntu/dists/>

或者使用aliyun的源:https://mirrors.aliyun.com/,要快一些。

3.4.2 使用debtap安装deb包

使用debtap转deb包:

sudo debtap xxx.deb

安装时会提示输入包名,以及licene,包名默认,护着看着写,license写GPL吧。 上述操作完成后,会生一个XXX.tar.xz的文件,就可以直接使用pacman安装了:

sudo pacman -U x.tar.xz

3.5 oh-my-zsh

manjaro已经自带了zsh,只需要再安装oh-my-zsh就好了。

wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh

接下来安装一些常用的插件。

3.5.1 自动补全

地址: GitHub - zsh-users/zsh-autosuggestions: Fish-like autosuggestions for zsh

git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

安装完成后,在~/.zshrc中,plugins列表中添加: zsh-autosuggestions

plugins=( … other plugins .. zsh-autosuggestions )

3.5.2 语法高亮

地址: GitHub - zsh-users/zsh-syntax-highlighting: Fish shell like syntax highlighting for Zsh.

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting ​

安装完成后,在~/.zshrc中,plugins列表中添加: zsh-syntax-highlighting

plugins=( … other plugins .. zsh-syntax-highlighting )

3.5.3 自动跳转

终端目录自动跳转神器。

git clone https://github.com/wting/autojump
cd autojump
./install.py
cd ..
rm -rf autojump

install脚本执行后,会有一段文本,按照提示将相关内容复制到~/.zshrc中。

3.6 NVM及node

3.6.1 安装nvm

安装命令:

yay -S nvm

安装完成后,安装日志户提示需要nvm添加到shell初始化脚本:

You need to source nvm before you can use it. Do one of the following
or similar depending on your shell (and then restart your shell):

  echo 'source /usr/share/nvm/init-nvm.sh' >> ~/.bashrc
  echo 'source /usr/share/nvm/init-nvm.sh' >> ~/.zshrc

You can now install node.js versions (e.g. nvm install 10) and
activate them (e.g. nvm use 10).

init-nvm.sh is a convenience script which does the following:

[ -z "$NVM_DIR" ] && export NVM_DIR="$HOME/.nvm"
source /usr/share/nvm/nvm.sh
source /usr/share/nvm/bash_completion
source /usr/share/nvm/install-nvm-exec

You may wish to customize and put these lines directly in your
.bashrc (or similar) if, for example, you would like an NVM_DIR
other than ~/.nvm or you don't want bash completion.

这里我选择使用init-nvm.sh脚本:

echo 'source /usr/share/nvm/init-nvm.sh' >> ~/.zshrc

3.6.2 安装node

安装LTS版本的node:

nvm install --lts

也可以安装多个node,并取别名:

nvm install 10.24.1
nvm alias old 10.24.1
nvm alias default 16.13.2

3.6.3 配置taobao镜像

将如下内容添加到~/.zshrc

# 修改nvm下载源为taobao镜像源
export NVM_NODEJS_ORG_MIRROR=http://npm.taobao.org/mirrors/node
export NVM_IOJS_ORG_MIRROR=http://npm.taobao.org/mirrors/iojs

3.7 visual studio code

安装命令:

yay -S visual-studio-code-bin

3.8 go & hugo

sudo pacman -S go

配置国内镜像:

# 启用 Go Modules 功能
go env -w GO111MODULE=on

# 2. 阿里云
go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/,direct

国内还有其他常用的代理,比如:

# 配置 GOPROXY 环境变量,以下三选一

# 七牛 CDN
go env -w  GOPROXY=https://goproxy.cn,direct
# 官方
go env -w  GOPROXY=https://goproxy.io,direct

选择一个使用即可,这里我选择了阿里云。

检查一下是否配置成功:

➜  ~ go env | grep GOPROXY

GOPROXY="https://mirrors.aliyun.com/goproxy/,direct"

4. 安装无线网卡

通过下面的命令查看网卡信息:

╰─$ lsusb 
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 0bda:c811 Realtek Semiconductor Corp. 802.11ac NIC
Bus 001 Device 006: ID 1532:0037 Razer USA, Ltd DeathAdder 2013
Bus 001 Device 005: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 001 Device 004: ID 3434:0230 Keychron Keychron K3 Pro
Bus 001 Device 002: ID 05e3:0610 Genesys Logic, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

这里的编号0bda:c811是我的无限网卡,通过一番搜索确定网卡驱动

安装过程:

  1. 安装一些必要依赖
sudo pacman -S --noconfirm dkms git bc iw
  1. 安装linux headers
uname -a
sudo pacman -S linux65-headers
  1. 下载驱动文件,解压并安装
sudo sh install-driver.sh

注意安装完成后需要交互保存配置并重启。