Archlinux - Installation
Table of Contents
- Preparation
- Installation
- Select the suitable architecture
- Partition disk
- Format the partitions
- Mount the partitions
- Configure network
- Select nearest mirror
- Install the base system and necessary applications
- Generate fstab file
- Chroot into the newly installed system
- Set hostname
- Set time zone
- Set system time
- Set locale
- Create an initial RAM disk
- Install bootloader
- Configure network for the newly installed OS
- Configure SSH service server
- Configure CPU frequency scaling
- Set password for root
- Unmount and reboot
Preparation
- Insert the DVD into the optical driver and reboot the computer.
- In the power-on self-test (POST) stage, press
F11
1 on the screen of BIOS splash to boot the computer from the DVD.
Installation
Select the suitable architecture
When Arch Linux splash appears, choose Boot Arch Linux (x86_64)
.
Partition disk
Divide the entire disk into several partitions, e.g. four partitions for /
, /var
, /tmp
, /home
, respectively. What deserves your attention, /
should be set bootable. With respect to the partition tool, you have so many choices, e.g. fdisk
, cfdisk
. Without loss of generality, we take cfdisk
for instance here.
cfdisk /dev/sda
For example, we have divided the disk into four partitions, e.g. /sda1
, /sda5
, /sda6
, /sda7
2.
Format the partitions
mkfs.ext4 /dev/sda1 mkfs.ext4 /dev/sda5 mkfs.ext4 /dev/sda6 mkfs.ext4 /dev/sda7
Mount the partitions
mount -t ext4 /dev/sda1 /mnt mkdir -p /mnt/{var,tmp,home} mount -t ext4 /dev/sda5 /mnt/var mount -t ext4 /dev/sda6 /mnt/tmp mount -t ext4 /dev/sda7 /mnt/home
Configure network
systemctl stop dhcpcd ip addr add IP_ADDR/24 broadcast BROADCAST_ADDR dev eth0 ip route add default via GATEWAY_IP_ADDR export http_proxy="http://PROXY_IP_ADDR:PORT" export https_proxy="https://PROXY_IP_ADDR:PORT" echo nameserver DNS_SERVER_IP_ADDR >> /etc/resolv.conf
Select nearest mirror
Edit /etc/pacman.d/mirrorlist
as
Server = http://mirrors.163.com/archlinux/$repo/os/$arch
Install the base system and necessary applications
pacstrap /mnt base base-devel os-prober grub openssh nfs-utils boost cpupower libxml2 ntp
Generate fstab file
genfstab -p /mnt >> /mnt/etc/fstab
Chroot into the newly installed system
arch-chroot /mnt
Set hostname
echo COMPUTER_NAME > /etc/hostname
Set time zone
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
Set system time
Prepend following line to /etc/ntp.conf
server head
Enable the network time service
systemctl enable ntpd.service systemctl start ntpd.service
Set locale
Edit /etc/locale.gen
and uncomment the following lines
... en_US.UTF-8 UTF-8 en_US ISO-8859-1 ... zh_CN.GB18030 GB18030 zh_CN.GBK GBK zh_CN.UTF-8 UTF-8 zh_CN GB2312 ...
Generate and set locales
locale-gen echo LANG=en_US.UTF-8 > /etc/locale.conf
Create an initial RAM disk
mkinitcpio -p linux
Install bootloader
grub-install --recheck /dev/sda grub-mkconfig -o /boot/grub/grub.cfg
Configure network for the newly installed OS
Edit /etc/profile
and append following two lines to configure the proxy server.
... export http_proxy="http://PROXY_IP_ADDR:PORT" export https_proxy="https://PROXY_IP_ADDR:PORT"
Create file /etc/netctl/ethernet_static
with its content
Description='A static ethernet connection' Interface=enp1s0f0 Connection=ethernet IP=static Address=('IP_ADDR/24') Gateway='GATEWAY_ADDR' DNS=('DNS_SERVER_IP_ADDR')
Enable the network configuration
netctl enable ethernet_static
Configure SSH service server
Edit file /etc/ssh/sshd_config
as below
... PermitRootLogin yes ...
Enable the SSH service
systemctl enable sshd.service
Configure CPU frequency scaling
systemctl enable cpupower
Set password for root
passwd
Unmount and reboot
exit umount -R /mnt reboot
Congratulation! So far, you have finished the installation of the base system of Arch Linux as a server. You can leave the server room and access the newly installed Linux server remotely for further configuration.