06 February 2013

333. Arch linux with Gnome in virtualbox

Not too different from what I've posted before (330, 331), but I'm just so excited that I can't help myself, so here we go:

I'll presume that you've got virtualbox installed.


0. Get the Arch iso:
If you're allowed to use bittorrent:

sudo apt-get install bittorrent squashfs-tools
cd ~/Downloads/
btdownloadcurses https://www.archlinux.org/iso/2013.01.04/archlinux-2013.01.04-dual.iso.torrent

If you're not allowed to use bittorrent:

cd ~/Downloads
wget http://mirror.aarnet.edu.au/pub/archlinux/iso/2013.01.04/archlinux-2013.01.04-dual.iso

Note that the links will change with time.



1. Setting up the machine
Start virtualbox and click on New. Select Type=Linux and Version=Arch Linux.

Give the machine at least 512 Mb, although even that is probably a bit on the low end for Gnome.

Create a virtual harddisk. 8 Gb is enough for testing purposes, but if you're actually planning on using the virtual machine you're better off giving it something like 15-20 Gb. VDI is fine when it comes to format, and 'Dynamically allocated' is a safe choice for a normal desktop.








There's a little bit of tinkering left to do. Click on Settings, go to Storage, and mount your iso:





2. First Boot
Click on Star which will boot off of the CD.


You can pick whatever makes you happy here. For the sake of simplicity will pick the first option -- x86_64.

You're now met with the first indication that this ain't Kansas (or Ubuntu):

Remember -- terminals/consoles should give you warm and fuzzy feeling because there is nothing which you can't accomplish in a terminal. A one-click installation option would be nice for checking things out though, but it's actually pretty easy to get started.


Preparing the harddrive
Our first step is to format the harddrive. Remember, it's an imaginary virtual harddrive -- nothing will be touched on your physical harddrive.

Do

fdisk /dev/sda

Hit n to create a new partition. p for primary, 1 to make it partition number 1, make it start at sector 2048, and make it e.g. 2 Gb by having it stop at +2G -- this will be our swap. Hit n again, p again, and make it partition number 2, and accept the default sectors that it suggests. This will be our  /(root) partition.

Hit a, then 2, to make the partition bootable.

Hit t, then 1, then 82 to make a swap disk.

Hit w to finalise the changes.

Do
mkswap /dev/sda1
mkfs.ext4 /dev/sda2

to set up the file systems.

Do
mount /dev/sda2 /mnt

to mount your new ext4 partition.

Install a basic system:
Do
pacman-key --init
pacman-key --populate archlinux

to get set up with pacman. Edit pacman.conf if you want a specific architecture (i686 or x86_64), or the current architecture will be used.

Time to install packages:
pacstrap /mnt base gnome xorg-xinit xorg-server xorg-utils xorg-server-utils virtualbox-guest-modules virtualbox-guest-utils vim mlocate wicd wicd-gtk openssh grub-bios upower

Generate a proto-fstab:
genfstab -p /mnt > /mnt/etc/fstab

Then enter a chroot:
arch-chroot /mnt

Edit /etc/fstab and add a line for swap:
/dev/sda1    none    swap    sw    0 0

Set up your locale and timezone:
ln -s /usr/share/zoneinfo/Australia/Melbourne /etc/localtime
echo 'LANG="en_US.UTF-8"'>/etc/locale
echo 'KEYMAP=us'> /etc/vconsole.conf
echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen
locale-gen
echo "spinebill" >/etc/hostname

Set up a user:
pacman -S sudo
useradd -p `openssl passwd -1 mypassword` -m verahill
echo "verahill ALL=(ALL) ALL">> /etc/sudoers

Edit /home/verahill/.xinitrc and uncomment
exec gnome-session

Set up grub and booting:
mkinitcpio -p linux
grub-mkconfig -o /boot/grub/grub.cfg
grub-install /dev/sda

You're now ready to start your Arch system. First you need to shut down your current system though:
exit
umount /mnt
shutdown -h now

Once the machine is off, go to Settings, Storage, and remove disk from virtual drive.



Booting:
Boot by clicking on Start.
You might get the odd error message while booting, but everything will be fine.

Log in as the user you created, then enabled the ssh daemon and the wicd daemon:
sudo systemctl enable sshd
sudo systemctl enable wicd

Start wicd-curses
wicd-curses

and wait 10-20 seconds for wicd to detect the network card and starting it


Quit by hitting 'Q'.

To launch gnome, type
startx
evening gnome?
It'll take a little while to start up. This is a pretty ugly Gnome though, but that's the stock background which changes during the day.
daytime gnome?



2 comments:

  1. Hi, I tried this, and the instructions were really good, but when I hit startx at the end, gnome starts to boot and then I get the oh no, something has gone wrong error.
    I'm unsure why as I'm pretty sure I followed this fairly close?

    ReplyDelete
    Replies
    1. 'fairly close' is a bit vague -- you might want to look at what you did different since that will hold the clues to why it isn't working for you.

      Delete