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
:
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:
systemctl stop dhcpcd.service
systemctl disable dhcpcd.service
Configuring resolv.conf
#
To maintain compatibility, rename the existing file and create a symbolic link:
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:
networkctl list
Example output:
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:
[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:
systemctl restart systemd-networkd.service
Verify the IP address:
ip a
Creating a User Account #
Creating a Standard User #
Create a new user by executing:
useradd -m -G wheel <username>
Setting a Password #
Set a password for the new user:
passwd <username>
Configuring sudo Access #
Install sudo
if not already available:
pacman -S sudo
Edit the sudoers file:
EDITOR=vim visudo
Uncomment the following line:
%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:
sudo pacman -S git wget man-db man-pages