Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My Pandora Server installation script
As promised, here is my "Pandora Server" installation script.
It's not tested, so it may contaon bugs (it certainly contains bug!)
To be run as root:

# this script was released under GNU/GPL license 2006.
# by Denis Chupau, Tranquil IT Systems.
# It was _NEVER_ tested, so use it with care! and at your own risks.

#### var declarations
FILES_SERVER_URL="http:// ftp://" # server to download .tgz files from

# **** your Linux distribution detection code here:
# Get Linux Distro type and version

if [ -f "/etc/SuSE-release" ]
OS_VERSION=`cat /etc/SuSE-release | grep VERSION | cut -f 3 -d " "`
# *** put your code and vars for SUSE here
# CONSOLE_PATH="/var/www/html"
# *** between those comments
if [ -f "/etc/lsb-release" ]
OS_VERSION=`cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -f 2 -d "="`
# *** put your code and vars for UBUNTU here
# CONSOLE_PATH="/var/www/html"
# *** between those comments
if [ -f "/etc/debian_version" ]
OS_VERSION=`cat /etc/debian_version`
# *** put your code and vars for DEBIAN here
# CONSOLE_PATH="/var/www/html"
# *** between those comments
if [ -f "/etc/fedora-release" ]
OS_VERSION=`cat /etc/fedora-release | cut -f 4 -d " "`
# *** put your code and vars for FEDORA here
# *** between those comments
if [ -f "/etc/mandriva-release" ]
OS_VERSION=`cat /etc/mandriva-release`
# *** put your code and vars for MANDRIVA here
# *** between those comments
# Add your distribution detection code here
OS_VERSION=`uname -r`
# *** put your code and vars for GENERIC here
# *** between those comments
# **** end of detection.

urpmi sshd
urpmi wget
wget $FILES_SERVER_URL/$SERVER_PACK # retrieving packets to install them
tar -xzf $SERVER_PACK # de-tar prepared packages
tar -xzf $CONSOLE_PACK
tar -xzf $AGENT_PACK
mv $PANDORA_HOME/linux $PANDORA_HOME/$AGENT_SUBDIR # we only need linux agent
rm -rf $(ls /opt/pandora/ -I "pan*") # cleaning
chown -R root:root $PANDORA_HOME # root is the owner at this precise time

# ****************************************************************************
# ****************** Pandora Server configuration *********************
# ****************************************************************************
useradd -m -s /bin/bash pandora
echo "Password for user pandora:"
passwd pandora # => user intervention needed
chown pandora $PANDORA_HOME/$SERVER_SUBDIR/data_in
chown pandora $PANDORA_HOME/$SERVER_SUBDIR/log
chown pandora $PANDORA_HOME/$SERVER_SUBDIR/var
su pandora -c "mkdir /home/pandora/.ssh"
su pandora -c "touch /home/pandora/.ssh/authorized_keys"
su pandora -c "chmod 600 /home/pandora/.ssh/authorized_keys"
echo "SSH keys pair generation (keep default if you don't know what to do, hit Enter):"
su pandora -c "ssh-keygen" # => user intervention
su pandora -c 'echo command=\"$PANDORA_HOME/$SERVER_SUBDIR/\" $(cat /home/pandora/.ssh/ >> /home/pandora/.ssh/authorized_keys'
echo AllowUsers pandora tisadmin >> /etc/ssh/sshd_config
# echo PasswordAuthentication no >> /etc/ssh/sshd_config # => to make the server unaccessible without RSA keys (no password).
# echo Put here the key(s) you want to add to pandora authorized_keys
# cat >> /home/pandora/.ssh/authorized_keys
/etc/init.d/sshd restart
## RPM specifiques (will probably need user intervention)
urpmi mysql
urpmi perl-xml-simple
urpmi perl-XML-Parser
urpmi perl-datemanip
urpmi perl-forks
urpmi perl-reaper
urpmi perl-md5
## Database configuration
/etc/init.d/mysqld start
mysql -e "create database pandora"
cat $PANDORA_HOME/$CONSOLE_SUBDIR/pandoradb.sql | mysql -D pandora -u root
cat $PANDORA_HOME/$CONSOLE_SUBDIR/pandoradb_data.sql | mysql -D pandora -u root
mysql -e "grant all on pandora.* to 'pandora'@'localhost' identified by 'pandora'"

echo Enter Mysql root password:
mysql -e "SET PASSWORD FOR 'pandora'@'localhost' = PASSWORD('pandora')"
# mysql -e "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('')" # setting root password
# UPDATE mysql.user SET Password = PASSWORD('new_password') WHERE User = '' # another command to set user password: which one is best?
/etc/init.d/mysqld restart # using this instead of flush privileges

# **************************************************************
# *************** console installation ***********************
# **************************************************************
## RPM specifiques
urpmi apache-mod_php # apache + php5
urpmi php-mysql
urpmi php5-jpgraph
cp -r /usr/share/php5-jpgraph/* $CONSOLE_PATH/$CONSOLE_SUBDIR/reporting/jpgraph/
/etc/init.d/httpd start

# **************************************************************
# *********** installation de l'agent **************************
# **************************************************************
echo Generating modules ...
urpmi sshd
urpmi wget
The end of the script is the same than the agent installation script.
This is jsut an essay, so don't blame me if it's not perfect, I know it's not!
And I even say, be careful, this is just an idea of a script, and it robably needs to be completely rewriten.

bye for now!
God, well done :-)
I will test it too in a couple of days

Those 2 scripts will help a lot. Its will be propably upload to the contrib directory of pandora, when the tests and the corrections (if necessary) were done.

By the way, are you running your mysql without a root password?
I have noticed this:
mysql -D pandora -u root

Have you tried the script on a mysql with -p ? If not, don´t mind, I will :-)
If there´s a password on the mysql (normal scenario) would be a good idea to ask first for the root password (mysql), read it, and by using "expect" pass it as a data to the script, so the mysql tables and pandora user (on the mysql) will be set up automatically.

After seeing all your scripts, I´m thinking, seriusly, in making and script to copy all the keys and set perms correctly (this last thing sometimes drives people mad).

We are so glad you´re working hard on improving Pandora so much :-)
Once more, thanks
Quote:As promised, here is my "Pandora Server" installation script.
bye for now!

Quite interesting, probably put in contrib directory.... could be useful to future packaging scripts. Thanks a lot.
Thanks to you as well,
This script is taking installation of the Pandora Server from the beginning: that means that on the machine, there is a 'minimal installation" of a distribution (no apache, no mysql, no ...etc, just a running linux with a bash command line and network configured) and when you install mysql server for the first time it has no root password, it's more conveniant for an automated installation as mysql doesn't ask for a password every now and then...
The root password is set later in the script when all the tables and data are set. The password change functionnality has been commented because I wanted to let the choice to the user of half/entirely automatic installation and didn't implement it Wink sorry).

As I said it's just a start, but as I don't have much time actually to work on this one, I post it here for some to continue/give some ideas.

I will post some /etc/init.d/ start/stop scripts compatibles with chkconfig (this is not a big improvement as I added only half a dozen lines).

So the next step will be to integrate those strat/stop scripts in the installation scripts.

And maybe we could write an uninstall script?
thanks again
Quote:And maybe we could write an uninstall script?
thanks again

Why someone would be interested in unistall it? :-)
Hey dagget! how are you doing?

I´ve been testing a little bit the installation script and it doesn´t work properly, at least, for me. I´ve made some changes and now it´s ok.
I will post it soon, I´m finishing somethings at the moment.

Just a reminder, could you please send me a tar.gz package with all the scripts you have made? I´d like to test its and then once the review is done, upload its to the contrib directory on the SVN :-)

I wish you to have nice weekend!
Yep, I sent them 5 minutes ago!
Wow include my scripts in the SVN... it's makin' me quiet proud! :wink:
thanks, really, I'm really happy about that! It's a kind of a christmas persent! :lol:

I didn't send my script before 'cause I wanted to terminate some modifications on the packages (the char set issue) but it didn't work as expected, and I won't be working again on this until January 3rd 2007 (one week of vacations!!) 8) .

So happy new year and merry christmas to all of you, thanks for all the great job you did on Pandora, your precious help and see you in 1 week! Big Grin

bye for now.

Users browsing this thread: 1 Guest(s)

(c) 2006-2018 Artica Soluciones Tecnológicas. Contents of this wiki are under Create Common Attribution v3 licence. | |

Theme © MyBB Themes