I have Windows 7 64-bit on my Laptop (it has 4GB RAM) and here is how I went about Installing Arch Linux on a virtual machine created using VirtualBox
The condensed instructions above were prepared using the following references:
Prepare the virtual machine:
- Make sure your computer has an active internet connection
- Download and install "VirtualBox for Windows hosts" from here.
- Download and install "VirtualBox Oracle VM VirtualBox Extension Pack". Just double click on .vbox-extpack file to install it.
- Download the Arch Linux iso image file. The name of the latest image at the time of writing this was: archlinux-2012.11.01-dual.iso
- Click on "New" to create a new virtual machine for Arch Linux. Name it the same as the iso file (archlinux-2012.11.01-dual in my case) and the "Operating System" and "Version" types will automatically be selected. Set the RAM to 1024 MB, Hard Disk to VDI having capacity of 10GB.
- Before starting the virtual machine, right click on it and select settings and perform the following configurations:
- Under "General>Advanced" set the Shared Clipboard to Bidirectional
- Under "Storage>IDE Controller" point to the Arch Linux iso file for loading into the virtual CD/DVD drive. Put a tick in the Live CD/DVD checkbox.
- Under "Network" ensure that the Adapter 1 is enabled and attached to NAT. Under the "Advanced" option for the same, change the adapter type to "PCnet-FAST III"
- Under "Display" tick the "Enable 3D Acceleration" checkbox and increase the video memory to 128 MB.
- Double click on the newly created virtual machine to start it.
- When the system boots select "Boot Arch Linux" from the menu presented by the live CD
Format and mount the virtual hard disk:
Note that you will need to manually type out the commands, copy and paste won't work between Windows host and the Arch Linux
- When the command prompt is presented, execute the following command:
# cfdisk /dev/sda - Create one primary partition to use the whole 8GB hard disk.
- Mark the partition as Bootable.
- Write the partition table
- Exit cfdisk.
- When you are back to the command prompt, execute the following command to make the file system for the first and only partition:
# mkfs.ext4 /dev/sda1 - Mount the partition as root:
# mount /dev/sda1 /mnt - Install the base system (internet connection required, ~152MB will be downloaded):
# pacstrap /mnt base base-devel - Generate an fstab (fstab stores filesystem information):
# genfstab -U -p /mnt >> /mnt/etc/fstab - Generate locale:
# locale-gen - Chroot into the new system (Chroot is the process of changing of the apparent disk root directory to another root directory) :
# arch-chroot /mnt - Set time zone. Mine is India:
# ln -s /usr/share/zoneinfo/Asia/Kolkata /etc/localtime - Set hostname of your computer, I set mine to "alvm" :
# echo alvm > /etc/hostname - Set a password for the root user:
# passwd root - Add a new user. I added a user named "anurag"
# useradd -m -g users -s /bin/bash anurag - Set password for this new user:
# passwd anurag - We need to enable DHCP client services on the virtual network adapter 1 which we had configured for this virtual machine to operate in NAT mode.
Execute the following four commands:# pacman -S ifplugd# cd /etc/network.d# ln -s examples/ethernet-dhcp .# systemctl enable net-auto-wired.service
[Deleted above lines on 2014-04-27]
Execute the command:
# cp /etc/netctl/examples/ethernet-dhcp /etc/netctl/profile - Next we need to find out the identifier name of our adapter, execute the command:
# ip link
you will get the output like:
The name of the ethernet adapter is enp3s0.[root@tristan]#
ip link show
1: lo:
mtu 16436 qdisc noqueue link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: enp3s0: mtu 1500 qdisc pfifo_fast qlen 100 link/ether 00:80:c8:f8:4a:51 brd ff:ff:ff:ff:ff:ff - Execute the command :
# nano /etc/netctl/profile - Change all instances of eth0 to enp3s0 or whatever your ethernet adapter identifier is.
- WriteOut the File (Ctrl + O) and then exit.
- Execute the following command to start the network:
# netctl start profile - Test the network using:
# ping www.google.com - To permanently set the network to start at every boot up, execute:
# netctl enable profile - Create an initial ramdisk environment:
# mkinitcpio -p linux - Install bootloader (the one I used is Syslinux) by executing the following two commands:
# pacman -S syslinux
# syslinux-install_update -iam - Configure the bootloader. Edit the configuration file using nano text editor:
# nano /boot/syslinux/syslinux.cfg - Change the following entry:
APPEND root=/dev/sda3 ro
to
APPEND root=/dev/sda1 ro
You will have to do this in two places. One for the Arch (LABEL arch) entry and another for the fallback (LABEL archfallback) entry. - WriteOut the file
- Exit nano
- Exit chroot:
# exit - Unmount the partitions:
# umount /mnt/{boot,home,} - Reboot the virtual machine
# reboot
Boot system, install VirtualBox guest additions and Desktop Manager (internet connection needed for all the following steps):
- When the live CD menu shows up, select "Boot existing OS"
- Login as "root"
- Install VirtualBox guest additions:
# pacman -S virtualbox-guest-utils - Configure the guest addition modules to load at startup:
# nano /etc/modules-load.d/virtualbox.conf - Type the following three lines:
vboxguest
vboxsf
vboxvideo - WriteOut the file
- Exit nano
- Install D-Bus:
# pacman -S dbus dbus-core - Install the X Window System packages:
# pacman -S xorg-server xorg-xinit xorg-server-utils - Install mesa for 3D support:
# pacman -S mesa - Install touchpad driver (required if you are using laptop):
# pacman -S xf86-input-synaptics - Install the default environment:
# pacman -S xorg-twm xorg-xclock xterm - Install TrueType Fonts
# pacman -S ttf-dejavu - Install the GNOME Desktop Environment (~400 MB Download):
# pacman -S gnome gnome-extra gnome-control-center - Restart:
# reboot - Login as a normal user. I logged in with "anurag"
- Configure X Server, get a copy of the configuration file and place it in your home directory:
# cp /etc/skel/.xinitrc ~ - We need to configure the GNOME to start automatically when X is started
# nano ~/.xinitrc - Remove the "#" from the head of the following line, changing
# exec gnome-session
to
exec gnome-session - WriteOut the file (Ctrl + O)
- Exit nano
- Use the following command whenever you want to start the Graphical Interface:
# startx - Copy and paste between Windows host and Arch Linux guest will now work.
- You can now shutdown the virtual machine.
- Detach the Arch Linux live CD from the virtual machine.
- If you want to always start the virtual machine in graphical mode, reboot the virtual machine and login as root and issue the following command:
# systemctl enable gdm
Thanks for posting; good info here!
ReplyDeleteIn case the dhcp doesnt get enabled, execute the following to enable it at bootup:
ReplyDelete"systemctl enable dhcpcd@enp0s3"
replace enp0s3 with whatever is ur adapter name.. get the adapter name by executing "ip addr"