Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora Resources > Guides & Solutions (Not For Questions)
FedoraForum Search

Forgot Password? Join Us!

Guides & Solutions (Not For Questions) Post your guides here (No links to Blogs accepted). You can also append your comments/questions to a guide, but don't start a new thread to ask a question. Use another forum for that.

Reply
 
Thread Tools Search this Thread Display Modes
  #16  
Old 25th January 2015, 02:10 PM
glennzo Online
Un-Retired Administrator
 
Join Date: Mar 2004
Location: In your closet
Posts: 15,506
linuxfirefox
Re: Oracle VirtualBox installation script

Quote:
Originally Posted by MadmanRB View Post
Just seems odd that virtualbox is this hard to install, sure we have gnome boxes but boxes isnt that good IMHO
I not so sure that it's hard to install, I think some users just don't fully understand what needs to be done for a successful install.
__________________
Glenn
The Bassinator
© ®
Reply With Quote
  #17  
Old 25th January 2015, 02:15 PM
MadmanRB Offline
Registered User
 
Join Date: May 2013
Location: Places
Posts: 215
linuxchrome
Re: Oracle VirtualBox installation script

Eh even I had issues and I am not entirely new to Fedora, the only other distro that I had this much trouble with virtualbox is Arch.
__________________
Insane in the membrane
Reply With Quote
  #18  
Old 25th January 2015, 02:17 PM
rich1974 Offline
Registered User
 
Join Date: Feb 2012
Location: romania
Posts: 76
windows_7mozilla
Re: Oracle VirtualBox installation script

is not that hard, the problem is that the virtualbox from fedora repository got broken when they update the kernel to 3.17.8-300.fc21.i686. using the previous kernel, it works okay!

the problem with this script is that it would have to be updated once the oracle release a new build of virtualbox.
also, this thread would be good to be pinned.
Reply With Quote
  #19  
Old 25th January 2015, 02:23 PM
MadmanRB Offline
Registered User
 
Join Date: May 2013
Location: Places
Posts: 215
linuxchrome
Re: Oracle VirtualBox installation script

It also happened on my 64bit build too, still an odd issue.
__________________
Insane in the membrane
Reply With Quote
  #20  
Old 25th January 2015, 09:45 PM
glennzo Online
Un-Retired Administrator
 
Join Date: Mar 2004
Location: In your closet
Posts: 15,506
linuxfirefox
Re: Oracle VirtualBox installation script

Script updated. Now Fedora 18 and 19 friendly. Of course, that wasn't too difficult

PHP Code:
#!/bin/bash
# 21_oracle_virtualbox.sh

# Install and configure the Oracle version of VirtualBox for Fedora 19 and later.
# Install the Oracle VirtualBox Extension Pack.

# Glenn A. Johnson
# Started January 18, 2015
# Updated January 25, 2015

# A tip of the fedora to Fedora Forum members Sea, Skull One, marko, Dangermouse

<< COMMENT
The idea behind this script is to install Oracle VirtualBox 
and the Oracle VirtualBox Extension Pack for Fedora systems.
The script will detect and remove any installed version of Fedora VirtualBox.
It will clean up when finished by removing downloaded source files.
It will use DNF for Fedora 21 and upyum otherwise.
Supports color no color.

Does this script handle PAE kernelNot yet.

Guest additions need kernel-devel-$(uname -r) and gcc
COMMENT

# Variables
# Additional packages usually needed for a successful install of VirtualBox
packfiles="kernel-devel-$(uname -r) gcc qt qt-x11 libpng15 dkms wget SDL"

# At some point, when Oracle releases an updated RPM, these variables will need to be changed.
vbox_src_file="VirtualBox-4.3-4.3.20_96996_fedora18-1.`uname -m`.rpm"
vbox_ext_src="Oracle_VM_VirtualBox_Extension_Pack-4.3.20-96996.vbox-extpack"

# Color definitions; the variables are null if the option NOCOLOR is set
# Thanks Skull One!
if [ -"$NOCOLOR]; then
        OKB
=$(tput bold;tput setaf 2)
        
OK=$(tput setaf 2)
        
ERR=$(tput bold;tput setaf 1)
        
RST=$(tput sgr0)
else
        
OKB=
        
OK=
        
ERR=
        
RST=
fi

# Need root permissions at some point, might as well do it now.
if [[ $EUID -ne 0 ]] ; then
    clear
   
echo -"You're going to need root permissions at some point. Let's get that out of the way now.\nUse \"sudo\" or \"su -c\""
   
exit 0
fi

# Release 19 and later only
function get_release()
{
    
printf $OK"Checking Fedora release version... "$RST
    relnum
=$(rpm -qa --queryformat '%{version}\n' fedora-release)
    if [[ 
$relnum "18" ]] ; then
        printf $ERR
"\nThis script is for Fedora release 18 and later only.\nThis appears to be Fedora release $relnum.\n"$RST
       
exit 0
    
else printf $OKB" ✓"$RST
    
# Determine if we're going to use dnf or yum.
    
if [[ $relnum "21" ]] ; then
        install_with
="yum"
    
else
        
install_with="dnf"
    
fi
fi
echo
}

# Clear screen and print a banner
function banner()
{
    
clear
    printf $OKB
"==> VirtualBox installation script for Fedora 18 and up.\n"$RST
    printf $OKB
"==> Oracle VirtualBox and Oracle VirtualBox Extension Pack will be installed.\n"$RST
}

# Remove Oracle VirtualBox source files if they exist
function remove_source()
{
    for 
i in $vbox_src_file $vbox_ext_src ; do
        
rm -f $i
    done
}

# Remove any installed version of VirtualBox
function remove_fed_vbox()
{
vbox_installed=$(rpm -qa grep VirtualBox)
if [[ 
$vbox_installed ]] ; then
    printf $OK
"Removing previously installed instance of VirtualBox. Please wait..."$RST
    $install_with 
--q erase $vbox_installed 2>/dev/null
    printf $OK
"\nDone.\n"$RST
fi
}

# Install the downloaded source RPM from Oracle
function install_source()
{
    if [[ -
f $vbox_src_file ]] ; then
        printf $OK
"Installing Oracle VirtualBox\n"$RST
        rpm 
-Uvh $vbox_src_file
    
else
        echo 
$ERR"Source file missing."$RST
        
exit 0
    fi
}

# Get any necessary packages needed to complete the VirtualBox installation without errors
function get_packages()
{
echo -
-n $OK"Checking for necessary packages..."$RST
echo
newpkgs=""
for i in $packfiles ; do
   echo -
-n $OK"==> $i: "
   
rpm -q $i > /dev/null
    
if [ $? -eq 0 ] ; then
        
echo $OKB"✓"$RST
    
else
        echo 
$ERR"✗"$RST
        newpkgs
="${newpkgs} $i"
    
fi
done
if [ -"${newpkgs}]; then
   
echo --n $OK"==> Installing ${newpkgs}... "$RST
   $install_with 
--q install ${newpkgs2>/dev/null
   
echo -e $OKB"\nDone installing packages.\n"$RST
else
   echo 
$OKB"==> Nothing new to install."$RST
fi
}

# Get the VirtualBox source RPM from Oracle
function get_source()
{
    echo -
-n $OK"Getting VirtualBox source from the Oracle download site..."$RST
    remove_source
    wget 
-q http://download.virtualbox.org/virtualbox/4.3.20/$vbox_src_file
    
echo -e $OKB" ✓"$RST
    
echo --n $OK"Getting the VirtualBox Extension Pack source file..."$RST
    wget 
-q http://download.virtualbox.org/virtualbox/4.3.20/$vbox_ext_src
    
echo -e $OKB" ✓"$RST
echo
}

function 
install_extpack()
{
    if [[ -
f $vbox_ext_src ]] ; then
        
echo $OK"Installing Oracle VirtualBox extension pack"$RST
        VBoxManage extpack install 
--replace $vbox_ext_src
    
else
        echo 
$OK"Trying to install the Oracle VirtualBox extension pack but can't find the source file!"$RST
    fi
}
    
function 
script_complete()
{
        
remove_source
        printf $OKB
"Oracle VirtualBox is now installed.\n"
        
printf $OKB"Script run complete.\n"$RST
}

function 
script_cancel()
{
    
tput cuu1
    tput el
    printf $OK
"Script cancelled.\n"$RST
}

function 
menu()
{
clear
banner
printf $OK
"\nFor this script to succeed you need to be running the newest available and installed kernel.\n\nIf you aren't running the newest available and installed kernel please exit this script\nand update your system. Then boot into to newest kernel and run this script again.\n"$RST
printf $OKB
"\nShall we continue? <y/n> "$RST
read yn
case $yn in
    y
get_release
        remove_source
        remove_fed_vbox
        get_packages
        get_source
        install_source
        install_extpack
        script_complete
        
;;

    
nscript_cancel
        
exit 0
       
;;
    *) 
script_cancel
        
exit 0
       
;;
esac
}
menu 
__________________
Glenn
The Bassinator
© ®
Reply With Quote
  #21  
Old 27th January 2015, 12:27 AM
glennzo Online
Un-Retired Administrator
 
Join Date: Mar 2004
Location: In your closet
Posts: 15,506
linuxfirefox
Re: Oracle VirtualBox installation script

I'm open to suggestions if anyone feels that the script can be improved.

So far it has proven useful to a couple Fedora users. Hope it helps a few more.
__________________
Glenn
The Bassinator
© ®
Reply With Quote
  #22  
Old 27th January 2015, 10:30 AM
sea Offline
"Shells" (of a sub world)
 
Join Date: May 2011
Location: Confoederatio Helvetica (Swissh)
Age: 37
Posts: 4,280
linuxfedorafirefox
Re: Oracle VirtualBox installation script

Quote:
Originally Posted by glennzo
@ marko. I'm all about how the script looks. ....
Well...
In that case, let me ask, did you like (visualy) my efi-helper script, vhs or alike?
They all use TUI.

Have a preview of what it (or the single commands) could look like: Screenshots/
The installation is 2 lines: https://github.com/sri-arjuna/tui/wiki/Installation.

I've been asked what TUI is about, its about to help others with the task of making a script with an interface.
For example: tui-download would show how much it already downloaded (eg: 5mb, 1gb) (remember my 'game' script with zak mckracken? you pointed that out )

Hope this helps
__________________
EFI Cheatsheet :: http://forums.fedoraforum.org/showthread.php?t=298546
Video Handler Script (VHS) (mass re-encode videos, screenrecorder, console music/webradio player, ...) :: http://forums.fedoraforum.org/showthread.php?t=299182
Windows 8+ & Fedora 20+ Dualboot :: http://forums.fedoraforum.org/showthread.php?t=298161
Reply With Quote
  #23  
Old 1st February 2015, 08:53 AM
glennzo Online
Un-Retired Administrator
 
Join Date: Mar 2004
Location: In your closet
Posts: 15,506
linuxarchfirefox
Re: Oracle VirtualBox installation script

The latest version of my script. Works for Fedora 18 and up, I686, I686+PAE and x86_64.

PHP Code:
#!/bin/bash
# 21_oracle_virtualbox.sh

# Install and configure the Oracle version of VirtualBox for Fedora 20 and later.
# Install the Oracle VirtualBox Extension Pack.
# Handle all platforms, i686, PAE and x86_64 .
# Clean up when finished.
# Use DNF for Fedora 21 and up, YUM for Fedora 20 and earlier.
# Remove previously installed VirtualBox.
# Support color / no color (sudo NOCOLOR=1 21_oracle_virtualbox.sh)

# Glenn A. Johnson
# Started January 18, 2015
# Updated February 27, 2015

# 02.25.15 - Betterer code to discover kernel arch.
# 02.23.15 - New code to discover kernel arch
# 02.22.15 - Seems that kernel arch discovery is not working.
# 02.21.15 - New version of VirtualBox

# A tip of the fedora to Fedora Forum members Sea, Skull One, marko, Dangermouse
# for help with code

# Variables - Additional packages usually needed for a successful install of VirtualBox
# over the different platforms, x86_64, i686 and i686+PAE
#PACKFILES="kernel-devel-$(uname -r) gcc qt qt-x11 libpng15 libXmu libXt libvpx dkms wget SDL"

# Determine OS platform and install correct packages.
getvers=$(uname -grep "PAE")
if [[ 
$getvers ]] ; then
    PACKFILES
="kernel-PAE-devel gcc qt qt-x11 libpng15 libXmu libXt libvpx dkms wget SDL"
else
    
PACKFILES="kernel-devel-$(uname -r) gcc qt qt-x11 libpng15 libXmu libXt libvpx dkms wget SDL"
fi

# We can easily make changes to the source file versions by changing
# a few variables below.

VB_REL_VER="4.3-4.3.22_98236"
VB_EXT_VER="4.3.22-98236"
VB_REL_DIST="fedora18-1"
VBOX_SRC_FILE="VirtualBox-${VB_REL_VER}_${VB_REL_DIST}."`uname -m`".rpm" 
VBOX_EXT_SRC="Oracle_VM_VirtualBox_Extension_Pack-${VB_EXT_VER}.vbox-extpack"
SRC_PATH="http://download.virtualbox.org/virtualbox/4.3.22"
#http://download.virtualbox.org/virtualbox/4.3.22/VirtualBox-4.3-4.3.22_98236_fedora18-1.i686.rpm

# Color definitions; the variables are null if the option NOCOLOR is set.
# Thanks Skull One!

if [ -"$NOCOLOR]; then
        OKB
=$(tput bold;tput setaf 6)
        
OK=$(tput setaf 6)
        
ERRB=$(tput bold;tput setaf 1)
        
ERR=$(tput setaf 1)
        
RST=$(tput sgr0)
else
        
OKB=
        
OK=
        
ERRB=
        
ERR=
        
RST=
fi

# Need root permissions at some point, might as well do it now.
if [[ $EUID -ne 0 ]] ; then
    clear
       printf $OK
"You're going to need root permissions at some point. Let's get that out of the way now.\nUse \"sudo\" or \"su -c\"\n"$RST
       
exit 0
fi

# Release 20 and later only
function get_release()
{
    
printf $OK"Checking Fedora release version... "$RST
    RELNUM
=$(rpm -qa --queryformat '%{version}\n' fedora-release)
    if [[ 
$RELNUM "20" ]] ; then
        printf $ERR
"\nThis script is for Fedora release 20 and later only.\n"$RST
           
exit 0
    
else printf $OKB"Fedora $RELNUM ✓"$RST
    
# Determine if we're going to use dnf or yum.
    
if [[ $RELNUM "21" ]] ; then
        install_with
="yum"
    
else
        
install_with="dnf"
    
fi
fi
echo
}

# Clear screen and print a headline.
function headline()
{
    
clear
    printf $OKB
"==> VirtualBox installation script for Fedora 20 and up.\n"$RST
    printf $OKB
"==> Oracle VirtualBox and Oracle VirtualBox Extension Pack will be installed.\n"$RST
}

# Remove Oracle VirtualBox source files if they exist in the current working directory.
function remove_source()
{
    for 
i in $VBOX_SRC_FILE $VBOX_EXT_SRC ; do
        
rm -f $i
    done
}

# Remove any installed version of VirtualBox.
function remove_fed_vbox()
{
VBOX_INSTALLED=$(rpm -qa grep VirtualBox)
if [[ 
$VBOX_INSTALLED ]] ; then
    printf $OK
"Removing previously installed instance of VirtualBox. Please wait..."$RST
    $install_with 
--q erase $VBOX_INSTALLED 2>/dev/null
    printf $OKB
" ✓\n\n"$RST
fi
}

# Install Oracle VirtualBox from the downloaded source RPM.
function install_source()
{
    if [[ -
f $VBOX_SRC_FILE ]] ; then
        printf $OK
"Installing Oracle VirtualBox\n"$RST
        rpm 
-Uvh $VBOX_SRC_FILE
    
else
        
printf $ERR"The source file missing.\nThere was an error downloading the file.\n"$RST
        
exit 0
    fi
}

# Install the Oracle VirtualBox Extension Pack.
function install_extpack()
{
    if [[ -
f $VBOX_EXT_SRC ]] ; then
        
echo $OK"Installing Oracle VirtualBox extension pack."$RST
        VBoxManage extpack install 
--replace $VBOX_EXT_SRC
    
else
        
printf $ERR"Oracle VirtualBox extension pack source file missing!\n"$RST
    fi
}

# Get any Fedora packages typically needed to complete the VirtualBox installation without errors.
function get_packages()
{
printf $OK"Checking for necessary packages..."$RST
echo
NEWPKGS=""
for i in $PACKFILES ; do
    
printf $OK"==> $i: "
       
rpm -q $i > /dev/null
    
if [ $? -eq 0 ] ; then
        printf $OKB
"✓\n"$RST
    
else
        
printf $ERR"✗\n"$RST
        NEWPKGS
="${NEWPKGS} $i"
    
fi
done
if [ -"${NEWPKGS}]; then
    
echo --n $OK"==> Installing necessary packages$OKB "${NEWPKGS}"... "$RST
    
#echo "Installing ${NEWPKGS}"
       
$install_with --q install ${NEWPKGS2>/dev/null
       
echo -e $OKB"\nDone installing packages.\n"$RST
else
       
printf $OK"==>$OKB Nothing new to install.\n"$RST
fi
}

# Get the VirtualBox source files from Oracle
function get_source()
{
    
printf $OK"Getting VirtualBox source from the Oracle download site..."$RST
    remove_source
    wget 
-q $SRC_PATH/$VBOX_SRC_FILE
    printf $OKB
" ✓\n"$RST
    printf $OK
"Getting the VirtualBox Extension Pack source file..."$RST
    wget 
-q $SRC_PATH/$VBOX_EXT_SRC
    printf $OKB
" ✓\n"$RST
echo
}

# The script run has completed. Print a short message stating same.
function script_complete()
{
    
remove_source
    printf $OKB
"Oracle VirtualBox is now installed.\n"
    
printf $OKB"Script run complete.\n"$RST
}

# Script execution has been cancelled by the user.
function script_cancel()
{
    
tput cuu1
    tput el
    printf $OK
"Script cancelled.\n"$RST
}

# Main script flow
function menu()
{
clear
headline
printf $OK
"\nFor this script to succeed you need to be running the newest available and installed kernel.\n\nIf you aren't running the newest available and installed kernel please exit this script\nand update your system. Then boot into the newest kernel and run this script again.\n"$RST
printf $OKB
"\nShall we continue? <y/n/t> "$RST
read yn
case $yn in
    y
)    get_release
        remove_fed_vbox
           get_packages
           get_source
           install_source
           install_extpack
           script_complete
           
;;

    
n)    script_cancel
           
exit 0
           
;;
# Test menu entry
    
t)     get_release
           get_packages
           get_source
           script_complete
           
;;
    
    *)    
script_cancel
           
exit 0
           
;;
esac
}
menu 
__________________
Glenn
The Bassinator
© ®
Reply With Quote
  #24  
Old 27th February 2015, 11:02 AM
glennzo Online
Un-Retired Administrator
 
Join Date: Mar 2004
Location: In your closet
Posts: 15,506
linuxfedorafirefox
Re: Oracle VirtualBox installation script

Has anyone else tried this script? How well did it work? I've tested it fairly extensively on virtual machines, Fedora 21 and 20, x86_64, i686 and i686+PAE. Feedback would be awesome.

Updated code in post #23 as of today.

Disregard the "test" menu option. I needed something that would do some quick testing without doing the full installation.
__________________
Glenn
The Bassinator
© ®
Reply With Quote
  #25  
Old 15th March 2015, 10:46 PM
glennzo Online
Un-Retired Administrator
 
Join Date: Mar 2004
Location: In your closet
Posts: 15,506
linuxfedorafirefox
Re: Oracle VirtualBox installation script

Minor code updates and tested for Fedora 22 Workstation Alpha x86_64.

PHP Code:
#!/bin/bash
# 21_oracle_virtualbox.sh

# Install and configure the Oracle version of VirtualBox for Fedora 20 and later.
# Install the Oracle VirtualBox Extension Pack.
# Handle all platforms, i686, PAE and x86_64 .
# Clean up when finished.
# Use DNF for Fedora 21 and up, YUM for Fedora 20 and earlier.
# Remove previously installed VirtualBox.
# Support color / no color (sudo NOCOLOR=1 21_oracle_virtualbox.sh)

# Glenn A. Johnson
# Started January 18, 2015
# Updated March 15, 2015

# 03.15.15 - Tested under Fedora 22 Workstation Alpha (x86_64).
# 03.14.15 - New VirtualBox version
# 02.25.15 - Betterer code to discover kernel arch.
# 02.23.15 - New code to discover kernel arch
# 02.22.15 - Seems that kernel arch discovery is not working.
# 02.21.15 - New version of VirtualBox

# A tip of the fedora to Fedora Forum members Sea, Skull One, marko, Dangermouse
# for help with code

# Variables - Additional packages usually needed for a successful install of VirtualBox
# over the different platforms, x86_64, i686 and i686+PAE
#PACKFILES="kernel-devel-$(uname -r) gcc qt qt-x11 libpng15 libXmu libXt libvpx dkms wget SDL"

# Determine OS platform and install correct packages.
GETVERS=$(uname -grep "PAE")
if [[ 
$GETVERS ]] ; then
    PACKFILES
="kernel-PAE-devel gcc qt qt-x11 libpng15 libXmu libXt libvpx dkms wget SDL"
else
    
PACKFILES="kernel-devel-$(uname -r) gcc qt qt-x11 libpng15 libXmu libXt libvpx dkms wget SDL"
fi

# We can easily make changes to the source file versions by changing
# a few variables below.
VB_REL_VER="4.3-4.3.24_98716"
VB_EXT_VER="4.3.24-98716"
VB_REL_DIST="fedora18-1"
VBOX_SRC_FILE="VirtualBox-${VB_REL_VER}_${VB_REL_DIST}."`uname -m`".rpm" 
VBOX_EXT_SRC="Oracle_VM_VirtualBox_Extension_Pack-${VB_EXT_VER}.vbox-extpack"
SRC_PATH="http://download.virtualbox.org/virtualbox/4.3.24"

# Color definitions; the variables are null if the option NOCOLOR is set.
# Thanks Skull One!

if [ -"$NOCOLOR]; then
        OKB
=$(tput bold;tput setaf 6)
        
OK=$(tput setaf 6)
        
ERRB=$(tput bold;tput setaf 1)
        
ERR=$(tput setaf 1)
        
RST=$(tput sgr0)
else
        
OKB=
        
OK=
        
ERRB=
        
ERR=
        
RST=
fi

# Need root permissions at some point, might as well do it now.
if [[ $EUID -ne 0 ]] ; then
    clear
       printf $OK
"You're going to need root permissions at some point. Let's get that out of the way now.\nUse \"sudo\" or \"su -c\"\n"$RST
       
exit 0
fi

# Release 20 and later only
function get_release()
{
    
printf $OK"Checking Fedora release version... "$RST
    RELNUM
=$(rpm -qa --queryformat '%{version}\n' fedora-release)
    if [[ 
$RELNUM "20" ]] ; then
        printf $ERR
"\nThis script is for Fedora release 20 and later only.\n"$RST
           
exit 0
    
else printf $OKB"Fedora $RELNUM ✓"$RST
    
# Determine if we're going to use dnf or yum.
    
if [[ $RELNUM "21" ]] ; then
        install_with
="yum"
    
else
        
install_with="dnf"
    
fi
fi
echo
}

# Clear screen and print a headline.
function headline()
{
    
clear
    printf $OK
"==>$OKB VirtualBox installation script for Fedora 20 and up.\n"$RST
    printf $OK
"==>$OKB Oracle VirtualBox and Oracle VirtualBox Extension Pack will be installed.\n"$RST
}

# Remove Oracle VirtualBox source files if they exist in the current working directory.
function remove_source()
{
    for 
i in $VBOX_SRC_FILE $VBOX_EXT_SRC ; do
        
rm -f $i
    done
}

# Remove any installed version of VirtualBox.
function remove_fed_vbox()
{
VBOX_INSTALLED=$(rpm -qa grep VirtualBox)
if [[ 
$VBOX_INSTALLED ]] ; then
    printf $OK
"Removing previously installed instance of VirtualBox. Please wait..."$RST
    $install_with 
--q erase $VBOX_INSTALLED 2>/dev/null
    printf $OKB
" ✓\n\n"$RST
fi
}

# Install Oracle VirtualBox from the downloaded source RPM.
function install_source()
{
    if [[ -
f $VBOX_SRC_FILE ]] ; then
        printf $OK
"Installing Oracle VirtualBox\n"$RST
        rpm 
-Uvh $VBOX_SRC_FILE
    
else
        
printf $ERR"The source file missing.\nThere was an error downloading the file.\n"$RST
        
exit 0
    fi
}

# Install the Oracle VirtualBox Extension Pack.
function install_extpack()
{
    if [[ -
f $VBOX_EXT_SRC ]] ; then
        
echo $OK"Installing Oracle VirtualBox extension pack."$RST
        VBoxManage extpack install 
--replace $VBOX_EXT_SRC
    
else
        
printf $ERR"Oracle VirtualBox extension pack source file missing!\n"$RST
    fi
}

# Get any Fedora packages typically needed to complete the VirtualBox installation without errors.
function get_packages()
{
printf $OK"Checking for necessary packages..."$RST
echo
NEWPKGS=""
for i in $PACKFILES ; do
    
printf $OK"==> $i: "
       
rpm -q $i > /dev/null
    
if [ $? -eq 0 ] ; then
        printf $OKB
"✓\n"$RST
    
else
        
printf $ERR"✗\n"$RST
        NEWPKGS
="${NEWPKGS} $i"
    
fi
done
if [ -"${NEWPKGS}]; then
    
echo --n $OK"==> Installing necessary packages$OKB "${NEWPKGS}"... "$RST
    $install_with 
--q install ${NEWPKGS2>/dev/null
       
echo -e $OKB"\nDone installing packages.\n"$RST
else
       
printf $OK"==>$OKB Nothing new to install.\n"$RST
fi
}

# Get the VirtualBox source files from Oracle
function get_source()
{
    
printf $OK"Getting VirtualBox source from the Oracle download site..."$RST
    remove_source
    wget 
-q $SRC_PATH/$VBOX_SRC_FILE
    printf $OKB
" ✓\n"$RST
    printf $OK
"Getting the VirtualBox Extension Pack source file..."$RST
    wget 
-q $SRC_PATH/$VBOX_EXT_SRC
    printf $OKB
" ✓\n"$RST
echo
}

# The script run has completed. Print a short message stating same.
function script_complete()
{
    
remove_source
    printf $OKB
"Oracle VirtualBox is now installed.\n"
    
printf $OKB"Script run complete.\n"$RST
}

# The test script run has completed.
function script_test_complete()
{
    
remove_source
    printf $OKB
"This script test is now complete.\n"
    
printf $OKB"All necessary Fedora packages are installed.\n"$RST
}

# Script execution has been cancelled by the user.
function script_cancel()
{
    
tput cuu1
    tput el
    printf $OK
"Script cancelled.\n"$RST
}

# Main script flow
function menu()
{
clear
headline
printf $OK
"\nFor this script to succeed you need to be running the newest available and installed kernel.\n\nIf you aren't running the newest available and installed kernel please exit this script\nand update your system. Then boot into the newest kernel and run this script again.\n"$RST
printf $OKB
"\nShall we continue? <y/n/t> "$RST
read yn
case $yn in
    y
)    get_release
        remove_fed_vbox
           get_packages
           get_source
           install_source
           install_extpack
           script_complete
           
;;

    
n)    script_cancel
           
exit 0
           
;;
# Test menu entry
    
t)     get_release
           get_packages
           get_source
           script_test_complete
           
;;
    
    *)    
script_cancel
           
exit 0
           
;;
esac
}
menu 
__________________
Glenn
The Bassinator
© ®
Reply With Quote
  #26  
Old 29th March 2015, 07:09 PM
medicman2002 Offline
Registered User
 
Join Date: Mar 2015
Location: Ohio
Posts: 2
windows_7chrome
Re: Oracle VirtualBox installation script

Hello, if I could make this work then it would be great. Something in your code would likely correct my install issues. I do not understand at what point I'd use your script though. I am very new to fedora and have limited experience with VMBox. I've DL the latest VMBox (4.3.26) and am on a host Windows 7 64-bit Dell Inspiron laptop. I need to get some version of fedora (my text book uses fedora 13 to show how far behind our professors are) on my VMBox. I've tried already with fedora 21 (worstation) x86 version. I'd like to try with an iso of fedora 13 but don't know where to find that archived file.

Where or how does your script come into play-- and could you tell me generally what I've done incorrectly? I'd appreciate any help at all.
Reply With Quote
  #27  
Old 30th March 2015, 09:52 AM
glennzo Online
Un-Retired Administrator
 
Join Date: Mar 2004
Location: In your closet
Posts: 15,506
linuxfedorafirefox
Re: Oracle VirtualBox installation script

My script will be of no use to you. It is for a Fedora host.

You need the VirtualBox.exe file for a Windows host. http://download.virtualbox.org/virtu...-98988-Win.exe

Install that along with VirtualBox Extension Pack http://download.virtualbox.org/virtu...8.vbox-extpack. Click on the extension pack file and VirtualBox will open and offer to install it.

Then you need Fedora 13 32 Bit or 64 Bit.
__________________
Glenn
The Bassinator
© ®
Reply With Quote
  #28  
Old 26th April 2015, 01:26 PM
glennzo Online
Un-Retired Administrator
 
Join Date: Mar 2004
Location: In your closet
Posts: 15,506
linuxfedorafirefox
Re: Oracle VirtualBox installation script

Has anyone else tried this script? It would be wonderful to get some feedback. Did it work well?

Tested under Fedora 22 Beta x86_64 (virtual machine). Worked well

Still can't upload attachments

Copy and paste. Save as anythingyoulike.sh
Run
PHP Code:
sudo ./anythingyoulike.sh 
PHP Code:
#!/bin/bash
# 21_oracle_virtualbox.sh

# Install and configure the Oracle version of VirtualBox for Fedora 20 and later.
# Install the Oracle VirtualBox Extension Pack.
# Handle all platforms, i686, PAE and x86_64 .
# Clean up when finished.
# Use DNF for Fedora 21 and up, YUM for Fedora 20 and earlier.
# Remove previously installed VirtualBox.
# Support color / no color (sudo NOCOLOR=1 21_oracle_virtualbox.sh)

# Glenn A. Johnson
# Started January 18, 2015
# Updated April 26, 2015

# 04.26.15 - Can I add an uninstall (safely) feature?
# 04.26.15 - Testing... 1,2,3
# 03.26.15 - Cosmetic changes and version update
# 03.15.15 - Tested under Fedora 22 Workstation Alpha (x86_64).
# 03.14.15 - New VirtualBox version
# 02.25.15 - Betterer code to discover kernel arch.
# 02.23.15 - New code to discover kernel arch
# 02.22.15 - Seems that kernel arch discovery is not working.
# 02.21.15 - New version of VirtualBox

# A tip of the fedora to Fedora Forum members Sea, Skull One, marko, Dangermouse
# for help with code

# Variables - Additional packages usually needed for a successful install of VirtualBox
# over the different platforms, x86_64, i686 and i686+PAE
#PACKFILES="kernel-devel-$(uname -r) gcc qt qt-x11 libpng15 libXmu libXt libvpx dkms wget SDL"

# Determine OS platform and install correct packages.
# PAE or no?
GETVERS=$(uname -grep "PAE")
if [[ 
$GETVERS ]] ; then
    PACKFILES
="kernel-PAE-devel gcc qt qt-x11 libpng15 libXmu libXt libvpx dkms wget SDL"
else
    
PACKFILES="kernel-devel-$(uname -r) gcc qt qt-x11 libpng15 libXmu libXt libvpx dkms wget SDL"
fi

# We can easily make changes to the source file versions by changing a few variables below.
# Most recent is http://download.virtualbox.org/virtualbox/4.3.26/VirtualBox-4.3-4.3.26_98988_fedora18-1.x86_64.rpm
VB_REL_VER="4.3-4.3.26_98988"
VB_EXT_VER="4.3.26-98988"
VB_REL_DIST="fedora18-1"
VBOX_SRC_FILE="VirtualBox-${VB_REL_VER}_${VB_REL_DIST}."`uname -m`".rpm" 
VBOX_EXT_SRC="Oracle_VM_VirtualBox_Extension_Pack-${VB_EXT_VER}.vbox-extpack"
SRC_PATH="http://download.virtualbox.org/virtualbox/4.3.26"

# Color definitions; the variables are null if the option NOCOLOR is set.
# Thanks Skull One!

if [ -"$NOCOLOR]; then
    OKB
=$(tput bold;tput setaf 6)
    
OK=$(tput setaf 6)
    
ERRB=$(tput bold;tput setaf 1)
    
ERR=$(tput setaf 1)
    
RST=$(tput sgr0)
else
    
OKB=
    
OK=
    
ERRB=
    
ERR=
    
RST=
fi

# Need root permissions at some point, might as well do it now.
if [[ $EUID -ne 0 ]] ; then
    clear
       printf $OK
"You're going to need root permissions at some point. Let's get that out of the way now.\nUse \"sudo\" or \"su -c\"\n"$RST
       
exit 0
fi

# Release 20 and later only
function get_release()
{
    
printf $OK"Checking Fedora release version... "$RST
    RELNUM
=$(rpm -qa --queryformat '%{version}\n' fedora-release)
    if [[ 
$RELNUM "20" ]] ; then
        printf $ERR
"\nThis script is for Fedora release 20 and later only.\n"$RST
           
exit 0
    
else printf $OKB"Fedora $RELNUM ✓"$RST
    
# Determine if we're going to use dnf or yum.
    
if [[ $RELNUM "21" ]] ; then
        install_with
="yum"
    
else
        
install_with="dnf"
    
fi
fi
echo
}

# Clear screen and print a headline.
function headline()
{
    
clear
    printf $OK
"==>$OKB VirtualBox installation script for Fedora 20 and up.\n"$RST
    printf $OK
"==>$OKB Oracle VirtualBox and Oracle VirtualBox Extension Pack will be installed.\n"$RST
    printf $OK
"==>$OKB VirtualBox release $VB_REL_VER\n"$RST
}

# Remove Oracle VirtualBox source files if they exist in the current working directory.
function remove_source()
{
    for 
i in $VBOX_SRC_FILE $VBOX_EXT_SRC ; do
        
rm -f $i
    done
}

# Remove any installed version of VirtualBox.
function remove_fed_vbox()
{
VBOX_INSTALLED=$(rpm -qa grep VirtualBox)
if [[ 
$VBOX_INSTALLED ]] ; then
    printf $OK
"Removing previously installed instance of VirtualBox. Please wait..."$RST
    $install_with 
--q erase $VBOX_INSTALLED 2>/dev/null
    printf $OKB
" ✓\n\n"$RST
fi
}

# Install Oracle VirtualBox from the downloaded source RPM.
function install_source()
{
    if [[ -
f $VBOX_SRC_FILE ]] ; then
        printf $OK
"Installing Oracle VirtualBox\n"$RST
        rpm 
-Uvh $VBOX_SRC_FILE
    
else
        
printf $ERR"The source file missing.\nThere was an error downloading the file.\n"$RST
        
exit 0
    fi
}

# Install the Oracle VirtualBox Extension Pack.
function install_extpack()
{
    if [[ -
f $VBOX_EXT_SRC ]] ; then
        
echo $OK"Installing Oracle VirtualBox extension pack."$RST
        VBoxManage extpack install 
--replace $VBOX_EXT_SRC
    
else
        
printf $ERR"Oracle VirtualBox extension pack source file missing!\n"$RST
    fi
}

# Get any Fedora packages typically needed to complete the VirtualBox installation without errors.
function get_packages()
{
printf $OK"Checking for necessary packages..."$RST
echo
NEWPKGS=""
for i in $PACKFILES ; do
    
printf $OK"==> $i: "
       
rpm -q $i > /dev/null
    
if [ $? -eq 0 ] ; then
        printf $OKB
"✓\n"$RST
    
else
        
printf $ERR"✗\n"$RST
        NEWPKGS
="${NEWPKGS} $i"
    
fi
done
if [ -"${NEWPKGS}]; then
    
echo --n $OK"==> Installing necessary packages$OKB "${NEWPKGS}"... "$RST
    $install_with 
--q install ${NEWPKGS2>/dev/null
       
echo -e $OKB"\nDone installing packages.\n"$RST
else
       
printf $OK"==>$OKB Nothing new to install.\n"$RST
fi
}

# Get the VirtualBox source files from Oracle
function get_source()
{
    
printf $OK"Getting the VirtualBox source RPM from the Oracle download site..."$RST
    remove_source
    wget 
-q $SRC_PATH/$VBOX_SRC_FILE
    printf $OKB
" ✓\n"$RST
    printf $OK
"Getting the VirtualBox Extension Pack source file..."$RST
    wget 
-q $SRC_PATH/$VBOX_EXT_SRC
    printf $OKB
" ✓\n"$RST
echo
}

# The script run has completed. Print a short message stating same.
function script_complete()
{
    
remove_source
    printf $OKB
"Oracle VirtualBox is now installed.\n"
    
printf $OKB"Script run complete.\n"$RST
}

# The test script run has completed.
function script_test_complete()
{
    
remove_source
    printf $OKB
"This script test is now complete.\n"
    
printf $OKB"All necessary Fedora packages are installed.\n"$RST
}

# Script execution has been cancelled by the user.
function script_cancel()
{
    
tput cuu1
    tput el
    printf $OK
"Script cancelled.\n"$RST
}

# Main script flow
function menu()
{
clear
headline
printf $OK
"\nFor this script to succeed you need to be running the newest available and installed kernel.\n\nIf you aren't running the newest available and installed kernel please exit this script\nand update your system. Then boot into the newest kernel and run this script again.\n"$RST
printf $OKB
"\nShall we continue? <y/n/t> "$RST
read yn
case $yn in
    y
)    get_release
        remove_fed_vbox
           get_packages
           get_source
           install_source
           install_extpack
           script_complete
           
;;

    
n)    script_cancel
           
exit 0
           
;;
# Test menu entry used for development. End user should ignore this menu option.
# All this does is install missing packages. It also downloads VirtualBox and the Extension Pack.
    
t)     get_release
           get_packages
           get_source
           script_test_complete
           
;;
    
    *)    
script_cancel
           
exit 0
           
;;
esac
}
menu 
__________________
Glenn
The Bassinator
© ®
Reply With Quote
  #29  
Old 14th May 2015, 05:57 PM
zuser Offline
Registered User
 
Join Date: Jan 2011
Posts: 173
windows_98_nt_2000firefox
Re: Oracle VirtualBox installation script

glennzo:

Thanks again for this. After several upgrades in both kernel and VirtualBox, script continues to work flawlessly. Staying current is sooooo easy.
Reply With Quote
  #30  
Old 14th May 2015, 06:08 PM
glennzo Online
Un-Retired Administrator
 
Join Date: Mar 2004
Location: In your closet
Posts: 15,506
windows_xp_2003chrome
Re: Oracle VirtualBox installation script

You're welcome.

Oddly enough, there is a new version of VirtualBox. I've updated the script for that version but haven't had time to update here. (At work at the moment). I believe, and correct me if I'm wrong, that there is an extremely serious vulnerability with virtual machines run under VirtualBox. Here's an example of what I've read somewhere else.
http://www.zdnet.com/article/venom-s...s-datacenters/
__________________
Glenn
The Bassinator
© ®
Reply With Quote
Reply

Tags
installation, oracle, script, virtualbox

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
oracle virtualbox not working pythonkr11 Wibble 1 7th September 2012 07:48 PM
oracle virtualbox not working pythonkr11 Fedora Focus 1 7th September 2012 07:20 PM
Oracle Virtualbox clueless Using Fedora 5 17th May 2011 10:39 AM
[SOLVED] oracle vm virtualbox postmanpat Using Fedora 5 24th November 2010 11:51 AM
Update Oracle VM VirtualBox error JValeck Using Fedora 2 12th October 2010 05:42 AM


Current GMT-time: 19:42 (Wednesday, 26-04-2017)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat