Skip to content

ArchLinux:Installation

Arch Linux 설치 방법에 대한 정리.

USB media

In macOS

First, you need to identify the USB device. Open /Applications/Utilities/Terminal and list all storage devices with the command:

$ diskutil list

Your USB device will appear as something like /dev/disk2 (external, physical). Verify that this is the device you want to erase by checking its name and size and then use its identifier for the commands below instead of /dev/diskX.

A USB device is normally auto-mounted in macOS, and you have to unmount (not eject) it before block-writing to it with dd. In Terminal, do:

$ diskutil unmountDisk /dev/diskX

Now copy the ISO image file to the device. The dd command is similar to its Linux counterpart, but notice the 'r' before 'disk' for raw mode which makes the transfer much faster:

Note

BSD-derived [[dd], which includes macOS's default dd, uses lower-case m suffix. This differs from GNU dd, used elsewhere in this article.

$ sudo -H -s
# dd if=path/to/arch.iso of=/dev/rdiskX bs=1m

This command will run silently. To view progress, send SIGINFO by pressing Ctrl+t. Note diskX here should not include the s1 suffix, or else the USB device will only be bootable in UEFI mode and not legacy. After completion, macOS may complain that "The disk you inserted was not readable by this computer". Select 'Ignore'. The USB device will be bootable.

USB Booting

참고로 ACER Swift3 SF314-42 R7 씬스틸러로 설치를 진행했다.

F2를 사용하여 BIOS 설정페이지로 진입 후, 아래와 같이 설정했다.

  • Boot > Secure Boot > DIsabled
  • Boot priority order:
    1. USB CDROM
    2. USB HDD
    3. UEFI_SHELL

Installation

UEFI를 확인한다.

무선 네트워크 설정

iwd를 사용하여 네트워크에 연결한다. 관련 정보를 해당 항목 참조.

$ systemctl start iwd.service
$ iwctl
[iwd]# device list
[iwd]# station <device-name> scan
[iwd]# station <device-name> get-networks

[iwd]# station <device-name> connect <ssid>
## or
[iwd]# station <device-name> connect-hidden <ssid>

[iwd]# station <device-name> show
[iwd]# quit
$ ifconfig

시스템 시간 설정

timedatectl 항목을 참조하여 시간을 설정한다. 간단히,

$ timedatectl set-timezone Asia/Seoul
$ timedatectl set-ntp true
$ timedatectl status

디스크 파티션 설정

Disk partitioning항목 참조. 예제는 DiskPartitioning:Example:UEFI_with_GPT를 참조.

파티션 포맷

파티션이 생성되면 각각 적절한 파일 시스템으로 포맷 해야 한다. DiskPartitioning:Example:UEFI_with_GPT 와 같이 파티션이 나눠졌다면 다음과 같이 파티션을 포맷해야 한다.

다른 운영 체제와의 잠재적 인 문제를 방지하기 위해 EFI 파티션은 FAT32로 포맷한다. 자세한 내용은 Unified Extensible Firmware Interface#Format the partition항목 참조.

$ mkfs.fat -F32 /dev/sda1

OS 데이터가 저장될 파티션은 다음과 같이 ext4로 포맷한다.

$ mkfs.ext4 /dev/sda2

스왑 용 파티션을 생성 한 경우 mkswap및 swapon을 사용하여 파티션을 초기화하십시오.

$ mkswap /dev/sda3
$ swapon /dev/sda3

파티션 마운트

/mnt에 루트 파티션을 마운트 한다.

$ mount /dev/sda2 /mnt

/mnt/boot에 시스템 파티션을 마운트 한다.

$ mkdir /mnt/boot
$ mount /dev/sda1 /mnt/boot

차 후, genfstab을 사용하여 마운트된 파일 시스템과 스왑 공간을 인식할 것이다.

설치

미러 서버는 /etc/pacman.d/mirrorlist에서 수정할 수 있다. 라이브 시스템에서는 모든 서버가 선택되어 있고 설치 이미지가 만들어진 시점에서 동기화 상태 및 속도에 따라 정렬되어 있다. 목록의 상단에 있는 순서로 우선순위가 주어진다. pacstrap으로 설치할 때 이 미러 목록 파일을 새로운 시스템으로 복사하기 때문에 이 파일을 제대로 수정해 둘 필요가 있다.

pacstrap으로 base, linux, linux-firmware 패키지 그룹을 설치한다.

$ pacstrap /mnt base linux linux-firmware

추가 패키지는 추가 인자로 계속 붙일 수 있다. 또는 chroot 단계를 지나, pacman 명령으로 설치할 수 있다.

시스템 설정

fstab

다음의 명령어으로 fstab 파일을 생성한다. 이때 UUID를 사용하려면 -U옵션을, 레이블은 -L 옵션을 사용하면 된다.

$ genfstab -U /mnt >> /mnt/etc/fstab

생선된 /mnt/etc/fstab파일을 학인해 보면 된다.

chroot

새로운 시스템으로 ROOT를 변경한다.

$ arch-chroot /mnt

추가 패키지 설치

편리한 몇 가지 패키지를 pacman으로 설치한다.

설치 전, 저장소 정보를 업데이트한다.

$ pacman -Syu

텍스트 에디터 vim, neovim:

$ pacman -S vim neovim

패키지 문서를 위한 man:

$ pacman -S man man-db man-pages texinfo

관리자 권한 접근을 위한 sudo:

$ pacman -S sudo

무선 네트워크 연결을 위한 iwd:

$ pacman -S iwd

시간대

TimeZone 설정을 진행한다. /usr/share/zoneinfo/지역명/도시명 파일을 사용한다. Asia/Seoul 을 사용할 경우 다음과 같이 적용한다.

$ ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime

하드웨어 시간대를 hwclock를 사용해 UTC로 설정한다.

$ hwclock --systohc --utc

/etc/adjtime 파일이 생성되었는지 확인한다. hwclock(8)항목 참조.

현지화 설정

/etc/locale.gen 파일 에서 en_US.UTF-8 UTF-8와 필요한 localization을 찾아 주석 표시를 제거하고 locale-gen을 실행한다.

$ vim /etc/locale.gen

## 수정 후 ...
$ locale-gen

언어 설정

시스템 전반의 언어 설정을 관리하는 LANG변수를 설정한다.

$ echo "LANG=en_US.UTF-8" > /etc/locale.conf

locale.conf(5) 항목 참조.

키보드 레이아웃

특별한 설정이 없다면 기본값은 us를 사용한다. 사용 가능한 레이아웃 목록은 다음과 같이 확인할 수 있다.

$ ls /usr/share/kbd/keymaps/**/*.map.gz

키맵 설정은 /etc/vconsole.conf파일에 KEYMAP 환경변수를 추가하면 된다.

$ echo "KEYMAP=us" > /etc/vconsole.conf

레이아웃 수정 방법

loadkeys(1)를 사용하여 레이아웃을 수정할 수 있다. 예를 들어 독일어 키보드 레이아웃은:

$ loadkeys de-latin1

콘솔 폰트/usr/share/kbd/consolefonts/ 디렉토리에 있다. setfont(8)를 사용하여 수정할 수 있다.

호스트이름

hostname(5)을 수정한다. (hostnamectl(1) 을 사용할 수 있는 듯 하다.. <- 확인 요망)

$ echo "호스트명" > /etc/hostname

그리고 hosts(5) 항목을 갱신한다.

$ vim /etc/hosts

다음과 같이 목록을 갱신하면 된다.

127.0.0.1   localhost.localdomain   localhost
::1     localhost.localdomain   localhost
127.0.1.1   호스트명.localdomain    호스트명

호스트이름 항목을 참조.

관리자 설정

관리자 비밀번호를 설정한다.

$ passwd

visudo를 사용하여 sudo 설정을 진행한다.

다음의 부분을 찾는다.

## Uncomment to allow members of group wheel to execute any command
# %wheel ALL=(ALL) ALL

그 후, 다음과 같이 주석을 제거한 후 저장하면 된다.

## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(ALL) ALL

사용자 설정

새로운 사용자를 추가한다.

$ useradd -m -g users -G wheel -s /bin/bash [사용자명]

옵션은 다음과 같은 의미가 있다.

  • -m: 사용자 이름의 홈 디렉토리 생성.
  • -g [그룹명]: 소문자 g는 기본 그룹을 의미한다. /etc/group에 그룹 목록이 있다.
  • -G: 추가 그룹 설정.
    • power는 이제 안쓰이는 그룹. 사용하지 말자.
    • sotragesystemd를 흡수하기 전에 사용된 추가 그룹. 사용하지 말자.
    • wheelsudo와 su등의 프로그램을 사용하기 위한 관리자 그룹.
  • -s [쉘 실행파일 경로]: 사용할 기본 쉘 프로그램 선택

사용자 비밀번호를 설정한다.

$ passwd [사용자명]

부트 로더 설치

GRUB와 efibootmgr 패키지를 설치한다.

$ pacman -S grub efibootmgr

GRUB를 설치한다.

$ grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch --recheck

정상적으로 설치되면 다음과 같은 메시지가 출력된다.

Installing for x86_64-efi platform.
Instrallation finished. No error reported.

/etc/default/grub파일을 확인하여, 기본 설정을 변경할 수 있다. 이 파일을 기반으로 부팅 파일을 생성한다.

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

정상적으로 생성되면 다음과 같은 메시지가 출력된다.

Generating grub configuration file ...
Found linux image: /boost/vmlinuz-linux
Found initrd image: /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot: initramfs-linux-fallback.img
done

종료 및 재부팅

chroot 환경에서 종료한다.

$ exit

마운트 되어있던 장치들을 제거한다.

$ umount /mnt/boot
$ umount /mnt

또는 아래와 같이 Recursive 옵션을 추가한다.

$ umount -R /mnt

그리고 재부팅 한다.

$ reboot

무선 네트워크 구성

DNS 관리를 위해, iwd에서 기본 값으로 사용하는 systemd-resolved를 기동한다.

$ systemctl start systemd-resolved.service
$ systemctl enable systemd-resolved.service

iwd의 설정파일인 /etc/iwd/main.conf를 다음과 같이 수정한다.

[General]
EnableNetworkConfiguration=true

그리고 iwd를 기동한다.

$ systemctl start iwd.service
$ systemctl enable iwd.service

상단의 iwctl을 사용하여 연결을 완료하면 /var/lib/iwd/ 디렉토리에 해당 SSID의 설정파일이 저장된다.

아래의 명령으로 IP가 정상적으로 할당 되었는지 확인한다.

$ ip addr

그리고 외부 네트워크 연결이 정상적으로 되는지 확인한다.

$ ping www.google.com

추천 항목

시스템 관리에 대한 안내, GUI 환경 설정, 소리, 터치패드 등 추가적으로 해야 할 일은 일반 추천 사항을 보십시오.

관심을 가질 만한 프로그램 목록도 참고하십시오.

Next: ArchLinux:Setup

See also

Favorite site

References


  1. Arch_Linux_Installation_Guide-W._H._Jeon.pdf