2019년 5월 2일 목요일

Archlinux 설치

Archlinux 설치

Archlinux 설치

이 문서는 개인 백업 성격이 강한 문서로, laptop에 아치 리눅스를 설치하는 과정 및 개인적으로 설치한 패키지들의 리스트를 정리해 둔 문서이다.

설치 환경

  • ASUS UX390UAK
    • Intel Core i7-7500U
    • DDR3 16GB
    • NVME 512GB
    • Intel HD Graphics 620
    • Windows 10 과 병용
    • UEFI secure boot OFF

설치 준비

인터넷 연결

# CLI 창에서 AP를 선택해 접속
wifi-menu

파티션

# 옛날엔 fdisk만 주구장창 썼는데 써보니 cfdisk가 편함
cfdisk /dev/nvme0n1

설치 환경에서의 파티션 테이블은 다음과 같이 두었다.

장치 타입 크기 포맷 리눅스에서 사용
/dev/nvme0n1p1 Windows 복원 환경 499 MB NTFS X
/dev/nvme0n1p2 EFI 시스템 100 MB FAT32 /boot
/dev/nvme0n1p3 Windows 예약 16 MB X
/dev/nvme0n1p4 Windows 127.4 GB NTFS X
/dev/nvme0n1p5 Linux Data 325 GB Btrfs /
/dev/nvme0n1p6 Linux Swap 24 GB swap swap

포맷

# 주 파일 시스템은 Btrfs
mkfs.btrfs /dev/nvme0n1p5
# Swap 파티션 생성
mkswap /dev/nvme0n1p6
# Swap 파티션 사용
swapon /dev/nvme0n1p6

마운트

# 주 파일 시스템을 먼저 마운트
mount /dev/nvme0n1p5 /mnt
# /boot 디렉토리를 생성하고
mkdir /mnt/boot
# EFI system 파티션을 /boot에 마운트
mount /dev/nvme0n1p2 /mnt/boot

미러 리스트 수정

# Pacman의 미러 리스트를 직접 수정한다.
vim /etc/pacman.d/mirrorlist

한국 서버를 맨 위로 옮긴다. 단, KAIST FTP 서버는 403 error가 발생하므로 옮길 필요 없다.

기본 패키지 설치

# Arch linux 설치
pacstrap /mnt base base-devel

설치 후 환경 설정

마운트 테이블 생성

# 현재 마운트 정보를 /etc/fstab에 저장
genfstab -U /mnt >> /mnt/etc/fstab

루트 변경

arch-chroot /mnt

호스트 네임 설정

# 네트워크 상 다른 컴퓨터에 보여질 이름
echo JGAHN-UX390UAK > /etc/hostname

로케일 설정

/etc/locale.gen 파일의 en_US.UTF-8ko_KR.UTF-8을 주석 해제한다.

vim /etc/locale.gen
locale-gen
echo LANG=en_US.UTF-8 > /etc/locale.conf

시간 설정

echo Asia/Seoul > /etc/timezone
hwclock --systohc --local
ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime

루트 패스워드 설정

passwd

사용자 추가

useradd -m -G users,wheel -s /bin/bash dubhe
passwd dubhe
visudo

visudo 실행해 sudoers 파일의 %wheel ALL=ALL 항목을 주석 해제

부트로더 설치

GRUB

pacman -S grub efibootmgr
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=Arch --recheck
grub-mkconfig -o /boot/grub/grub.cfg
bootctl --path=/boot install

부트 로더 설정 파일 생성

vim /boot/loader/loader.conf

파일 내용

default Arch
editor 1
timeout 3

엔트리 파일 생성

vim /boot/loader/entries/arch.conf

파일 내용

title Archlinux
linux /vmlinuz-linux
initrd /initramfs-linux.img

마지막 option은 따로 추가한다.

echo "options root=PARTUUID=$(blkid -s PARTUUID -o value /dev/nvme0n1p5) rw" >> /boot/loader/entries/Arch.conf

네트워크 프로그램 설치

pacman -S networkmanager dialog

위 둘을 설치해 두면 재부팅 후 wifi-menu 명령으로 인터넷 연결 가능

정리 후 종료

# chroot 종료
exit
# /mnt의 모든 마운트 해제
umount -R /mnt
# 재시작
reboot

GUI 설치

wayland 설치

sudo pacman -S wayland wayland-protocols

GNOME 설치

sudo pacman -S gdm gedit gnome-calculator gnome-calendar gnome-characters gnome-clocks gnome-color-manager gnome-contacts gnome-control-center gnome-disk-utility gnome-font-viewer gnome-keyring gnome-menus gnome-session gnome-settings-daemon gnome-shell gnome-shell-extensions gnome-system-monitor gnome-terminal gnome-weather mousetweaks mutter nautilus accerciser dconf-editor gnome-code-assistance gnome-nettool gnome-tweaks gnome-usage nautilus-sendto sysprof network-manager-applet gnome-bluetooth
sudo systemctl enable gdm
sudo systemctl enable NetworkManager
sudo reboot

여기서 gnome-terminal 패키지는 추후에 gnome-terminal-transparency 패키지를 설치하며 삭제하였다.

AUR helper

yay

git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si

장치 설정

인텔 마이크로 코드

sudo pacman -S intel-ucode
sudo grub-mkconfig -o /boot/grub/grub.cfg

부트로더 엔트리 파일에 마이크로 코드를 initrd로 추가해 주어야 정상적으로 로드 된다.

sudo vim /boot/loader/entries/arch.conf

파일 내용

...상략
linux /vmlinuz-linux
initrd /intel-ucode.img
initrd /initramfs-linux.img
하략...

블루투스

sudo pacman -S bluez bluez-utils
sudo systemctl enable bluetooth

그래픽카드

sudo pacman -S mesa xf86-video-intel vulkan-intel

사운드

sudo vim /usr/share/pulseaudio/alsa-mixer/paths/analog-output.conf.common

위 파일에서 [Element PCM] 항목을 찾아 앞뒤로 각각 [Element Master][Element LFE] 항목을 다음과 같이 추가해 준다. 이는 UX390의 surround sound 하드웨어 때문에 필요한 설정이다.

[Element Master]
switch = mute
volume = ignore

[Element PCM]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right

[Element LFE]
switch = mute
volume = ignore

지문 인식

sudo pacman -S fprintd

GDM을 사용하므로 별도 다른 설정은 필요하지 않다. 지문 등록도 fprintd-enroll을 실행해도 되지만, 그냥 GNOME의 설정 창의 사용자 계정 패널에서 등록 가능하다. 단, 윈도우즈 10과는 다르게 그냥 손가락을 대고 있는 것이 아니라, 센서에 지문을 문질러야 인식 된다.

전원 관리

sudo pacman -S tlp tlp-rdw
yay -S tlpui-git
sudo systemctl enable NetworkManager-dispatcher
sudo systemctl enable tlp
sudo systemctl enable tlp-sleep

Appendix

전체 설치 패키지 설치 목록

패키지 이름 설명 비고
grub GNU GRand Unified Bootloader 2
efibootmgr Tool to modify UEFI Firmware Boot Manager Variables
networkmanager Network connection manager and user applications
dialog A tool to display dialog boxes from shell scripts
wayland A computer display server protocol
wayland-protocols Specifications of extended Wayland protocols
gdm Display manager and login screen
gedit GNOME Text Editor
gnome-calculator GNOME Scientific calculator
gnome-calendar Simple and beautiful calendar application designed to perfectly fit the GNOME desktop
gnome-characters A character map application
gnome-clocks Clocks applications for GNOME
gnome-color-manager GNOME Color Profile Tools
gnome-contacts Contacts Manager for GNOME
gnome-control-center GNOME’s main interface to configure various aspects of the desktop
gnome-disk-utility Disk Management Utility for GNOME
gnome-font-viewer A font viewer utility for GNOME
gnome-keyring Stores passwords and encryption keys
gnome-menus GNOME menu specifications
gnome-session The GNOME Session Handler
gnome-settings-daemon GNOME Settings Daemon
gnome-shell Next generation desktop shell
gnome-shell-extensions Extensions for GNOME shell, including classic mode
gnome-system-monitor View current processes and monitor system state
gnome-weather Access current weather conditions and forecasts
mousetweaks Mouse accessibility enhancements
mutter A window manager for GNOME
nautilus Default file manager for GNOME
accerciser Interactive Python accessibility explorer for the GNOME desktop
dconf-editor dconf Editor
gnome-code-assistance Code assistance services for GNOME
gnome-nettool Graphical interface for various networking tools
gnome-tweaks Graphical interface for advanced GNOME 3 settings (Tweak Tool)
gnome-usage GNOME application to view information about use of system resources
nautilus-sendto Easily send files via mail
sysprof Kernel based performance profiler
network-manager-applet Applet for managing network connections
gnome-bluetooth The GNOME Bluetooth Subsystem
firefox Standalone web browser from mozilla.org
firefox-i18n-ko Korean language pack for Firefox
thunderbird Standalone mail and news reader from mozilla.org
thunderbird-i18n-ko Korean language pack for Thunderbird
bluez Daemons for the bluetooth protocol stack
git the fast distributed version control system
ttf-d2coding D2Coding Fixed Width TrueType fonts AUR
ttf-nanum Nanum series TrueType fonts AUR
ibus Next Generation Input Bus for Linux
ibus-hangul Korean input engine for IBus
google-chrome The popular and trusted web browser by Google (Stable Channel) AUR
code The Open Source build of Visual Studio Code (vscode) editor
enpass-bin A multiplatform password manager AUR
mesa An open-source implementation of the OpenGL specification
xf86-video-intel X.org Intel i810/i830/i915/945G/G965+ video drivers
vulkan-intel Intel’s Vulkan mesa driver
gvfs-google Virtual filesystem implementation for GIO (Google Drive backend)
tumbler D-Bus service for applications to request thumbnails
totem Movie player for the GNOME desktop based on GStreamer
gimp GNU Image Manipulation Program
gthumb Image browser and viewer for the GNOME Desktop
gnome-backgrounds Background images and data for GNOME
tlp Linux Advanced Power Management
tlp-rdw Linux Advanced Power Management - Radio Device Wizard
tlpui-git A GTK-UI to change TLP configuration files easily. It has the aim to protect users from setting bad configuration and to deliver a basic overview of all the valid configuration values. AUR
gnome-terminal-transparency The GNOME Terminal Emulator, with background transparency AUR
chrome-gnome-shell Native browser connector for integration with extensions.gnome.org
qogir-gtk-theme-git Qogir is a flat Design theme for GTK AUR
intel-ucode Microcode update files for Intel CPUs
ms-office-online Microsoft Office Suite Online AUR
evolution Manage your email, contacts and schedule for test
xdg-user-dirs-gtk Creates user dirs and asks to relocalize them
gtk-theme-adwaita-tweaks Tweaks to improve the default GNOME experience. AUR
minicom A serial communication program
alsa-utils An alternative implementation of Linux sound support
fprintd D-Bus service to access fingerprint readers

Gnome extensions

  • Appfolders Management extension: 앱 화면에 폴더 사용
  • Removable Drive Menu: USB 장치 메뉴
  • Remove Dropdown Arrows: 상단 바의 세모 표시 없앰
  • User Themes: 유저 영역에서 테마 설치

Thunderbird extensions

  • Lightning: 달력과 할 일 목록 제공. 기본으로 깔려 있지만 언어가 안 바뀐다. 따로 설치하면 된다.
  • Provider for Google Calendar: 구글 캘린더와 연동

Google Chrome 바로가기

Google Chrome에서 바로가기를 생성할 수 있다. 크롬 메뉴(우상단 점 3개)에서 *도구 더보기 → 바로가기 만들기···*를 선택하면 해당 페이지에 대한 링크가 아이콘과 함께 생성된다. 웹 앱들이 발전하면서 이런 식으로 링크를 걸어 사용할 일이 더욱 많아질 것 같아 이 문서에 남겨둔다. 생성된 링크 파일은 ~/.local/share/applications/ 아래에 chrome-<app-id>-<profile-dir>.desktop 형태로 저장된다. 이렇게 생성한 앱들은 크롬의 앱 창에도 등록이 되어 있다.
삭제는 크롬 앱 창에서 해당 앱을 삭제하면 추가로 물어보는 창이 있다. 같이 삭제 해 주면 GNOME의 앱 메뉴에서도 삭제된다.

기타 개인 설정

Bash 설정

vim ~/.bashrc

파일 내용 수정

#
# ~/.bashrc
#

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

# Prompt
PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\>[\033[00m\]\$ '

if [ -x /usr/bin/dircolors ]; then
	test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
fi

# Alias
alias ls='ls --color=auto'
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias vi='vim'
alias grep='grep --color=auto'

if [ -d "$HOME/.local/bin" ]; then
	export PATH=$HOME/.local/bin:$PATH
fi
if [ -d "$HOME/bin" ]; then
	export PATH=$HOME/bin:$PATH
fi

Vim 설정

vim ~/.vimrc

파일 내용

set tabstop=4
set shiftwidth=4
set visualbell
set nobackup
set cindent
set autoindent
set smartindent
set incsearch
set ruler
set number
syntax on
filetype on
set backspace=eol,start,indent

Git 설정

vim ~/.gitconfig

파일 내용

[user]
   name = <이름>
   email = <이메일>
[core]
   editor = vim
   autocrlf = input
[merge]
   tool = vimdiff

댓글 없음:

댓글 쓰기