nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

Automate PHPBB Bulletin Board install via script

This is a discussion on Automate PHPBB Bulletin Board install via script within the Getting started tutorials forums, part of the Linux Getting Started category; Guys, At my job we offer phpbb as a free forum if the client is interested. Well to my surprise ...


Go Back   nixCraft Linux Forum > Linux Getting Started > Getting started tutorials

Linux answers from nixCraft.


Getting started tutorials So much to read, so little time! If that is your problem, we have solution. Read our FAQ and tutorials to help you cut through the clutter of information overload. Only members of "contributors" group can post new tutorials. Other members can just reply to thread.

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 30-12-2009, 11:33 PM
jaysunn's Avatar
Powered By Linux
User
 
Join Date: Apr 2009
Location: 41.332032,-73.089775
OS: RHEL - OSX
Scripting language: BASH - Learning Ruby
Posts: 602
Thanks: 61
Thanked 80 Times in 72 Posts
Rep Power: 10
jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold
Default Automate PHPBB Bulletin Board install via script

Guys,
At my job we offer phpbb as a free forum if the client is interested. Well to my surprise I was getting asked to install phpbb bulletin boards like 5 a day. This started to become repetitive. So I wrote a script to perform my duties. This script will expand the files create the correct permissions. Create the database in mysql server and prepare the files. I am sure this can be modified for all mysql web based applications.

And I am sure that this is a sloppy poor attempt at script for experienced script writers. However I am learning fast.


You will execute this from the shell prompt using the clients name as the 1 argument. It has been working great for me....................

Stipulation!!!
You will need the phpbb.zip file in this location:

Code:
/export/home/phpuser/phpbb/install_files/
Code:
[root@forums1 bin]# ./create_phpbb_site.sh clientname

PHP Code:
#!/bin/bash

# jralph@job.com
# March 24, 2009 
# script to create nesessary directory structure for phpbb sites.

clientname=$1

if [ -e $clientname ] ;
then
  
echo "Please give client name" ;
  exit;
fi

# change to correct directory
cd /export/home/phpuser/phpbb/install_files/

# copy the install zip to target directory.
cp phpBB-3.0.4.zip ../

# backup one directory step.
cd ..

# unzip the archive
unzip phpBB-3.0.4.zip

# Move to client folder.
mv phpBB3 $clientname

# Remove the install archive
rm -f phpBB-3.0.4.zip

#change ownership to our correct permissions
chown phpuser:ftpusers -/export/home/phpuser/phpbb/$clientname/
chown nobody:ftpusers /export/home/phpuser/phpbb/$clientname/config.php

# Change permissions with chmod.
chmod -R 775 /export/home/phpuser/phpbb/$clientname/

# Change directories again
cd /export/home/phpuser/phpbb/$clientname/

# again change ownerships to all necessary files.
chown -R nobody:ftpusers files/
chown -R nobody:ftpusers store/
chown -R nobody:ftpusers styles/
chown -R nobody:ftpusers images/
chown -R nobody:ftpusers cache/

#create database and add schema privileges.
mysql -u root -p'sqlpassword' -e"create database  phpbb_$clientname"
mysql -u root -p'sqlpassword' -e"GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER ON phpbb_$clientname.* TO phpuser@'%' " 
Now just create the apache document root or vhost and proceed with the install. Or any other web servers docroot.

Hope you all can use this. And As I said. Experts, go easy on me.

Jaysunn
__________________
Have a look at what I have been working on
http://www.shellasaurus.com

Last edited by jaysunn; 31-12-2009 at 12:25 AM. Reason: Made changes to script. 2:55PM EST looks good
Reply With Quote
The Following User Says Thank You to jaysunn For This Useful Post:
vamsi (02-01-2010)
  #2 (permalink)  
Old 01-01-2010, 12:06 PM
rockdalinux's Avatar
Is that all you got?
User
 
Join Date: May 2005
Location: Planet Vegeta
OS: Redhat
Posts: 708
Thanks: 15
Thanked 19 Times in 18 Posts
Rep Power: 10
rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light
Default

Nice script. Can you modify it a bit:
Store all path in vars
Code:
clientname="$1"
wwr="/export/home/phpuser/phpbb"
path="$wwr/$clientname"
Now you can just use $path. What if /export/home/phpuser/phpbb changed on other servers?
Quote:
# Change directories again
cd /export/home/phpuser/phpbb/$clientname/

# again change ownerships to all necessary files.
chown -R nobody:ftpusers files/
chown -R nobody:ftpusers store/
chown -R nobody:ftpusers styles/
chown -R nobody:ftpusers images/
chown -R nobody:ftpusers cache/
can be
Code:
chown -R nobody:ftpusers  $path/{files,store,styles,images,cache}
may be shorter..
Code:
chown -R nobody:ftpusers  $path/
remember small is beautiful and fast.. i hope i went easy on you..i no expert here though
__________________
Rocky Jr.
What's wrong? I hope I am not making you uncomfortable...

Never send a boy to do a mans job.
Reply With Quote
The Following User Says Thank You to rockdalinux For This Useful Post:
jaysunn (01-01-2010)
  #3 (permalink)  
Old 01-01-2010, 08:20 PM
jaysunn's Avatar
Powered By Linux
User
 
Join Date: Apr 2009
Location: 41.332032,-73.089775
OS: RHEL - OSX
Scripting language: BASH - Learning Ruby
Posts: 602
Thanks: 61
Thanked 80 Times in 72 Posts
Rep Power: 10
jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold
Default

Quote:
chown -R nobody:ftpusers $path/{files,store,styles,images,cache}
@rockdalinux,

Sweet work on the curly braces. I know that this kind of usage has tremendous power. However I am still trying to grasp it.

Thanks for the insight.

Jaysunn
__________________
Have a look at what I have been working on
http://www.shellasaurus.com
Reply With Quote
  #4 (permalink)  
Old 02-01-2010, 10:56 AM
vamsi's Avatar
Senior Member
User
 
Join Date: Nov 2009
Location: Bangalore / India
OS: Ubuntu , Debian Lenny , CentOS 5.x
Posts: 109
Thanks: 70
Thanked 7 Times in 5 Posts
Rep Power: 1
vamsi will become famous soon enough
Default

wow..this is cool !!
thanks !
__________________
Reply With Quote
  #5 (permalink)  
Old 05-01-2010, 11:42 PM
vamsi's Avatar
Senior Member
User
 
Join Date: Nov 2009
Location: Bangalore / India
OS: Ubuntu , Debian Lenny , CentOS 5.x
Posts: 109
Thanks: 70
Thanked 7 Times in 5 Posts
Rep Power: 1
vamsi will become famous soon enough
Default

sorry for double posting..but when I execute this
I get Please give client name
there's no input field..
btw running on Ubuntu

edit
after having a look at this.
here is the code I have written

PHP Code:
#!/bin/bash
read -"Enter the user name : " name
mkdir $name
cd $name
wget http
://mydesiredurlhere/app.zip
unzip app.zip
rm app
.zip
cd app 
chmod 777 uploads
chmod 777 temp
/etc/init.d/apache2 restart
/etc/init.d/mysqld restart
echo "all done , enjoy :D " 
wow ..I am loving this ..very handy for some automation , so I am learning
__________________

Last edited by vamsi; 06-01-2010 at 12:02 AM.
Reply With Quote
  #6 (permalink)  
Old 06-01-2010, 04:14 AM
jaysunn's Avatar
Powered By Linux
User
 
Join Date: Apr 2009
Location: 41.332032,-73.089775
OS: RHEL - OSX
Scripting language: BASH - Learning Ruby
Posts: 602
Thanks: 61
Thanked 80 Times in 72 Posts
Rep Power: 10
jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold
Default

Hi Vamsi,

Are you using the snippet from my script up above?

Code:
clientname=$1

if [ -e $clientname ] ;
then
  echo "Please give client name" ;
  exit;
fi
This is a test to make sure that you use a clientname for a variable.

You need to run the script as follows:

Code:
Prompt>./script clientname
What the if statement does is check for the $1 or command line variable. If not there. It replies "Please give client name"

Hope this makes sense.

Jaysunn
__________________
Have a look at what I have been working on
http://www.shellasaurus.com
Reply With Quote
Reply

Tags
install phpbb script , phpbb , shell


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
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 On
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Automate drac/ilo reboot Clinton Shell scripting 2 27-11-2009 03:36 PM
shell script to automate a process that uses executable file Gtolis Shell scripting 6 15-10-2009 08:28 PM
Script for backup and automate it skumar704 Shell scripting 2 11-05-2009 10:53 PM
script to automate download and rename wademac Shell scripting 0 14-04-2008 11:51 PM
AUDIO CAPTURE PROBLEM ON ARM PB926EJ-s board, Audio couldn't capture on the ARM Board fazlur Linux hardware 0 05-09-2007 05:04 PM


All times are GMT +5.5. The time now is 10:01 AM.


Powered by vBulletin® Version 3.8.5 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38