Skip to main content

Arch Linux Initial Setup

··2 mins·
Arch-Linux
Makoto Morinaga
Author
Makoto Morinaga
A personal notebook for tech notes, coding, and system experiments.
Table of Contents

To effectively use Arch Linux as a server, it is essential to set a static IP address and create a dedicated user for administrative tasks (instead of using the root account). This post covers these fundamental configurations along with the installation of necessary management tools.

Configuring a Static IP Address
#

A static IP address is required for a server environment. This configuration is managed using systemd-networkd.

Starting and Enabling Required Services
#

Execute the following commands to start and enable systemd-networkd and systemd-resolved:

Terminal
systemctl start systemd-networkd.service
systemctl start systemd-resolved.service
systemctl enable systemd-networkd.service
systemctl enable systemd-resolved.service

If dhcpcd is enabled, disable it with:

Terminal
systemctl stop dhcpcd.service
systemctl disable dhcpcd.service

Configuring resolv.conf
#

To maintain compatibility, rename the existing file and create a symbolic link:

Terminal
mv /etc/resolv.conf /etc/resolv.conf.org
ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf

Checking the Network Interface Name
#

Determine the NIC device name using:

Terminal
networkctl list

Example output:

Terminal
IDX LINK     TYPE       OPERATIONAL SETUP
1 lo       loopback   carrier     unmanaged
2 ens192   ether      routable    unmanaged

Creating the Network Configuration File
#

Create /etc/systemd/network/static.network and configure it as follows:

/etc/systemd/network/static.network
[Match]
Name=ens192

[Address]
Address=192.168.10.10/24

[Network]
DNS=192.168.10.254

[Route]
Gateway=192.168.10.254

Adjust these parameters according to the network environment.

Parameter Description
Name NIC device name
Address Static IP address
DNS DNS server IP
Gateway Default gateway

Restarting the Service
#

Apply the settings with:

Terminal
systemctl restart systemd-networkd.service

Verify the IP address:

Terminal
ip a

Creating a User Account
#

Creating a Standard User
#

Create a new user by executing:

Terminal
useradd -m -G wheel <username>

Setting a Password
#

Set a password for the new user:

Terminal
passwd <username>

Configuring sudo Access
#

Install sudo if not already available:

Terminal
pacman -S sudo

Edit the sudoers file:

Terminal
EDITOR=vim visudo

Uncomment the following line:

visudo
%wheel ALL=(ALL:ALL) ALL

With this configuration, the user can execute administrative commands using sudo instead of logging in as root.

Installing Essential Packages
#

Log in as the newly created user and install useful management tools:

Terminal
sudo pacman -S git wget man-db man-pages

Related

Managing SSH Connections with ~/.ssh/config
··2 mins
Arch-Linux Ssh
SSH Key Authentication Configuration
··2 mins
Arch-Linux Ssh
Basic SSH Configuration
··2 mins
Arch-Linux Ssh