Skip to content

Instantly share code, notes, and snippets.

@shinchiro
Last active November 27, 2018 07:04
Show Gist options
  • Save shinchiro/0a7bbc6111a4f55190d586e31c4b25c7 to your computer and use it in GitHub Desktop.
Save shinchiro/0a7bbc6111a4f55190d586e31c4b25c7 to your computer and use it in GitHub Desktop.
Good reference:
https://gist.github.com/miguelfrde/5dde43aa08b076106b9e
http://tech.memoryimprintstudio.com/dual-boot-installation-of-arch-linux-with-preinstalled-windows-10-with-encryption/
https://wiki.archlinux.org/index.php/GRUB#Windows_installed_in_UEFI-GPT_Mode_menu_entry
http://valleycat.org/linux/arch-usb.html?i=1
#boot live usb or cd
fdisk -l (find your drive names)
lsblk
cfdisk /dev/sda (assuming sda is your HDD)
#create 1GB BOOT PRIMARY
#create 1GB SWAP PRIMARY
#format remaing partition primary
fdisk -l (List your partition so you know what is what)
mkfs.ext4 /dev/sda1 (This is the boot partition)
mkswap /dev/sda2 (This is the swap partition)
mkfs.ext4 /dev/sda3 (This is the root partition)
mkdir /mnt/boot /mnt/var /mnt/home
mount /dev/sda3 /mnt
mount /dev/sda1 /mnt/boot
# Install package to /mnt
mount -o remount,size=2G /run/archiso/cowspace
pacstrap /mnt base base-devel
genfstab -p /mnt >> /mnt/etc/fstab
arch-chroot /mnt
# networking stuff
pacman -Syu iw wpa_supplicant dialog wpa_actiond
# bootloader stuff
pacman -Syu grub efibootmgr os-prober
bash
mkinitcpio -p linux
passwd root
grub-mkconfig -o /boot/grub/grub.cfg
grub-install /dev/sda
umount -R /mnt
umount -R /boot
exit
reboot
#log in with your newly created user account, you can now use sudo as well.
hostnamectl set-hostname hostnamegoeshere OR echo hostnamegoeshere > /etc/hostname
systemctl enable dhcpcd
systemctl start dhcpcd
# If using wifi,
systemctl disable dhcpcd
# Add default user
useradd -m -G wheel -s /bin/bash shinchiro
passwd shinchiro
groupadd -r autologin
gpasswd -a username autologin
nano /etc/sudoers (Add this: "myname ALL=(ALL) ALL")
# Uncomment '%wheel ALL=(ALL) ALL'
# Install XFCE Desktop
# Edit mirrorlist
nano /etc/pacman.conf
pacman -S xorg
pacman -S xterm xorg-xclock xorg-twm xorg-xinit xorg-server-utils
pacman -S xfce4 xfce4-goodies gvfs
pacman -Syu networkmanager network-manager-applet
pacman -Syu lightdm lightdm-gtk-greeter ntfs-3g
# Set 'thunar --daemon' as autostart
# Set System Language / time zone
nano /etc/locale.gen (select locals)
locale-gen
echo LANG=en_US.UTF-8 > /etc/locale.conf
export LANG=en_US.UTF-8
ln -s usr/share/zoneinfo/UTC > /etc/localtime
# or if not working, try: timedatectl set-timezone Etc/UTC
timedatectl set-ntp true
hwclock --systohc --utc
systemctl enable lightdm
netctl-auto@<interface>.service # get from 'iw dev' or `ip link´
reboot
If not works,
systemctl enable netctl-auto@<interface>.service
After connected wireless netwok, add a line in file: /etc/netctl/wlan0-ssid
ForceConnect=yes
nano /etc/fstab (Add this: "/dev/sda2 none swap defaults 0 0")
If something happens and lightdm fails to start you can always start xfce withthe command: "startxfce4"
#############################
# Install arch from live cd #
#############################
Download archlinux-bootstrap*.tar.gz binary from arch's site. Its size is more small than archlinux full image.
Copy to USB and locate the filepath. Mount /dev/sdx to '/mnt'
tar xzf bootstrap.tar.gz -C /mnt --strip-components=1
arch-chroot /mnt
pacman-key --init
pacman-key --populate archlinux
pacman -Syy
Note: Edit pacman file first before chroot with nano
/etc/pacman.conf
/etc/pacman.d/mirrorlist
Then, the following steps is similar with above
###################################################################
From: https://www.youtube.com/watch?v=METZCp_JCec
Here is a list of what I do in the video:
(i) Make some space for Arch Linux in Windows
(ii) Make a bootable installation media for Arch Linux (Not covered in this tutorial)
(iii) Attach it to your computer
(iv) Shutdown Windows after disabling fast shutdown. And use the command shutdown -s -t 0 to do so.
(v) Boot into Arch Linux Installation media in UEFI Mode.
(vi) Create two partitions in that empty space: (a) Swap (b) Root Partition
gdisk /dev/sda
n #Wanna create new partition!
#Hit enter, don't care about partition number
#Hit enter, automatically first sector will be starting of unallocated space
+2GB #Specify the size of the swap partition
8200 #Hex code for the Linux Swap partition.
w #Write changes to disk
Y #Confirm!
Type gdisk -l /dev/sda to find out the partition number of the swap partition. In my case, it is 5.
mkswap -L "Linux Swap" /dev/sda5 #Linux Swap is the label
swapon /dev/sda5 #Turn on swap!
free -m #Last line will confirm whether swap space has been turned on or not.
#Time to create partition in which Arch will be installed.
gdisk /dev/sda
n #Wanna create new partition!
#Hit enter, don't care about partition number
#Hit enter, automatically first sector will be starting of unallocated space
#Hit enter, automatically rest of the unallocated space will be filled
#Hit enter, default Hex code for the Linux Partition.
w #Write changes to disk
Y #Confirm!
(vii) Format the partition into filesystems.
Type gdisk -l /dev/sda to find out the partition number of the newly created partition. In my case, it is 6.
mkfs.ext4 -L "Arch Linux" /dev/sda6 #Format the new partition with ext4 file system.
(viii) Mount the partition in which Arch Linux files will be present to /mnt
mount /dev/sda6 /mnt
(ix) Use pacstrap to initialize the Arch Installation
If you are behind a proxy server, type:
export http_proxy=http://proxy_ip_or_domain:proxy_port
packstrap /mnt base
(x) Find and mount the efi partition to /mnt/boot/efi
mkdir -p /mnt/boot/efi
#Type gdisk -l to figure out the partition number of the existing EFI partition. In my case, it is 2.
mount /dev/sda2 /mnt/boot/efi
(xi) Generate the fstab, so that required partitions are mounted on reboot.
genfstab -p /mnt >> /mnt/etc/fstab
(xii) chroot into the arch installation.
arch-chroot /mnt
(xiii) Configure timezone, generate initial RAM disk.
#Chang password for root user
passwd
ln -s /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
mkinitcpio -p linux
(xiv) Install the bootloader. I use grub.
pacman -Syu grub efibootmgr
grub-mkconfig -o /boot/grub/grub.cfg #Generate initial grub config.
grub-install /dev/sda
(xv) Install the desktop environment, display manager, and vim and xterm.
packman -Syu gnome-desktop xterm vim gnome-display-manager
systemctl enable gdm #Start gdm on boot
(xvi) Create a new user and add him to the group wheel.
useradd -G wheel -s /bin/bash -m shinchiro
passwd shinchiro
(xvii) Reboot into Arch Linux
reboot
(xviii) Install os-prober. Regenerate grub configuration. Reboot.
pacman -Syu os-prober
grub-mkconfig -o /boot/grub/grub.cfg
Done! Now you can choose between Windows and Arch Linux at the start. Yay!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment