OpenLamp was a script that set up a webserver. Was mostly used among my Networking class users.
clear
echo "OPENlamp. Version 1.6"
if [ -e /usr/bin/zenity ]
then
zenity --question --text="You have Zenity Installed. Continuing with script."
else
echo "Zenity is needed for this script to run properly. Installing Zenity"
echo "...."
sleep 3
sudo aptitude install zenity
fi
#The following part of the script is just to make sure that you ran this script with sudo. It won't damage anything.
sudo echo "#This was a test for server.sh. You may remove this, but as it is commented, it does not effect your file." >> /etc/hosts
if [ $? -eq 0 ]
then
zenity --question --text="You're using sudo. Good."
else
zenity --question --text="You MUST run this script with Sudo. (e.g. 'sudo ./server.sh') This script will now close."
exit 1
fi
#Ending testing.
zenity --question --text="OPENlamp v.1.6\nServer Setup and Configuration Script\nCopyright 2009 to Nicholas Badger.\nGPLv3 Licensed\nThis Script is meant to be run for FRESH installs of Apache2, mySQL, and PHP. If there is any existing instances of these programs, problems may occur!\n\nTo continue, press 'OK'. 'Cancel' will close this script."
if [ $? = 1 ]
then
echo "Script is Terminating.. please wait..."
exit 1
fi
zenity --question --text="I am going to install apache2. Is this okay with you?"
if [ $? = 1 ]
then
zenity --question --text="Skipping Apache2 installation."
else
sudo dpkg --configure -a
sudo apt-get -y install apache2
sudo echo "ServerName localhost" >> /etc/apache2/apache2.conf
sudo /etc/init.d/apache2 restart
fi
zenity --question --text="I am now going to work on installing PHP. Is this okay with you?"
if [ $? = 1 ]
then
zenity --question --text="Skipping PHP installation."
else
sudo apt-get -y install -y php5
fi
zenity --question --text="If you want me to install mySQL on your computer, continue by clicking OK."
if [ $? = 1 ]
then
zenity --question --text="Skipping mySQL installation."
else
sudo apt-get -y install mysql-server libapache2-mod-auth-mysql php5-mysql
fi
zenity --question --text="I'm going to install phpMyAdmin and configure parts of it for you. Is that OK?"
if [ $? = 1 ]
then
zenity --question --text="Skipping phpMyAdmin installation."
else
sudo apt-get -y install phpmyadmin
sudo echo "Include /etc/phpmyadmin/apache.conf" >> /etc/apache2/apache2.conf
fi
zenity --question --text="I'm going to install mySQL-admin. Is this OK?"
if [ $? = 1 ]
then
zenity --question --text="Skipping mySQL-admin installation."
else
sudo apt-get -y install mysql-admin
fi
zenity --question --text="I'm going to restart Apache, test configuration, and then Restart again. Is that fine with you? (If 'No is selected, I will still restart Apache. That step is still necessary to run it correctly."
if [ $? = 1 ]
then
sudo /etc/init.d/apache2 restart
zenity --question --text="Skipping Apache configuration"
else
sudo /etc/init.d/apache2 restart
sudo /usr/sbin/apache2ctl configtest
sudo /usr/sbin/apache2ctl restart
zenity --question --text="If you did NOT get 'Syntax OK', contact your system administrator to find the faulty file(s)."
fi
zenity --question --text="This part of setup will install and configure parts of vsFTPd. vsFTPd is a very secure FTP server and is needed to use ftp on your website: locally or commercially."
if [ $? = 1 ]
then
zenity -- question --text="Skipping vsFTPd installation/configuration"
else
sudo apt-get -y install vsftpd
zenity --question --text="You can find the original vsftpd, if you need to troubleshoot or want to read it, at '/etc/vsftpdball.conf'."
sudo cp /etc/vsftpd.conf /etc/vsftpdbakk.conf
sudo echo "listen=YES" > /etc/vsftpd.conf
sudo echo "dirmessage_enable=YES" >> /etc/vsftpd.conf
sudo echo "use_localtime=YES" >> /etc/vsftpd.conf
sudo echo "xferlog_enable=YES" >> /etc/vsftpd.conf
sudo echo "connect_from_port_20=YES" >> /etc/vsftpd.conf
sudo echo "secure_chroot_dir=/var/run/vsftpd/empty" >> /etc/vsftpd.conf
sudo echo "pam_service_name=vsftpd" >> /etc/vsftpd.conf
sudo echo "rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem" >> /etc/vsftpd.conf
sudo echo "local_enable=YES" >> /etc/vsftpd.conf
sudo echo "write_enable=YES" >> /etc/vsftpd.conf
sudo /etc/init.d/vsftpd restart
fi
zenity --question --text="You should now have a running Apache2, PHP5, FTP, and mySQL server running along with all the bells and whistles. Thank you for using my script."
And a later version of OpenLamp, GSIK.
#GSIK was designed for Ubuntu by Nicholas Badger (alias, dZ).
#Script relies heavily on the 'zenity' program being installed. If it isn't, this script should install it for you.
#GSIK was originally called OPENlamp. OPENlamp was in BETA v1.6 before it's name change.
#Currently, GSIK is in BETA version 1.1.
#GSIK is licensed under the terms of GPLv3 or later, found at http://www.gnu.org/licenses/gpl-3.0.html
#
#This script will, with your permission at every step, install programs/information not affiliated with itself.
#No guarantee comes with this shell script, even though I wish I could offer as such.
#Use at your own discretion.
#
#If GSIK is not downloaded as executable, you can do so yourself by following the steps below...
#Move GSIK to your desktop.
#Open a Terminal > type 'cd ~/Desktop' > type 'sudo chmod a+x ./gsikv1.sh'.
#or...
#Right click on 'gsikv1.sh' > Properties > 'Permissions' tab > check the box that says 'Allow executing file as program'.
#
#Please be aware that this script must be ran with Administrative Permissions.
#To do this, please follow the steps below...
#Open a Terminal > type 'cd ~/Desktop' > type sudo ./gsikv1_1.sh'.
#You WILL be prompted with your password.
#
#If any help is needed, you may contact me.
#'[email protected]' (nichob[at]dreamrp[dot]com).
#
clear
#
#STARTING COLOR CODENAME SETTER
RED="\033[1;31m"
GREEN="\033[1;32m"
BLUE="\033[1;34m"
INSTALL="\033[1;56m"
ENDCOLOR="\033[0m"
echo -e $BLUE"Welcome to the GSIK Installer. Please wait a moment while pre-installation commands are ran."$ENDCOLOR
#ENDING COLOR CODENAME SETTER
#
#STARTING SUDO CHECK
echo -e $BLUE"This script is going to need your password. Please enter it to continue."$ENDCOLOR
sudo touch /var/sudotest.txt
if [ $? -eq 0 ]
then
sudo rm /var/sudotest.txt
else
echo -e $RED"GSIK must be ran with sudo (e.g. sudo ./gsikv1.sh)."$ENDCOLOR
echo -e $RED"Terminating script... Please wait."$ENDCOLOR
sleep 5
clear
exit 1
fi
#ENDING SUDO CHECK
#
#STARTING ZENITY CHECK
if [ -e /usr/bin/zenity ]
then
echo -e $GREEN"Zenity is installed. This script will continue."$ENDCOLOR
else
echo -e $BLUE"Zenity is needed for this script to run properly..."$ENDCOLOR
echo -e $BLUE"Please wait while Zenity is installed..."$ENDCOLOR
sleep 1
echo -e $INSTALL
sudo aptitude install zenity
echo -e $ENDCOLOR
if [ $? -eq 0 ]
then
clear
echo -e $GREEN"Zenity is installed. This script will continue."$ENDCOLOR
else
echo -e $RED"For some reason, unknown, Zenity could not install. Please check your internet connection and repositories."$ENDCOLOR
sleep 1
echo -e $RED"This script will not run without Zenity installed and working. Please, run GSIK again when you have fixed the problem. Thank you."$ENDCOLOR
sleep 1
echo -e $RED"GSIK will terminate in five seconds."$ENDCOLOR
sleep 5
exit 1
fi
fi
#ENDING ZENITY CHECK
#
#STARTING COPYRIGHT INFORMATION WINDOW
zenity --info --title="Copright Information" --text="GSIK v.1.1\nGraphical Server Installer and Konfigurator\nCopyright 2010 to Nicholas Badger under GPLv3.\n\nThis script was designed to install Apache2, PHP5, mySQL, vsFTPd, a few tools to help run your server, and configure parts of the said installations."
#ENDING COPYRIGHT INFORMATION WINDOW
#
#STARTING UPDATE PROCEEDURE
zenity --question --title="Update?" --text="Updates may be needed for this script to run properly. Is it okay for me to run a couple of commands not directly related to this program to ensure that it runs correctly?\nPress 'Cancel' to skip possibly needed update. Press 'OK' to continue."
if [ $? = 1 ]
then
echo -e $BLUE"Skipping update..."$ENDCOLOR
else
echo -e $INSTALL
sudo dpkg --configure -a
sudo aptitude update
echo -e $ENDCOLOR
clear
echo -e $GREEN"Update complete..."$ENDCOLOR
fi
#ENDING UPDATE PROCEEDURE
#
#STARTING GSIK PROGRAM INSTALLATION CHOOSER WINDOW
ans=$(zenity --list --width=625 --height=260 --text "GSIK > Please choose which programs you want to install...\nIf you press 'Cancel', this installation process will close.\nIf you want to just run the configuration portion of my script, please click 'OK' without selecting any of the programs below." --checklist --column "Select" --column "Options" --column "Description" FALSE "Apache2 WebServer" "Apache is the leading webserver manager." FALSE "PHP5" "PHP5 is a leading database and language inregration manager." FALSE "mySQL" "mySQL is the webserver database manager." FALSE "phpMyAdmin" "phpMyAdmin is the leading PHP5 webserver manager." FALSE "mySQL-admin" "mySQL-admin is the leading mySQL webserver manager." FALSE "vsFTPd" "vsFTPd is a very safe FTP database." --separator=":");
#ENDING GSIK PROGRAM INSTALLATION CHOOSER WINDOW
#
#STARTING "IF CANCEL IS CLICKED"
if [ $? = 1 ]
then
echo -e $RED"Program Terminated"$ENDCOLOR
exit 1
fi
#ENDING "IF CANCEL IS CLICKED"
#
arr=$(echo $ans | tr "\:" "\n")
for x in $arr
do
if [ $x = "Apache2" ]
then
clear
echo -e $BLUE"I am installing Apache2...."$ENDCOLOR
echo -e $INSTALL
sudo apt-get -y install apache2
echo -e $ENDCOLOR
echo -e $GREEN"Installation of Apache2 complete!"$ENDCOLOR
fi
if [ $x = "php5" ]
then
clear
echo -e $BLUE"I am installing PHP5...."$ENDCOLOR
echo -e $INSTALL
sudo apt-get -y install php5
echo -e $ENDCOLOR
echo -e $GREEN"Installation of PHP5 complete!"$ENDCOLOR
fi
if [ $x = "mySQL" ]
then
clear
echo -e $BLUE"I am installing mySQL...."$ENDCOLOR
echo -e $INSTALL
sudo apt-get -y install mysql-server
sudo apt-get -y install libapache2-mod-auth-mysql
sudo apt-get -y install php5-mysql
echo -e $ENDCOLOR
echo -e $GREEN"Installation of mySQL complete!"$ENDCOLOR
fi
if [ $x = "phpMyAdmin" ]
then
clear
echo -e $BLUE"I am installing phpMyAdmin...."$ENDCOLOR
echo -e $INSTALL
sudo apt-get -y install phpmyadmin
echo -e $ENDCOLOR
echo -e $GREEN"Installation of phpMyAdmin complete!"$ENDCOLOR
fi
if [ $x = "mySQL-admin" ]
then
clear
echo -e $BLUE"I am installing mySQL-admin...."$ENDCOLOR
echo -e $INSTALL
sudo apt-get -y install mysql-admin
echo -e $ENDCOLOR
echo -e $GREEN"Installation of mySQL-admin complete!"$ENDCOLOR
fi
if [ $x = "vsFTPd" ]
then
clear
echo -e $BLUE"I am installing vsFTPd...."$ENDCOLOR
echo -e $INSTALL
sudo apt-get -y install vsftpd
echo -e $ENDCOLOR
echo -e $GREEN"Installation of vsFTPd complete!"$ENDCOLOR
fi
done
#
#STARTING GSIK PROGRAM CONFIGURATION CHOOSER WINDOW
ans=$(zenity --list --width=625 --height=260 --text "GSIK > Please choose which programs you want me to configure for you automatically...\nIf you press 'Cancel', this configuration process will close.\n" --checklist --column "Select" --column "Options" --column "Description" FALSE "Configure Apache2" "This will edit/add files that are needed for Apache to function correctly." FALSE "Configure vsFTPd" "This will edit/add files that are needed for vsFTPd to function correctly." --separator=":");
#ENDING GSIK PROGRAM CONFIGURATION CHOOSER WINDOW
#
#
#STARTING "IF CANCEL IS CLICKED"
if [ $? = 1 ]
then
echo -e $RED"Program Terminated"$ENDCOLOR
exit 1
fi
#ENDING "IF CANCEL IS CLICKED"
#
arr=$(echo $ans | tr "\:" "\n")
for x in $arr
do
if [ $x = "Apache2" ]
then
clear
echo -e $BLUE"I am now configuring Apache2...."$ENDCOLOR
echo -e $INSTALL
sudo cp /etc/apache2/apache2.conf ~/Desktop/apache2.conf
sudo chmod 777 ~/Desktop/apache2.conf
echo "ServerName localhost" >> ~/Desktop/apache2.conf
sudo chmod 644 ~/Desktop/apache2.conf
sudo cp ~/Desktop/apache2.conf /etc/apache2/apache2.conf
sudo rm ~/Desktop/apache2.conf
echo -e $ENDCOLOR
echo -e $GREEN"Configuration of Apache2 complete!"$ENDCOLOR
fi
if [ $x = "vsFTPd" ]
then
clear
echo -e $BLUE"I am now configuring vsFTPd...."$ENDCOLOR
echo -e $INSTALL
sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.bak
touch ~/Desktop/vsftpd.conf
echo "listen=YES" > ~/Desktop/vsftpd.conf
echo "dirmessage_enable=YES" >> ~/Desktop/vsftpd.conf
echo "use_localtime=YES" >> ~/Desktop/vsftpd.conf
echo "xferlog_enable=YES" >> ~/Desktop/vsftpd.conf
echo "connect_from_port_20=YES" >> ~/Desktop/vsftpd.conf
echo "secure_chroot_dir=/var/run/vsftpd/empty" >> ~/Desktop/vsftpd.conf
echo "pam_service_name=vsftpd" >> ~/Desktop/vsftpd.conf
echo "rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem" >> ~/Desktop/vsftpd.conf
echo "local_enable=YES" >> ~/Desktop/vsftpd.conf
echo "write_enable=YES" >> ~/Desktop/vsftpd.conf
sudo chmod 644 ~/Desktop/vsftpd.conf
sudo cp ~/Desktop/vsftpd.conf /etc/vsftpd.conf
sudo rm ~/Desktop/vsftpd.conf
clear
echo -e $ENDCOLOR
echo -e $GREEN"vsFTPd Configuration Completed."$ENDCOLOR
fi
done
echo -e $RED"======================================"$ENDCOLOR
echo -e $RED"==I AM RESTARTING IMPORTANT PROGRAMS=="$ENDCOLOR
echo -e $RED"======================================"$ENDCOLOR
echo -e $INSTALL
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/apache2 start
sudo /etc/init.d/apache2 restart
sudo /etc/init.d/vsftpd stop
sudo /etc/init.d/vsftpd start
sudo /etc/init.d/vsftpd restart
echo -e $ENDCOLOR
echo -e $RED"======================================"$ENDCOLOR
echo -e $RED"==============I AM DONE==============="$ENDCOLOR
echo -e $RED"======================================"$ENDCOLOR
#STARTING COLOR CODENAME UNSETTER
unset BLUE
unset RED
unset GREEN
unset INSTALL
unset ENDCOLOR
#ENDING COLOR CODENAME UNSETTER