[HowTo] Install Manjaro using CLI only

Install Manjaro using CLI only


This is how you install Manjaro like a pro using the Arch Way.

This guide uses the Manjaro Architect ISO but you can use any Manjaro ISO - just flip to TTY to get that pro feeling of installing entirely using the terminal.

The guide can also be used to install an Arch Linux - just substitute the arch equivalent (linux or linux-lts, pacstrap and arch-chroot)

  • On bare-metal use CtrlAltF4
  • On VirtualBox use RightCtrlF4

Install Manjaro like a pro using CLI


Many of you know Architect - the installer framework originally created by @carlduff back in 2016 to install ArchLinuxยฎ and later modified by @Chrysostomus to install Manjaro's iso-profiles.

This guide is intended as a reference for basics abstracted by the Architect framework (Steps not guaranteed to be the same order). The guide can be applied as a virtual machine or hardware.

Synopsis


  1. VirtualBox or Hardware
  2. Installation prerquisites
  3. Partitioning
  4. Formatting
  5. Mounting
  6. Base installation
  7. Base configuration
    • Vconsole
    • Locale
    • Timezone
    • Clock
    • Hostname
    • Sudo
    • Network
    • Time sync
    • Root password
  8. Bootloader
    • Init
    • Bootloader
  9. Conclusion

1. Virtual machine or hardware


This guide is a generic guide targeted at UEFI based systems. If you test this using a virtual machine please use the recommended configuration for Manjaro VM.

  • 2 CPU
  • 2 GB memory
  • 32 GB disk (this guide uses 128G disk)
  • Enable EFI
  • Graphics 128MB

Use an up-to-date ISO

For the best result use the most recent Manjaro ISO from OSDN either official or community and write it to an USB or start a virtual machine with the ISO as selected boot media. To write an ISO to USB you can use CLI or install the package mintstick and use USB Image Writer.

2. Installation prerquisites


Load the ISO to your system - virtual or bare-metal.

When you have loaded the system be sure to set the following items.

  1. Keyboard
  2. System time
  3. Branch and mirror
  4. Pacman databases and keyrings
  5. Trust database (pacman keys)

If you used a GUI ISO you have initially selected your preferred keyboard and you can skip this step.

1. Keyboard
Set keyboard on Architect ISO by using loadkeys followed by a country code e.g. for Denmark

# loadkeys dk

The available keymaps can be found by looking in the /usr/share/kbd/keymaps/ folder.

2. System time
Ensure system time is correct - necessary for SSL certificates

# systemctl enable --now systemd-timesyncd

3. Mirror and branch
We use pacman-mirrors to set a mirror and the desired branch.

# pacman-mirrors --api --set-branch unstable --url https://manjaro.moson.eu

You can replace the branch with stable or testing and you can remove the --url argument and use e.g. --continent for closer mirrors.

4. Database and keyrings
Ensure pacman is up-to-date, download the databases and install keyrings

# pacman -Syy pacman archlinux-keyring manjaro-keyring

5. Trust database
Create trust database, populate and refresh keys

# pacman-key --init
# pacman-key --populate archlinux manjaro
# pacman-key --refresh-keys

3. Partitioning disk


If you are using a system with multiple disk devices you need to make sure of you are targeting the right disk, so start with listing your devices. By doing this you will determine which device you want to target for the installation.

NOTE: All your disk devices will be listed - including your removable devices. Removable devices will have 1 in the RM column of the output.

List disk devices

List the devices using the command lsblk. Depending on your system your output may look like this

# lsblk
NAME  MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0   7:0    0  52.5M  1 loop /run/miso/sfs/livefs
loop0   7:1    0 501.3M  1 loop /run/miso/sfs/rootfs
sda     8:0    0   128G  0 disk
sr0    11:0    1 617.4M  0 rom  /run/miso/bootmnt

Partition layout

We need to make a decision on how to partition our device.

A modern system uses EFI and requires a special partition to preload the system.

Depending on your system and the intended use you need to consider making room for swap. Swap space is a temporary storage location for memory shared by applications. If you are using integrated graphics (shared system memory) a swap partition of the same size as your RAM will do it.

A Manjaro system can run with a root partition of less than 10G but doing so will require strict dicipline and maintenance to avoid your system root from running full. A root partition of 20-32G is more than adequate.

Many experienced users like to setup partitions for different purposes. The only extra I will recommend here is a partition to hold the home folders.

This makes a total of 4 (four) partitions:

  1. efi - 300M - FAT32
  2. swap - 2G (or equal to system RAM size)
  3. root - 32G
  4. home - remaining space

Create the partitions

The partitions can be created by script commands or you can use interactive console programs like fdisk or cfdisk. The programs is navigated by keys (arrows, letters, enter and esc) or you can script it using sfdisk.

From our example system listing above - our main disk device is labeled sda and for this guide we use cfdisk.

Note: This command uses the --zero argument to empty the partition table of the selected disk.

# cfdisk --zero /dev/sda

Select gpt label type when prompted and press Enter

The cfdisk is a three part window

  • Top: various device information
  • Center: shows partition info
  • Bottom: displays commands and a short description

There is two (2) block cursors

  • object cursor
  • action cursor

To do something you need to select an object and a command.

Create the partitions according the layout described above.

Be very careful to set the partition type exactly as described as we will let systemd mount the partitions according to partition type. You may expect us to later create a fstab file - surprise - we won't - and you will learn something about Discoverable Partitions Specification

  1. EFI or $esp
    • Select Free space using โ†‘ or โ†“.
    • Select New using โ† or โ†’ โ†’ Enter.
    • 300M press Enter.
    • Select Type โ†’ Enter.
    • Select EFI System โ†’ Enter.
  2. swap partition.
    • Select Free space โ†’ New โ†’ Enter.
    • Enter size 2G โ†’ Enter.
    • Select Type โ†’ Enter.
    • Select Linux swap โ†’ Enter.
  3. root partition.
    • Select Free space โ†’ New &rarr Enter.
    • Enter size 32G โ†’ Enter
    • Select Type โ†’ Enter.
    • Select Linux root (x86_64) โ†’ Enter.
  4. home partition.
    • Select Free space โ†’ New โ†’ Enter.
    • Enter to assign the remaining space to home.
    • Select Type โ†’ Enter.
    • Select Linux home โ†’ Enter.
  5. Save the changes
    • Select Write โ†’ Enter
    • Input yes when prompted โ†’ Enter
    • Select Quit โ†’ Enter

4. Formatting


List your partitions and note that each partition is listed as part of our sda disk device.

# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0    7:0    0  52.5M  1 loop /run/miso/sfs/livefs
loop0    7:1    0 501.3M  1 loop /run/miso/sfs/rootfs
sda      8:0    0   128G  0 disk 
โ”œโ”€sda1   8:1    0   300M  0 part
โ”œโ”€sda2   8:2    0     2G  0 part
โ”œโ”€sda3   8:3    0    32G  0 part
โ””โ”€sda4   8:4    0  93.7G  0 part
sr0     11:0    1 617.4M  0 rom  /run/miso/bootmnt

EFI ($esp)

# mkfs.fat -F 32 /dev/sda1

Swap

# mkswap /dev/sda2

Root

# mkfs.ext4 /dev/sda3

Home

# mkfs.ext4 /dev/sda4

5. 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 folders for /boot/efi and /home.

# mount /dev/sda3 /mnt
# mkdir -p /mnt/boot/efi
# mkdir -p /mnt/home

Verify your folder structure

# find /mnt -type d
/mnt
/mnt/home
/mnt/boot
/mnt/boot/efi

Mount the efi and home partition

# mount /dev/sda1 /mnt/boot/efi
# mount /dev/sda4 /mnt/home

Verify your mounts

# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0    7:0    0  52.5M  1 loop /run/miso/sfs/livefs
loop0    7:1    0 501.3M  1 loop /run/miso/sfs/rootfs
sda      8:0    0   128G  0 disk 
โ”œโ”€sda1   8:1    0   300M  0 part /mnt/boot/efi
โ”œโ”€sda2   8:2    0     2G  0 part
โ”œโ”€sda3   8:3    0    32G  0 part /mnt
โ””โ”€sdc4   8:4    0  93.7G  0 part /mnt/home
sr0     11:0    1 617.4M  0 rom  /run/miso/bootmnt

6. Base installation


When your folder structure and mounts are in place you install the base system into the new partitions.

To get a functional system you need

  • The base meta package
  • A kernel
    • By release linux53
    • Latest linux-latest
    • LTS linux-lts
  • Network
    • Basic ethernet using dhcp
    • For more advanced Network Manager
  • Grub boot loader
  • EFI boot manager
  • Texteditor
    • Any terminal based of your choice, to name a few nano, vi or micro.
  • Sudo

The minimum required is the base meta package. But to actually run the install we need kernel, network, boot loader, efi boot manager, text editor and sudo.

And let's kick in a text mode web browser - just for the fun of it - links - it works everywhere :slight_smile: - easy to check out network connection.

Use basestrap command to install a base set of packages into the newly mounted root

# basestrap /mnt base linux53 dhcpcd networkmanager grub mkinitcpio efibootmgr vi nano sudo links

7. Base configuration


Next thing is to configure the system in a chrooted environment. The tasks to be performed creating the necessary configurations for your system. We will use bash as shell.

:information_source: Using Nano editor press F2yEnter to save and exit.

# manjaro-chroot /mnt /bin/bash

Console keyboard

Keyboard lists are found in /usr/share/kbd/keymaps.
Set console keyboard in /etc/vconsole.conf - example for Denmark

KEYMAP=dk
FONT=
FONT_MAP=

Locale

To generate the messages edit /etc/locale.gen and remove the comment for locale(s) to be generated (UTF-8 is the recommend choice).

Select locale
Example for a system in Denmark using english messages

...
#en_CA ISO-8859-1
en_DK.UTF-8 UTF-8
#en_DK ISO-8869-1
...

TIP: uncomment the locale en_US.UTF-8 UTF-8 as a fallback locale.

Generate the messages

# locale-gen

locale.conf
Edit your locale configuration in /etc/locale.conf to match above choice - example for Denmark

LANG=en_DK.UTF8

Timezone

Set the time zone for location (the available zones is listed in /usr/share/zoneinfo/ using the Continent/Capitol format).

Symlink the time zone as /etc/localtime - example for Denmark

# ln -sf /usr/share/zoneinfo/Europe/Copenhagen /etc/localtime

Clock

Linux clock runs using the timezone info and UTC time.

# hwclock --systohc --utc

Hostname

Set hostname

# echo manjaro > /etc/hostname

Hosts configuration

# nano /etc/hosts

127.0.0.1    localhost
::1          localhost
127.0.1.1    manjaro.localdomain manjaro

Note: If the system has a static IP replace 127.0.1.1 with the IP.

System administration

Allow members of the wheel group to perform administrative tasks.

Run visudo

# visudo

Locate the line reading # %wheel ALL=(ALL) ALL and remove the # in the beginning of the line

%wheel ALL=(ALL) ALL

And press EscShiftzz

Network

Don't enable both - not necessary and not a good idea.

Either enable basic ethernet using dhcpcd

# systemctl enable dhcpcd

or Network Manager if you need e.g. wireless

# systemctl enable NetworkManager

Time syncronization

Enable timesync daemon

# systemctl enable systemd-timesyncd

Root password

Set a password the root user

# passwd

8. Bootloader


Build the initramfs and install and setup grub

Initramfs

Build the initramfs according to your chosen kernel e.g. linux53

# mkinitcpio -p linux53

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

9. Conclusion


Close chroot

# exit

Unmount the partitions

# umount -R /mnt

Restart your system

Remember to remove your install media.

# reboot

Login as root and test your internet connection

$ links manjaro.org

Variations


Screen shot


Sample htop from basic CLI

Get PDF

34 Likes

thanks a lot!

in manjaro, you can also use the following alias to do the same thing, it is your choice:

# update-grub

7 Likes

This is not a guide how to use `manjaro-architect. The title is a bit misleading.

You do everything manually.

5 Likes

Better:

Installing Manjaro the "Arch Way" (CLI only)

Pretty nice tutorial (long expected!)!!

3 Likes

I have been thinking. :laughing:

While I like the expression the "Arch Way" - as it signifies the hands on.

This is a guide to understand the Manjaro installation steps.

Steps normally abstracted by either the Architect framework or Calamares GUI - and a guide describing how to reproduce a very basic Manjaro installation.

So the final topic is [HowTo] Install Manjaro using CLI only.

Thank you for your attention :slight_smile:.

I have added a link to a PDF version - should anyone fancy an offline copy.

4 Likes

No I personally don't like the term "the Arch way". I'd prefer "manually with basestrap command".

1 Like

By hand on command line?

Fair. Still the name describes precisely the method in a cool name.
I don't fear to imply Manjaro relation to Arch. In the contrary IMHO, it shows respect to what Archlinux has offered to Linux world community.

Opinions... Everybody has one! :laughing::rofl:

3 Likes

Thank you for this guide. I think it is very helpful for those who may need to install a minimal OS for a specific purpose. Would it be possible to add/fork this guide to include doing the same thing with encryption? I have to admit that I don't quite get at which step LUKS needs to be used to create an encrypted OS but not just a partition. In other words, imagine installing Manjaro from the CLI to a laptop that you want the whole thing encrypted, just like how this is achieved by using the GUI.

Thanks for considering!

I didn't know either - know I do

2 Likes

Followed this guide today, and then followed up with "Install a basic XFCE environment" from the wiki.

And, as expected, complete success!

I'm thrilled, because this was exactly what I was afer, a nice clean desktop you can build upon yourself.

But just a little heads up to other complete newbies:

At present the base install will fail unless you refresh the keys first:

sudo pacman-key --refresh-keys

And then you can proceed along the guide. Took me a little bit of googling!

1 Like

That puzzles me - I have not got that message - but alas I will mention it.

Been thinking - this could be a side effect of the used install media. Keyrings on the media could be outdated - and I see the logic of refreshing the keys before installing.

Yet again - pacman.conf includes a directive to sync keyrings first- so it should not be necessary to refresh them.

HoldPkg      = pacman glibc manjaro-system
# If upgrades are available for these packages they will be asked for first
SyncFirst    = manjaro-system archlinux-keyring manjaro-keyring

And a very minor thing, it still installs the following:

-Kvantum Manager
-Avahi SSH Server Browser
-Avahi VNC Server Browser
-Avahi Zeroconf Browser

I'll have to go back and read up on how to avoid those.

They don't seem to be absolutely required to me? I'd like to start as clean as possible, and then work from there, it suits my learning style.

Avahi is a dependency of Network Manager - so unless you choose to handle your network using e.g. systemd or dhcpcd - you cannot avoid it.

Kvantum manager is probably a dependency of Manjaro's Xfce desktop settings package.

1 Like

Oh, thanks for the tip!

All I can say is that it failed. I gave it a second try starting over clean, and it failed again. It complained about one outdated or missing key, so I read up a bit, refreshed the keys, and then it went through.

I'm new to Linux, so I haven't got the insight or vocabulary to explain why, just that updating the keys made it work.

Oh, the architect iso was freshly downloaded today.

The Architect ISO is dated if I remember correct (18.1.3 @ 2019-11-29).

But good you got it working.

I have added information on setting mirror for the install and info on the possible keyring age and how to continue.

Thank you for letting me know. :+1:

1 Like

You may want to consider that this directive is outdated/deprecated.
At least, it is not documented in man:

man pacman | grep -i syncfirst
man pacman.conf | grep -i syncfirst

I don't know how long, though...

Thank you for noting - it is a Manjaro patch - not official upstream which explains why it is not in the man page.

I've done this architect iso CLI install 5-6 times now (because I'm experimenting with adding and leaving out stuff, newbie-style), and it is definitively an issue here.

Some ''levente@enetepolaynk.net is an unknown trustee'', resulting in an aborted base install and a corrupt package in the cache. When refreshing the keys first, everything goes smoothly.

Just reporting!

Forum kindly sponsored by