a simple, lightweight linux distribution

31
A simple, lightweight linux distribution.

Upload: hakhuong

Post on 06-Jan-2017

242 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: A simple, lightweight linux distribution

A simple, lightweight linux distribution.

Page 2: A simple, lightweight linux distribution

● It’s a community supported distro that was created in 2002 by Judd Vinet.○ He was a fan of Slackware, Crux, and BSD, but wanted the convenience of a package

manager with binary packages, which they didn’t have at the time.

What is Arch Linux?

Page 3: A simple, lightweight linux distribution

● It’s a community supported distro that was created in 2002 by Judd Vinet.○ He was a fan of Slackware, Crux, and BSD, but wanted the convenience of a package

manager with binary packages, which they didn’t have at the time.

● Arch is independently developed, was built from scratch and is not based on any other GNU/Linux distribution.

What is Arch Linux?

Page 4: A simple, lightweight linux distribution

● It’s a community supported distro that was created in 2002 by Judd Vinet.○ He was a fan of Slackware, Crux, and BSD, but wanted the convenience of a package

manager with binary packages, which they didn’t have at the time.

● Arch is independently developed, was built from scratch and is not based on any other GNU/Linux distribution.

● Arch Linux is a rolling release distro.○ It has no actual releases. The repos are continually updated as packages are marked stable.○ It’s intended to never require reinstalling. Just update forever.○ They occasionally have “Snapshot Releases” which are just for building the install iso against.

What is Arch Linux?

Page 5: A simple, lightweight linux distribution

● It’s a community supported distro that was created in 2002 by Judd Vinet.○ He was a fan of Slackware, Crux, and BSD, but wanted the convenience of a package

manager with binary packages, which they didn’t have at the time.

● Arch is independently developed, was built from scratch and is not based on any other GNU/Linux distribution.

● Arch Linux is a rolling release distro.○ It has no actual releases. The repos are continually updated as packages are marked stable.○ It’s intended to never require reinstalling. Just update forever.○ They occasionally have “Snapshot Releases” which are just for building the install iso against.

● It is built exclusively for the i686 and the x86_64 architectures.○ There is an ARM version available, but it’s maintained by a different team and is considered a

fork. They have a Raspberry Pi release as well.

What is Arch Linux?

Page 6: A simple, lightweight linux distribution

● It’s a community supported distro that was created in 2002 by Judd Vinet.○ He was a fan of Slackware, Crux, and BSD, but wanted the convenience of a package

manager with binary packages, which they didn’t have at the time.

● Arch is independently developed, was built from scratch and is not based on any other GNU/Linux distribution.

● Arch Linux is a rolling release distro.○ It has no actual releases. The repos are continually updated as packages are marked stable.○ It’s intended to never require reinstalling. Just update forever.○ They occasionally have “Snapshot Releases” which are just for building the install iso against.

● It is built exclusively for the i686 and the x86_64 architectures.○ There is an ARM version available, but it’s maintained by a different team and is considered a

fork. They have a Raspberry Pi release as well.

● Intended to be used by intermediate to advanced Linux users.○ There is a lot of manual configuring.○ You're expected to be familiar with using the terminal to administrate Linux.

What is Arch Linux?

Page 7: A simple, lightweight linux distribution

● It’s a community supported distro that was created in 2002 by Judd Vinet.○ He was a fan of Slackware, Crux, and BSD, but wanted the convenience of a package

manager with binary packages, which they didn’t have at the time.

● Arch is independently developed, was built from scratch and is not based on any other GNU/Linux distribution.

● Arch Linux is a rolling release distro.○ It has no actual releases. The repos are continually updated as packages are marked stable.○ It’s intended to never require reinstalling. Just update forever.○ They occasionally have “Snapshot Releases” which are just for building the install iso against.

● It is built exclusively for the i686 and the x86_64 architectures.○ There is an ARM version available, but it’s maintained by a different team and is considered a

fork. They have a Raspberry Pi release as well.

● Intended to be used by intermediate to advanced Linux users.○ There is a lot of manual configuring.○ You're expected to be familiar with using the terminal to administrate Linux.

● It follows a core philosophy called “The Arch Way.”

What is Arch Linux?

Page 8: A simple, lightweight linux distribution

● Simplicity○ Avoid unnecessary complexity and automation.

○ Keep all packages as close to upstream as possible.

■ Usually the only changes involve distro specific changes to file paths.

● Modern○ Keep all packages as up to date as possible, as long as breakage can be avoided.

■ Among the first distros to adopt systemd. March, 2012. Switched from SysVinit.

● Pragmatism○ Arch Linux repositories support freedom of choice, offering free and open source software for those

who prefer it as well as proprietary software packages for those who embrace functionality over

ideology.

The Arch Way

Page 9: A simple, lightweight linux distribution

Relying on complex tools to manage and build your system is going to hurt the

end users. If you try to hide the complexity of the system, you'll end up with a

more complex system. Layers of abstraction that serve to hide internals are never

a good thing. Instead, the internals should be designed in a way such that they

NEED no hiding.

-Aaron Griffin, Lead developer of Arch Linux since 2007.

K.I.S.S. - Keep It Simple Stupid.

The Arch Way

Page 10: A simple, lightweight linux distribution

Generally, you have to manually configure everything. There is no automation

when you install a new package. Packages come with the same default config

files as the upstream project. If you install a daemon, it will not automatically set

the daemon to autostart for you and will not make any changes to your system

other than drop the files in their appropriate locations.

The Arch Way

Page 11: A simple, lightweight linux distribution

● Pacman is the package manager that was created for Arch Linux in 2002.

● The goal of pacman is to make it possible to easily manage packages,

whether they are from the official repositories or the user's own builds.○ It can manage binary packages as well as custom packages compiled from source.

● Packages come in a precompiled binary format in .pkg.tar.xz files.

● If a package update has a new config file included and the configuration file

currently in use was modified, it will rename the new config file *.pacnew and

leave the original file untouched. If the default config is in use is unmodified, it

overwrites it with the new one.○ This is the only automated configuration that Pacman is capable of.

● When you uninstall a package, modified config files will remain in /etc.

Pacman

Page 12: A simple, lightweight linux distribution

● # pacman -S Install (Synchronize)● # pacman -Sy Refresh repos● # pacman -Su Install all updates● # pacman -Syu Refresh repos and install all updates

Pacman

Page 13: A simple, lightweight linux distribution

● # pacman -S Install (Synchronize)● # pacman -Sy Refresh repos● # pacman -Su Install all updates● # pacman -Syu Refresh repos and install all updates

● # pacman -R Remove● # pacman -Rs Remove with dependencies● # pacman -Rdd Force uninstall, ignoring dependencies● # pacman -Rc Cascade remove

○ Uninstalls all packages that depend on a package recursively

Pacman

Page 14: A simple, lightweight linux distribution

● # pacman -S Install (Synchronize)● # pacman -Sy Refresh repos● # pacman -Su Install all updates● # pacman -Syu Refresh repos and install all updates

● # pacman -R Remove● # pacman -Rs Remove with dependencies● # pacman -Rdd Force uninstall, ignoring dependencies● # pacman -Rc Cascade remove

○ Uninstalls all packages that depend on a package recursively

● # pacman -Q Query installed packages● # pacman -Ql Query all files owned by a package● # pacman -Qo Query for what package owns a particular file

Pacman

Page 15: A simple, lightweight linux distribution

● There is no installer!!!

● The installation image boots into a terminal root shell.

● The live environment includes some scripts to make the install process easier.

● The installation instructions are in /root/install.txt and on the Arch Wiki.○ https://wiki.archlinux.org/index.php/Beginners%27_guide

● The wiki is very thorough and gives detailed instructions for almost every

package.

○ Since the packages follow as close to upstream as possible, the Arch Wiki is a very useful

resource even if you are not an Arch user.

○ It is recommended to follow the wiki as you do the install process.

● An internet connection is required for the standard install method.

The Install Process

Page 16: A simple, lightweight linux distribution

● Step 1: Connect to the internet○ Wired connections work automatically.

○ Comes with the “wifi-menu” command for an Ncurses display to setup your wifi.

● Step 2: Partition your hard drive and format to your filesystems of choice.

○ You can do this ahead of time if you would rather not use a text based tools like fdisk

and mkfs.

● Step 3: Mount your root partition and whatever other partitions you want

under /mnt.○ Optionally, you can also make a swap partition and turn swap on at this point.

● Step 4: Install the base system.○ The pacstrap install script does this for you.

■ # pacstrap /mnt base base-devel

● base-devel is optional, but it adds important stuff like gcc and make.

The Install Process

Page 17: A simple, lightweight linux distribution

● Step 5: Create your /etc/fstab. (Configure disk mount locations.)○ You can manually create one, or you can use the “genfstab” build script.

■ # genfstab /mnt > /mnt/etc/fstab

● Optionally, you can add -U if you want to mount by UUID.

● This will automatically create an fstab based on what you have mounted under

/mnt and will also add whatever active swap partitions you may have.

● Step 6: Change root into your new system.○ There is an “arch-chroot” install script that can do this for you.

■ # arch-chroot /mnt

● Step 7: Set your Locale.○ Uncomment your correct locale in /etc/locale.gen

○ run “# locale-gen”

The Install Process

Page 18: A simple, lightweight linux distribution

● Step 8: Make your initramfs.○ # mkinitcpio -p linux

● Step 9: Install your bootloader.○ # pacman -S grub os-prober

○ # grub-install /dev/sda

○ Generate grub.cfg

■ # grub-mkconfig -o /boot/grub/grub.cfg

○ This step can become a lot more complicated on UEFI systems.

● Step 10: Configure the network.○ Set your hostname under /etc/hostname

○ Enable DHCP Client daemon.

■ # systemctl enable dhcpcd

○ Optional: install the “wifi-menu” command

■ # pacman -S iw wpa_supplicant dialog

The Install Process

Page 19: A simple, lightweight linux distribution

● Step 11: Set your root password.○ # passwd

● Step 12: Exit your chroot environment and reboot the system.

At this point the installation is finished, but all you have is a base system with just

a root user. You still need to create your user(s) and install and setup whatever

packages you want, install Xorg, ect...

The Install Process

Page 20: A simple, lightweight linux distribution

● Install from any live graphical Linux environment.○ If the live environment is Arch based, you can simply run

# pacman -S arch-install-scripts

to turn it into an Arch Linux install environment.

○ If the live environment is not an Arch based distro, you can download a bootstrap image that

you can mount/chroot into and run your install from.

○ This has the added benefit of being able to use graphical tools like Gparted to set up your

filesystem and gives you access to a web browser so you can easily follow the wiki.

○ This is my prefered installation method.

Alternate Installation Methods

Page 21: A simple, lightweight linux distribution

These are alternate distros, usually with graphical installers, based on Arch.● ArchBang Linux

○ Uses official Arch repos.

○ Installs a preconfigured Openbox desktop environment with a fancy Conky setup.

● Manjaro○ Maintains it’s own repos and uses the official Arch repos as a testing repo to try to

add another layer of testing for stability. Package releases are delayed about 2 weeks.

○ Offers a variety of desktop environments preconfigured.

○ Has a graphical frontend for Pacman.

● Antergos○ Uses official arch repos plus one additional repo maintained by them with extra tools.

○ Offers a variety of desktop environments preconfigured.

○ Has a graphical frontend for Pacman.

○ Will go out of their way to maintain compatibility with the official Arch repos.

Alternate Installation Methods

Arch Derivatives

Page 22: A simple, lightweight linux distribution

The Repositories● Base

○ This is where all packages that come pre-installed on the base install go.○ It’s maintained directly by the Arch developers.

● Extras○ This contains any packages that are maintained directly by the arch developers that aren’t part

of the base install.● Community

○ This contains packages that are maintained by trusted community members.○ There are currently 43 trusted users.○ In the early days, this repo was a free-for-all where anyone could upload anything. This

obviously couldn’t be maintained once the distro started to grow in popularity.○ If a trusted user can no longer maintain a package it will be removed from the repo. They are

expected to stay up to date with upstream unless there is a stability issue.● MultiLib

○ This contains all packages that are 32 bit compiled for x86_64 regardless of who maintains the package.

○ This only available on x86_64 installations and is not enabled by default. You must add it yourself if you want it.

● There are also testing counterparts for each repo.

BaseExtrasCommunityMultiLib

Page 23: A simple, lightweight linux distribution

The A.U.R.The Arch User Repository

● The AUR is an official community maintained repo that anyone can upload to.○ It was created to maintain the community involvement and package availability that they had

back when the official Community repo was still a free-for-all, but in a more managed way.

● It is moderated by the Trusted Users.○ The Trusted Users have the authority to delete packages, flag packages as “out of date”, flag

packages as “orphaned”, and change ownership of packages.

● If a package is orphaned, you can make a request to adopt the package.○ A Trusted User needs to approve the adoption.○ If you don’t want to go through the adoption process, you can just upload it as a new package

with a slightly different name.

● If an orphaned package is adopted by a Trusted User or if a package maintainer is promoted to Trusted User, the package is moved out of the AUR and into the official Community repo.

● There is a rating system and a comment system to help you vet a package.● While the AUR is officially maintained, packages in the AUR are not officially

supported.

Page 24: A simple, lightweight linux distribution

The A.U.R.The Arch User Repository

● The AUR operates as a repository of text files called PKGBUILD.○ The PKGBUILD files are the basis of Arch Linux packages.○ It contains packaging instructions for the makepkg program which builds all Arch packages.○ makepkg can run a large variety of PKGBUILD scripts pulling from any source. It can pull from

other binary packages or it can compile from source and apply patches.

● Packages in the official repos are already built into binary .pkg.tar.xz packages. Packages in the AUR require you to download the PKGBUILD and build the package yourself.

○ After building the package, you can install it with # pacman -U name.pkg.tar.xz and Pacman will automatically deal with dependencies.

● The AUR is one of the main draws to Arch Linux.○ Thanks to the AUR, Arch Linux has one of the largest package libraries, rivaling even Ubuntu.

Page 25: A simple, lightweight linux distribution

Packages 29773

Orphan Packages 672

Packages added in the past 7 days 339

Packages updated in the past 7 days 940

Packages updated in the past year 24723

Packages never updated 5050

Registered Users 30424

Trusted Users 43

AUR Statistics5442 Official Packages

The A.U.R.The Arch User Repository

Page 26: A simple, lightweight linux distribution

# Maintainer: Joe User <[email protected]>

pkgname=patchpkgver=2.7.1pkgrel=1pkgdesc="A utility to apply patch files to original sources"arch=('i686' 'x86_64')url="https://www.gnu.org/software/patch/patch.html"license=('GPL')groups=('base-devel')depends=('glibc')makedepends=('ed')optdepends=('ed: for "patch -e" functionality')source=("ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.xz"{,.sig})md5sums=('e9ae5393426d3ad783a300a338c09b72' 'SKIP')

build() { cd "$srcdir/$pkgname-$pkgver" ./configure --prefix=/usr make}

package() { cd "$srcdir/$pkgname-$pkgver" make DESTDIR="$pkgdir/" install}

Page 27: A simple, lightweight linux distribution

● Yaourt is french for yogurt.● Yaourt is an AUR helper. It’s a wrapper for Pacman that automates the

package build process.○ It has the same command line syntax as Pacman.○ You can install packages directly from the AUR by typing $ yaourt -S name

● If you install a package that had dependencies on other AUR packages, it will download them and install them for you.

● You can search the repos, including the AUR, by typing yaourt without any options.

● Yaourt doesn’t require root and will ask you for your password when needed if your user has permission to use sudo.

○ It’s considered dangerous to run makepkg as root and it will prevent you from running as root.● All AUR helpers are not officially supported and none are in the official repos.

○ From the official wiki:Warning: None of these tools are officially supported by Arch Linux, therefore it is recommended to become familiar with the manual build process in order to be prepared to troubleshoot problems on one's own.

Page 28: A simple, lightweight linux distribution

● To install Yaourt:○ Option 1:

■ Add the Yaourt repo to Pacman by adding the following to/etc/pacman.conf:

[archlinuxfr]

SigLevel = Never

Server = http://repo.archlinux.fr/$arch

● then run # pacman -Sy yaourt and it will refresh the repos and install.○ Option 2:

■ Manual download and build the Yaourt and it’s dependency, Package-Query from the AUR.git clone https://aur.archlinux.org/package-query.gitcd package-querymakepkg -sicd ..git clone https://aur.archlinux.org/yaourt.gitcd yaourtmakepkg -si

● Once installed, it will manage all packages installed from the AUR for you.○ Perform a full system upgrade by typing $ yaourt -Syua

Page 29: A simple, lightweight linux distribution

The A.B.S.The Arch Build System

● The ABS is a ports-like system for building and packaging software from source code.

○ A Ports Tree is a system used by BSD to automate the process of building software from source code.

● It’s installed via the abs package in the official repos and by running the abs command as root.

○ ABS is made up of a directory tree (the ABS tree) residing under /var/abs. This tree contains many subdirectories, each within a repo name and each named by their respective package. Within each package directory is the PKGBUILD file for that package.

| -- core/| || -- acl/| || || -- PKGBUILD| || -- attr/| || || -- PKGBUILD| || -- abs/| || || -- PKGBUILD| || -- autoconf/| || || -- PKGBUILD| || -- ...| -- extra/| || -- acpid/| || || -- PKGBUILD| || -- apache/| || || -- PKGBUILD| || -- ...| -- community/| || -- ...

Page 30: A simple, lightweight linux distribution

The A.B.S.The Arch Build System

● If you navigate to a folder for a package you can use the makepkg commands to pull down the sources and create a modified package.

○ Optionally you can define a PACKAGER variable in /etc/makepkg.conf so that pacman can keep track of which packages are user modified.PACKAGER="myname <[email protected]>"

Page 31: A simple, lightweight linux distribution

The A.L.A.The Arch Linux Archive

● The ALA is an official archive of daily snapshots of the repos.○ Was previously called the ARM, or Arch Rollback Machine.

● You can downgrade individual packages using the program downgrade which is available in the Arch User Repository.

○ It will give you the option to add your downgraded package to the Pacman ignore group.○ This will work for small things, but it becomes troublesome if you try to downgrade a package

that has other packages depending on it being up to date.○ If you are careless, you can end up in dependency hell.

● If you need to roll back a major component of your system, like the kernel or xorg, it’s MUCH easier to rollback the entire system to a specific day.

○ You can point Pacman directly at a certain date in the ALA by putting this in your Pacman mirrorlist. and commenting out your standard mirrors.

Server=https://archive.archlinux.org/repos/2014/03/30/$repo/os/$arch

○ The date is in the URL.○ Force Pacman to refresh to older package lists and downgrade by typing:

# pacman -Syyuu