[Solved] Proper way to make this a shell script


in some directory of your choice do touch [script_name].sh then enter the following into the script

#!/bin/bash
#if not sudo or root yum fails
if [ "$EUID" -ne 0 ]
  then echo "Please run as root"
  exit
fi

yum update -y
yum install httpd -y
service httpd start
yum install mysql-server -y && service mysqld start && mysql_secure_installation
yum install php php-mysql -y && service httpd restart
rpm -ivh https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm && yum check-update && yum install phpMyAdmin -y

sed -i '24s/Deny from All/Allow from All/' /etc/httpd/conf.d/phpMyAdmin.conf
yum install git -y && yum install gcc make mysql mysql-devel mysql-server pcre-devel zlib-devel && yum -y install dos2unix gdb nano screen unzip wget zip
yum -y groupinstall Desktop && yum -y install tigervnc-server pixman pixman-devel libXfont
vncpasswd
echo VNCSERVERS="1:root" >> /etc/sysconfig/vncservers
echo VNCSERVERARGS[1]="-geometry 1100x768" >> /etc/sysconfig/vncservers

yum -y install xterm && yum -y install subversion && yum install gnome-utils -y && yum -y install nautilus-open-terminal
service vncserver start
chkconfig httpd on && chkconfig mysqld on && chkconfig vncserver on
echo rebooting computer
sleep 5
reboot

After that is done exit the text editor and run the command chmod +x /scriptpath/[script_name].sh and then cd to the directory containing the script and run ./[script_name].sh.

2

solved Proper way to make this a shell script