Arch Linux Installation Little Note
This is just an essay to record the process of starting from a new installation of Arch Linux to a variety of software configurations during use.
In fact, for Linux with rolling updates like Arch Linux, there is little need to reinstall the system. It's just that some of the problems you get when you start using Arch Linux don't really know why or the problem is covered up, so it's good to write some documentation and back up some of the files that you spend time configuring, whether you use it again or if you sort it out later.
Note: This is not a complete process for installing Arch Linux, ArchWiki is. But for some users it can be used as a reference.
1. System Installation Boot mode
Check whether the boot mode supports UEFI, which will determine the steps to install the Bootloader phase:
ls /sys/firmware/efi/efivars
Network connection
Wired users can generally connect to a network when DHCP can obtain IP, and wireless users can use the following command to select a network connection:
wifi-menu -o wlp3s0 # 使用WiFi
Test whether the network is connected:
E ping-c 3 www.archlinux.org
Time
Enable NTP service to update the system time to ensure the accuracy of the time:
timedatectl set-ntp truetimedatectl status
Disk
View the disk information to select the disk used:
lsblk
Create/change disk information, where disk/DEV/SDB is re-partitioned, using GPT format:
parted /dev/sdb(parted) mklable gpt(parted) mkpart ESP fat32 1MiB 513MiB(parted) set 1 boot on(parted) mkpart primary ext4 513MiB 100%
To format a partition:
mkfs.fat -F32 /dev/sdbmkfs.ext4 /dev/sdx
Mount Partition:
mount /dev/sdb2 /mntmkdir /mnt/bootmount /dev/sdb1 /mnt/boot
Mirror
Select the image server to use for installation, generally use the China several, to extract the notes/move to the top of the file:
vim /etc/pacman.d/mirrorlist
Synchronize the mirror server and install:
pacman -Syy #一般不需要,但可以测试选择镜像服务器速度用pacstrap -i /mnt base base-devel
Fstab
Generate Fstab as a UUID:
genfstab -U /mnt >> /mnt/etc/fstab
Check and modify Fstab
vim /mnt/etc/fstab
Because SSD is used and trim is supported, modify parameters to reduce hard disk writes and add discard to enable Trim:
UUID=xx / ext4 defaults,noatime,discard 0 1 # relatime -> noatime & add discard
Chroot
Chroot system to complete the final work of the installation:
arch-chroot /mnt /bin/bash
Install some tools
Some of the most commonly used tools are preinstalled here, and more tools can be installed after the system is installed:
pacman -S vim intel-ucode iw wpa_supplicant dialog zsh # intel-ucode是intel的微码工具
Localization
Edit the following file to extract the type of the annotation used:
vim /etc/locale.gen
To make it effective after saving:
locale-gen
To create localization options:
echo LANG=en_US.UTF-8 > /etc/locale.conf
Time
Set the time zone and sync to the system clock:
tzselectln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtimehwclock --systohc --utc
RAMDisk
Create the initial RAMDisk:
mkinitcpio -p linux
Bootloader
Because UEFI + GPT is used, the boot information is generated directly using the SYSTEMD tool:
bootctl install
To create a startup configuration file:
vim /boot/loader/entires/arch.conf
Add the following information:
title Arch Linuxlinux /vmlinuz-linuxinitrd /intel-ucode.img #安装intel-ucode后添加initrd /initramfs-linux.imgoptions root=/dev/sdb2 rw #/文件系统的分区
To modify the file default startup information:
vim /boot/loader/loader.conf#add default arch & add timeout 0
Computer name
Set the name of this system:
echo leesheen-X240 > /etc/hostname
and add the same host name to the/etc/hosts:
vim /etc/hosts# 添加 leesheen-X240 到文件中两行内容的末尾
Root password
To set the root user password:
passwd
Complete
Exit Chroot Environment:
exit
To unmount a disk:
umount /mnt -R
Restart:
reboot
2. After the system is installed
After the system restarts, log in to the system as the root user.
Set Network
Todo
LAN
Wlan
User
Normally we should use the Linux system with normal (non-root) users, and use sudo when root is required.
To create a Leesheen user:
useradd -m -G wheel -s /bin/zsh leesheenpasswd leesheen
Add the Leesheen user to the sudo user group:
vim /etc/sudoers#add leesheen ALL=(ALL) ALL
AUR
The user software source for Arch Linux has a huge resource, which is one reason Archer loves it, Yaourt is a great Aur helper tool that helps users automate intermediate processes.
To edit a Pacman configuration file:
vim /etc/pacman.conf
To add a ARCHLINUXCN source:
[archlinuxcn]SigLevel = Optional TrustAllServer = http://mirrors.163.com/archlinux-cn/$arch
The source of the Arch wiki is a bit slow, there are domestic source addresses, you can test the speed of your own choice:
Server = http://repo.archlinuxcn.org/$archServer = http://mirrors.ustc.edu.cn/archlinuxcn/$archServer = https://mirrors.ustc.edu.cn/archlinuxcn/$archServer = http://mirrors.cqu.edu.cn/archlinux-cn/$archServer = http://mirrors.163.com/archlinux-cn/$archServer = http://mirrors.hustunique.com/archlinuxcn/$archServer = http://mirrors.4.tuna.tsinghua.edu.cn/archlinuxcn/$archServer = http://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch # both IPv4 & IPv6Server = http://mirrors.6.tuna.tsinghua.edu.cn/archlinuxcn/$arch # only IPv6
Update the source and install Yaourt when you are finished modifying:
pacman -Syu yaourt
Driven
User host for ThinkPad X240,intel Haswell HD4400 Single set:
To install the ThinkPad Touchpad driver:
pacman -S xf86-input-libinput xf86-input-synaptics
To install the display driver:
pacman -S mesa-libgl xf86-video-intel libva-intel-driver libvdpau-va-glmesa-demos
Voice
The kernel is already integrated with the ALSA driver, where the tools are installed:
pacman -S alsa-utils
ThinkPad X240 recognizes two sound cards by default, setting the audio card of the HDMI channel as the default, if you want to use notes
This is the sound card, set the PCH to the default, add the boot load file:
TODO look PCM
vim /etc/modprobe.d/alsa-base.conf
Add the following code settings:
# Set pcm is default sound cardoptions snd_pcm index=0options snd_hda_intel index=1
Reboot, the PCH sound card becomes the default sound card.
Switch users
The above operations basically completed the installation of the Arch Linux core, the following for different users and different needs of the operation, will also be logged in as a normal user.
Reboot to log in as a normal user
reboot
3. User Software Installation Gfwshadowsocks
Shadowsocks is a lightweight SOCKS5 agent, written in Python.
Install SS:
sudo pacman -S shadowsocks libsodium python2-numpy python2-salsa20 python2-m2crypto
To copy the default configuration file:
sudo cp /etc/shadowsocks/example.json /etc/shadowsocks/config.json# 按自己shadowsocks配置修改
Background boot service and boot:
sudo systemctl enable [email protected]sudo systemctl start [email protected]
Proxychains
Most of the time the application does not support proxies or some proxy methods, Proxychains is a tool that will globally SOCKS5 proxy classes. Installation:
sudo pacman -S proxychains-ng
Modifying a configuration file/etc/proxychains.conf
# 修改最后一行socks5 127.0.0.1 1080
Then you can use it in terminal to let XXX app go SOCKS5 agent:
proxychains xxx
Git
Git is more than just a version management tool, and many times it's a tool for getting content. Installation:
sudo pacman -S git
To configure Git:
git config --global user.name "Lee Sheen"git config --global user.email "[email protected]"
Many times it is difficult to access GitHub, and most of my git is done on GitHub, so let all git use the SOCKS5 agent to ensure speed. Of course, you can not add, in the difficult time of access with proxychains use, add proxy information:
git config --global https.proxy ‘socks5://127.0.0.1:1080‘git config --global http.proxy ‘socks5://127.0.0.1:1080‘
Configuration file
In order to synchronize the multi-computer configuration is convenient, I have some configuration files synced to GitHub, first the configuration file clone down:
mkdir ~/Toolscd ~/Toolsgit clone https://www.github.com/leesheen/config-linux.git
Under ~/tools/config-linux/is the configuration file that is needed later.
Zsh
Zsh is a powerful shell that we use instead of the system's default bash. Before we have installed:
# pacman -S zsh
Zsh's high customization makes it more complicated to get a good configuration, but there is an open source project called Oh-my-zsh, which uses the official website's script to configure the installation directly:
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"# 或者使用wgetsh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"# 没有速度可配合Proxychains使用,或者执行备份脚本的内容:./Tools/config-linux/script/ohmyzsh_install.sh
Add Alias
vim .zshrc#添加需要的alias到最后alias pcs=‘proxychains -q‘
Note: If you want to use this configuration of zsh under the root user, execute the above command under root
Vim
Vim is a powerful editor, and the most powerful thing for me is its speed, and the processing of files of any size does not lag. Whether it is code or markdown, it's smooth let me work more focused, before the initial installation we have installed:
# pacman -S vim
Youcompleteme has a powerful complement and semantic check feature to install:
yaourt vim-youcompleteme-git
YCM Check semantics requires clang support, installation:
pacman -S clang
Link global configuration file to configuration directory J
Ctags is a weapon for tracking files under Linux, installed:
pacman -S ctags
Its strength is also its high customizable line, rich plugins make our work simpler, but unlike other plug-in rich tools (chrome/atom), it does not have an official channel to manage these plugins, so use a plug-in to manage these plugins, it is called Vundle, To install using git:
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
Link the configured VIMRC to the VIMRC of the home directory:
ln ~/Tools/config-linux/config/vimrc ~/.vimrc
Type the command to install the plugin:
Note: If the root user or sudo under the use of Vim is also plug-in, the above steps under the root user also operate the Powerline plugin requires additional fonts, installation:
yaourt ttf-cosolas-powerline
Keyboard
Xbindkeys is a program that allows users to customize key values, and we can use it to customize some keys
such as mute and increase or decrease the volume of the shortcut keys can not be used, etc., installation:
sudo pacman -S xbindkeys
The configuration in the configuration file is used here:
ln ~/Tools/config-linux/config/xbindkeysrc ~/.xbindkeysrc
This file uses the following tools
- Sound: alsa-utils The above has been installed;
- BackLight: xinit-backlight The above has been installed;
- Multiscreen: Lxrandr needs to be installed;
- Wi-Fi: The default button can use Up/down Wi-Fi;
- Setting:todo
- Search:todo
- Finder: xfce4-appfinder the following xfce4 installation;
- FileManager: Nautilus the following xfce4 installation;
Install the tools you need to install above:
sudo pacman -S lxrandr
add Xbindkeys boot to XINITRC, which is already included in the following configuration file.
x/Desktop Environment/window manager xorg:
Xorg is an open source implementation of the X11 window System that requires X mates when using a desktop environment or window manager.
Install xorg and its kits:
sudo pacman -S xorg-server xorg-server-utils xorg-apps xorg-xinitln ~/Tools/config-linux/config/xinitrc ~/.xinitrc# 其中添加了fcitx和启动i3cp /etc/X11/xinitrc/xserverrc ~/.xserverrc
Installing XFCE
Xfce4 is a lightweight, modular desktop environment. It is generally used as a backup when a desktop environment is required.
To install Xfce4 and common software packages:
sudo pacman -S xfce4 xfce4-goodiesyaourt solarized-dark-themes
Installing NetworkManager
pacman -S networkmanager network-manager-applet xfce4-notifyd dnsmasq ppp rp-pppoe modemmanagersudo systemctl enable NetworkManagersudo systemctl start NetworkManager
Install Bluetooth:
pacman -S bluez bluez-utils bluemansudo systemctl enable bluetoothsudo systemctl start bluetooth
If you need to boot Bluetooth, add the following file:
vim /etc/udev/rules.d/10-local.rules# Set bluetooth power upACTION=="add", KERNEL=="hci0", RUN+="/usr/bin/hciconfig hci0 up"
Pairing a Bluetooth mouse:
If you use a dual system and use a Bluetooth mouse, then let the two systems use each other without pairing:
sudo pacman -S chntpwmount /dev/sda4 /mnt/tmp/
Execute under CHNTPW:
cd ControlSet001\Services\BTHPORT\Parameters\Keys ls
Copy the 16 binary code and remove the space
90C13638D41763DF52243F17D566146Fsu # 切换到root模式cd /var/lib/bluetooth/ls
Replace the above copied 16 binary code with the value of key, and save the restart will take effect.
To install a VPN:
yaourt strongswan yaourt networkmanager-strongswan
To install the I3 window Manager:
The efficiency of window manager is much bigger than the desktop environment after habit, AWESOME/I3-WM and so on are representatives, and I3-WM is simple and efficient.
sudo pacman -S i3-wm i3lock i3status
Todo
yaourt dmenu2 yaourt j4-dmenu-desktop-git
To create a i3 configuration file:
mkdir -p ~/.config/i3 ~/.config/i3statusln ~/Tools/config-linux/config/i3/config ~/.config/i3/configln ~/Tools/config-linux/config/i3/i3status ~/.config/i3status/config
Background
pacman -S feh imagemagickfeh --bg-scale /path/to/image
The installation configuration is completed to enter X, usually into the i3:
startx
Browser
Personally like the Chrome browser, in the arch under the Pacman Library for open-source chromium, does not include flash components, but now many sites in the domestic lack of flash, I choose to install at the same time, when using the battery in the mobile state to choose chromium. Install Chrome/chromium:
sudo pacman -S chromiumyaourt google-chrome-stable
Font
Installs the common English font and the Chinese font, the individual very likes the Adebe source series of sources font, installs:
sudo pacman -S ttf-dejavu wqy-microheisudo pacman -S adobe-source-code-pro-fonts adobe-source-sans-pro-fonts adobe-source-serif-pro-fonts adobe-source-han-sans-cn-fontsyaourt ttf-monaco
TODO Config terminal default Chinese font
Input
Personal likes to use the FCITX framework, the Chinese input method provided in this framework is relatively useful, here only choose to install Sogou Input method:
sudo pacman -S fcitx fcitx-im fcitx-qt5 fcitx-configtoolyaourt fcitx-sogoupinyin
Using Fcitx-configtool to add Sogou Pinyin under X, after reloading FCITX, use the SHIFT key to switch between Chinese and English.
Terminal
Think that before using KDE Plasma, very like konsole, but in fact xfce4-terminal as can complete konsole work, and lighter.
Xfce4-terminal
Xfce4-terminal has been installed during the XFCE installation.
To add a configuration file:
# 创建配置文件目录mkdir -p ~/.config/xfce4/terminal# 链接配置文件ln ~/Tools/config-linux/terminalrc ~/.config/xfce4/terminal/terminalrc
Konsole
To install Konsole, select VLC for the back end:
# sudo pacman -S konsole
Mediamplayer
MPlayer is an open-source player that works quickly and installs:
sudo pacman -S mplayer# 自带解码包依赖
TODO: Profile Subtitles
File Manager
Usually the Thunar under Xfce4 is rarely used, and the installation Xfce4 already contains Thunar.
- Dropbox
Yaourt Thunar-dropbox
Yaourt Dropbox-experimental
Compression
To install the commonly used compression/decompression tools:
sudo pacman -S unzip p7zip lzop cpio unrar
Disk
Before using Windows, so the hard disk contains NTFS partitions and additional EXT4 partitions, first install the necessary disk utility to support FAT/NTFS/EXFAT/HFS and other partition formats:
The above configuration file contains the default fstab, which mounts the NTFS partition (data) and Linux EXT4 (data) used by Windows in hard disk 1 under the directory of the corresponding device name under/MNT:
sudo mkdir /mnt/sda6 /mnt/sda8 /mnt/sda9 /mnt/tmpsudo chmod g+w *sudo ln ~/Tools/config-linux/config/fstab /etc/fstab# 危险,应该添加额外的配置sudo hdparm -I /dev/sdb | grep TRIMsystemctl enable fstrim.service fstrim.timersystemctl start fstrim.service fstrim.timer
Markdown
There are a lot of better MD tools, like Atom, remarkable, etc., but the remarkable preview always has a problem, Atom uses a bit of lag, so still use vim edit, chrome plugin real-time preview way.
Atom
Atom is the official GitHub editor with native support for Markdown, which installs Atom:
yaourt atom-editor
Like other great editing tools, Atom has a number of plugins that install markdown-related MD-to-PDF and Vim-mode plugins:
apm vim-mode ex-mode markdown-pdf# Atom的插件在Github上,可以使用proxychains协助安装
Vim + Chrome Plugin
Search for markdown Preview Plus in Chrome's webstore and install
Open chrome://extensions/and tick "Allow access to file URLs" in its settings page
Open the local markdown file in Chrome, Http/https is also supported, you will see the content that has been converted to HTML
Enter the file path in the Chrome address bar to open the markdown file, use vim to edit the markdown, save the page will be automatically refreshed, to achieve a preview.
Add the following to the VIMRC:
autocmd BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn} map <Leader>p :!start "C:\Program Files\Google\Chrome\Application\chrome.exe" "%:p"<CR>
You need to preview when you enter \p to open the browser preview.
Image
ImageMagick
Download
Wget
Ssh
yaourt openssh-hpn-git
Wps
yaourt wps-office ttf-wps-fonts
Index
pacman -S mlocateupdatedb
Kvm
pacman -S qemu libvirt pm-util virt-managerpacman -S ebtables dnsmasq bridge-utils openbsd-netcat
To modify a configuration file:
vim /etc/libvirt/libvirtd.conf# 解注释下面的配置unix_sock_group = "libvirt"unix_sock_ro_perms = "0777" # set to 0770 to deny non-group libvirt usersunix_sock_rw_perms = "0770"auth_unix_ro = "none"auth_unix_rw = "none"systemctl enable libvirtd.service virtlogd.servicesystemctl start libvirtd.service virtlogd.service
Nfs
pacman -S nfs-utils
Configuration file
vim /etc/exports添加/srv/nfs4/ 192.168.1.0/24(rw,fsid=root,no_subtree_check)/srv/nfs4/music 192.168.1.0/24(rw,no_subtree_check,nohide) # note the nohide option which is applied to mounted directories on the file system.vim /etc/conf.d/nfs-server.conf添加NFSD_OPTS="-N 2 -N 3"
Start the service
systemctl enable nfs-serversystemctl start nfs-server
Samba
pacman -S sambacp /etc/samba/smb.conf.default /etc/samba/smb.conf
Geditvirtualbox
pacman -S virtualbox virtualbox-guest-iso qt4 net-toolsyaourt virtualbox-ext-oraclegpasswd -a leesheen vboxusers
Temp
pacman -S hddtemp
Arch Linux Installation Little Note