Skip to content

Latest commit

 

History

History
541 lines (372 loc) · 10.7 KB

Arch-Installation.md

File metadata and controls

541 lines (372 loc) · 10.7 KB

Arch-Notes

Instructions for Arch installation notes + Arch on IMac/Book installation.

References:


Procedure

1. Make bootable USB media with Arch ISO image (wiki, video guide)

dd if = archlinux-2015.01.01-dual.iso | pv | of = /dev/sd*

2. Hold the alt/option key and boot into USB

3. Create partitions

fdisk -l
cgdisk /dev/sd*

Partitions:

If the installation is on Apple device the partition table should look like this:

Mount point Partition Name Partition type Suggested size
NONE /dev/sdX4 Boot Loader Apple HFS+ 128M
/ /dev/sdX5 Boot Linux filesystem 256MB
/ /dev/sdX6 Root Linux filesystem [Rest of space]

Check if the partition scheme of the disk is right:

lsblk

4. Format and mount partitions

mkfs.ext4 /dev/sdX5
mkfs.ext4 /dev/sdX6
mount /dev/sdX6 /mnt
mkdir /mnt/boot && mount /dev/sdX5 /mnt/boot

Create a swapfile :

dd if=/dev/zero of=/mnt/swapfile bs=1G count=8
chmod 600 /mnt/swapfile
mkswap /mnt/swapfile
swapon /mnt/swapfile

4.1 Use this method for creating a swap partition instead of a swapfile:

Mount point Partition Name Partition type Suggested size
NONE /dev/sdX4 Boot Loader Apple HFS+ 128M
/ /dev/sdX5 Boot Linux filesystem 256MB
NONE /dev/sdX6 Swap Linux Swap [X]
/ /dev/sdX7 Root Linux filesystem [Rest of space]

Check if the partition scheme of the disk is right:

lsblk

Create Filesystem:

mkfs.ext4 /dev/sdX5
mkfs.ext4 /dev/sdX7
mount /dev/sdX7 /mnt
mkdir /mnt/boot && mount /dev/sdX5 /mnt/boot
mkswap /dev/sdX6
swapon /dev/sdX6

4.2 Installation with GPT in BIOS:

Mount point Partition Name Partition type Suggested size
NONE /dev/sdX1 Boot BIOS boot partition 2M
/ /dev/sdX2 Root Linux filesystem [Rest of space]

Check if the partition scheme of the disk is right:

lsblk

Create Filesystem:

mkfs.ext4 /dev/sdX2
mount /dev/sdX2 /mnt

Create a swapfile :

dd if=/dev/zero of=/mnt/swapfile bs=1G count=8
chmod 600 /mnt/swapfile
mkswap /mnt/swapfile
swapon /mnt/swapfile

5. Install the base system

Internet connection required, for wireless option use:

wifi-menu

For DHCP:

systemctl enable dhcpcd.service

Test:

ping www.google.com

Run

pacstrap /mnt base base-devel
genfstab -p /mnt >> /mnt/etc/fstab

6. Optimize fstab for SSD, add swap (Apple only)

vi /mnt/etc/fstab
/dev/sd*6  /       ext4  defaults,noatime,discard,data=writeback 0 1
/dev/sd*5  /boot   ext4  defaults,relatime,stripe=4 0 2
/swapfile  none    swap  defaults 0 0

If your drive is HDD, you fstab file should look like this (Apple only):

/dev/sd*6  /      ext4  rw,defaults,noatime,data=writeback 0 1
/dev/sd*5  /boot  ext4  rw,defaults,data=ordered 0 2

7. Configure system

arch-chroot /mnt /bin/bash
passwd
echo myhostname > /etc/hostname
ln -s /usr/share/zoneinfo/Canada/Eastern /etc/localtime
hwclock –systohc –utc
useradd -m -g users -G wheel -s /bin/bash myusername
passwd myusername
pacman -S sudo

8. Grant sudo

echo “%wheel ALL=(ALL) ALL” > /etc/sudoers.d/10-grant-wheel-group

9. Set up locale

nano /etc/locale.gen
locale-gen
echo LANG=en_US.UTF8 > /etc/locale.conf
export LANG=en_US.UTF-8

10. Set up mkinitcpio hooks and run

Insert "keyboard" after "autodetect" if it's not already there.

vi /etc/mkinitcpio.conf

Then run it:

mkinitcpio -p linux

11. Bootloader

To boot up the computer we will continue to use Apple’s EFI bootloader, so we need GRUB-EFI:

pacman -S grub-efi-x86_64

Configuring GRUB

vi /etc/default/grub

A special kernal parameter must be set to avoid system (CPU/IO) hangs:

GRUB_CMDLINE_LINUX_DEFAULT="quiet rootflags=data=writeback libata.force=1:noncq"

Additionally, the grub template is broken and requires this adjustment:

#Fix broken grub.cfg gen
GRUB_DISABLE_SUBMENU=y

Generate the configuration file of grub:

grub-mkconfig -o boot/grub/grub.cfg
grub-mkstandalone -o boot.efi -d usr/lib/grub/x86_64-efi -O x86_64-efi --compress=xz boot/grub/grub.cfg

Copy boot.efi (generated in the command above) to a USB stick for use later in OS X:

mkdir /mnt/usbdisk && mount /dev/sdb /mnt/usbdisk 
cp boot.efi /mnt/usbdisk/

11.1 BIOS

For GRUB/EFI bootloader configuration

Install GRUB:

 pacman -S grub

Configuring GRUB

vi /etc/default/grub

The grub template is broken and requires this adjustment:

#Fix broken grub.cfg gen
GRUB_DISABLE_SUBMENU=y

Generate the configuration file of grub:

grub-install --target=i386-pc --recheck /dev/sdX
grub-mkconfig -o boot/grub/grub.cfg

12. Network

Arch doesn't have wireless included in the base packages. Install the following packages before rebooting for the WiFi to work on reboot:

pacman -S iw wireless_tools wpa_supplicant dialog

13. Setup boot in OS X

Before rebooting, exit from the chroot and unmount partition/s:

exit
umount -R /mnt
reboot

14. Launch Disk Utility in OS X

Format (“Erase”) /dev/sda4 using Mac journaled filesystem.

15. Create boot file structure

This procedure allows the Apple bootloader to see our Arch Linux system and present it as the default boot option.

cd /Volumes/disk0s4
mkdir System mach_kernel
cd System
mkdir Library
cd Library
mkdir CoreServices
cd CoreServices
touch SystemVersion.plist
nano SystemVersion.plist
<xml version="1.0" encoding="utf-8"?>
<plist version="1.0">
<dict>
    <key>ProductBuildVersion</key>
    <string></string>
    <key>ProductName</key>
    <string>Linux</string>
    <key>ProductVersion</key>
    <string>Arch Linux</string>
</dict>
</plist>

Copy boot.efi from your USB stick to this CoreServices directory. The tree should look like this:

|___mach_kernel
|___System
       |
       |___Library
              |
              |___CoreServices
                      |
                      |___SystemVersion.plist
                      |___boot.efi

16. Make Boot Loader partition bootable

sudo bless --device /dev/disk0s4 --setBoot

You may need to disable the System Integrity Projection of OS X:

  • Restart the computer, while booting hold down Command-R to boot into recovery mode.
  • Once booted, navigate to the “Utilities > Terminal” in the top menu bar.
  • Enter “csrutil disable” in the terminal window and hit the returnkey.
  • Restart the machine and System Integrity Protection will now be disabled.

End of Arch Linux is installation.

Reboot the computer and hold the alt/option key to select operating system.


Post Installation

GUI

  1. Installation
  2. Starting Session
  3. .xinitrc
  4. Graphical terminal

Applications

  1. Packages

1. Installation:

sudo pacman -S gnome

2. Starting Session

I will be using xinit to start the desktop enviroment, a display manager like GDM can be used and enable with systemd.

sudo pacman -S xorg-xinit
i. .xinitrc

The .xinitrc file should look like this, first run:

cp /etc/X11/xinit/xinitrc ~/.xinitrc
sudo nano .xinitrc

then

# merge in defaults and keymaps

if [ -f $sysresources ]; then







    xrdb -merge $sysresources

fi

if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi

if [ -f "$userresources" ]; then







    xrdb -merge "$userresources"

fi

if [ -f "$usermodmap" ]; then
    xmodmap "$usermodmap"
fi

# start some nice programs

if [ -d /etc/X11/xinit/xinitrc.d ] ; then
 for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
  [ -x "$f" ] && . "$f"
 done
 unset f
fi

# twm &
#xclock -geometry 50x50-1+1 &
#xterm -geometry 80x50+494+51 &
#xterm -geometry 80x20+494-0 &
#exec xterm -geometry 80x66+0+0 -name login
exec gnome-session

Start session with:

starx

3. Graphical Terminal

Install Guake:

sudo pacman -S guake
3.1 Install Zsh:
sudo pacman -S zsh
3.2 Install Oh My Zsh

Install halfo/lambda-mod-zsh-theme

3.3 Clone .dotfiles repo and install script:
git clone [email protected]:alphayed/.dotfiles.git
cd ~/.dotfiles
chmod +x .makesymlinks.sh
./.makesymlinks.sh

Applications

1. Packages

Use techdavid/backup script to restore Arch Linux's pacman configuration data and manually installed packages.

Usage

To backup your current packages and configuration, simply run the following at any time:

./bacpac backup

To restore your packages and configuration on another computer or after reinstalling the operating system, run the following:

git clone https://gist.github.com/alphayed/af79469e7f143bf5c517344e57503132 bacpac
cd bacpac
./bacpac restore

To update bacpac, which you should do every few days to stay up-to-date, run the following:

./bacpac update