Minimalistic Headless CLI Install of Manjaro (2022)
Minimalistic Headless CLI Install of Manjaro.
I have an Manjaro server running for 3+ years now. Why Manjaro ? Because it's not as bleeding edge as Arch. They test more before releasing packages. Why not just use Debian or Ubuntu or "Other Distro" Server ? IMHO: Because AUR + pacman are just great to work with, no big bang every few years, latest updates and it's my Home Server. I have nothing against any other distro's, it's just a personal preference, get over it ! Bleeding edge server !? Tame it ? I use Manjaro for that reason and i run the LTS kernel. Have had no problems. Be sure to check before installing from the AUR, because Arch is ahead of Manjaro. That could lead to a dependancy not being available yet in Manjaro, because it's still being checked. Anyways: I am preparing for a new server and wanted to check if everything still works, before i start installing. Might as wel document it on my website to. Sources: https://forum.manjaro.org/t/root-tip-how-to-do-a-manual-manjaro-installation/12507 https://wiki.archlinux.org/title/installation_guide Tip: https://wiki.archlinux.org/title/System_maintenance#Partial_upgrades_are_unsupported
Minimalistic Headless CLI Install Manjaro
Architect isn't available anymore (it is but has trouble, but you could make an architect iso yourself) For me it's the Arch way then. So i build an Minimalistic Headless Manjaro server from the CLI. Start a Manjaro distro of your flavour Set the Boot settings like "Time Zone" and "Keyboard" and then select "Boot with open source drivers".
In the GUI Make sure the date, time and timezone are set right, else set and sync them before starting. Press 'ctrl+alt+F4' to go to the CLI Login to the Manjaro CLI Login: manjaro Password: manjaro Now elevate yourself so you don't have to sudo all the time
sudo su
Partitioning disk
Let's start by partitioning the disk List all disks To check which disk is which.
lsblk
Just check if you are in efi mode If this folder can not be found, you are not running your bios in uefi mode
ls /sys/firmware/efi/efivars
Use cfdisk to partition your drive Use the --zero argument to empty the whole partition table
cfdisk --zero /dev/sda
Select label type "gpt" when prompted and press enter
EFI or $esp
Select Free space
Select New
512M
Select Type
Select EFI System
root partition.
Select Free space
Enter to assign the remaining space to the ROOT
Select Type
Select Linux root (x86_64)
Save the changes
Select Write
Input yes, not just y, when prompted
Select Quit
Formatting
EFI ($esp) Format the EFI partition (1) with the FAT32 filesystem
mkfs.fat -F 32 /dev/sda1
Root Format the ROOT partition (2) with the EXT4 filesystem
mkfs.ext4 /dev/sda2
Mounting
Before we install the base system we need to mount the devices. First we mount the root system - using the folder /mnt for the temporary mount, then we make a folder for /boot/efi.
mount /dev/sda2 /mnt
mkdir -p /mnt/boot/efi
Verify your folder structure
find /mnt -type d
Now Mount the efi partition
mount /dev/sda1 /mnt/boot/efi
Verify your mounts
lsblk
Pre-Base Install
Before we install anything let's set our mirrors. Set pacman mirrors We use pacman-mirrors to set pacman to:
Fastest Mirrors:
pacman-mirrors --fasttrack
or
Country Specific:
pacman-mirrors -c Country
Install Keyrings Download the databases and install keyrings
pacman -Syy archlinux-keyring manjaro-keyring
Create trust Database Create trust database, populate and refresh keys
pacman-key --init
pacman-key --populate archlinux manjaro
pacman-key --refresh-keys
BASE Install
Base Install First check which kernel you want to install To see which linux kernels are available: https://www.kernel.org/ To check the available kernels through the CLI (for the naming schema):
mhwd-kernel -l
To install the Base: First let look at the arch wiki and the manjaro post: The Arch wiki says:
pacstrap -K /mnt base linux linux-firmware
But the Arch wiki also states: Installing other packages may be necessary for a fully functional base system. In particular, consider installing: - userspace utilities for the management of file systems that will be used on the system, - utilities for accessing RAID or LVM partitions, - specific firmware for other devices not included in linux-firmware (e.g. sof-firmware for sound cards), - software necessary for networking (e.g. a network manager or DHCP client), - a text editor, - packages for accessing documentation in man and info pages: man-db, man-pages and texinfo. The Manjaro Guide says:
basestrap /mnt base $LINUX dhcpcd networkmanager grub mkinitcpio efibootmgr vi nano sudo links
Where $LINUX is the kernel of linux you want to install (linux515 for instance) So the manjaro guide has added all the base packages. But to have both dhcpcd and networkmanager installed is not recommend. NetworkManager is the better one so just install that. Still there are some very important and/ or handy packages missing: base-devel - To build packages from the AUR pamac-cli - To install packages from the AUR linux515-headers - Some driver installs asks for headers manjaro-release - Gives the lsb_release command, which is used by a lot of software. mhwd - Manjaro Linux Hardware Detection library and application mhwd-db - Manjaro Linux Hardware Detection Database mhwd-amdgpu - MHWD module-ids for amdgpu mhwd-nvidia - MHWD module-ids for nvidia linux-firmware - Base firmware package amd-ucode - For AMD processors intel-ucode - For INTEL processors ntfs-3g - NTFS support dosfstools - FAT support exfatutils - exFAT utilities f2fs-tools - f2fs tools needed to make a f2fs btrfs-progs - btrfs support (needed if you run btrfs) linux515-zfs - zfs support (needed if you run zfs) samba - Windows File Sharing (smb) support nfs-utils - nfs (Network File System) support tar - To handle tar.gz files unzip - To un-zip files p7zip - For 7Z files curl - File transfer server git - To download from github man-db - To read manuals with the man command openssh - To remote connect to the machine grub-theme-manjaro - Manjaro's Grub Theme (Just for fun)
This is the basestrap config i used
basestrap /mnt base linux515 networkmanager grub mkinitcpio efibootmgr vi nano sudo links base-devel pamac-cli linux515-headers manjaro-release mhwd mhwd-db mhwd-nvidia linux-firmware amd-ucode ntfs-3g dosfstools exfat-utils samba nfs-utils tar unzip p7zip curl git man-db openssh grub-theme-manjaro
If you want to auto install your videocard AMD use open drivers - free , NVIDIA use proprietary drivers - nonfree More info: https://wiki.manjaro.org/index.php/Configure_Graphics_Cards
# AMD Videocard
mhwd -a pci free 0300
# NVIDIA Videocard
mhwd -a pci nonfree 0300
BASE CONFIG
first generate an fstab file (In Arch the command = genfstab, in Manjaro the command = fstabgen) This mounts all your disks.
fstabgen -U /mnt >> /mnt/etc/fstab
Then edit fstab and replace all "relatime" with "noatime"
nano /mnt/etc/fstab
vi and nano are text editors. To save the file from "vi" type ':wq' (: = Open Command Mode, w = Write, q = quit) To save the file from "nano" use "ctrl+o" (write-out) and hit "enter", then "ctrl+x" (Exit) to exit Next thing is to configure the system in a chrooted environment, using bash as shell. chroot changes the root directory for the current running processes and children.
manjaro-chroot /mnt /bin/bash
Set Console keyboard Set your keyboard layout I use a dutch locale, but we use a US-Int keyboard layout in the Netherlands. Edit vconsole.conf
nano /etc/vconsole.conf
Set your keyboard layout
KEYMAP=us
FONT=
FONT_MAP=
Set Locale This set's the time and date format settings Edit locale.gen
nano /etc/locale.gen
Uncomment the locale you want to use Remove the comment (#) for the locale(s) to be generated (UTF-8 is the recommended choice) TIP: Uncomment the locale 'en_US.UTF-8 UTF-8' as a fallback locale.
English (United States):
en_US.UTF-8 UTF-8
English (United Kingdom):
en_GB.UTF-8 UTF-8
Dutch (Netherlands):
nl_NL.UTF-8 UTF-8
Generate the messages
locale-gen
Make a locale configuration Make a locale configuration in /etc/locale.conf
nano /etc/locale.conf
Add the LANG that you want for messages
LANG=en_US.UTF8
Set Timezone Set the time zone for your location using the Continent/Capitol format. Look in /usr/share/zoneinfo/ for format.
cd /usr/share/zoneinfo/
ls
cd Europe/
ls
Symlink the time zone as /etc/localtime - example for the Netherlands
ln -sf /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime
Set Clock Linux clock runs using the timezone info and UTC time.
hwclock --systohc --utc
Set Hostname Change 'ChangeMe' to the name you want to give your system.
echo ChangeMe > /etc/hostname
Hosts configuration You can skip this and just enable the networkmanager to handle your network. Edit the hosts file
nano /etc/hosts
Change 'ChangeMe' to the name you gave your system. Note: If the system has a static IP replace 127.0.1.1 with the IP.
nano /etc/hosts
127.0.0.1 localhost.localdomain localhost
::1 localhost.localdomain localhost
127.0.1.1 ChangeMe.localdomain ChangeMe
NetworkManager Enable the NetworkManager to have it start at boot
systemctl enable NetworkManager
Systemd-resolved After install i could only reach my server on ip not on server name, this was because systemd-resolved service wasn't running Enable systemd-resolved to have it start at boot
systemctl enable systemd-resolved
Time syncronization Enable the Time Daemon to have it start at boot
systemctl enable systemd-timesyncd
SSH Remote Connection Enable the ssh daemon to have it start at boot
systemctl enable sshd
System administration Allow members of the wheel group to perform administrative tasks. I'm using nano to edit visudo
EDITOR=nano visudo
Locate the line reading # %wheel ALL=(ALL:ALL) ALL and remove the # in the beginning of the line To save the file from "vi" type ':wq' (: = Open Command Mode, w = Write, q = quit) To save the file from "nano" use ctrl+o an hit enter, then ctrl+x to exit
%wheel ALL=(ALL:ALL) ALL
Root password Set a password the root user
passwd
Add a user for yourself Add a user called 'yourself' (Change to your desired username)
useradd -m -G wheel -s /bin/bash yourself
Set password for yourself Set a password for the user 'yourself' (Change to your desired username)
passwd yourself
Bootloader
Now to make initramfs (Root Filesystem Image) and make our grub bootloader Initramfs Build the initramfs
mkinitcpio -P
Bootloader Generate grub for EFI system
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=Manjaro
Generate grub configuration
grub-mkconfig -o /boot/grub/grub.cfg
Finalize
Just some finishing touches and we good. This next one is just for fun.
Change pacman to color and make pacman eat pills in terminal Open pacman.conf
sudo nano /etc/pacman.conf
Uncomment color and add ILoveCandy under # Misc options
Color
ILoveCandy
Now to activate AUR (Arch Universal Repository) support Always double check when installing packages from the AUR because Arch is ahead of Manjaro's release schema. Activate AUR support and AUR updates for pamac Open pamac.conf
sudo nano /etc/pamac.conf
and uncomment the following 2 lines
## Allow Pamac to search and install packages from AUR:
EnableAUR
## When AUR support is enabled check for updates from AUR:
CheckAURUpdate
Close chroot Close the chroot enviroment
exit
Unmount the partitions Unmount the partitions mounted on /mnt
umount -R /mnt
Shutdown your system Remember to remove your install media
shutdown now
Test
Now turn on your server and see if it boots. If it works, your greeted with an command line. Login with your username and password to see if that works to. Now test the following to see if you have internet.
links manjaro.org
If this works, your system is ready to go. You can also test if you can ssh to your system from another machine now. Use it's HostName and/ or ip adress. Samba and zfs-utils need to be setup if you want to use them, but you have to config them before starting the service. That's why i didn't enable them yet.