Author Topic: Arch Linux Install Guide (Aug. 2014)  (Read 7232 times)

0 Members and 1 Guest are viewing this topic.

Offline Rytiou

  • Noob Zombie
  • VIP
  • Knight
  • *
  • Posts: 199
  • Cookies: 45
  • EZ's Noob
    • View Profile
Arch Linux Install Guide (Aug. 2014)
« on: December 12, 2013, 02:35:18 am »
Alright so it's been nearly a whole year since I've created this thread I decided to give it some justice and revamp it to the best of my abilities while taking in to consideration everyone's replies they've made. Here's how how I'm going to lay out this thread:
Base Install
Upgrade System | Configure keymap | Configure mirrorlist | Create partitions | Format device | Install system base | Configure fstab | Configure Mkinitcpio | Configure hostname | Configure timezone | Configure hardware clock | Configure locale | Install/Configure bootloader | Make a user account | Final Stuff
Post Install
Basic Setup | Desktop Environment / Window Manager | Closing Thoughts

Hopefully this is layed out well enough for anyone to follow. Some of you who have done this before may or may not think this a weird layout for an Arch Linux install but this has worked out for me without any difficulty so far. I hope this well help anyone out who's interested in  Arch but can't seem to get it up and running. If anything in here doesn't work out for you please let me know and I will try to assist you to the best of my abilities. Also, if you're not up to installing this on actual hardware, which is understandable, I would download and put this on Virtualbox as it's a great free VM software. Now, without further ado, let's get this tutorial going.

Upgrade System
Before you actually get started with anything I'd recommend you upgrading your system so that you can get all the necessary things and not run into problems down the line. If this isn't working because you're on wireless here is the Arch Wiki post about setting up your wireless. I would tell you how to do it here but I have no experience in doing so.
After you're sure your internet is working you can finally run the command below
Code: [Select]
pacman -Syu
Configure Keymap
Now we are going to setup our keymap so that we'll be able to use our appropriate layout. A list of the layouts you can use are usually stored in /usr/share/kbd/keymaps/ Replace us with whatever layout you decide to use.
Code: [Select]
loadkeys us
Configure Mirrorlist
Now we are going to configure our mirrors. This is so that you can pick mirrors that are in your country or close to it so you can download packages a bit faster. If you're having trouble with your mirrors later down the road you may need to generate a new one. Click here to find out how to do that.
Code: [Select]
nano /etc/pacman.d/mirrorlist
uncomment a few that are in or near your country by remove the #'s in front of whatever mirror you choose to use

Create Partitions
Next we are going to make our partitions. You can make this as simple or complex as you want it to be. I'll show you both a scheme with just a home and swap partition and a scheme with a root, usr, home, boot, var, and swap partitions. Choose whichever you prefer. Also, wherever you see a +G put the amount in Gigabytes you would like to use right between the + and G.
Code: [Select]
fdisk

2 partitions
---------------
/home - Press n, then n, then p, 1, 2048, +G, then press a
/swap Press n, then p, 2, ENTER, ENTER, t, 2, type 82

5 partitions
---------------
/boot - Press n, then p, 1 2048, +200M, then press a
/ - Press n, then p, 2, ENTER, +G (Usually want this to be around 15 GB - 20 GB),
/var - Press n, then p, 3, ENTER, +G (Usually want this to be around (8 GB - 12 GB)
/home - Press n, then p, 4, ENTER, +G (Varies. This is where most of your HDD space is. IMO I would leave enough space that's about twice the amount of ram you have if you can spare it)
/swap - Press n, then p, 5, ENTER, ENTER, t, 5, type 82
Verify your partition scheme is right by hitting p. If everything is good then hit w to write and exit.
Format Device
Once the above is done you are going to want to format the partitions Arch Linux is going to be install too and set the filesystem it's going to use. In this tutorial we are going to use ext4 as it's one of the most common filesystems used in linux. Replace partition with the order your partition scheme is. If it's your main hard drive it'll be /dev/sda1 /dev/sda2 etc
Code: [Select]
mkfs.ext4 /dev/partition
mkswap /dev/partiton (this is wherever your swap partition is)
swapon /dev/partition (same as above)

Install System Base
Now that we got that all out of the way we can finally proceed to installing to base system. But before we do we must mount the necessary partitions.
Code: [Select]
First, mount the root partition on /mnt Mine happens to be /dev/sda1 but yours maybe different so replace it to whatever it is.
mount /dev/sda1 /mnt

Next mount the home partition and any other separate partition (/boot, /var, etc), if you have any
mkdir /mnt/home
Finally, enter the following command
Code: [Select]
pacstrap -i /mnt base base-devel
Configure fstab
Next we are going to generate an fstab which is a file that typically lists all available disks and disk partitions. Just run the following command and you should be good to go.
Code: [Select]
genfstab -U -p /mnt >> /mnt/etc/fstab
Configure Mkinitcpio
Now we have to configure Mkinitcpio so our kernel can load.
Code: [Select]
mount /dev/sda1 /mnt
arch-chroot /mnt /bin/bash
mkinitcpio -p linux
Configure Hostname
This part is completely optional except for the first command. This is the name that follows the @ in your terminal to help distinguish your machines. If you would like to change your host name type in this command
Code: [Select]
hostnamectl set-hostname myhostname
Configure Timezone
Now we are going to set our timezone. Please note that your location may not be on the list. If that is the case just pick the location closest to you.
Code: [Select]
ls /usr/share/zoneinfo/
ls /usr/share/zoneinfo/countryhere
ln -s /usr/share/zoneinfo/Country/ClosestPlace /etc/localtime

Incase you get a symbolic link error from the last command
ln -sf /usr/share/zoneinfo/Country/ClosestPlace /etc/localtime
Configure Hardware Clock
Next you're going to want to configure your hardware clock. This is so that if you ever dual boot and what not all your clocks will stay the same and not cause your time to shift.
Code: [Select]
hwclock --systohc --utc
Configure Locale
This next part is so that you can set what language locale your system is. You're going to want to uncomment whatever locale you are. For me, it's en_US
Code: [Select]
nano /etc/locale.gen
Uncomment the two things that have your locale listed.
local-gen
Next thing to do is to create your locale.conf file. Just substitute the locale listed below for whatever locale you chose.
Code: [Select]
echo LANG=en_US.UTF-8 > /etc/locale.conf
export LANG=en_US.UTF-8
Install / Configure Bootloader
We're almost done. Now we have to install a bootloader so that our system that our system can actually boot up. I'm going to use grub as it's one of the most popular and well supported bootloaders.
Code: [Select]
pacman -S grub
grub-install --target=i386-pc --recheck /dev/sda
cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo (Replace en for whatever language you chose)
grub-mkconfig -o /boot/grub/grub.cfg
Make a User Account
Finally, we are going to create a user account since you don't want to run your system as root all the time. Just enter the following commands and you should be set.
Code: [Select]
pacman-S sudo
useradd -m -g users -G wheel,storage,power -s /bin/bash USERNAMEHERE
passwd USERNAMEHERE

Now set a password for the root user
passwd
Now in order to run root commands as a user you are going to have to do a few things.
Code: [Select]
EDITOR=nano visudo
Scroll down and uncomment "%wheel all=all"
Final Stuff
Before we reboot into our new system I thought I'd show you a few useful things. First off if you want your internet to automatically run type in the following commands.
Code: [Select]
systemctl enable dhcpcd@eth0.service
pacman -S wireless_tools wpa_supplicant wpa_actiond dialog
Also, I forgot to tell you to do this if you're on a 64 bit installation
Code: [Select]
nano /etc/pacman.conf
Scroll down until you multilib. Underneath it should be line starting with the word "including". Remove the # that's in front of it.
That's about it now. Just type in the next few commands and reboot your pc without the installation media inserted.
Code: [Select]
exit
umount /mnt
reboot
Basic Setup
Congratulations! You successfully installed Arch Linux. Now all you have to do is setup sound, install a Desktop / Window Environment, install video drivers, and enable network manager

Sound setup
Code: [Select]
pacman -S alsa-utils
enter the command - alsamixer
crank each volume bar until you see a gain of 0
Video Drivers
Code: [Select]
Check which video card you have - lspci -k | grep -A 2 -i "VGA"
(People who have Intel) sudo pacman -S xf86-video-intel
(People who have AMD) sudo pacman -S xf86-video-ati
(People who have NVIDIA) sudo pacman -S nvidia
(People who are in a VM) sudo pacman -S virtualbox-guest-utils
Dekstop Environment / Windows manager
Now all we have to do really is install a DE / WM + enable network manager and you should be all done and good to go.
I'm going to be installing XFCE4 but you can install anything you like. Just look at the respective Arch Wiki page. First off for any DE you are going to want to enter this command.
Code: [Select]
sudo pacman -S xorg-server xorg-xinit xorg-server-utils mesa ttf-dejavu samba smbclient networkmanager networkmanager-vpnc networkmanager-pptp networkmanager-openconnect gvfs-smb sshfs
Now you are going to want to enable Network Manager and reboot.
Code: [Select]
sudo systemctl enable NetworkManager Once you boot back up and login you are finally going to install your DE / WM of choice. This is the command to install XFCE
Code: [Select]
sudo pacman -S xfce4 xfce4-goodiesNow you are going to want to enable your DE / WM so you can use the startx command to start it.
Code: [Select]
cp /etc/skel/.xinitrc ~
nano .xinitrc
Uncomment / Instert whatever DE / WM you've installed. Usually the command to start it will be on the respective page on the Arch wiki.
startx
Closing Thoughts
Now you're officially done with Installing Arch Linux. Congratulations if you made it all the way to the end. If you were new to this I hope you learnt a lot along the way. Now you don't have much installed really but you'll get past that soon. If you want a list of some applications then look here for a good list of some. Now all that's left for you to do is to use your system and break stuff / fix it / repeat. Thanks for reading my tutorial and I hope I helped anyone who reads this out in one way or another :).
« Last Edit: August 27, 2014, 04:27:16 am by Rytiou »
Quote from: Evilzone IRC
<EZBot> life, you're so lame we decided to change your nick to Rytiou's bitch.
<EZBot> Rytiou is lord of the fags and will suck dicks for shells.

Offline proxx

  • Avatarception
  • Global Moderator
  • Titan
  • *
  • Posts: 2803
  • Cookies: 256
  • ФФФ
    • View Profile
Re: Arch Linux Install Guide (Dec. 2013)
« Reply #1 on: December 12, 2013, 07:58:54 am »
Thanks for sharing :)

Uhm but one partition ?
I would highly recommend splitting  /usr /home /boot  and /
1 Gb of swap is not really enough for suspend to RAM and similar.
Im not using any swap at all but be careful it is easy to corrupt databases when you have too little swap space, or in other words , I wouldnt recoomend it for productions systems.
« Last Edit: February 12, 2015, 08:38:22 pm by proxx »
Wtf where you thinking with that signature? - Phage.
This was another little experiment *evillaughter - Proxx.
Evilception... - Phage

Offline lucid

  • #Underground
  • Titan
  • **
  • Posts: 2683
  • Cookies: 243
  • psychonaut
    • View Profile
Re: Arch Linux Install Guide (Dec. 2013)
« Reply #2 on: December 12, 2013, 08:50:50 am »
Yeah technically it's recommended to use at least twice as much swap space as RAM. I'm like proxx and use no swap however. Also, I thank you for contributing but this guide is a little lacking in detail and any complete noob to installing Arch would probably have difficulty following this. I mean, there's probably no other documentation that one needs when one has the ever comprehensive Arch wiki.

Still, at least you are making an effort to contribute.
"Hacking is at least as much about ideas as about computers and technology. We use our skills to open doors that should never have been shut. We open these doors not only for our own benefit but for the benefit of others, too." - Brian the Hacker

Quote
15:04  @Phage : I'm bored of Python

Offline techb

  • Soy Sauce Feeler
  • Global Moderator
  • King
  • *
  • Posts: 2350
  • Cookies: 345
  • Aliens do in fact wear hats.
    • View Profile
    • github
Re: Arch Linux Install Guide (Dec. 2013)
« Reply #3 on: December 12, 2013, 09:11:50 am »
I also agree with the above.

I would also add, this in an ethernet only install. I had to do it several times with wireless. And a desktop is optional, you could use just a window manager which is what I recommend. I don't use a swap either.
>>>import this
-----------------------------

Offline Snayler

  • Baron
  • ****
  • Posts: 812
  • Cookies: 135
    • View Profile
Re: Arch Linux Install Guide (Dec. 2013)
« Reply #4 on: December 12, 2013, 02:25:43 pm »
You forgot to insert a link in the "Introduction" chapter.

Quote
If you need to download VM software look here.
Anyway, good contribution.
« Last Edit: December 12, 2013, 02:26:07 pm by Snayler »

Offline Heisenburg

  • Serf
  • *
  • Posts: 32
  • Cookies: 4
    • View Profile
Re: Arch Linux Install Guide (Dec. 2013)
« Reply #5 on: December 24, 2013, 01:11:37 pm »
 :o  erm, that codes.
I think Archlinux's wiki and community already have a good environment for beginner to deal with it.

Anyway, good try :)

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: Arch Linux Install Guide (Dec. 2013)
« Reply #6 on: December 24, 2013, 01:56:43 pm »
Nice effort! :) nice looking and straight guide. But you should really surround the commands with code tags.

Offline jacobopus

  • /dev/null
  • *
  • Posts: 5
  • Cookies: 4
  • Auch!
    • View Profile
Re: Arch Linux Install Guide (Dec. 2013)
« Reply #7 on: August 21, 2014, 07:55:36 pm »
Thanks for the tutorial.
 
I'm trying to follow it and I found this:

Code: [Select]
genfstab -U -p >> /mnt/etc
ERROR : no root directory specified.

After a little research i could do it:

Code: [Select]
genfstab -U -p /mnt/home >> /mnt/home/etc/fstab

This because /mnt/home was the mount point specified in the first step of the guide and genfstab need to know where /root/ is.

I know this post is old, and you guys do not need it, but maybe this clarification will help other noobs.

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: Arch Linux Install Guide (Dec. 2013)
« Reply #8 on: August 21, 2014, 08:19:48 pm »
It's OK to necro a thread if you have something valuable to add :)

Offline voodoo

  • Serf
  • *
  • Posts: 42
  • Cookies: 4
  • Try Harder
    • View Profile
    • Security Voodoo
Re: Arch Linux Install Guide (Dec. 2013)
« Reply #9 on: August 26, 2014, 07:21:21 am »
Code: [Select]
https://wiki.archlinux.org/index.php/beginners'_guide
keep it simple

Offline Rytiou

  • Noob Zombie
  • VIP
  • Knight
  • *
  • Posts: 199
  • Cookies: 45
  • EZ's Noob
    • View Profile
Re: Arch Linux Install Guide (Dec. 2013)
« Reply #10 on: August 26, 2014, 12:19:34 pm »
Thanks for the tutorial.
 
I'm trying to follow it and I found this:

Code: [Select]
genfstab -U -p >> /mnt/etc
ERROR : no root directory specified.

After a little research i could do it:

Code: [Select]
genfstab -U -p /mnt/home >> /mnt/home/etc/fstab

This because /mnt/home was the mount point specified in the first step of the guide and genfstab need to know where /root/ is.

I know this post is old, and you guys do not need it, but maybe this clarification will help other noobs.
Interesting, thanks for letting me know. The command most likely have changed since I made this thread. I might get around to updating this thread since I haven't really done anything with it in the past year. Also, +1 for the info and letting me know people are still interested in this thread.
Quote from: Evilzone IRC
<EZBot> life, you're so lame we decided to change your nick to Rytiou's bitch.
<EZBot> Rytiou is lord of the fags and will suck dicks for shells.

Offline voodoo

  • Serf
  • *
  • Posts: 42
  • Cookies: 4
  • Try Harder
    • View Profile
    • Security Voodoo
Re: Arch Linux Install Guide (Dec. 2013)
« Reply #11 on: August 26, 2014, 04:22:21 pm »
the correct way to initially generate the fstab file is.
Code: [Select]
genfstab -U -p /mnt >> /mnt/etc/fstab
the following
Code: [Select]
genfstab -U -p >> /mnt/etc/fstabshouldn't do anything as you are not giving it the path to the mounted partitions.
However, if genfstab defaults a path to /mnt I could be wrong.
keep it simple

Offline proxx

  • Avatarception
  • Global Moderator
  • Titan
  • *
  • Posts: 2803
  • Cookies: 256
  • ФФФ
    • View Profile
Re: Arch Linux Install Guide (Dec. 2013)
« Reply #12 on: August 26, 2014, 05:48:25 pm »
Genfstab source.
Code: [Select]
#!/bin/bash

shopt -s extglob

m4_include(common)

write_source() {
  local src=$1 spec= label= uuid= comment=()

  label=$(lsblk -rno LABEL "$1" 2>/dev/null)
  uuid=$(lsblk -rno UUID "$1" 2>/dev/null)

  # bind mounts do not have a UUID!

  case $bytag in
    '')
      [[ $uuid ]] && comment=("UUID=$uuid")
      [[ $label ]] && comment+=("LABEL=$(mangle "$label")")
      ;;
    LABEL)
      spec=$label
      [[ $uuid ]] && comment=("$src" "UUID=$uuid")
      ;;
    UUID)
      spec=$uuid
      comment=("$src")
      [[ $label ]] && comment+=("LABEL=$(mangle "$label")")
      ;;
    *)
      [[ $uuid ]] && comment=("$1" "UUID=$uuid")
      [[ $label ]] && comment+=("LABEL=$(mangle "$label")")
      [[ $bytag ]] && spec=$(lsblk -rno "$bytag" "$1" 2>/dev/null)
      ;;
  esac

  [[ $comment ]] && printf '# %s\n' "${comment[*]}"

  if [[ $spec ]]; then
    printf '%-20s' "$bytag=$(mangle "$spec")"
  else
    printf '%-20s' "$(mangle "$src")"
  fi
}

optstring_apply_quirks() {
  local varname=$1 fstype=$2

  case $fstype in
    f2fs)
      # These are Kconfig options for f2fs. Kernels supporting the options will
      # only provide the negative versions of these (e.g. noacl), and vice versa
      # for kernels without support.
      optstring_remove_option "$varname" noacl,acl,nouser_xattr,user_xattr
      ;;
    vfat)
      # Before Linux v3.8, "cp" is prepended to the value of the codepage.
      if optstring_get_option "$varname" codepage && [[ $codepage = cp* ]]; then
        optstring_remove_option "$varname" codepage
        optstring_append_option "$varname" "codepage=${codepage#cp}"
      fi
      ;;
  esac
}

usage() {
  cat <<EOF
usage: ${0##*/} [options] root

  Options:
    -L             Use labels for source identifiers (shortcut for -t LABEL)
    -p             Avoid printing pseudofs mounts
    -t TAG         Use TAG for source identifiers
    -U             Use UUIDs for source identifiers (shortcut for -t UUID)

    -h             Print this help message

genfstab generates output suitable for addition to an fstab file based on the
devices mounted under the mountpoint specified by the given root.

EOF
}

if [[ -z $1 || $1 = @(-h|--help) ]]; then
  usage
  exit $(( $# ? 0 : 1 ))
fi

while getopts ':Lpt:U' flag; do
  case $flag in
    L)
      bytag=LABEL
      ;;
    U)
      bytag=UUID
      ;;
    p)
      nopseudofs=1
      ;;
    t)
      bytag=${OPTARG^^}
      ;;
    :)
      die '%s: option requires an argument -- '\''%s'\' "${0##*/}" "$OPTARG"
      ;;
    ?)
      die '%s: invalid option -- '\''%s'\' "${0##*/}" "$OPTARG"
      ;;
  esac
done
shift $(( OPTIND - 1 ))

(( $# )) || die "No root directory specified"
root=$1; shift

if ! mountpoint -q "$root"; then
  die "$root is not a mountpoint"
fi

# handle block devices
findmnt -Recvruno SOURCE,TARGET,FSTYPE,OPTIONS,FSROOT "$root" |
    while read -r src target fstype opts fsroot; do
  if (( nopseudofs )) && fstype_is_pseudofs "$fstype"; then
    continue
  fi

  # default 5th and 6th columns
  dump=0 pass=2

  src=$(unmangle "$src")
  target=$(unmangle "$target")
  target=${target#$root}

  if (( !foundroot )) && findmnt "$src" "$root" >/dev/null; then
    # this is root. we can't possibly have more than one...
    pass=1 foundroot=1
  fi

  # if there's no fsck tool available, then only pass=0 makes sense.
  if ! fstype_has_fsck "$fstype"; then
    pass=0
  fi

  if [[ $fsroot != / ]]; then
    if [[ $fstype = btrfs ]]; then
      opts+=,subvol=${fsroot#/}
    else
      # it's a bind mount
      src=$(findmnt -funcevo TARGET "$src")$fsroot
      if [[ $src -ef $target ]]; then
        # hrmm, this is weird. we're probably looking at a file or directory
        # that was bound into a chroot from the host machine. Ignore it,
        # because this won't actually be a valid mount. Worst case, the user
        # just re-adds it.
        continue
      fi
      fstype=none
      opts+=,bind
      pass=0
    fi
  fi

  # filesystem quirks
  case $fstype in
    fuseblk)
      # well-behaved FUSE filesystems will report themselves as fuse.$fstype.
      # this is probably NTFS-3g, but let's just make sure.
      if ! newtype=$(lsblk -no FSTYPE "$src") || [[ -z $newtype ]]; then
        # avoid blanking out fstype, leading to an invalid fstab
        error 'Failed to derive real filesystem type for FUSE device on %s' "$target"
      else
        fstype=$newtype
      fi
      ;;
  esac

  optstring_apply_quirks "opts" "$fstype"

  # write one line
  write_source "$src"
  printf '\t%-10s' "/$(mangle "${target#/}")" "$fstype" "$opts"
  printf '\t%s %s' "$dump" "$pass"
  printf '\n\n'
done

# handle swaps devices
{
  # ignore header
  read

  while read -r device type _ _ prio; do
    options=defaults
    if [[ $prio != -1 ]]; then
      options+=,pri=$prio
    fi

    # skip files marked deleted by the kernel
    [[ $device = *'\040(deleted)' ]] && continue

    if [[ $type = file ]]; then
      printf '%-20s' "$device"
    elif [[ $device = /dev/dm-+([0-9]) ]]; then
      # device mapper doesn't allow characters we need to worry
      # about being mangled, and it does the escaping of dashes
      # for us in sysfs.
      write_source "$(dm_name_for_devnode "$device")"
    else
      write_source "$(unmangle "$device")"
    fi

    printf '\t%-10s\t%-10s\t%-10s\t0 0\n\n' 'none' 'swap' "$options"
  done
} </proc/swaps

# vim: et ts=2 sw=2 ft=sh:

« Last Edit: August 26, 2014, 05:48:45 pm by proxx »
Wtf where you thinking with that signature? - Phage.
This was another little experiment *evillaughter - Proxx.
Evilception... - Phage

Offline Rytiou

  • Noob Zombie
  • VIP
  • Knight
  • *
  • Posts: 199
  • Cookies: 45
  • EZ's Noob
    • View Profile
Re: Arch Linux Install Guide (Aug. 2014)
« Reply #13 on: August 27, 2014, 04:30:14 am »
Alright so I actually went back and spent a few hours revamping this entire thread. Hopefully this is better than last time and if I missed anything or if I didn't do something right please let me know since I'm always open to feedback. Hope this contribution helps a few people out who want to become fellow Archers.
Quote from: Evilzone IRC
<EZBot> life, you're so lame we decided to change your nick to Rytiou's bitch.
<EZBot> Rytiou is lord of the fags and will suck dicks for shells.

Offline proxx

  • Avatarception
  • Global Moderator
  • Titan
  • *
  • Posts: 2803
  • Cookies: 256
  • ФФФ
    • View Profile
Re: Arch Linux Install Guide (Aug. 2014)
« Reply #14 on: August 27, 2014, 08:17:33 am »
Real man write their own fstab files :P
Thanks for the effort dude fellow archer.
Wtf where you thinking with that signature? - Phage.
This was another little experiment *evillaughter - Proxx.
Evilception... - Phage