So we have installed Arch Linux, but the only user currently is the root user, and there is no desktop environment, i.e. the system is in command line interface (CLI) instead of graphical user interface (GUI). This is dangerous and not user friendly, as doing everything with root user poses a threat that one might accidentally delete important files (from personal experience using
sudo, enough said), and not everyone likes CLI. Luckily, none of these tasks are hard, but we will do it step by step.
Creating Users and Groups
To create a new user, we use the
useradd command. We will want to add the new user into the group
wheel. So we do the following:
useradd -m -G wheel -s /bin/bash . Read here for more details on users and user groups. Then to add a password for the user,
passwd and enter the same password twice. Note: The password is case sensitive, and we should see
passwd: password updated successfully
Great! Now we have set up a new user, but sometimes, we still want to have root access to do install/update a package, and this usually requires sudo. However, if we just log in as the user that we have just created, we will see
<username> is not in the sudoers file. This incident will be reported.
And as mentioned before, it is discouraged to do everything with the root user. To add the newly created user to one of the
sudoers, we need to edit the
/etc/sudoer. Friendly reminder that we should use
visudo to edit the file instead of other editors. To do this, enter
visudo -f /etc/sudoers. This should be done with the
root user. Then go to the line
root ALL=(ALL) ALL, copy and paste the line below and changing
<username>. Now save and quit by typing
:wq, including the colon. Now reboot and the new user should be able to use
There are a lot of choices in terms of desktop environment using GUI. Some supported GUI ones can be found here. In this post however, we will install GNOME; people have different comment on this environment, I personally do not hold any grudges or irrational hate towards GNOME, but some of my friends does. This is up to personal preference, but I find installing GNOME is slightly easier than the other environments. Maybe I will write a post in the future about installing XFCE instead.
To install GNOME, type
pacman -S gnome gnome-extra, and if no preference for login screen, we can append
gdm (for other display manager see here) after
Starting a GNOME session
For different types of GNOME sessions click here. I will setup the environment using Xorg.
To run a Xorg GNOME session, first, install Xorg by
pacman -S xorg xorg-xinit, then type
startx. However, if we want to start the computer with GUI, we need to modify the
~/.xinitrc file. Append
exec gnome-session at the end of the
~/.xinitrc file. Reboot, and we should be good.
Starting GDM on Boot
To start GDM on boot, enable its systemd service, i.e.
systemctl enable gdm.service. Note: You have to use
sudo for this, or enable this as root.