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 VBoxLinuxAdditions.run 

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.

Advertisements
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. 192.168.2.31).
  • 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:

http://localhost/

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:

http://localhost/index.php

To see the MySQL section, go to:

http://localhost/index.php#module_mysql

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 127.0.0.1 
allow from ::1 
</Directory>

So the lines looks like:

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

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.

System administration 1: Useful Commands and Locations on Windows and Unix/Linux

System administration 1: Useful Commands and Locations on Windows and Unix/Linux


This post lists common commands used in Windows and Linux/Unix system administration, server support, and troubleshooting.

Linux/Unix

The first command indicates the command name (searchable with a man page). The parens indicate useful extensions

File Searching, Browsing

Command Usage/Function
ls (-al) List files and directories
find (./ -name  or expression ‘in quotes’) -print Find files given filename and other parameters.Some usage patterns are below.-exec is powerful since it defines what to do with the file(s) found by the find command. For example, you can use grep to look for information inside those files (see below).
find / -type f -exec grep -l “string_here” {} ; Find files containing a string called “string_here”
find / -type f -print -exec grep -l “string_here” {} ; >Find files containing a string called “string_here” and output the lines from those files that contain that string. -print will show which files were found.
find . -name ‘*s’ -print To see which files within the current directory and its subdirectories that end in s
grep Display files and extract information containing word / pattern after the command
egrep Extract line containing word / pattern after the command
pwd Print (output to console) current working directory
less, more Console content control/reader
locate
Cp
mv
Rm (-Rf) Remove (with recursive and forced)

ampersand (&) – Executed after a UNIX command makes the command run while providing the command prompt back. Using & allows you to continue to type more UNIX commands.

Common use of the ampersand ( & ) is at the end of commands that open their own windows like a web browser or an editor..

The amperand (&) means something different when used immediately after a greater than (>) for output redirection or after the pipe symbol ( | ) for passing output to other commands.

Utility

Command Usage/Function
cat
man Manuals (help pages) for system commands.
ln –s Create symbolic links between files
touch
ftp File transfer protocol program
ping
finger
telnet
ssh Secure Shell
bash Bash shell (running activates bash shell on console if it is available).
Rm (-Rf) Remove (with recursive and forced)
nslookup OR dig OR host Domain name service lookupdig -x <ip> or nslookup <ip> does reverse lookup
whois Query
traceroute Trace network route
lynx Text based HTML browser
mount, unmount Mount or unmounts file systems
date Date/time on system
runmqsc (WebSphere Messaging Queue MQ) ex. runmqsc <queue>

DISPLAY CHSTATUS(*) 
- display all channels info
DISPLAY CHSTATUS('<queue>')
STOP CHANNEL('<queue>')
RESET CHANNEL('<queue>')
START CHANNEL('<queue>')
DISPLAY CHANNEL('<queue>')
wget GNU tool to retrieve web or file content.
Example of using wget to create of backup of a website (web archive) stored on your local computer. See the wget manual for more options.Get/backup website content for offline viewing:

[dark_box]wget -c -m -k -K -E -P/tmp http://url_of_the_website[/dark_box]

Get/backup website content for offline viewing. Limit rate to reduce load on the target website and ignore robots file. Ignoring the robots file is helping for backuping up everything under a website and for WordPress blogs.

[dark_box]wget -c -m -k -K -E -P/tmp –limit-rate=300k -e robots=off http://url_of_the_website[/dark_box]

Here is what each option means:

  • wget > Download web content
  • -c continue from partially downloaded files, useful for finishing a partial wget in the past
  • -m or –mirror > recursively with time-stamping (), while
  • -k -K > converting links for local viewing
  • -E or –html-extension > and add .html extension for html files if not present.
  • -P or –directory-prefix=… > Download the web content to the directory indicated; in this case /tmp.
  • http://&#8230; > Location where to start the web backup / archival
  • ––limit-rate (e.g. –limit-rate=300k ––wait=2> To limit your download rate and prevent overloading or taxing the performance of the web server

ystem Administration

Command Usage/Function
prstat: report active process statisticssar: System activity reportermpstat : Report per-processor or per-processor-set statistics Check CPU utilization, per CPU statistics. (e.g. sar 1, sar -u 10 60, mpstat 10 60)(e.g. Stats by zone: prstat -Z, Stats by Projects/users prstat -J)
useradd (Solaris) Create a user Example: useradd -d /export/home/smithjo -m -k -s /bin/bash -c “John Smith” -g100 smithjo
userdel (Solaris) Remove a user. Example: userdel -r smithjo
The -r option removes the users home directory and login information
groupadd (Solaris) Modify a user’s information like group
usermod (Solaris) Modify a user’s information like group
rpm (Redhat based systems) Package manager
ifconfig (-a) Display IP address information including loopback and inet interfaces, sometimes in /usr/sbin
hostname (-f) Obtain hostname information of server
domainname Display a servers domain name
pkgadd (Solaris), yum (Fedora, RPM)package-cleanup Package manager tools (e.g. yum install <program name>
chkconfig
chownchmodchgrp File ownership and rights management. E.g. chown <new owner> <filename>chmod 664 <filename> for rw-rw-r
File compressions and ExtractionCompressgzip -c file1 file2 > foo.gztar cf – target_file_or_directory | gzip -c > target.tgzgtar -cvzf target output.tgzUncompressgzip -dc output_file.tar.gz | tar -xf – Related commandsCreate a tar file:tar cvf <tar.filename> <files.to.tar.up>Extract a tar file:tar xvf <tar.filename>Check the contents of a tar file:

tar tvf <tar.filename>tar (-xzif)

Unzip

unzips a zip filegunzip :unzips tar.gz files

sendmail Mailer
mail Email management
head
tail (-f) See near end of file or stream file with -f
passwd User password management
su Assume root user or user specified after command. Will prompt for password.
sudo Assume root user only for command following sudo. Will prompt for password.
last
who
df (-akh) Reports on disk space on mounted and mounted file systems
md5 Checksum command
cron Scheduler
uname (-a) System/machine information
ps (-ef) (-Al) List (all) processes and their details
xinetd
kill (-HUP) Send signals to process. E.g. kill -9 <pid> kills a process with pid specified
shutdown (now) (-r) Shutdown operating system e.g. -r restart afterwards “now” shuts the system down right away without a time delay
netstat (-an) Network information for system, port listeners and addresses. E.g. netstat –rn to view existing kernel IP routing table

Programming

Command Usage/Function
gcc (or cc) C compiles
pico, nano File editors
make Builder program

Useful Concepts for Linux/Unix

Directory Structure

Logs, spoools, and file resources (mail, logs, temp, etc.): /var

Configuration Files: /etc, /etc/rc.init (startup scripts). /etc/sendmail.cf

Unix “blackhole”: /dev/null

Core Command locations if not in path: /usr/(s)bin, /usr/local/(s)bin, /usr/sfw/bin/ | Solaris: /usr/openwin

Devices (I/O): /dev

Mounted Systems: /mnt, /media

Code Libraries/Modules: /usr/lib, /usr/local/lib

Stored source: /usr/src

Services: /etc/services – example of entries in services file (ports and protocols associated with the ports.

netstat         15/tcp
ftp             21/tcp                 # File Transfer
ssh             22/tcp                 # Secure Shell
telnet          23/tcp

Platform Specific

User settings ~/.<user setting folder>

e.g. ~/.kde/share/apps stores KDE desktop settings and configurations.

Checking serviers and ports in netstat

less /etc/services | grep <service name>

netstat -a | grep <service name>| grep <keyword, e.g. LISTEN>

Checking Memory

Check Total physical memory:

# prtdiag -v | grep Memory # prtconf | grep Memory

Check Free physical Memory:

# top (if available) # sar -r 5 10 Free Memory = freemen*8 (pagesize=8k) # vmstat 5 10 Free Memory = free

For swap:

# swap -s # swap –l

Windows

Command Usage/Function
certmgr.msc Certificates
ciadv.msc Indexing Service
comexp.msc Component Services
compmgmt.msc Computer Management, central administration panel for Windows. Can also be used to access IIS administration console.
control mouse Open control panel for mouse
defrag, dfrg.msc Disk Defragmenter
devmgmt.msc Device Manager
diskmgmt.msc Disk Management
eventvwr.msc Event Viewer
fsmgmt.msc Shared Folders
gpedit.msc Group Policy
lusrmgr.msc Local Users and Groups
msconfig Startup files and processes configuration
ntmsmgr.msc Removable Storage
ntmsoprq.msc Removable Storage Operator Requests
perfmon.msc Performance monitor
regedit Registry editor
rsop.msc Resultant Set of Policy
sc query Find function. E.g. Find a Windows services called “WSearch”sc query | FINDSTR /i /r WSearch
secpol.msc Local Security Settings
services.msc Services and Process manager
wab Windows address book
wmimgmt.msc Windows Management Infrastructure (WMI)

Remote Desktop Management related commands

ERROR The terminal server has exceeded the maximum number of allowed connections

If you encounter this error, you can either reboot the terminal server you are trying to remote desktop to or log into the machine as an administrator.

To log in as the administrator:

mstsc /v:<ip address e.g. 192.168.2.32) /console

By using /console at the end of the command you will be logging in as if you were at the server. Alternatively, if you are using Windows Server 2003, run this comment instead (replace /console with /admin)

mstsc /v:<ip address e.g. 192.168.2.32) /admin

If you can telnet or ssh to the server you can use the following command. This command will kill all active RDP sessions to free one so you can connect.

tsdiscon /1

tsdiscon /2

tsdiscon /3

tsdiscon /4

Session cleanup

When you execute the commands above, log in as an administrator on the machine. That log in allow you to use the console on the server.

Remove any disconnected users via the Terminal Services Manager

Start > All Programs > Administrative Tools > Terminal Services Manager

Click on the name of your server and the right side should show a list of users. If the users are disconnected, reset the users to free up the two normal remote desktop connections. Right clicking the disconnected user and selecting “Reset.”

It is good practices to only use the console to disconnect inactive sessions and not for anything else. Make sure you disconnect inactive user sessions first with the instructions above, otherwise if you get disconnected again you will have to physically access the server.

Remote Desktop sessions should always be closed using the Windows <<Log Off>> function rather than disconnecting by closing the window as using the X to close will disconnect from the session but leave it active.

References

Random thought:

Despite carefully following installation and configuration procedures for various programs, they still tend not be smooth.