Skip to content

Instantly share code, notes, and snippets.

@hthuong09
Created August 18, 2016 03:10
Show Gist options
  • Save hthuong09/3826d99c05448ff6938891071fa55e84 to your computer and use it in GitHub Desktop.
Save hthuong09/3826d99c05448ff6938891071fa55e84 to your computer and use it in GitHub Desktop.
Arch Install with EFI and Grub2
# These command was inspired from helmuthdu/aui
# BASIC INSTALLATION
# Select Keymap
loadkeys us
# Select Editor
pacman -S vim nano
# Configure Mirrorlist
# Download mirrorlist from archlinux
curl -so /tmp/mirrorlist.tmp "https://www.archlinux.org/mirrorlist/?country=VN&use_mirror_status=on"
# Backup current mirrorlist file
mv -i /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.orig
# Move new mirrorlist file to pacman.d
mv -i /tmp/mirrorlist.tmp /etc/pacman.d/mirrorlist
# Check mirror list
nano /etc/pacman.d/mirrorlist
##
## Arch Linux repository mirrorlist
## Sorted by mirror score from mirror status page
## Generated on 2016-08-18
##
## Score: 2.9, Vietnam
#Server = http://f.archlinuxvn.org/archlinux/$repo/os/$arch
## Score: 7.7, Vietnam
#Server = http://mirror-fpt-telecom.fpt.net/archlinux/$repo/os/$arch
# Partition Scheme
# Create / modify disk with cfdisk
cfdisk /dev/sdx
# Create 4 partitions
# /dev/sdx1 EFI boot partition
# /dev/sdx2 linux swap
# /dev/sdx3 linux root
# /dev/sdx4 linux home
# Formating and mounting partition
# Root Partition
mkfs.ext4 /dev/sdx3; fsck /dev/sdx3; # use mkfs.ext4 -E discard /dev/sdx3 if you are using SSD
mount -t ext4 /dev/sdx3 /mnt
# Home Partition
mkfs.ext4 /dev/sdx4; fsck /dev/sdx4; # use mkfs.ext4 -E discard /dev/sdx4 if you are using SSD
mkdir /mnt/home
mount -t ext4 /dev/sdx4 /mnt/home
# EFI System Partition
mkfs.vfat -F32 /dev/sdx1; fsck /dev/sdx1
mkdir -p /mnt/boot/efi
mount -t vfat /dev/sdx1 /mnt/boot/efi
# Linux Swap
mkswap /dev/sdx2
swapon /dev/sdx2
# Install Base System
pacstrap /mnt base base-devel ntp gptfdisk # parted btrfs-progs f2fs-tools
# Wireless
pacstrap /mnt iw wireless_tools wpa_actiond wpa_supplicant dialog
# Wired
# arch-chroot /mnt /bin/bash -c "systemctl enable dhcpcd@${WIRED_DEV}.service"
# Configure Fstab
genfstab -t PARTUUID -p /mnt >> /mnt/etc/fstab
# CHROOT
# Update keymap before chroot
echo "KEYMAP=us" > /mnt/etc/vconsole.conf
arch-chroot /mnt /bin/bash
# Configure Hostname
echo hostname > /etc/hostname
# Put hostname to hosts file
nano /etc/hosts
# 127.0.0.1 hostname # ipv4
# ::1 hostname # ipv6
# Configure Timezone
ln -s /usr/share/zoneinfo/Asia/Ho_Chi_Minh /etc/localtime
# Enable systemd-timesyncd
nano /etc/systemd/timesyncd.conf
# [Time]
# NTP=0.arch.pool.ntp.org 1.arch.pool.ntp.org 2.arch.pool.ntp.org 3.arch.pool.ntp.org
# FallbackNTP=0.pool.ntp.org 1.pool.ntp.org 0.fr.pool.ntp.org
timedatectl set-ntp true
# Configure Hardware Clock
hwclock --systohc --utc
# hwclock --systohc --localtime
# Configure Locale
echo 'LANG="en_US.UTF-8"' > /etc/locale.conf
sed -i '/en_US.UTF-8/s/^#//' /etc/locale.gen
locale-gen
# Configure Mkinitcpio
mkinitcpio -p linux
# Install Bootloader
pacman -S grub os-prober efibootmgr dosfstools
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch_grub --recheck
grub-mkconfig -o /boot/grub/grub.cfg
# Root Password
passwd
# ADVANCED INSTALLATION
# Create user
useradd -m -g users -G wheel -s /bin/bash username
chfn username
passwd username
cp /etc/skel/.bashrc /home/username
# Install sudo
pacman -S sudo
sed -i '/%wheel ALL=(ALL) ALL/s/^#//' /etc/sudoers
## This config is especially helpful for those using terminal multiplexers like screen, tmux, or ratpoison, and those using sudo from scripts/cronjobs:
# echo "" >> /etc/sudoers
# echo 'Defaults !requiretty, !tty_tickets, !umask' >> /etc/sudoers
# echo 'Defaults visiblepw, path_info, insults, lecture=always' >> /etc/sudoers
# echo 'Defaults loglinelen=0, logfile =/var/log/sudo.log, log_year, log_host, syslog=auth' >> /etc/sudoers
# echo 'Defaults passwd_tries=3, passwd_timeout=1' >> /etc/sudoers
# echo 'Defaults env_reset, always_set_home, set_home, set_logname' >> /etc/sudoers
# echo 'Defaults !env_editor, editor="/usr/bin/vim:/usr/bin/vi:/usr/bin/nano"' >> /etc/sudoers
# echo 'Defaults timestamp_timeout=15' >> /etc/sudoers
# echo 'Defaults passprompt="[sudo] password for %u: "' >> /etc/sudoers
# Default editor
pacman -S vim
export EDITOR=vim
# Basic packages
pacman -S bc rsync mlocate bash-completion #pkgstats arch-wiki-lite
# Uncompress tools
pacman-S zip unzip unrar p7zip lzop cpio
# Avahi
# pacman -S avahi nss-mdns
# systemctl enable enable avahi-daemon
# ALSA
pacman -S alsa-utils alsa-plugins lib32-alsa-plugins
# Pulseaudio
pacman -S pulseaudio pulseaudio-alsa lib32-libpulse
# Filesystems
pacman -S ntfs-3g dosfstools exfat-utils f2fs-tools fuse fuse-exfat autofs
# XORG & Display driver
pacman -S xf86-video-intel mesa-libgl libva-intel-driver lib32-mesa-libgl
pacman -S xorg-server xorg-server-utils xorg-server-xwayland xorg-xinit xorg-xkill
pacman -S xf86-input-synaptics xf86-input-mouse xf86-input-keyboard xf86-input-wacom xf86-input-joystick xf86-input-libinput
pacman -S mesa
# Font config
pacman-key -r 962DDE58
pacman-key --lsign-key 962DDE58
echo -e "\n[infinality-bundle]\nServer = http://bohoomil.com/repo/\$arch" >> /etc/pacman.conf
echo -e "\n[infinality-bundle-multilib]\nServer = http://bohoomil.com/repo/multilib/\$arch" >> /etc/pacman.conf
pacman -S --needed infinality-bundle
pacman -S --needed infinality-bundle-multilib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment