Linux package installation script

Installation guide

This document is a guide for installing Arch Linux using the live system booted from an installation medium made from an official installation image. The installation medium provides accessibility features which are described on the page Install Arch Linux with accessibility options. For alternative means of installation, see Category:Installation process.

Before installing, it would be advised to view the FAQ. For conventions used in this document, see Help:Reading. In particular, code examples may contain placeholders (formatted in italics ) that must be replaced manually.

For more detailed instructions, see the respective ArchWiki articles or the various programs’ man pages, both linked from this guide. For interactive help, the IRC channel and the forums are also available.

Arch Linux should run on any x86_64-compatible machine with a minimum of 512 MiB RAM, though more memory is needed to boot the live system for installation.[1] A basic installation should take less than 2 GiB of disk space. As the installation process needs to retrieve packages from a remote repository, this guide assumes a working internet connection is available.

Contents

Pre-installation

Acquire an installation image

Visit the Download page and, depending on how you want to boot, acquire the ISO file or a netboot image, and the respective GnuPG signature.

Verify signature

It is recommended to verify the image signature before use, especially when downloading from an HTTP mirror, where downloads are generally prone to be intercepted to serve malicious images.

On a system with GnuPG installed, do this by downloading the PGP signature (under Checksums in the Download page) to the ISO directory, and verifying it with:

Alternatively, from an existing Arch Linux installation run:

Prepare an installation medium

The installation image can be supplied to the target machine via a USB flash drive, an optical disc or a network with PXE: follow the appropriate article to prepare yourself an installation medium from the chosen image.

Boot the live environment

  1. Point the current boot device to the one which has the Arch Linux installation medium. Typically it is achieved by pressing a key during the POST phase, as indicated on the splash screen. Refer to your motherboard’s manual for details.
  2. When the installation medium’s boot loader menu appears, select Arch Linux install medium and press Enter to enter the installation environment.

To switch to a different console—for example, to view this guide with Lynx alongside the installation—use the Alt+arrow shortcut. To edit configuration files, mcedit(1) , nano and vim are available. See packages.x86_64 for a list of the packages included in the installation medium.

Set the console keyboard layout

The default console keymap is US. Available layouts can be listed with:

To modify the layout, append a corresponding file name to loadkeys(1) , omitting path and file extension. For example, to set a German keyboard layout:

Console fonts are located in /usr/share/kbd/consolefonts/ and can likewise be set with setfont(8) .

Verify the boot mode

To verify the boot mode, list the efivars directory:

If the command shows the directory without error, then the system is booted in UEFI mode. If the directory does not exist, the system may be booted in BIOS (or CSM) mode. If the system did not boot in the mode you desired, refer to your motherboard’s manual.

Connect to the internet

To set up a network connection in the live environment, go through the following steps:

  • Ensure your network interface is listed and enabled, for example with ip-link(8) :
  • For wireless and WWAN, make sure the card is not blocked with rfkill.
  • Connect to the network:
    • Ethernet—plug in the cable.
    • Wi-Fi—authenticate to the wireless network using iwctl.
    • Mobile broadband modem—connect to the mobile network with the mmcli utility.
  • Configure your network connection:
    • DHCP: dynamic IP address and DNS server assignment (provided by systemd-networkd and systemd-resolved) should work out of the box for Ethernet, WLAN and WWAN network interfaces.
    • Static IP address: follow Network configuration#Static IP address.
  • The connection may be verified with ping:

Update the system clock

Use timedatectl(1) to ensure the system clock is accurate:

To check the service status, use timedatectl status .

Partition the disks

When recognized by the live system, disks are assigned to a block device such as /dev/sda , /dev/nvme0n1 or /dev/mmcblk0 . To identify these devices, use lsblk or fdisk.

Results ending in rom , loop or airoot may be ignored.

The following partitions are required for a chosen device:

If you want to create any stacked block devices for LVM, system encryption or RAID, do it now.

Use fdisk or parted to modify partition tables. For example:

Example layouts

BIOS with MBR
Mount point Partition Partition type Suggested size
[SWAP] /dev/swap_partition Linux swap More than 512 MiB
/mnt /dev/root_partition Linux Remainder of the device
UEFI with GPT
Mount point Partition Partition type Suggested size
/mnt/boot or /mnt/efi 1 /dev/efi_system_partition EFI system partition At least 260 MiB
[SWAP] /dev/swap_partition Linux swap More than 512 MiB
/mnt /dev/root_partition Linux x86-64 root (/) Remainder of the device
  1. /mnt/efi should only be considered if the used boot loader is capable of loading the kernel and initramfs images from the root volume. See the warning in Arch boot process#Boot loader.

Format the partitions

Once the partitions have been created, each newly created partition must be formatted with an appropriate file system. For example, to create an Ext4 file system on /dev/root_partition , run:

If you created a partition for swap, initialize it with mkswap(8) :

Mount the file systems

Mount the root volume to /mnt . For example, if the root volume is /dev/root_partition :

Create any remaining mount points (such as /mnt/efi ) using mkdir(1) and mount their corresponding volumes.

If you created a swap volume, enable it with swapon(8) :

genfstab(8) will later detect mounted file systems and swap space.

Installation

Select the mirrors

Packages to be installed must be downloaded from mirror servers, which are defined in /etc/pacman.d/mirrorlist . On the live system, after connecting to the internet, reflector updates the mirror list by choosing 20 most recently synchronized HTTPS mirrors and sorting them by download rate.[2]

The higher a mirror is placed in the list, the more priority it is given when downloading a package. You may want to inspect the file to see if it is satisfactory. If it is not, edit the file accordingly, and move the geographically closest mirrors to the top of the list, although other criteria should be taken into account.

This file will later be copied to the new system by pacstrap, so it is worth getting right.

Install essential packages

Use the pacstrap(8) script to install the base package, Linux kernel and firmware for common hardware:

The base package does not include all tools from the live installation, so installing other packages may be necessary for a fully functional base system. In particular, consider installing:

  • userspace utilities for the management of file systems that will be used on the system,
  • utilities for accessing RAID or LVM partitions,
  • specific firmware for other devices not included in linux-firmware (e.g. sof-firmware for sound cards),
  • software necessary for networking,
  • a text editor,
  • packages for accessing documentation in man and info pages: man-db , man-pages and texinfo .
Читайте также:  Как удалить драйвер принтера windows 10 если драйвер занят

To install other packages or package groups, append the names to the pacstrap command above (space separated) or use pacman while chrooted into the new system. For comparison, packages available in the live system can be found in packages.x86_64.

Configure the system

Fstab

Generate an fstab file (use -U or -L to define by UUID or labels, respectively):

Check the resulting /mnt/etc/fstab file, and edit it in case of errors.

Chroot

Change root into the new system:

Time zone

Run hwclock(8) to generate /etc/adjtime :

This command assumes the hardware clock is set to UTC. See System time#Time standard for details.

Localization

Edit /etc/locale.gen and uncomment en_US.UTF-8 UTF-8 and other needed locales. Generate the locales by running:

Network configuration

Add matching entries to hosts(5) :

If the system has a permanent IP address or a fully qualified domain name, see the example in Network configuration#Local hostname resolution.

Complete the network configuration for the newly installed environment, that may include installing suitable network management software.

Initramfs

Creating a new initramfs is usually not required, because mkinitcpio was run on installation of the kernel package with pacstrap.

For LVM, system encryption or RAID, modify mkinitcpio.conf(5) and recreate the initramfs image:

Root password

Boot loader

Choose and install a Linux-capable boot loader. If you have an Intel or AMD CPU, enable microcode updates in addition.

Reboot

Exit the chroot environment by typing exit or pressing Ctrl+d .

Optionally manually unmount all the partitions with umount -R /mnt : this allows noticing any «busy» partitions, and finding the cause with fuser(1) .

Finally, restart the machine by typing reboot : any partitions still mounted will be automatically unmounted by systemd. Remember to remove the installation medium and then login into the new system with the root account.

Post-installation

See General recommendations for system management directions and post-installation tutorials (like creating unprivileged user accounts, setting up a graphical user interface, sound or a touchpad).

For a list of applications that may be of interest, see List of applications.

Источник

1. Package classification

1. Software package classification

  • Source package
  • Binary package

2. Source code package

2.1 What kind of source package

]# rpm -ivh /mnt/cdrom/Packages/gcc-4.4.6-4.el6.i686.rpm

2.2 Features of source code package

The advantages of source code packages are:

  • Open source, if you have enough ability, you can modify the source code
  • You can freely choose the desired function
  • The software is compiled and installed, so it is more suitable for your system, more stable and more efficient
  • Easy to uninstall
  • There are many steps in the installation process, especially when installing a large software collection (such as a LAMP environment), it is prone to spelling errors
  • The compilation process takes longer, and the installation takes longer than the binary installation
  • Because it is a compilation and installation, once an error is reported during the installation process, it is difficult for novices to solve

3. Binary package

3.1 Binary package classification

  • DPKG package: It is a package management mechanism developed by Debian Linux. Through the DPKG package, DebianLinux can perform package management. Mainly used in Debian and unbuntu.
  • RPM package: is a package management system developed by Red Hat. Powerful, installation, upgrade, query and uninstall are very simple and convenient. Many Linux currently use this package management method, including Fedora, CentOS, SuSE, and so on. We are learning CentOS 6.3, so we are going to learn RPM package management system

3.2 Features

Advantages of RPM packages:

  • The package management system is simple, and the package can be installed, upgraded, inquired and uninstalled with only a few commands
  • Installation speed is much faster than source package installation

Disadvantages of RPM packages:

  • After compilation, the source code can no longer be seen
  • Feature selection is not as flexible as source package
  • Dependence. Sometimes we find that we need to install b and c first when installing package a, and we need to install d and e when installing b. This is to install d and e first, then b and c, and finally install the a package. For example, I bought a beautiful lamp and plan to install it in our living room, but before installing the lamp, our living room must have a ceiling.
    If the ceiling is always waterproof and painted, the decoration and installation software is actually similar, there must always be a certain order. But sometimes dependency can be very cumbersome

3.3 RPM package dependency

1) Tree dependency a—->b—->c
2) Circular dependency a—->b—->c—->a
3) Function library dependency

Two rpm installation

1 rpm package naming rules

httpd: package name
2.2.15: Software version
15: the number of times the software was released
el6: Software publisher. el6 is released by RedHat company, suitable for RHEL6.x (Red Hat Enterprise Linux) and CentOS6.x using i686 suitable hardware platform. The RPM package can be installed on different hardware platforms, and the software version suitable for different CPUs can be selected to maximize CPU performance. Therefore, the so-called i386 (can be installed on computers above 386) and i586 (can be installed on computers above 586) ), i686 (all computers above Pentium II can be installed, all CPUs are above Pentium II, so this software version is mostly), x86_64 (64-bit CPU can be installed) and noarch (no hardware limitation) and other file names. The extension of the rpmrpm package. We have said that files under Linux do not distinguish file types by extension, that is, extensions in Linux have no meaning. But why does the extension appear here again? The reason is simple. If I don’t call the extension of the RPM «.rpm», it will be difficult for the administrator to know that this is an RPM package, and of course it will not be installed correctly. In other words, if the RPM package does not use «.rpm» as the extension, the system can correctly identify it without any problem, but it is difficult for the administrator to identify what kind of software it is.

Full package name: If you are operating an uninstalled package, use the full package name, and you need to pay attention to the absolute path
Package name: If you are operating an already installed software package, just use the package name. The system will produce the RPM package database (/var/lib/rpm/), and you can Operation under any path

2. Manual command installation of rpm package

2.1 Default installation location

RPM package default installation path
/etc/ Configuration file installation directory
/usr/bin/ Executable command installation directory
/usr/lib/ The storage location of the function library used by the program
/usr/share/doc/ Basic software manual save location
/usr/share/man/ Help file save location

2.2 RPM package installation

1) Installation command:

rpm —ivh package full name
#Note that it must be the full name of the package. Pay attention to the path if the command follows the full name of the package, because the package is on the CD
Options:

-i install installation (install)

-v display more detailed information (verbose)

-h print#Display installation progress (hash)

  • -Nodeps does not detect dependent installations. The software will detect dependencies and determine whether the required underlying software is installed. If it is not installed, an error will be reported. If I don’t care about dependencies and want to force installation, I can use this option. Note: The software installed without checking dependencies is basically unusable, so this is not recommended
  • -Replacefiles Replace file installation. If you install a software package, but some files in the package already exist, then during normal installation, an error «a file already exists» will be reported, which will cause the software to fail to install. Use this option to ignore this error and overwrite the installation.
  • -Replacepkgs Replace package installation. If the package is already installed, this option can install the package repeatedly.
  • -Force Force installation. Regardless of whether it has been installed, reinstall it. It is the synthesis of -replacefiles and -replacepkgs.
  • -Test Test the installation. Will not actually install, just check the dependencies.
  • -Prefix specifies the installation path. Specify the installation path for the installation software instead of using the default installation path. Note: If the installation path is specified, and the software is not installed in the system default path, the system will not find the installed software, and manual configuration is required to be recognized by the system. Therefore, we generally use the default path to install the rpm package.

2) Service start:

]# service service name start|stop|restart|status
Parameters:
start: start the service
stop: stop the service
restart: restart the service
status: View service status
[[email protected]

]# systemctl restart httpd
#This command also works

2.3 RPM package upgrade

]# rpm-Uvh package full name
Options:
-U (uppercase) Upgrade installation. If it has not been installed, the system will install it directly. If the installed version is older, then
Upgrade to the new version (upgrade)
[[email protected]

]# rpm – Fvh package full name
Options:
-F (uppercase) Upgrade installation. If it has not been installed, it will not be installed. An older version must be installed to upgrade (freshen)

2.4 Uninstall

]# rpm -e package name
Options:
—nodeps does not check dependencies
-e uninstall

2.5 query
1) Check whether the software package is installed
can query whether the software package is installed, the command format is as follows:

]# rpm -q package name
Options:
-q: query

2) Query all installation packages in the system
can query all installed software packages in the Linux system, the command format is as follows:

Of course, you can use the pipe character to view the required content, such as:

You will find that using «rpm -q package name» can only check whether the package is installed, but using «rpm -qa | grep package name»
will list all packages that contain package names.

3) Query the detailed information of the software package
can query the detailed information of an installed software package, the command format is as follows:

]# rpm –qi package name
Options:
-i: Query software information (information)

You can also query the detailed information of the packages that have not been installed. The command format is as follows:

]# rpm –qip package full name
Options:
-p: Query packages that are not installed (package)

4) Query the file list in the software package
can query the list of files in the installed software package and the complete directory of the installation, the command format is as follows:

]# rpm –ql package name
Options:
-l: List all files in the software package and the directory where the software is installed (list)

So, can you query the list of files in a package that has not been installed and the location where you plan to install it? The answer is yes, the command format
as follows:

]# rpm –qlp package full name
Options:
-p: Query the information of packages that are not installed (package)

5) Query which RPM package the system file belongs to
Now that you know the installation location of the files in each RPM package, can you query which RPM package the system files belong to? Of course you can, but it should be noted that files created manually cannot be queried because these files are not installed through RPM packages. Of course, it is not possible to reverse query which RPM package it belongs to. The command format is as follows:

]# rpm -qf system file name
Options:
-f: Query which package (file) the system file belongs to

6) Query the packages that the package depends on
Query the software packages in the system that have dependencies on the installed software packages, the command format is as follows:

]# rpm –qR package name
Options:
-R: Query package dependencies (requires)

Can I query the dependencies of packages that are not installed? Just add the «-p» option. For example, to check the dependent packages of the bind package that has not been installed, you can execute the following command:

]# rpm -qRp /mnt/cdrom/Packages/bind-9.8.2-0.10.rc1.el6.i686.rpm

4. Online installation of rpm package (yum installation)

4.1 yum source file analysis
The yum source configuration file is stored in the /etc/yum.repos.d/ directory, and the file extension must be «.repo». In other words, the yum source configuration file only needs the extension «.repo» will take effect.

]# ls /etc/yum.repos.d/
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-fasttrack.repo CentOS-Media.repo CentOS-Vault.repo

There are 5 yum source configuration files in this directory, and the CentOS-Base.repo file takes effect by default. Let’s open this file to see, the command is as follows:

There are 5 yum source containers in the CentOS-Base.repo file. Only the base container is listed here. Other containers are similar to base containers. Let’s explain the base container.

  • [base]: The name of the container, which must be placed in [].
  • name: Container description, you can write it freely.
  • mirrorlist: mirror site, this can be commented out.
  • baseurl: The address of our yum source server. The default is the official yum source server of CentOS, which can be used. If you think it is slow, you can change it to your favorite yum source address.
  • enabled: Whether the container is valid, if not written or written as enabled=1, the container is valid, and written as enabled=0, the container is not valid
  • gpgcheck: If it is 1, it means that the RPM digital certificate is valid; if it is 0, it means that the RPM digital certificate is not valid.
  • gpgkey: save the public key file of the digital certificate. No need to modify.

4.2 Build a local CD yum source

Step 1: Insert the CentOS installation CD, and mount the CD to the specified location. The command is as follows:

Step 2: Modify the extensions of several other yum source configuration files to make them invalid, because only files with the extension «*.repo» can be used as yum source configuration files. Of course, you can also delete several other yum source configuration files, but if you delete them, when you want to use the network as the yum source, there will be no reference files, so it is better to modify the extension. The command is as follows:

]# cd /etc/yum.repos.d/
[[email protected] yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak
[[email protected] yum.repos.d]# mv CentOS-Debuginfo.repo CentOS-Debuginfo.repo.bak
[[email protected] yum.repos.d]# mv CentOS-Vault.repo CentOS-Vault.repo.bak

Step 3: Modify the CD-ROM yum source configuration file CentOS-Media.repo, refer to the following method to modify:

The configuration is complete.

4.3 yum command

Query the list of all installable software packages on the yum source server.

[[email protected] yum.repos.d]# yum list
#Query the list of all available packages
Installed Packages
#Installed package
ConsoleKit.i686 0.4.1-3.el6 @anaconda-CentOS-201207051201.i386/6.3
ConsoleKit-libs.i686 0.4.1-3.el6 @anaconda-CentOS-201207051201.i386/6.3
…Omit part of the output…
Available Packages
#Packages that can also be installed
389-ds-base.i686 1.2.10.2-15.el6 c6-media
389-ds-base-devel.i686 1.2.10.2-15.el6 c6-media
#software name version location (CD)
…omit part of the output

Query whether a software package is included in the yum source server.

[[email protected] yum.repos.d]# yum list package name
#Query a single package
For example:
[[email protected] yum.repos.d]# yum list samba
Available Packages
samba.i686 3.5.10-125.el6 c6-media

Search all software packages related to the keyword on the yum source server.

Yum search can be used to determine which related package a certain software is in. This example can confirm that the «ifconfig» command needs to install the «net-tools» package.

Query information about the specified software package.

4) Uninstall
You are sure that the dependent packages of the uninstalled software will not affect the system, otherwise do not perform yum uninstallation, because it is very likely that the dependent packages uninstalled while uninstalling the software package are also important systems File, which may cause the system to crash. The uninstall command is as follows:

[[email protected] yum.repos.d]# yum remove package name
#Uninstall the specified software package
For example:
[[email protected] yum.repos.d]# yum remove samba
#Uninstall the samba package

4.4 yum group management commands

  • Query the software groups that can be installed

]# yum grouplist
#List all available software groups

  • Query the software included in the software group

]# yum groupinfo software group name
#List the software included in the software group
For example:
[[email protected]

]# yum groupinfo “Web Server”
#Query the software included in the software group «Web Server»

]# yum groupinstall software group name
#Install the specified software group, the group name can be queried from grouplist
For example:
[[email protected]

]# yum groupinstall “Web Server”
#Install web service software group

]# yum groupremove software group name
#Uninstall the specified software group

3. Source package installation

1. Matters needing attention

1.1 Which software package should I choose?

  • If the software package is to provide access to a large number of customers, it is recommended to install it using a source package, such as a LAMP environment, because the source package is more efficient.
  • If the software package is used by the bottom of Linux, or only for a small number of customers, it is recommended to use the rpm package to install, because the rpm package is simple.

1.2 Where does the source code package come from?
The rpm package is directly included in the CD, so there is no need for users to download it separately. The source code package is downloaded through the official website, if you need to use it, you need to download it separately

1.3 Is it possible to install both the rpm package Apache and the source package Apache in the system?
The answer is yes, because the two installation methods install Apache, the installation location is different, for example:

1.4 Will two types of Apache be installed on the production server?
Of course not, because there is only one port 80 in the system, so you can only start one Apache, and installing multiple ones will only waste resources. We recommend installing the source package of Apache.

2. Installation process

(1) Download the software package.
(2) Decompress.
(3) Enter the decompression directory.
(4)./configure Preparation before compilation
This step has three main functions:
① It is necessary to check whether the system environment meets the installation requirements before installation.
② Define the required function options. «./Configure» supports more functional options, you can execute «./configure —help»
command to query the supported functions. Generally, the installation path is specified by «./configure —prefix=installation path».
③ Write the detection results of the system environment and the defined function options into the Makefile file. The subsequent compilation and installation need
depends on the content of this file.

It should be noted that configure is not a system command, but a script program that comes with the source package software, so it must be used
«./configure» is executed («./» means in the current directory).

(5) make compilation
make will call the gcc compiler and read the information in the Makefile file to compile the system software. The purpose of compilation is to convert source code programs into executable files that can be recognized by Linux, and these executable files are saved in the current directory. The compilation process is time-consuming and requires patience.
(6) make clean: clear the compiled content (non-essential step).
If an error is reported in the «./configure» or «make» compilation, then we must remember to execute the make clean command before re-executing the command, it will clear the Makefile or the generated » .o» header file.
(7) make install: compile and install
This is the real installation process. Generally, the installation location of the program will be clearly written. If you forget to specify the installation directory, you can save the execution process of this command for future deletion.

3. Delete

There is no delete command for the source package. If you need to delete it, just delete the installation directory.

4. Enter the patch

4.1 Patch generation

Compare the differences between the next two files and generate the patch file «txt.patch», the command is as follows:

4.2 Patching

#Update according to the patch file
Options:
-pn n is a number. Represents the location of the update file according to the path in the patch file.

«-Pn» is hard to understand, let’s explain. The patch file needs to be entered into the old file, but the directory you are currently in and the directory recorded in the patch file may not match, so you need «-pn» to synchronize the two directories.

For example, I am currently in the «/root/test» directory (the old file I want to patch is in the current directory), and the patch file is recorded
The file directory recorded is «/root/test/old.txt», then if you write «-p1» (cancel the first level directory in the patch file directory) then the patch file is Will enter the «/root/test/root/test/old.txt» file, which is obviously wrong. If you write «-p2» (cancel the secondary directory in the patch file directory), then the patch file is typed in «/root/test/test/old.txt», which is obviously wrong. If you write «-p3» (cancel the third-level directory in the patch file directory), then the patch file is typed in «/root/test/old.txt», and our old.txt file is in this directory. So it should be «-p3». Then we update the «old.txt» file, the command is as follows:

Four script installer

1 Introduction to the script

Script packages are rare, so they are not listed as a category in the package classification. It is more similar to the program installation under Windows. There is an executable installation program. Just run the installation program and perform simple function customization options (such as specifying the installation directory, etc.), and the installation can be successful, but it is in the character interface Completed.

2 Webmin installation

2.1. Introduction
Let’s take a look at how to install and use the script. Install a tool software called Webmin. Webmin is a web-based system management interface. With the help of any browser that supports tables and forms (and the Java required by the File Manager module), you can set up user accounts, apache, DNS, file sharing, etc. Webmin includes a simple Web server and many CGI programs, which can directly modify system files, such as /etc/inetd.conf and /etc/passwd. The web server and all CGI programs are written in Perl 5, without using any non-standard Perl modules. In other words, Webmin is a software written in Perl that can manage Linux through a browser.

2.2 Installation steps
First download the Webmin software, the address is http://sourceforge.net/projects/webadmin/files/webmin/, here is webmin-1.610.tar.gz.
Next, unzip the software, the command is as follows:

Enter the decompression directory, the command is as follows:

Источник

Читайте также:  Как запустить блокнот от имени администратора windows
Оцените статью