Installing VirtualBox guest additions on Fedora

Installing VirtualBox guest additions on Fedora

Happy Holidays!

This celebration season post covers installation of the VirtualBox guest additions on Fedora while using yum to update the kernel sources.

The steps were tested in Fedora 13 (GNOME), Fedora 14 (GNOME), and Fedora 15 (XFCE and KDE). A common problem in installing the guest additions on a new copy of Fedora is the guest additions install will complain about missing kernel sources. These steps show how to update the kernel sources to fix this problem and allow a successful install of the guest additions.

OS Set Up and Installation of Guest Additions

1) First update the kernel by typing following command.

yum -y update kernel 

The latest kernel will be downloaded and updated.

2) Type following command after the kernel update.

yum -y install kernel-devel kernel-headers dkms gcc gcc-c++ 

After that, restart the Fedora virtual machine (VM).

3) Go to devices in VirtualBox console and select Install Guest additions.

This action will mount the VirtualBox guest additions and it will be visible on your desktop if it mounted successfully. Alternatively, you can find it in the file system (e.g. /media/VBox Additions CD).

4) Open a console terminal. Change directory to the Vboxadditions CD and run the following command.

sudo sh 

Note: To run sudo you must be part of the /etc/sudoers file – e.g.

# User privilege specification
yourusername    ALL=(ALL) ALL

or part of a Unix/Linux administration group.

5) It is possible after running the VirtualBox additions that you still need to install the current kernel-devel (files used for building kernel modules) in yum. In which case, the VBox additions install will tell you what to install (see an example below). After installing the kernel-devel, try running the VirtualBox additions installation again (sudo sh VBoxLinuxAdditions).

Building the VirtualBox Guest Additions kernel modules
The headers for the current running kernel were 
not found. 
If the following module compilation fails then 
this could be the reason.
The missing package can be probably be installed with
yum install kernel-devel-2.6.32-100.28.5.el6.x86_64

Check the installation log to verify everything works.

Shared Folders

If you’re using shared folders, check the VirtualBox documentation on using them. Usually the thing you have to do after setting up your host to share folders with the Fedora guest is to add the Linux user you are using to the vboxsf user group.

for example, use the command:

usermod -a -G vboxsf your_user_name

After adding your account to the vboxsf group, logout and then login again. You should be able to access the shared folders in the /media/ folder.

Add a user to a group

Usermod is a command to change a user’s account settings.To add a user to a group, use the following:
$ usermod -a -G newGroup username
Make sure to use the -a option so the user is added to newGroup while continuing to be a member of other groups. Otherwise the user is removed from all groups and only added to newGroup.

Install LAMP on Fedora and Run in 15 minutes – Apache, MySQL, PHP, and phpMyAdmin

Install LAMP on Fedora and Run in 15 minutes – Apache, MySQL, PHP, and phpMyAdmin

Below are steps to install the LAMP stack on a Fedora Linux server – Apache HTTP Server, MySQL (database software) and PHP (or Perl or Python) in about 15 minutes.

Things to know

  • Commands below are executed as root (or prefixed with sudo).
  • The steps have been tested on Fedora 14, Fedora 15, and Fedora 16 successfully.
  • Instead of localhost for the steps below, you may have to substitute your server’s IP address (e.g.
  • If you are using another Linux distribution (e.g. Ubuntu, OpenSUSE), the install command executions and file locations may differ, but setup will be similar.
  • If you already have the packages installed, your package manager will tell you and you can skip the installation step.
  • Install commands below will install the latest stable releases.

Getting Ready with a Clean Slate (Optional)

If you want to start with a clean install, you can remove existing installations of the components of the LAMP stack first.

# yum erase httpd mysql mysql-server php php-mysql phpmyadmin

Be careful if you do execute this command and find some components are already installed and yum asks you if you want to uninstall them. For example, some KDE distributions install MySQL with KDE packages like Akonadi, so you can leave MySQL there.

Install all Apache Web Server, MySQL, PHP, and phpMyAdmin

With this command, you can install all the packages at once.

# yum install httpd mysql mysql-server php php-mysql phpmyadmin

Apache – Starting and Configuring Apache (HTTPD)

Configure Apache to start automatically (Optional):

# /sbin/chkconfig httpd on

To start the server process immediately:

# /etc/rc.d/init.d/httpd start

Check Apache is running

Open up a browser on your server and go to the web address:


You should see a web page saying that Apache is running assuming your default Apache site (/var/www/html/) is empty.

 Get Started on a Website

If you want to get started with a website in Apache, you can find the root of the web server at /var/www/html/ and configuration files at /etc/httpd/

Other notes

Instructions on how to use iptables or system-config-firewall-tui to ensure port 80 is accessible from remote computers.

MySQL – Starting and Configuring MySQL

Start MySQL first if it isn’t already started. If you skip this step, a common error encountered is Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock” or /tmp/mysql.sock.

# /etc/rc.d/init.d/mysqld start

Some Fedora installations may already have MySQL running for KDE packages like Kontact, Kmail, and Akonadi, so MySQL may already be started.

Check MySQL is running

# mysqladmin version status

Set mysql root password

Go into the mysql command line to set the root password.

mysql -u root

Set the password of the root user in mysql at the mysql prompt. Do not forget to end your mysql command with a semicolon:

mysql> SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘yourpassword’);

If it is successful, this message appears:

Query OK, 0 rows affected (0.00 sec)

Exit the mysql prompt

mysql> quit

PHP – Check PHP works with Apache and MySQL

Create the following file in the Apache default site.

# echo “<?php phpinfo(); ?>” > /var/www/html/index.php

Go the address below. You should see a page describing PHP’s configuration and status:


To see the MySQL section, go to:


If the steps above succeeded, you can delete your test file with:

# rm -f /var/www/html/index.php

Configure server start up (Optional)

To start MySQL and Apache every time the server starts up, execute the following:

# chkconfig –levels 235 httpd on

# chkconfig –levels 235 mysqld on

phpMyAdmin – Configure Apache and phpMyAdmin

If you want to allow phpmyadmin connection from other locations other than localhost, then modify the following file. This setting is not recommended if you want to restrict who can access phpMyAdmin, but is common for server installations.

nano /etc/httpd/conf.d/phpMyAdmin.conf

Comment out these lines in the file:

<Directory /usr/share/phpMyAdmin/> 
order deny,allow 
deny from all 
allow from 
allow from ::1 

So the lines looks like:

#<Directory /usr/share/phpMyAdmin/> 
# order deny,allow 
# deny from all 
# allow from 
# allow from ::1 

Restart Apache:

# /etc/rc.d/init.d/httpd restart

Check everything is working!

Now you are all set Apache, MySQL, and PHP are setup and you have phpmyadmin to help you administer the MySQL server. Access phpmyadmin at http://localhost/phpmyadmin. Use your MySQL root credentials you configured during the MySQL set up to log in. If you can log into the phpmyadmin application, everything works – Congratulations!

Helpful links for installing LAMP

Random thought:

Turn on the LAMP in your life.