Last active
August 29, 2015 14:04
-
-
Save kokizzu/e221ffbfcc9b9eaa263b to your computer and use it in GitHub Desktop.
VPS Archlinux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 0. download latest .iso from https://www.archlinux.org/download/ | |
# dump to USB disk if required: | |
# dd bs=4M if=/path/to/archlinux-yyyy.mm.dd-dual.iso of=/dev/your_usb_disk | |
# 1. boot with archlinux ISO | |
# 2. create partition, format, mount | |
lsblk # find disk name | |
disk=/dev/vda | |
cfdisk $disk # create only 1 ext4 partition, set bootable; 83; write; quit | |
part=/dev/vda1 | |
mkfs.ext4 $part | |
mount $part /mnt | |
# 3. update repo, bootstrap, chroot | |
pacman -Syy | |
pacstrap -i /mnt base base-devel vim bash openssh curl | |
genfstab -U -p /mnt >> /mnt/etc/fstab | |
arch-chroot /mnt | |
# 4. configure language (Canada and Indonesia, not US) | |
bash | |
loadkeys us | |
vim /etc/locale.gem # uncomment en_CA.UTF-8, id_ID.UTF-8 | |
locale-gen | |
export LANG=en_CA.UTF-8 | |
# 5. configure time (Jakarta) | |
location=/usr/share/zoneinfo/Asia/Jakarta | |
ln -s $location /etc/localtime | |
hwclock --systohc --utc | |
current="2014-07-23 06:00:00" | |
date -s "$current" | |
# 6. change name, configure network and ssh, use Google DNS | |
echo 'archvps' > /etc/hostname | |
echo nameserver 8.8.8.8 > /etc/resolv.conf | |
systemctl enable sshd | |
vim /etc/ssh/sshd_config # uncomment PermitRootLogin yes | |
ip link | |
dev=eno1 # eth0, enp1s0, wlp2s1 | |
# 6a. for permanent dhcp | |
systemctl enable dhcpcd@$dev | |
# 6b. for static address | |
addr=192.168.20.28 | |
nmask=24 | |
bcast=192.168.20.255 | |
gw=192.168.20.1 | |
# 6b1. for permanent static address | |
echo "address=$ipaddr | |
netmask=$nmask | |
broadcast=$bcast | |
gateway=$gw | |
" > /etc/conf.d/network@interface | |
curl 'https://gist.githubusercontent.com/kokizzu/2e6e6838dfe360a73b5d/raw/7275ec752c7ffeb659e696280dcbcc7f3492463f/network@.service' > /etc/systemd/system/network@.service | |
systemctl enable network@$dev | |
# 6b2. for temporary static address (gone when reboot) | |
ip link set dev $dev up | |
ip addr add $addr/$nmask broadcast $bcast dev $dev | |
ip route add default via $gw | |
# 7. enable 32-bit repo, set password | |
vim /etc/pacman.conf # uncomment multilib | |
pacman -Sy | |
passwd # remember! | |
# 8. install and configure bootloader | |
pacman -S grub-bios os-prober | |
grub-install --recheck /dev/vda | |
grub-mkconfig -o /boot/grub/grub.cfg | |
# 9. reboot | |
exit | |
exit | |
reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment