Basic (VERY BASIC!!) X-Windows Setup in FreeBSD 8.1 inside VirtualBox
In this post we'll see how we can take our very basic FreeBSD installation and install X-Windows in it. My favorite desktop environment so far is IceWM although it may seem rather very primitive for some. In most cases it provides enough functionality to make life sufficiently easy without hogging down your limit Virtual Machine resources. Those are better left for... services .. which we will start looking into further tutorials :devil: .
For now :angel: though, let's see how easy (or not!) it is easy to setup IceWM.
1. You will need to have logged in as root. You should be at this screen:
2. Then we need to start typing in some commands. We need to start by adding (downloading+installing) the IceWM package. Generally to add a package in FreeBSD you will want/need to use the pkg_add command. The parameter -r makes sure that you don't fall in 'dependency hell', meaning it will make sure to install any required prerequisites and make life easier. Yes this is a good thing.
Note!!! : Remember that everything in FreeBSD is case sensitive! 'pkg_add' is not the same as 'PKG_ADD' !
Type the following:
pkg_add -r xorg icewm firefox
Just like in this screenshot:
The above command will download and install xorg, icewm and firefox precompiled packages. You are certainly familiar with Firefox, the popular free and open source browser. IceWM is of course the IceWM desktop environment and xorg is the X-Windows server that we require to run everything on.
3. Press the Enter key and provided you have done your FreeBSD installation correctly and have setup networking, FreeBSD will go ahead and download the packages from the FTP servers.
Note: Depending on your Internet connection this may take a while! This took about 7 minutes on my Cable connection.
You should see something like this :
When it's finished you should see something like this:
4. Now it's time for some configuration. First let's go ahead and make sure that the mouse will be working in X-Windows. Yes, I know that you're probably thinking 'but I can see my mouse working already in FreeBSD!' - Yes it works, in the shell but experience has shown me that X-Windows are a little more picky. We need to do some configuration first to make sure it will work in X-Windows as well. Follow those steps:
4.1 - Configure the /etc/rc.conf file – this contains entries for daemons (that's what we call Services in FreeBSD) you want to start at start-up such as Apache, E-mail, and the mouse daemon :)
Type: ee /etc/rc.conf
4.2 - And press Enter – you should get this:
4.3 - ee is the default FreeBSD editor. It's a little awkward to use but nowhere near as hard as the famous (or infamous for being primitive to use) vi.
Using the scroll keys, scroll down to the bottom of the text and add the lines:
hald_enable=”YES”
dbus_enable=”YES”
your /etc/rc.conf should look like this now:
To exit and save do the following:
Hold down the left Ctrl key and press {
You should get a little menu that looks like this:
press 'a' to leave the editor
You'll get another little menu that looks like this:
press 'a' again to exit and save
FreeBSD will inform you of the result of the editing – that way you know you actually saved the changes.
2. Reboot FreeBSD. This is one of the rare times where I've found that Xorg won't configure properly before you restart it. Restart it by typing
Press 'Enter' to commence reboot
3. After FreeBSD restarts and you login again type:
/usr/local/bin/Xorg -configure
You should get this:
This means that Xorg has built a basic skeleton configuration file. We will now configure this further.
4. mkdir /usr/local/etc/X11
Press 'Enter'
5. mv /root/xorg.conf.new /usr/local/etc/X11/xorg.conf
Press 'Enter'
The two previous commands will create the appropriate Xorg directory where the configuration is expected to be. The other one will move the configuration there.
6. Time to edit the xorg.conf that we have been moving around! To edit it type:
ee /usr/local/etc/X11/xorg.conf
You should get this:
7. You need to make the following changes as to get what I have in the screenshots:
Section “InputDevice”
Section “Monitor”
Section “Screen” - you need to delete most stuff here you won't be needing it
As before, exit by holding Ctrl+[ and then type 'a' twice
8 . Now we need to edit the root user's personal X configuration file. Don't worry this is much shorter – it basically tells X-Windows what to start when the environment is started.
Type ee /root/.xinitrc
This file should be empty – simply add the following
Exit and save in the usual way !
9 . Create the directory /root/.icewm – type the following:
mkdir /root/.icewm
10. Last step is to edit the IceWM Start button , type the following:
ee /root/.icewm/menu
This file should be empty too – add the following:
Exit and save.
We should be ready !
Type startx !
You should be getting a basic Desktop like this:
Let's start Firefox .. .
Click on 'Xterm' Icon to start a new terminal.
should look like this:
type:
top (to see the running processes)
This will give you the process running, how much CPU they are taking up and how much memory they are using
… Results :
As we can see the Window Manager Xorg is only taking up 28572KB of memory.. the desktop manager IceWM is taking up 12308KB .. This might sound like a lot but if you compare it to what Windows is spending on resources this is pretty light!
To exit click on 'IceWM->Logout->Logout'