Configure Linux before installation.
| Guide |
I have been using Linux for some years. Over the years, I have the honor to witness the development of open source. The installation efforts of various releases are also a unique part. In the past, installing Linux was the best task for technical personnel. Now, as long as you install software, you will install Linux. It's simple, and I'm not blowing it off. It's also effective in attracting new users. In fact, installing the entire Linux operating system seems faster than installing an Update for Windows users. |
But every time, I like to see something different-something that can make me experience new things. NixOS is unique in this regard. To be honest, I used it as another Linux release that provides standard features and the KDE Plasma 5 interface.
It seems that there is nothing wrong with it.
After downloading the ISO image, I started VirtualBox and used the downloaded image to create a new virtual machine. After the VM is started, the Bash logon interface is displayed. It instructs me to log on to the root account with an empty password and how to start the GUI Display Manager (figure 1 ).
Figure 1: The initial contact with NixOS may not be too harmonious.
"Okay," I thought so. "Open it !"
I did not find the desired "Install" button when I started and run the GUI (KDE Plasma 5. It turns out that NixOS is a release that requires your configuration before installation. This is really interesting. Let's see how it works!
Pre-installation Configuration
The first thing you need to do is to create partitions. Because the NixOS installer does not contain a partition tool, you must use the built-in GParted (Figure 2) to create an EXT4 partition.
Figure 2: partition the disk before installation.
Create a partition and mount it with the command mount/dev/sdX/mnt. (Replace sdX with your new partition ).
You need to create a configuration file. The command is as follows:
nixos-generate-config --root /mnt
The preceding command creates two files (stored in the/mnt/etc/nixos directory ):
Configuration. nix-default configuration file. Hardware-configuration.nix-hardware configuration (not editable)
Run nano/mnt/etc/nixos/configuration. nix to open the file. Note some of the items to be edited. The first change is to set the startup option. Find the row:
# Boot. loader. grub. device = "/dev/sda"; # Use "nodev" for efi"
Delete the beginning of the line # To make this option take effect (Make sure/dev/sda and the partition you created ).
Through the configuration file, you can set the time zone and append the software package to be installed. Let's look at an example of the commented-out installation package:
# List packages installed in system profile. To search by name, run:# nix-env -aqP | grep wget# environment.systemPackages = with pkgs; [# wget vim# ];
If you want to add software packages and install them during installation, remove the comments and add the required software packages. For example, you need to add LibreOffice. For the example, see the following:
# List packages installed in system profile. To search by name, run:nix-env -aqP | grep wgetenvironment.systemPackages = with pkgs; [libreoffice wget vim];
You can enter the nix-env-aqP | grep PACKAGENAME command to find the exact package name (PACKAGENAME is the PACKAGENAME you want to find ). If you do not want to enter the command, you can also retrieve the NixOS Software Package database.
After you have added all the software packages, you still have something to do (if you want to log on to the desktop, I think you have to go over the KDE Plasma 5 desktop ). Go to the end of the configuration file and add the following content before the last} symbol:
services.xserver = {enable = true;displayManager.sddm.enable = true;desktopManager.plasma5.enable = true;};
In the NixOS official file, you can find more options in the configuration file. Save and disable the configuration file.
Install
After you complete the configuration according to your needs, use the command (root permission required) nixos-install. The time required to complete the installation varies with the number of packages you add. After the installation is complete, you can use the command to restart the system. After the restart, you will be greeted by the logon management interface of KDE Plasma 5 (Figure 3 ).
Figure 3: KDE Plasma 5 logon Management page
After installation
One of the two things you need to do first is to set a password for the root user (by entering the passwd command to change the default password) and add a standard user. This is the same as other Linux releases. Log on as the root user and enter the following command on the terminal:
useradd -m USER
Replace the USER with the username you want to add. Then, run the following command to set a password for the user:
passwd USER
Replace the USER with the USER you added.
Then you will be prompted to enter and verify the new password. Then, you can use standard users to log on to NixOS.
After you install and run NixOS, you can add new software packages to the system, but not in the usual way. If you find that you need to install something new, you have to go back to the configuration file (location:/etc/nixos/) and find the location where the software package was added during installation, run the following command (root permission required ):
nixos-rebuild switch
After the command is executed, you can use the newly installed software package.
Enjoy NixOS
Now, NixOS is running with all the software you want to install and the KDE Plasma 5 desktop. You must know that what you do is not just install a Linux release, but the key is that your custom release meets your needs. So enjoy your NixOS!