MethodicalJosh

Arch Linux Install

Nov 19th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.42 KB | None | 0 0
  1. Methodical Josh - How to install Arch Linux Base (No Dual Boot)
  2.  
  3. 1: Create Arch Linux USB by downloading live iso from http://www.archlinux.org/ and write to USB using Etcher (Easiest).
  4.  
  5. 2: Insert USB into computer, and find the key associated with USB Booting for your motherboard. Some motherboards can allow you to also boot to usb from inside BIOS.
  6.  
  7. 3: Once the shell has loaded, proceed with the commands below. You should see "root@archlinux:"
  8.  
  9.  
  10.  
  11.  
  12. --------------------------------------------------------------------------------------------------------------------
  13.  
  14. # Ping google to test internet connection. You should get a result if connected, if not follow 'Append1' at the bottom.
  15.  
  16. ping -c 4 google.com # This is used to ask google for data back to prove that the internet is working.
  17.  
  18. --------------------------------------------------------------------------------------------------------------------
  19.  
  20. # Find out your desired disk by using the following command
  21.  
  22. fdisk -l # This is used to show partition data for every disk.
  23.  
  24. # Your disk will be appended with /dev/sdx - with x being your append drive letter
  25.  
  26. --------------------------------------------------------------------------------------------------------------------
  27.  
  28. # Format the entire drive for cleaning of partition
  29.  
  30. mkfs.ext4 /dev/sdx #Replace x with desired disk append. This is used to format the entire drive for reinitialization.
  31.  
  32. --------------------------------------------------------------------------------------------------------------------
  33.  
  34. # Start building partitions using CFDISK
  35.  
  36. cfdisk #This runs a more user friendly version of fdisk.
  37.  
  38. # It will ask you if you want to clear the disc, select yes, then select GPT/UEFI or MBR/BIOS
  39.  
  40. --------------------------------------------------------------------------------------------------------------------
  41.  
  42. # You'll now be prompted with a list with your disks.. Follow below.
  43.  
  44. /dev/sdx, Select "Create" - Again, x will be replaced with your drive append letter
  45.  
  46. Enter a size of 1G if using UEFI, otherwise ignore. * IGNORE IF USING BIOS SYSTEM
  47. Select this partition and select "Type", set this to "EFI System" * IGNORE IF USING BIOS SYSTEM
  48. You should now see /dev/sdx1 * IGNORE IF USING BIOS SYSTEM
  49.  
  50. Create another partition by selecting the unused space, select "Create" again.
  51. Enter a size equivalent of the amount of RAM your device has, so if you have 4GB of RAM, enter 4G. This will be your swap space.
  52. Select this partition and select "Type", set this to "Linux Swap"
  53. You should now see /dev/sdx2 - or sdx1 if using bios system
  54.  
  55. Create another the same way as before.
  56. Enter a size of AT LEAST 20GB for the linux partition. More heavy users increase this as needed.
  57. Select this partition and select "Type", set this to "Linux Filesystem"
  58. You should now see /dev/sdx3 - or sdx2 if using bios system
  59.  
  60. Create a final partition for your /home folder which will contain all of you data such as (Desktop, Downloads, Pictures, Videos, Music, Documents, etc..)
  61. It should already have the biggest size possible in the size field, just hit enter as done before.
  62. Select this partition and select "Type", set this to "Linux Home"
  63. You should now see /dev/sdx4 - or sdx3 if using bios system
  64.  
  65. Finally, Select the "Write" command, and select yes.
  66. Select "Quit" after, and you should be back to the command line.
  67.  
  68. --------------------------------------------------------------------------------------------------------------------
  69.  
  70. # Do as follows, replacing x with your drive append letter.
  71.  
  72. mkfs.fat -F32 /dev/sdx1 # This formats the EFI partition to the proper filesystem. * IGNORE IF USING BIOS SYSTEM
  73.  
  74. mkswap /dev/sdx2 # This turns the "Linux Swap" partition into an actual usable partition. IF USING BIOS, THIS WILL BE sdx1
  75. swapon /dev/sdx2 # This turns on the swap. IF USING BIOS, THIS WILL BE sdx1
  76.  
  77. mkfs.ext4 /dev/sdx3 # This formats the "Linux Filesystem" partition into the EXT4 Filesystem. IF USING BIOS, THIS WILL BE sdx2
  78. mkfs.ext4 /dev/sdx4 # This formats the "Linux Home" partition into the EXT4 Filesystem. IF USING BIOS, THIS WILL BE sdx3
  79.  
  80. --------------------------------------------------------------------------------------------------------------------
  81.  
  82. # You will now need to mount the partitions by doing the following. Follow as the commands are.
  83.  
  84. mount /dev/sdx3 /mnt # This mounts the "Linux Filesystem" partition to the /mnt folder.
  85.  
  86. mkdir /mnt/home # This makes the folder /home inside of the /mnt directory which will be used for the "Linux Home" partition.
  87. mkdir -p /mnt/boot/EFI # This makes the EFI and boot folder consecutively using the parent flag, which is used only if you have a UEFI system. * IGNORE IF USING BIOS SYSTEM
  88.  
  89. mount /dev/sdx1 /mnt/boot/EFI # This mounts the EFI to the folder we made for it. * IGNORE IF USING BIOS SYSTEM
  90. mount /dev/sdx4 /mnt/home # This mounts the "Linux Home" partition to the /home folder inside of /mnt
  91.  
  92. --------------------------------------------------------------------------------------------------------------------
  93.  
  94. pacman -Sy # This updates your packages
  95. pacman -S reflector # This installs reflector which determines the best mirrors to use based on speed and ping.
  96.  
  97. reflector --verbose -l 10 --sort rate --save /etc/pacman.d/mirrorlist # This is the actual command to use reflector.
  98.  
  99. --------------------------------------------------------------------------------------------------------------------
  100.  
  101. # You'll now install the base system preparing the system for it's final form.
  102.  
  103. pacstrap -i /mnt base base-devel # This calls for all packages for base and base-devel to be installed to the /mnt folder which is currently mounted with "Linux Filesystem" partition.
  104.  
  105. --------------------------------------------------------------------------------------------------------------------
  106.  
  107. # You'll now configure FSTAB which is the configuration used to automount partitions and folders where they are supposed to be mounted, which are appended with a UUID (Universally Unique Identifier).
  108.  
  109. genfstab -U -p /mnt >> /mnt/etc/fstab # This is used to turn the current mounting configuration into a usable fstab configuration file.
  110.  
  111. --------------------------------------------------------------------------------------------------------------------
  112.  
  113. # You'll now change root (chroot) into your new installed filesystem for last configurations of it before restarting.
  114.  
  115. arch-chroot /mnt # This changes the terminal over to the new installed filesystem in /mnt.
  116.  
  117. --------------------------------------------------------------------------------------------------------------------
  118.  
  119. # Now, You'll go through language and location configuration.
  120.  
  121. nano /etc/locale.gen # This moves you into a terminal editor for editing the locale.gen file. Find your locale in the file and remove the '#' symbol from in front of it, then press CTRL+O to write, and then CTRL+X to exit.
  122.  
  123. locale-gen
  124.  
  125. echo LANG=en_US.UTF-8 > /etc/locale.conf # Replace the en_US.UTF-8 with the locale of yours from the locale.gen, This copies the LANG to the locale.conf for language configuration.
  126. export LANG=en_US.UTF-8 # Again, replace with your locale, this finalizes the language.
  127.  
  128. --------------------------------------------------------------------------------------------------------------------
  129.  
  130. # Now, set your time zone.
  131.  
  132. ln -s /usr/share/zoneinfo/America/New_York > /etc/localtime #Replace America and New_York with your region and city using a _ as a space between city/region names.. Etc.. West_Virginia, South_Carolina
  133.  
  134. --------------------------------------------------------------------------------------------------------------------
  135.  
  136. # Configure the package manager to include multilib
  137.  
  138. nano /etc/pacman.conf # Opens the pacman.conf in nano editor, CTRL+O to save, CTRL+X to exit
  139.  
  140. Uncomment (Remove the #):
  141.  
  142. [multilib]
  143. include = /etc/pacman.d.mirrorlist
  144.  
  145. pacman -Sy # Updates the package list to include the multilib above
  146.  
  147.  
  148. --------------------------------------------------------------------------------------------------------------------
  149.  
  150. # Set the hardware clock
  151.  
  152. hwclock --systohc --est # Replace est with your time zone, this will sync the system and hardware clock together.
  153.  
  154. --------------------------------------------------------------------------------------------------------------------
  155.  
  156. # Set your hostname for your computer.. Kinda like a special name you want to call it.
  157.  
  158. echo mycomputername > /etc/hostname # Replace mycomputername with the name you want.
  159.  
  160. # Now copy this into /etc/hosts:
  161.  
  162. nano /etc/hosts
  163.  
  164. COPY THIS with editing:
  165.  
  166. 127.0.0.1 localhost
  167. ::1 localhost
  168. 127.0.1.1 mycomputername.localdomain mycomputername
  169.  
  170. ## Edit the mycomputer name to match your prefered name, then CTRL+O to save, CTRL+X to exit nano.
  171.  
  172. --------------------------------------------------------------------------------------------------------------------
  173.  
  174. # We will now configure your ETHERNET for auto connection, Not wifi.
  175.  
  176. ip link show # This will show you available networking devices, You should see one called something similar to "enp0s3", Write down this entire thing except the : at the end and make sure to use proper caps sensitive lettering.
  177.  
  178. systemctl enable dhcpcd@enp0s3.service # Replace the enp0s3 with your network device name, This will create a service for automatically connecting using this device.
  179.  
  180. --------------------------------------------------------------------------------------------------------------------
  181.  
  182. # You'll now set your root passwork and then also make your first NON-root user for daily usage like other linux systems.
  183.  
  184. passwd # Type your password, BE CAREFUL because you can not see it for security purposes. If you mess up, just hold backspace until you believe it is cleared.
  185.  
  186. pacman -S sudo bash-completion # This will install SUDO needed for root commands without being root, also installs bash-completeion for easier command lining by hitting tab twice.
  187.  
  188. useradd -m -g users -G wheel,storage,power -s /bin/bash yourusername # This will create a user in the users group primary, and add user to the wheel, storage and power group for accessing sudo, storage devices and power ahci devices. Replace yourusername with the name you want.
  189.  
  190. passwd yourusername # Create a password for the user, again BE CAREFUL as it is invisible. Replace yourusername with your users name.
  191.  
  192. --------------------------------------------------------------------------------------------------------------------
  193.  
  194. # You'll now need to allow the users in wheel to access the sudo command by editing the sudoers file.
  195.  
  196. nano /etc/sudoers # This is the sudoers file, be careful inside this file. Only change what is needed.
  197.  
  198. # Find %wheel ALL=(ALL) ALL and remove the '#' from in front of it, again save by pressing CTRL+O, and exit using CTRL+X
  199.  
  200. --------------------------------------------------------------------------------------------------------------------
  201.  
  202. # Almost done, Now we must create a ramdisk environment to boot all the stuff we need before arch starts.
  203.  
  204. mkinitcpio -p linux # This creates that ramdisk environment for booting.
  205.  
  206. pacman -S grub os-prober # This installs grub which is the boot menu for linux filesystems.. IF YOU ARE USING an EFI SYSTEM, use the command 'pacman -S grub os-prober efibootmgr' to install the EFI files needed.
  207.  
  208. ##FOR EFI:
  209. grub-install --efi-directory=/boot/EFI /dev/sdx # DO NOT APPEND A NUMBER TO THE sdx, only change the letter. Ex. /dev/sda
  210.  
  211. ##FOR BIOS:
  212. grub-install /dev/sdx # DO NOT APPEND A NUMBER TO THE sdx, only change the letter. Ex. /dev/sda
  213.  
  214. --------------------------------------------------------------------------------------------------------------------
  215.  
  216. # Create the grub menu with the proper configuration
  217.  
  218. grub-mkconfig -o /boot/grub/grub.cfg # This creates the grub menu using the grub.cfg file downloaded.
  219.  
  220. --------------------------------------------------------------------------------------------------------------------
  221.  
  222. # And you're done, do the following.
  223.  
  224. exit #Exits back to the previous root bash
  225.  
  226. umount -R /mnt #Unmounts recursively all mount points inside of /mnt so there is no problem booting.
  227.  
  228. reboot # Uh.. Duh.
Add Comment
Please, Sign In to add comment