almost 8 years ago
Archlinux Installation with Raid
I will show Archlinux installation with the following environment.
- GPT is a standard for the layout of the partition table on a physical hard disk. And you can find the introduction in wiki
CPU: 2 RAM: 2G Harddisk: 20G*2 GPT /boot - 128M, ext2 swap - 1G /root - rest, ext4
- The first, you must download the live CD, and you can find it in official website. I choose nctu mirror in Taiwan. [download link 2014.08.01] And then let computer or VM select CD as its first boot-device.
-
Set up the sshd to make it easy to install
Network setup- Here, I use static and private IP.
- If there is not static IP, you just use DHCP, and need to get its IP for ssh.
- Or, you can go next step, and type command line in front of PC(VM).
# dhcpcd -k //stop the DHCP # ip link //find network interface(NI) name # ip link set ens32 up //en32 is NI's name # ip addr add 192.168.10.50/24 dev ens32 # ip route add default via 192.168.10.1 # echo "nameserver 8.8.8.8" >> /etc/resolv.conf # passwd //set up temporary password # systemctl start sshd # ping www.google.com //testing network
- Then, you can use shell on linux workstation or use putty on windows to remotely login PC.
# ssh root@192.168.10.50
-
Hard disk partition
- You can use 'cgdisk' to create GPT partitions with description.
- But I use 'gdisk' here
# gdisk /dev/sda //Type '?', if you need to help. // 'n' can add a new partition. // 'w' write table to disk and exit. // 'p' see your partition table. //And then, you need to partition it to like to below. Number Start (sector) End (sector) Size Code Name 1 6144 210943 100.0 MiB FD00 Linux RAID 2 210944 2308095 1024.0 MiB 8200 Linux swap 3 2308096 41943006 18.9 GiB FD00 Linux RAID 128 2048 6143 2.0 MiB EF02 BIOS boot partition
- Then,copy partition table to /dev/sdb
# sgdisk /dev/sda -R=/dev/sdb # sgdisk -G /dev/sdb
-
Raid
- refer Archlinux wiki Raid page.
- use mdadm to do software RAID. And I will make / and /boot do RAID1(mirror) in order to backup data.
# mdadm --create --verbose /dev/md1 --level=mirror --raid-devices=2 /dev/sd{a,b}1 # mdadm --create --verbose /dev/md3 --level=mirror --raid-devices=2 /dev/sd{a,b}3 # mdadm --detail --scan | tee -a /etc/mdadm.conf //save the profile
- use 'cat /proc/mdstat' to check out progress of mdadm.
-
Create filesystems and install base system
- You can add mirror location or change the order in '/etc/pacman.d/mirrorlist', if you need.
- Here, I set 'Server = http://linux.cs.nctu.edu.tw/archlinux/$repo/os/$arch' (NCTU mirror) to first.
# mkswap /dev/sda2 # mkswap /dev/sdb2 # swapon /dev/sd{a,b}2 # mkfs.ext2 /dev/md1 # mkfs.ext4 /dev/md3 # mount /dev/md3 /mnt && mkdir /mnt/boot && mount /dev/md1 /mnt/boot # pacstrap /mnt base base-devel // install base and base-devel on /mnt
-
Initially set system profile
- you can refer to Fstab, Locale, Console font and keymap,and Time zone.
# genfstab -p /mnt | tee /mnt/etc/fstab following table is my finally fstab,and you can modify it in /mnt/etc/fstab. /dev/md3 / ext4 defaults,relatime 0 1 /dev/md1 /boot ext2 rw,relatime 0 2 /dev/sda2 none swap defaults 0 0 /dev/sdb2 none swap defaults,pri=-2 0 0
# cp /etc/mdadm.conf /mnt/etc/ # arch-chroot /mnt # hostnamectl set-hostname [your hostname] # echo "KEYMAP=us" > /etc/vconsole.conf # ln -s /usr/share/zoneinfo/Asia/Taipei /etc/localtime # hwclock --systohc --utc --adjfile /etc/adjtime # vi /etc/locale.gen //To uncomment a line remove the '#' in the front, if your system needs it to support the locale(language). Following options are selected for my system.
en_US.UTF-8 UTF-8 en_US ISO-8859-1 zh_TW.UTF-8 UTF-8 zh_TW BIG5
# locale-gen # echo "LANG=en_US.UTF-8" > /etc/locale.conf -
set up network
# systemctl disable network # cd /etc/netctl # cp examples/ethernet-static ethernet # vi ethernet //Like to below. Here, using static IP to set my profile, if you use DHCP, you can refer to Network.
Interface=ens32 Connection=ethernet IP=static Address=('192.168.10.51/24') Gateway='192.168.10.1' DNS=('140.113.235.1') IP6=stateless
# netctl enable ethernet -
Install ssh and create an initial ramdisk environment
# pacman -S openssh # systemctl enable sshd.service # vi /etc/mkinitcpio.conf //add 'mdadm_udev' option to HOOKS. Look like to HOOKS="base udev autodetect modconf block filesystems keyboard fsck mdadm_udev" # mkinitcpio -p linux
- you can refer to Fstab, Locale, Console font and keymap,and Time zone.
-
Install and configure a bootloader
- Install 'Grub' to system, and seting boot option.
# pacman -S grub # grub-install --target=i386-pc --recheck /dev/sda # grub-install --target=i386-pc --recheck /dev/sdb # cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo # vi /etc/default/grub //add 'nomodeset' option to GRUB_CMDLINE_LINUX_DEFAULT. Look like to GRUB_CMDLINE_LINUX_DEFAULT="quiet nomodeset". # grub-mkconfig -o /boot/grub/grub.cfg # passwd // Setting root's password. # exit # reboot
- Install 'Grub' to system, and seting boot option.
-
Success and reboot system
- You can 'ssh' immediate, if no any problem.
- May be, you need to delete 'know_hosts' in your ssh profile, if you install with 'ssh'.
- May be, your system have some problem such as network profile wrong, sshd not running, or /etc/fstab not correct, etc.
-
My common pogram list
-Just, for reference.pacman -Sy sudo vim screen bash-completion dnsutils net-tools git mercurial wget zip unzip zsh pacman -Sy vim pacman -Sy screen pacman -Sy bash-completion pacman -Sy dnsutils pacman -Sy net-tools pacman -Sy git pacman -Sy mercurial pacman -Sy wget pacman -Sy zip pacman -Sy unzip
-
Notice: need to set up NTP
# pacman -Sy ntp # vim /etc/ntp.conf # systemctl enable ntpd # systemctl start ntpd //Testing # date ==>Sun Apr 17 11:18:31 CST 2016
Example ntp.conf
server tock.stdtime.gov.tw prefer¬ server tick.stdtime.gov.tw¬ server time.stdtime.gov.tw restrict default kod limited nomodify nopeer noquery notrap¬ restrict 127.0.0.1¬ restrict ::1 driftfile /var/lib/ntp/ntp.drift
-
Reference
- Help of NCTU CSCC which is a place to pursue my studies.
- Archlinux Installation Guide
- [Archlinux Beginners Guide-fstab]:(https://wiki.archlinux.org/index.php/Beginners_Guide')
- [Archlinux wiki fstab]:https://wiki.archlinux.org/index.php/Fstab
-
Article update information
- 2014/8/21 finish process of installation
- 2014/8/15 update
- 2014/8/15 Begin writing this Article.
- 2016/4/17 Add ntp set up