Graphical install CentOS 6 using VNC, for dedicated servers

Status
Not open for further replies.

vpsdeploy

Member
20
2011
1
125
Hi, this script modify a grub configuration to launch in the next reboot a CentOS 6 netinstall in graphical mode.
I hope it will be useful for your business.
Regards!

Code:
#!/bin/bash
clear
echo
echo "Network Boot Install Script for CentOS"
echo "(c) alexsmith.im 2009-2010"
echo
echo "This script gives you the ability to install and use the VNC based network installer built into the"
echo "CentOS and Fedora Core network images."
echo
echo "It will walk you through your settings and reboot the server when required, please only run this script"
echo "if you are happy to lose the contents of this machines hard drive(s)"
echo
echo "This script comes without guarantee that it will work if it breaks your server I cannot be held responsible"
echo "I have tested it on my servers and it works without issue, if you do find a bug please report it"
echo "to me via my site at http://alexsmith.im - Thanks"
echo
echo " Please choose one of the following options"
echo
echo "A) Install CentOS 6.x 32 Bit"
echo "B) Install CentOS 6.x 64 Bit"
echo "X) Quit this installer"
echo
echo -n "Select an option and hit [ENTER]: "
read option

rm -rf /setup
mkdir /setup
cd /setup

case "$option" in

    "a" | "A" )
    
        echo
        echo "Installing CentOS 6 32 Bit"
        wget -4 -q http://mirror.ovh.net/ftp.centos.org/6/os/i386/images/pxeboot/initrd.img -O /setup/initrd.img
        wget -4 -q http://mirror.ovh.net/ftp.centos.org/6/os/i386/images/pxeboot/vmlinuz -O /setup/vmlinuz
        mirror="http://mirror.ovh.net/ftp.centos.org/6/os/i386/"
        ;;
    
    "b" | "B" )
    
        echo
        echo "Installing CentOS 6 64 Bit"
        wget -4 -q http://mirror.ovh.net/ftp.centos.org/6/os/x86_64/images/pxeboot/initrd.img -O /setup/initrd.img
        wget -4 -q http://mirror.ovh.net/ftp.centos.org/6/os/x86_64/images/pxeboot/vmlinuz -O /setup/vmlinuz
        mirror="http://mirror.ovh.net/ftp.centos.org/6/os/x86_64/"
        ;;
        
    "x" | "X" )
    
        echo "Quitting"
        exit
        ;;
        
esac

echo
echo "Detecting required system settings..."
gateway=`netstat -nr | grep UG | awk '{print $2}'`
echo "Gateway detected as $gateway"
ip=`ifconfig eth0 | grep "inet addr:" | awk '{print $2}' | cut -d : -f 2`
echo "IP detected as $ip"

echo 
echo 
echo "This password is purely for VNC access and it doesn't like long ones" 
echo -n "So please enter a SHORT (6 chars or less) password for VNC and hit [ENTER]: "
read password

cp /setup/initrd.img /boot/pxe.initrd.img
cp /setup/vmlinuz /boot/pxe.vmlinuz

echo
echo "Forcing install of Grub..."
yum install grub -y > /dev/null

echo "Creating boot menu..."
if [ -s /boot/grub/menu.lst ]
then 
    rm /boot/grub/menu.lst
fi

# Make menu.lst with correct settings
cat > /boot/grub/menu.lst << DELIM
default 0
timeout 5
title PXE Install Boot
root (hd0,0)
kernel /boot/pxe.vmlinuz vnc vncpassword=$password headless ip=$ip netmask=255.255.255.0 gateway=$gateway dns=8.8.8.8 ksdevice=eth0 method=$mirror lang=en_US keymap=us
initrd /boot/pxe.initrd.img
DELIM

if [ -s /boot/grub/grub.conf ]
then
        rm /boot/grub/grub.conf
        cp /boot/grub/menu.lst /boot/grub/grub.conf
fi

echo "Installing Grub to the first disk..."
grub-install /dev/sda > /dev/null
echo "Checking Grub Install..."
grub-install --recheck /dev/sda > /dev/null

echo
echo "PRE-SETUP COMPLETE"
echo
echo "Once the server is rebooted VNC will start up and you will be able to carry on the install as normal"
echo "This includes doing your partitioning and installing your packages"
echo
echo "You will be able to connect to the VNC Server using $ip:1 as the host"
echo
echo "The reboot can take a few minutes, depending on the speed of your server and if the mirror is busy"
echo "If you would like to reboot the server now to start the installation of your server please hit [ENTER] now, otherwise press ctrl+c"
read -s
echo "Rebooting!"
reboot
 
10 comments
I have installed CentOS 6 on visualization player. that is rapid really. I suggest all use CentOS 6 on virtual machine. the experience is awesome.

I have manage the apache web server and any php/mysql website able to run on that.
 
Not with NX...

1- Create this file and run it
2- Reboot the server
3- Connect via VNC -> IP.of.the.server:1

The graphical install is waiting your VNC connection.

Regards.
 
Code:
Not with NX...

1- Create this file and run it
2- Reboot the server
3- Connect via VNC -> IP.of.the.server:1

The graphical install is waiting your VNC connection.
i really have problem with ovh kernel. i need to install a original centos. i tried everything from instruction of this link http://forum.ovh.co.uk/showthread.php?t=3073&page=8 but there is no luck to connect to vnc. this already waste so much time on me for this. i really need help for this. i have a little knowledge about linux. could you please explain a little it more detail. what and how to create and how to run it?? i really appreciate for this
 
Hi,

create a new file:

setup.sh with the content of the script
Do a chmod 777 setup.sh
Run "sh setup.sh"
And reboot
Wait for server reboot
Connect via VNC -> IP.of.the.server:1

Regards
 
hi
agian...this method still give me no luck to connect to vnc..i heard people said if i cant connect to vnc it might be the firewall...do you think is it the problem???? if it does...how do i fix that?? thank you

---------- Post added at 08:24 PM ---------- Previous post was at 11:12 AM ----------

this way is not working. is there any other ways to install a stock centos????
 
Status
Not open for further replies.
Back
Top