Install arch from other linux

Offline installation of packages

This article or section needs language, wiki syntax or style improvements. See Help:Style for reference.

From time to time you might end up with a copy of Arch Linux on an offline computer and want to install packages for it.

Contents

Install from file: pacman -U

The Pacman -U command installs packages from the provided paths, and is probably what you are looking for in casual use cases.

For one package:

For several packages:

Offline cache

You can stuff things into /var/lib/pacman/sync and /var/cache/pacman/pkg to make pacman think it has everything it needs to do searches, updates, and installs. This method is based on byte’s post from this thread.

Download the package databases on a computer with internet access and transfer them to your computer. If needed, change MIRROR to any mirror from the mirror status list.

Following steps will make sure you are working with up-to-date package lists, as if you ran pacman -Sy .

After transferring the *.db files to the offline PC, do the following:

To update a New Arch Linux base system after installation you may enter

Now open that textfile with an editor and delete all lines that are not URLs. Next, bring that list with you to a place where you have internet and either download the listed packages manually or run wget in an empty directory:

Take all the *.pkg.tar.gz files back home, put them in /var/cache/pacman/pkg and finally run

Local repository

Scenario: you have two Arch Linux machines, ‘Al’ (with internet connection) and ‘Bob’ (without internet connection), and you need to install some NVIDIA packages and their dependencies on ‘Bob’. In this example, the wanted packages are nvidia , nvidia-utils , and xf86-video-nouveau , but you want to use a dedicated directory instead of /var/cache/pacman/pkg/ and a dedicated repository called nvidia (instead of the usual core, extra etc. )

Generate a list of packages to download

This can be done on any Arch Linux machine which has up-to-date repository data bases (see above for links to database files); to create the list of links to the required packages, use:

The file nvidia.list will contain links to the listed packages and any others which they depend on which are not already installed on ‘Al’. Unless you have cleared your cache the packages you have installed will be in your cache location. You can check /etc/pacman.conf for the location. It is probably something like /var/cache/pacman/pkg/ .

Download/copy the packages and their dependencies

Obviously this requires an internet connection, so on ‘Al’ create a directory called /path/to/nvidia for the files and run:

Then copy the dependencies you have already installed from the cache. Either find them manually by browsing https://archlinux.org/packages/ or if the total size of all your packages is not too large just copy them all

Create a repository database just for these packages

This can be done on either ‘Al’ or ‘Bob’ using the repo-add command which comes with pacman (from version 3?); first, change to the /path/to/nvidia directory where the packages were downloaded, then create database file called nvidia.db.tar.gz :

Transfer the packages

Now all the packages have been downloaded, you do not need ‘Al’ anymore. Copy the contents of /path/to/nvidia to a the temporary NVIDIA packages cache directory on ‘Bob’. In this example, this folder is called /home/me/nvidia :

Next, pacman must be made aware of this new repository of packages. First copy your current pacman.conf :

Now in /etc/pacman.conf make sure that your SigLevel is set to Never as your repository will not provide signatures

and add the following lines at the bottom of pacman.conf :

Читайте также:  Драйвер запоминающего устройства для установки windows server 2019

You may also need to comment out the other repositories so stale defaults do not cause failed attempts to download from online Now, instruct pacman to synchronize with the dedicated NVIDIA repository we created:

This command finds the nvidia.db.tar.gz file in /home/me/nvidia and expands it to /var/lib/pacman/sync/nvidia to create a database of packages contained in the NVIDIA repository.

Install the packages

Finally install the packages:

Restoring online sources

Should Bob ever be put online we can restore access to the online sources by replacing /etc/pacman.conf with the previously created /etc/pacman.conf.old .

Compiled from the forums, with thanks to Heller_Barbe and byte

Источник

Offline installation (Русский)

The factual accuracy of this article or section is disputed.

Если вы хотите установить Archiso (Русский) (например, официальный ежемесячный выпуск) без подключения к интернету или если вы не хотите загружать пакеты снова:

Сначала следуйте инструкциям статьи Руководство по установке, а затем пропустите разделы от Соединения с Интернетом до Установки основных пакетов.

Contents

Установка archiso в новый корень

Вместо того, чтобы устанавливать пакеты с помощью pacstrap (которые будут загружаться из удалённых репозиториев), скопируйте всё в live-среду в новый корень:

Затем скопируйте образ ядра в новый корень, чтобы сохранить целостность новой системы:

После этого сгенерируйте fstab, как описано в разделе Руководство по установке#Fstab.

Chroot и настройка базовой системы

Далее, выполните операцию chroot в вашей вновь установленной системы:

Восстановление конфигурации journald

Эта настройка archiso приведёт к сохранению системного журнала в ОЗУ, а это означает, что журнал после перезагрузки будет недоступен:

Удаление особых правил udev

Это правило udev [устаревшая ссылка 2021-07-05] автоматически запускает dhcpcd, если есть какие-либо проводные сетевые интерфейсы.

Отключение и удаление служб, созданных archiso

Некоторые файлы служб создаются для live-среды – отключите их и удалите файлы, поскольку они не нужны в новой системе:

Удаление особых скриптов live-среды

Существуют некоторые скрипты, установленные скриптами archiso в live-системе, которые не нужны для новой системы:

Импорт ключей archlinux

Чтобы использовать официальные репозитории, нужно импортировать главные ключи archlinux (pacman/Package signing (Русский)#Инициализация связки ключей). Этот шаг обычно делается с помощью pacstrap, но может быть выполнен с помощью

Настройка системы

Теперь вы можете выполнить пропущенные шаги раздела Руководство по установке#Настройка системы (установка локали, часовой пояс, имя хоста и т.д.) и завершить установку, создав исходный ramdisk, как описано в разделе Руководство по установке#Initramfs.

Источник

Install Arch Linux from existing Linux

This document describes the bootstrapping process required to install Arch Linux from a running Linux host system. After bootstrapping, the installation proceeds as described in the Installation guide.

Installing Arch Linux from a running Linux is useful for:

  • remotely installing Arch Linux, e.g. a (virtual) root server
  • replacing an existing Linux without a LiveCD (see #Replacing the existing system without a LiveCD)
  • creating a new Linux distribution or LiveMedia based on Arch Linux
  • creating an Arch Linux chroot environment, e.g. for a Docker base container
  • rootfs-over-NFS for diskless machines

The goal of the bootstrapping procedure is to setup an environment from which the scripts from arch-install-scripts (such as pacstrap and arch-chroot ) can be run.

If the host system runs Arch Linux, this can be achieved by simply installing arch-install-scripts . If the host system runs another Linux distribution, you will first need to set up an Arch Linux-based chroot.

Contents

Backup and preparation

Backup all your data including mails, webservers, etc. Have all information at your fingertips. Preserve all your server configurations, hostnames, etc.

Here is a list of data you will likely need:

  • IP address
  • hostname(s), (note: rootserver are mostly also part of the providers domain, check or save your /etc/hosts before you delete)
  • DNS server (check /etc/resolv.conf )
  • SSH keys (if other people work on your server, they will have to accept new keys otherwise. This includes keys from your Apache, your mail servers, your SSH server and others.)
  • Hardware info (network card, etc. Refer to your pre-installed /etc/modules.conf )
  • Grub configuration files.

In general, it is a good idea to have a local copy of your original /etc directory on your local hard drive.

From a host running Arch Linux

Follow Installation guide#Mount the file systems to mount the filesystem that will be used for the root directory as well as all the other needed mount points. If you already use the /mnt directory for something else, just create another directory such as /mnt/install and use it as the mount point base for the rest of the installation.

At this stage, Arch Linux can either be installed from scratch or it can mirror the host installation. The two options are described thereafter.

Create a new Arch installation

In the procedure, the first step, Installation guide#Select the mirrors, can be skipped since the host should already have a correct mirrorlist.

Читайте также:  Windows 10 mobile как установить xap

Create a copy of an existing Arch installation

It is possible to replicate an existing Arch Linux installation by copying the host filesystem to the new partition and make some adjustments to it to make it bootable and unique.

The first step is to copy the host files into the mounted new partition, for this, consider using the approach exhibited in rsync#Full system backup.

Then, follow the procedure described in Installation guide#Configure the system with some caveats and additional steps:

  • Installation guide#Time zone, Installation guide#Localization and Installation guide#Root password can be skipped
  • Installation guide#Initramfs may be required in particular if changing filesystem, for example from ext4 to Btrfs
  • Regarding Installation guide#Boot loader, it is necessary to reinstall the bootloader
  • Delete /etc/machine-id so that a new, unique one, is generated at the next boot

If the mirrored Arch installation may be used within a different configuration or with another hardware, consider the following additional operations:

  • Use the CPU microcode update adapted to the target system during the step Installation guide#Boot loader
  • If any specific Xorg#Configuration was present on the host and may be incompatible with the target system, follow Moving an existing install into (or out of) a virtual machine#Disable any Xorg-related files
  • Make any other adjustment appropriate to the target system, like reconfiguring the network or the audio.

From a host running another Linux distribution

There are multiple tools which automate a large part of the steps described in the following subsections. See their respective homepages for detailed instructions.

The manual way is presented in the following subsections. The idea is to either get pacman working directly on the host system, or to run an Arch system inside the host system, with the actual installation being executed from the Arch system. The nested system is contained inside a chroot.

Using pacman from the host system

Pacman can be compiled on most Linux distributions, and used directly on the host system to bootstrap Arch Linux. The arch-install-scripts should run without issues directly from the downloaded sources on any recent distribution.

Some distributions provide a package for pacman and/or arch-install-scripts in their official repositories which can be used for this purpose. As of July 2020, Void Linux is known to provide the pacman package, and Alpine Linux and Fedora are known to provide both pacman and arch-install-scripts.

Creating a chroot

Two methods to setup and enter the chroot are presented below, from the easiest to the most complicated. Select only one of the two methods. Then, continue at #Using a chroot environment.

Download the bootstrap image from a mirror into /tmp . You can also download the signature (same URL with .sig added) and verify it with GnuPG.

Extract the tarball:

Select a repository server by editing /tmp/root.x86_64/etc/pacman.d/mirrorlist .

Enter the chroot:

  • If bash 4 or later is installed, and unshare supports the —fork and —pid options:
  • Otherwise, run the following commands:

Method B: Using the LiveCD image

It is possible to mount the root image of the latest Arch Linux installation media and then chroot into it. This method has the advantage of providing a working Arch Linux installation right within the host system without the need to prepare it by installing specific packages.

The root image can be found on one of the mirrors under iso/latest/arch/x86_64/ . The squashfs format is not editable, so we unsquash the root image and mount it.

To unsquash the root image, run

Select a repository server by editing squashfs-root/etc/pacman.d/mirrorlist .

Before chrooting to the unsquashed root image, we need to set up some mount points and copy the resolv.conf for networking.

Now, everything is prepared to chroot into the newly installed Arch environment:

Using a chroot environment

The bootstrap environment is really barebones (no nano or lvm2 ). Therefore, we need to set up pacman in order to download other necessary packages.

Initializing pacman keyring

Before starting the installation, pacman keys need to be setup. Before running the following two commands, read pacman-key#Initializing the keyring to understand the entropy requirements:

If you prefer generating entropy through system activity and decide to run ls -Ra / in another console (TTY, terminal, SSH session. ), do not be afraid of running it in a loop a few times: five or six runs from the host proved sufficient to generate enough entropy on a remote headless server.

Downloading basic tools

Installation tips

Some host systems or configurations may require certain extra steps. See the sections below for tips.

Читайте также:  Skype для телефонов windows

Debian-based host

/dev/shm

On some Debian-based host systems, pacstrap may produce the following error:

This is because in some versions of Debian, /dev/shm points to /run/shm while in the Arch-based chroot, /run/shm does not exist and the link is broken. To correct this error, create a directory /run/shm :

/dev/pts

While installing archlinux-2015.07.01-x86_64 from a Debian 7 host, the following error prevented both pacstrap(8) and arch-chroot from working:

Apparently, this is because these two scripts use a common function. chroot_setup() [1] relies on newer features of util-linux , which are incompatible with Debian 7 userland (see FS#45737).

The solution for pacstrap is to manually execute its various tasks, but use the regular procedure to mount the kernel filesystems on the target directory ( «$newroot» ):

Instead of using arch-chroot for Installation guide#Chroot, simply use:

lvmetad

Trying to create LVM logical volumes from an archlinux-bootstrap-2015.07.01-x86_64 environment on a Debian 7 host resulted in the following error:

(Physical volume and volume group creation worked despite /run/lvm/lvmetad.socket: connect failed: No such file or directory being displayed.)

This could be easily worked around by creating the logical volumes outside the chroot (from the Debian host). They are then available once chrooted again.

The factual accuracy of this article or section is disputed.

Also, if the system you are using has lvm, you might have the following output:

This is because debian does not use lvmetad by default. You need to edit /etc/lvm/lvm.conf and set use_lvmetad to 0 :

The factual accuracy of this article or section is disputed.

This article or section needs language, wiki syntax or style improvements. See Help:Style for reference.

This will trigger later an error on boot in the initrd stage. Therefore, you have to change it back after the grub generation. In a software RAID + LVM, steps would be the following:

  • After installing the system, double check your Mkinitcpio and your bootloader settings. See Arch boot process#Boot loader for a list of bootloaders.
  • You may need to change your /etc/mdadm.conf to reflect your RAID settings (if applicable).
  • You may need to change your HOOKS and MODULES according to your LVM and RAID requirements: MODULES=»dm_mod» HOOKS=»base udev mdadm_udev . block lvm2 filesystems . «
  • You will most likely need to generate new initrd images with mkinitcpio. See Mkinitcpio#Image creation and activation.
  • Set use_lvmetad = 0 in /etc/lvm/lvm.conf .
  • Update your bootloader settings. See your bootloader’s wiki page for details.
  • Set use_lvmetad = 1 in /etc/lvm/lvm.conf .

Fedora-based host

On Fedora based hosts and live USBs you may encounter problems when using genfstab to generate your fstab. Remove duplicate entries and the «seclabel» option where it appears, as this is Fedora-specific and will keep your system from booting normally.

Things to check before you reboot

Before rebooting, doublecheck a few details in your installation to achieve a successful installation. To do so, first chroot into the newly-installed system, and then:

  • create a user with password, so you can login via ssh. This is critical since root login is disabled by default since OpenSSH-7.1p2.
  • set a root password so that you can switch to root via su later
  • install a ssh solution and enable its server instance to start automatically at boot.
  • set up your network configuration in order to have a connection started automatically at boot.
  • set up a boot loader and configure it to use the swap partition you appropriated earlier as the root partition. You might want to configure your bootloader to be able to boot into your old system; it is helpful to re-use the server’s existing /boot partition in the new system for this purpose.

Replacing the existing system without a LiveCD

700 MB of free space somewhere on the disk, e.g. by partitioning a swap partition. You can disable the swap partition and set up your system there.

Set old swap partition as new root partition

Check cfdisk , /proc/swaps or /etc/fstab to find your swap partition. Assuming your hard drive is located on sdaX ( X will be a number).

Do the following:

Disable the swap space:

Create a filesystem on it

Create a directory to mount it in

Finally, mount the new directory for installing the intermediate system.

Installation

Install essentials packages and any other package required to get a system with internet connection up and running in the temporary partition, being careful with the limit of

700 MB space. When specifying packages to be installed with pacstrap, consider adding the -c flag to avoid filling up valuable space by downloading packages to the host system.

Once the new Arch Linux system is installed, fix the bootloader configuration, then reboot into the newly created system, and rsync the entire system to the primary partition.

Источник

Оцените статью