This article is the 20th day article of NIT-Numazu Advent Calendar 2019
Hello everyone. This year's Advent Calendar has a lot of holes, so this is my second writing. Perhaps the people who are looking at this article are mostly Linux users (or macOS users). (Don't use Linux? Windows only? Build a dual boot environment and grow overwhelmingly.) However, even with Linux, there are several distributions such as Debian on Ubuntu and Fedora on CentOS, and to be honest, I'm wondering which distribution to put in every time. I wonder how some people are. Especially for those who are using Windows 7 now, next year, support will end in less than a month, so I would like to upgrade the OS, but Win10 is heavy, but there are many Linux distros and I do not know which one is better. ??
I would like to recommend this ** Arch Linux ** to you. In this article, I will just talk about the goodness of Arch Linux and then write my own insco method until it can be used at the minimum.
ArchLinux? No, Ubuntu is enough www I prepared a simple comparison graph of Arch Linux and Ubuntu for people.
|Number of packages||About 10,000(Approximately 5 including AUR.50 000)||約50 000|
|The concept of version||None||Yes|
|Default GUI environment||None||GNOME(16.Up to 4 Unity)|
|Main target||I like DIY approach||Beginner|
|Installation media capacity||About 600MB||About 2GB|
|Net connection during installation||Mandatory||Not required|
|Operation||Independence, community||Canonical Ltd.|
Well, it looks like this lightly ... Even though it is the same Linux in the first place, Ubuntu and Arch have different target layers, so it is difficult to compare Poke * n and Mo * han because there are monsters in the name, so I will leave it at this level.
However, if it is used by technical college students, there are more packages for developers, and there is no extra software (even Ubuntu is better than Windows) ~ ~ Like a certain bread ~ ~ Arch Linux which is an OS I think that is easier to use. (Of course, I recommend Ubuntu for those who have only touched Android on their mobile phones and CentOS in the practice room at best.)
For example, if you want to put VS Code as a development editor, on Ubuntu you can jump to the download page from your browser, download the .deb package, install it with the dpkg command and resolve any dependencies if necessary ... It takes a little time, but with Arch Linux from the terminal
$ sudo pacman -S code
You can install it with just this.
Furthermore, in addition to the official repository, Arch Linux has a user repository called AUR, and packages that do not exist in the official repository can be installed from here. Furthermore, even if there is software that does not exist in these, if you use snapd etc ... If you think about it, most software can be installed from the terminal. (Rather, it seems that there are few software that can be installed from other than the terminal)
Besides, Arch Linux adopts a release model called rolling release, and there is no so-called version number. In other words, there is no such thing as XP or 7 in Windows (TH1 or 19H2 in Win10) or 16.04 or 18.04 in Ubuntu. You might think "what a mess", but that means that small software updates are so frequent that there are no major updates. Therefore, once you install it and build an environment that is easy for you to use, you can continue to use it semi-permanently. This is a very nice specification for those who want to continue using a computer for a long time. (By the way, Gentoo Linux and Chromium OS are also rolling releases)
The biggest feature of Arch Linux is that it was developed with a focus on simplicity and minimalism, so there are almost no apps in the initial state, so it is an OS that makes it easy to build your own environment. (It is also lightweight because it does not contain extra things.)
Well, I have listed the good points of light Arch Linux, but of course there are also weaknesses and weaknesses in such Arch Linux.
Perhaps the first is ** Difficulty installing **. Arch Linux is designed with a focus on simplicity and minimalism, so installation is almost (or all) done with the CUI. It's fine for people who say "CUI? Margin www", but it's quite difficult for people who say "Linux commands are only cd, ls and mkdir". (By the way, there are Manjaro and Alter Linux that added a function that can be done with GUI to Arch Linux, but there is a slight lag in package update) Of course, only the minimum required drivers are included, so for example, even if you use one Wi-Fi, you need to install the driver separately (although it is usually official unless you use a very strange board. (Located in the repository)
Since the target layer is the target layer, there are few users, and the information that is searched and comes out is small accordingly. Of course, Arch Linux has a community of users, and if you look at them, you can solve most of the problems, but since it's mostly in English, it's quite difficult for people who can't speak English. (Other than that, even if you look for information on relatively new packages, the search result in Japanese may be 0 ...)
If you are a normal PC user, you do not need to worry about it, but unfortunately if you are using PowerMac (PowerPC) or Raspberry Pi (ARM), you can not install it (For ARM, Arch Linux ARM of community release there is)
Postscript: It seems that x86 (32bit version) is no longer officially supported (there is also a community release version, and it is still possible to put 32bit software in the 64bit version Arch).
Is it such a place? There are many advantages and disadvantages, so I will leave it at this level.
Those who read the disadvantages section and wondered "what is this?" Should switch to Arch Linux. The game will also work if you include Proton (Valve's devilishly modified Wine for the game, Beat Saber also works).
So let's install Arch Linux immediately. I'd like to go, but Arch Linux has the minimum necessary initial configuration, and I will install what I want to use later, so the installation method explained here is mine. Just be aware that it's my installation method for me. (Also, this time we will proceed in the EFI environment, but we will explain the procedure in the BIOS as appropriate.)
Even if you go, the general procedure is written in the Arch Wiki.
First, drop the installation iso file from Arch Linux official website. Drop it wherever you like, whether it's a mirror site or a torrent. If you drop it, you can use the dd command, so burn the iso to a CD or USB to make it bootable. So far, it's pretty much the same as other Linux distributions like Ubuntu.
So I will install it. From the boot options in the BIOS, change the boot priority and insert the USB or CD you created earlier to boot.
By the way, did you see a screen with a prominent triangular logo like the one below? (Or did you come up with an option with only lonely letters?) If the OS that was originally installed in the PC starts up without being displayed, it is heavy if the boot order cannot be changed, so please look back at the BIOS (UEFI).
By the way, if you see the Arch logo here, it's BIOS, and if only the letters appear, it's UEFI. Please keep in mind that the installation method is slightly different for each.
I think there is an option ** Boot Arch Linux (x86_64) ** (or ** Arch Linux archiso x86_64 UEFI xxx **, xxx is USB or CD), so select it. Press the Enter (Return) key. By the way, I will not worship graphical images and characters for a while from here.
Immediately, if you are using a JIS keyboard, change the keymap.
# loadkeys jp106
Well, if you wait for a while, you should be logged in as root without permission. After confirming that you are logged in, first partition. First of all, check the name of the storage stuck in the PC.
What is displayed at this time is a list of devices that are stuck. In most cases, it is / dev / sdX (X is an alphabet), but it is different from NVMe SSD, so check it. Also, it is the partition that branches from each device and has a number such as / dev / sda1. Use the ls command to see the contents or determine which device partition is which device partition. If you have already partitioned with Gparted etc., you can use them, but if you have not done anything in particular, use gdisk, fdick, parted etc. to partition. (There is no problem here if you have a clean HDD or SSD partner, but if you already have another OS, it may be safer to use a partition manager separately implemented with a GUI such as Gparted) Partition configuration example
This partition configuration depends on whether it is BIOS or UEFI (MBR or GPT). It's almost official round plagiarism, but it's just an example of a partition.
|Mount point||Partition example||Partition type||capacity|
|/mnt||/dev/sdX1||Linux||All remaining areas|
|[Swap area]||/dev/sdX2||Linux swap||512MiB or more|
|Mount point||Partition example||Partition type||capacity|
|/mnt /boot (/mnt/efi)||/dev/sdX1||EFI System Partition||260～512MiB|
|/mnt||/dev/sdX2||Linux x86_64 root (/)||All remaining areas|
|Swap area||/dev/sdX3||Linux swap||512MiB or more|
In the example of the capacity of the swap area, it is often said that it is twice the main memory, but if you really receive it, a certain Mac Pro will need to use 3TB for the swap area, so please adjust it appropriately. Also, if __ already contains Windows, the EFI system partition should have already been created, so you can use the one created by Windows without creating it separately. __ (In fact, it contains Windows boot information, so please mount the one that Windows made by itself)
By the way, from here onward, it is troublesome, so I will talk on the assumption that each partition is as follows, so ** Please change that part according to the environment as appropriate. ** **
|Device partition number||Mount point|
Now, after splitting the partition, format the split partition immediately. Enter the following command. (Change the device partition name as appropriate) Also, do not format the EFI system partition if it has already been created.
# mkfs.fat -F 32 /dev/sda1 # mkfs.ext4 /dev/sda2 # mkswap /dev/sda3
Now that we have formatted each partition, we will continue to mount each partition.
# swapon /dev/sda3 # mount /dev/sda2 /mnt # mkdir /mnt/boot # mount /dev/sda1 /mnt/boot
So, from here onward, you need to be connected to the internet, so make sure you are connected to the internet.
# ip link
The above command will bring up a list of connected network interfaces, so make a note of them (generally enp0s3 or eth0). __ This time, we will proceed on the assumption that it is enp0s3, so please change that part as appropriate. __ Then ping to see if you are connected to the net
# ping archlinux.jp
Normally, you should be connected to the net automatically when you start the installation media, so this should return a ping, but if it does not come back,
# systemctl start dhcpd@enp0s3
Please enable the network with. (When using dynamic IP)
After checking the net connection, update the system clock as it is
# timedatectl set-ntp true
Now that the preparations are complete, I will install it immediately. For the time being, install the minimum required items, compilers, Linux kernel and its firmware. (DL capacity approx. 300MB, post-deployment capacity approx. 1.5GB)
# pacstrap /mnt base base-devel linux linux-firmware
If you want to install the LTS version of the Linux kernel, you can install it by changing linux to linux-lts.
Now that you have installed the minimum required packages, let's make various settings next.
Now, let's set up to use the installed Arch Linux. First of all, generate fstab (a file that contains various things such as the system partition).
# genfstab -U /mnt >> /mnt/etc/fstab
If all the required partitions are not mounted at this point, you will not be able to boot.
Next, enter the root directory of the system installed by chroot.
# arch-chroot /mnt
Next, set the time zone. Please change here according to the area you live in. Example: When setting to Tokyo (GMT +9)
# ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
Set the set time zone to the hardware clock with.
# hwclock --systohc --utc
Now that we have set the time zone, we will set the locale. However, since the editor is not included by default, insert some editor and set the locale with it (the following is an example of vim)
# pacman -S vim # vim /etc/locale.gen
English is required, so uncomment ʻen_US.UTF-8 UTF-8
and other languages you use (such asja_JP.UTF-8 UTF-8`).
After uncommenting the required locale, generate the locale and set the generated locale. (Set the keymap only when using a JIS keyboard.)
# locale-gen # echo LANG=en_US.UTF-8 > /etc/locale.conf # echo KEYMAP=JP106 > /etc/vconsole.conf
Next, set the host name of the computer. Please set the name of the host name as you like (for the time being, it will be archkun below)
# echo archkun > /etc/hostname
Write a similar name in
/ etc / hosts
127.0.0.1 localhost ::1 localhost 127.0.1.1 archkun.localdomain archkun
Now, continue to set the root password
So, when I actually start using it, I'm afraid to do everything by route at that time, so I will make a general user. User name is your choice. (This time user)
# useradd -m -g users -G wheel -s /bin/bash user # passwd user
So, let's use sudo. After installing sudo, uncomment the sudoers wheel.
# pacman -S sudo # vim /etc/sudoers
(abridgement) ## Uncomment to allow members of group wheel to execute any command %wheel ALL=(ALL) ALL (abridgement)
So, if you restart and start it, you will not be able to connect to the Internet as it is, so insert the dhcp client.
# sudo pacman -S dhcpcd
** 2020/02/14 Addendum: If you use Wi-Fi etc., it may be better to install NetworkManager. ** **
This completes the basic settings. However, I have not installed the boot loader yet, so I will install it quickly so that it can be started.
It doesn't make sense if you can't boot the OS even though you installed it, so install the boot loader. In addition, this time it is assumed that you will install it on a clean PC that does not have an OS mystery, so if you already have another OS, please set it accordingly. Also, please note that the settings from here onwards differ depending on whether it is BIOS or UEFI.
First, install GRUB.
# pacman -S grub
Something is said, but maybe if you press y, it's okay. Once installed, create a GRUB configuration file
** For BIOS MBR **
# grub-install --target=i386-pc /dev/sda # grub-mkconfig -o /boot/grub/grub.cfg
** For UEFI GPT **
# sudo pacman -S efibootmgr # grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=grub # grub-mkconfig -o /boot/grub/grub.cfg
Now that the OS can boot, let's exit the chroot and reboot.
So, if you remove the installation media and reboot, grub will start, so select Arch Linux and start it. When you start it, you will not be connected to the Internet in the initial state, so enter the following command to enable it, and make it start automatically from the next time onwards. (Once enabled, ping to see if you can connect.)
$ sudo systemctl start dhcpcd@enp0s3 $ sudo systemctl enable dhcpcd@enp0s3
By the way, it is good to continue using it with CUI, but I think it is difficult to use it, so let's prepare the GUI environment. This time I use KDE Plasma just because I personally like it, but if you already have a desktop environment you like, it's okay to use it.
$ sudo pacman -S acpid xorg sddm plasma $ sudo systemctl enable sddm
After that, if you reboot, the GUI environment will appear! ... but I don't have a terminal emulator, so I'll install the terminal for the time being.
$ sudo pacman -S xterm
Now you can do this with at least a GUI! How was everyone? Let's build an environment that is easy for you to use. ... you can't do anything with a terminal and a minimal GUI environment. So for the time being, the installation method ends here, but I will add some software that should be privately installed.
You can't do almost anything without it. Let's install it.
$ sudo pacman -S dolphin
Let's make it possible to browse the Internet.
$ sudo pacman -S firefox
Since clamtk only makes clamAV a GUI, it is unnecessary if the command line is sufficient.
$ sudo pacman -S clamav clamtk
There are various types, but this time I selected ufw, because gufw only makes ufw a GUI (the following is omitted) This time, all access to the outside is permitted, and all access from the outside is denied.
$ sudo pacman -S ufw gufw $ sudo ufw default deny $ sudo ufw enable
Allows you to enter Japanese. This time we will introduce Fcitx Mozc.
$ pacman -S noto-fonts-cjk $ pacman -S fcitx-im fcitx-configtool fcitx-mozc
After inscoring, let's add Japanese to the input method.
In addition to the official repository, Arch Linux has a user repository called AUR, and the AUR helper makes it easy to handle with commands. A long time ago, yaout was famous, but due to the suspension of development, yay seems to be common these days, so I will insuko it. (By the way, git is also installed because it is essential for yay installation.)
$ sudo pacman -S git go $ git clone https://aur.archlinux.org/yay.git $ cd yay $ makepkg -si
You should now be able to use the yay command.
By the way, this should have the minimum necessary items (I think it is selfish). If you have other software you need, you can search the Arch Wiki, which is also posted on the reference page below, to find out whether it is in the AUR or the official repository, so check it from there. please look.
How was it here? Arch Linux that I want people who use Linux a lot to use. If you're curious, why not put it in a virtual environment first? Arch Linux is a kettle, lightweight, and has abundant repositories, and I think many people find it surprisingly easy to use because it is light. So, let's take this opportunity to install Arch Linux.