Arch Linux and Mountain Lion:VirtualBox Part 3

Arch Linux and Mountain Lion:VirtualBox Part 3

Install Arch Linux on the virtual hard drive:

The steps below are the ones I followed by referring the beginners guide.

1)After the 12 steps mention in my other post,you will be presented with a shell prompt. I have an US keyboard hence I will skip the part which is required for other language keyboards.For other keyboards refer the part “Change the language” in the beginner’s guide.

2)I had an internet connection by default hence did not need to configure the same.To find out if there is an internet connection run the command:

 ping -c 3 www.google.com

If you don’t get the below error then you are doing fine else check the beginner’s guide.

ping: unknown host

3)Now we will partition and format the virtual hard drive.We will create 3 partitions Root,Home and BIOS.Run the following command

cgdisk /dev/sda

4)Now we are presented with a table which has no partition entries.

Create the Root partition first.

Choose New (or press N)
Press Enter for the first sector (2048)
Type in 10G 
Press Enter again for the default hex code (8300)
Press Enter again for a blank partition name.
This creates a new Root partition.

Now to create the home partition:
Press the down arrow a couple of times to move to the larger free space area.

Choose New (or press N)
Press Enter for the first sector
Type in the remaining 10G
Press Enter for the default hex code (8300)
Press Enter for a blank partition name.
This creates our home partition.

Now to create the BIOS partition:
There should be third entry in the table with 1007.0 KiB size.Press the up or down arrow and select this entry.

Choose New (or press N)
Press Enter for the first sector.
Press Enter again for selecting the remaining size.
Type EF02 for the partition type
Press Enter for a blank partition name.
This creates our BIOS partition.

5)Create a file system.Run the following commands.

mkfs.ext4 /dev/sda1
mkfs.ext4 /dev/sda2

6)Mount the partitions:Run the following commands.

mount /dev/sda1 /mnt
mkdir /mnt/home
mount /dev/sda2 /mnt/home

7)Install the base system.Run the following commands.

pacstrap -i /mnt base

8)Generate a FSTAB (File System Table).Run the following commands.

genfstab -U -p /mnt >> /mnt/etc/fstab
nano /mnt/etc/fstab

Press Control X followed by Y and enter to save the file and exit nano (The default command line editor).
9)Chroot(Change the root directory) and configure the base system.Run the following commands.

arch-chroot /mnt

10)Setting the Locale.
Run the following command:

nano /etc/locale.gen

Uncomment (Remove the # at the beginning of the line) the lines that are relevant.I only needed en_US.UTF-8 UTF-8.Press Control X followed by Y and enter to save the file and exit nano.
Run the following command:

locale-gen

Run the following command:

echo LANG=en_US.UTF-8 > /etc/locale.conf
export LANG=en_US.UTF-8

If you has set a different keyboard than the US layout then refer the “Console font and keymap” section in the beginner’s guide.

11)Set the Time Zone.
For Berlin, Germany I ran the following command:

ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime

To find the allowed Zones run the following commands:

ls /usr/share/zoneinfo/

To get a subzone for a zone.Here Europe is taken as an example.

ls /usr/share/zoneinfo/Europe

12)Set the hardware clock to UTC:

hwclock --systohc --utc

13)Set the host name:I set it to oopra.

echo oopra > /etc/hostname

14)Configure the wired network:

systemctl enable dhcpcd.service

15)Set the root password and remember it.

passwd

16)Install Bootloader: We will install Grub(Grand Unified Bootloader) for our Arch Linux:

pacman -S grub
grub-install --recheck /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg

17)Now the Arch Linux is installed in the Virtual hard drive.Shutdown the Linux system.
Run the command:

shutdown

18)Now in the virtualBox window select the “Settings tab” uncheck the CD/DVD ROM.

Screen Shot 2013-07-20 at 11.05.53 AM

19)Start the Arch Linux virtual machine again.
Now we are booting the Arch Linux that is installed in the virtual hard drive.
Again it presents us a shell prompt.Now its time to create another user.Until now we were running as a root user.But for our day-to-day work another user name has to be created.I created a new user oopra.

useradd -m -g users -s /bin/bash oopra

Add some for information about the user. In my case the user is oopra:

chfn oopra

Choose a new password for the new user.oopra in my case:

passwd oopra

20)Now the time has finally arrived to create a Graphical User Interface.
Run the following commands for installing the X window system:

pacman -S xorg-server xorg-server-utils xorg-xinit
pacman -S mesa

21)Install Guest additions:

pacman -S virtualbox-guest-utils
modprobe -a vboxguest vboxsf vboxvideo
nano /etc/modules-load.d/virtualbox.conf

Add the following lines in virtualbox.conf

vboxguest
vboxsf
vboxvideo

Press Control X followed by Y and enter to save the file and exit nano.

22) Test X Window System:
Install the default environment:

pacman -S xorg-twm xorg-xclock xterm

Remove the default xinitrc file.

rm ~/.xinitrc

23)Install SLIM for starting a desktop manager:

pacman -S slim

Enable SLIM:

systemctl enable slim.service

Create a .xinitrc file:

cp /etc/skel/.xinitrc ~/.xinitrc
nano ~/.xinitrc

The .xinitrc should look like:

#!/bin/sh

if [ -d /etc/X11/xinit/xinitrc.d ]; then
  for f in /etc/X11/xinit/xinitrc.d/*; do
    [ -x "$f" ] && . "$f"
  done
  unset f
fi
exec startxfce4

Press Control X followed by Y and enter to save the file and exit nano.

The .xinitrc file should be created for all users. The above step only creates the .xinitrc file for the root. For the other user I created (oopra in my case) the same file has to be created.

su oopra

Create a .xinitrc file:

cp /etc/skel/.xinitrc ~/.xinitrc
nano ~/.xinitrc

The .xinitrc should look like:

#!/bin/sh

if [ -d /etc/X11/xinit/xinitrc.d ]; then
  for f in /etc/X11/xinit/xinitrc.d/*; do
    [ -x "$f" ] && . "$f"
  done
  unset f
fi
exec startxfce4

Press Control X followed by Y and enter to save the file and exit nano.

 

Do not forget to exit.

exit

24)Install the desktop manager xfce4.

pacman -S xfce4

25)Now you have a basic Arch Linux with GUI support.Time to enable the sound :
Install Alsa running the following commands:

pacman -S alsa-utils

Unmute running the following command:

amixer sset Master unmute

Initialise Alsa control in Virtual Box running the following command:

alsactl init

26) Install flash plugins:

pacman -S flashplugin

27)Now you have a basic Arch Linux with GUI support.Now reboot using the following command:

reboot

Once it presents the login window. Login with the username and password that was created before. You can add anything more you want but running the

 pacman -S PackageNameYouWant

command.

6 Replies to “Arch Linux and Mountain Lion:VirtualBox Part 3”

  1. you post can be easily compared with Gentoo’s Install Guide. Arch’s is so bad documented, that I spent around two hours just searching for what you just described. Thanks man, I needed to install Arch using a Virtual Machine (in my case I used VMWare) and it’s working like a charm! My only problem was that after installing, there was no internet connection on Linux, figuring it out as of now, but everything else is working perfectly =) thanks man

        1. Hi.. according to the Arch beginners guide. Run the following command to search for available networks: iw dev wlp3s0 scan | grep SSID

          Connect to the desired network using the following command. Here “ssid” and “psk” are the network name and the password of the wi-fi network you want to connect to. The quotes are necessary so do not remove them :

          wpa_supplicant -B -i wlp3s0 -c <(wpa_passphrase "ssid" "psk")

          To give an IP address: dhcpcd wlp3s0

          Please let me know if this helps.

  2. Hi for wireless connection according to the Arch beginners guide.
    Run the following command to search for available networks:

    iw dev wlp3s0 scan | grep SSID

    Connect to the desired network using the following command. Here “ssid” and “psk” are the network name and the password of the wi-fi network you want to connect to. The quotes are necessary so do not remove them :

    wpa_supplicant -B -i wlp3s0 -c <(wpa_passphrase "ssid" "psk")

    To give an IP address:
    dhcpcd wlp3s0

    Please let me know if this helps.

Leave a Reply

Your email address will not be published. Required fields are marked *