Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Ubuntu Server Development (http://www.linux-archive.org/ubuntu-server-development/)
-   -   drupal 6.x install script (http://www.linux-archive.org/ubuntu-server-development/159300-drupal-6-x-install-script.html)

"Jim Tarvid" 09-13-2008 02:24 PM

drupal 6.x install script
 
Rough cut on an install script. usage install_drupal user pass domain dbpass dbname
The intent is to install drupal in user space such that http://domain/ brings up Drupal's install screen.


This would allow users to design their website and prepare it for uploading to a public server.

To do that
1) add the user
2) build the skeleton at /home/user
3) download and install drupal 6.4 from drupal.org

4) prep the drupal install tree
5) fix ownership and permissions
6) create the mysql user and database
7) create the apache virtual config file and enable
8) create the bind9 zone and add to named.conf.local

9) add domain to /etc/hosts file
10 reload bind9 and apache2

Some obvious improvements
1) error check the parameters
2) test existence before creating users, apache config files, bind files, hosts modifications

3) error checking and recovery

This could lead to an ubuntu package

I'd appreciate wisdom and advice.


--
http://ls.net
http://drupal.ls.net



--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam

Charliej 09-13-2008 04:48 PM

drupal 6.x install script
 
On Sat, 2008-09-13 at 10:24 -0400, Jim Tarvid wrote:
> Rough cut on an install script. usage install_drupal user pass domain
> dbpass dbname
> The intent is to install drupal in user space such that http://domain/
> brings up Drupal's install screen.
>
> This would allow users to design their website and prepare it for
> uploading to a public server.
>
> To do that
> 1) add the user
> 2) build the skeleton at /home/user
> 3) download and install drupal 6.4 from drupal.org
> 4) prep the drupal install tree
> 5) fix ownership and permissions
> 6) create the mysql user and database
> 7) create the apache virtual config file and enable
Not sure if this is what your looking for but gallery2 would be a good
*example* package to look at for 1-7 and 10(apache2), debconf and
wwwconfig-common are your friends. Not sure about the rest.=)
> 8) create the bind9 zone and add to named.conf.local
> 9) add domain to /etc/hosts file
> 10 reload bind9 and apache2
>
> Some obvious improvements
> 1) error check the parameters
> 2) test existence before creating users, apache config files, bind
> files, hosts modifications
> 3) error checking and recovery
>
> This could lead to an ubuntu package
>
> I'd appreciate wisdom and advice.
>
>
>
> --
> http://ls.net
> http://drupal.ls.net
>
> --
> ubuntu-server mailing list
> ubuntu-server@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
> More info: https://wiki.ubuntu.com/ServerTeam


--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam

"Jim Tarvid" 09-13-2008 05:07 PM

drupal 6.x install script
 
Actually looking for comments and advice on the attached script.

On Sat, Sep 13, 2008 at 12:48 PM, Charliej <cjsmo@cableone.net> wrote:

On Sat, 2008-09-13 at 10:24 -0400, Jim Tarvid wrote:

> Rough cut on an install script. usage install_drupal user pass domain

> dbpass dbname

> The intent is to install drupal in user space such that http://domain/

> brings up Drupal's install screen.

>

> This would allow users to design their website and prepare it for

> uploading to a public server.

>

> To do that

> 1) add the user

> 2) build the skeleton at /home/user

> 3) download and install drupal 6.4 from drupal.org

> 4) prep the drupal install tree

> 5) fix ownership and permissions

> 6) create the mysql user and database

> 7) create the apache virtual config file and enable

Not sure if this is what your looking for but gallery2 would be a good

*example* package to look at for 1-7 and 10(apache2), debconf and

wwwconfig-common are your friends. Not sure about the rest.=)

> 8) create the bind9 zone and add to named.conf.local

> 9) add domain to /etc/hosts file

> 10 reload bind9 and apache2

>

> Some obvious improvements

> 1) error check the parameters

> 2) test existence before creating users, apache config files, bind

> files, hosts modifications

> 3) error checking and recovery

>

> This could lead to an ubuntu package

>

> I'd appreciate wisdom and advice.

>

>

>

> --

> http://ls.net

> http://drupal.ls.net

>

> --

> ubuntu-server mailing list

> ubuntu-server@lists.ubuntu.com

> https://lists.ubuntu.com/mailman/listinfo/ubuntu-server

> More info: https://wiki.ubuntu.com/ServerTeam





--
http://ls.net
http://drupal.ls.net


#!/bin/bash
echo user=$1
echo password=$2
echo domain=$3
echo dbpass=$4
echo dbname=$5
useradd $1 -p `mkpasswd $2`
mkdir /home/$1
mkdir /home/$1/public_html
cd /home/$1/public_html
wget http://ftp.drupal.org/files/projects/drupal-6.4.tar.gz
tar xzvf drupal-6.4.tar.gz
mv drupal-6.4 $3
mkdir /home/$1/public_html/$3/sites/all/modules
mkdir /home/$1/public_html/$3/sites/all/themes
mkdir /home/$1/public_html/$3/sites/default/files
chmod -R 777 /home/$1/public_html/$3/sites/default/files
cp /home/$1/public_html/$3/sites/default/default.settings.php /home/$1/public_html/$3/sites/default/settings.php
chmod 777 /home/$1/public_html/$3/sites/default/settings.php
chown -R $1.$1 /home/$1
mysql -uroot -p$4 -e "DROP USER '$1'@'localhost';"
mysql -uroot -p$4 -e "DROP DATABASE IF EXISTS $5;"
mysql -uroot -p$4 -e "CREATE USER '$1'@'localhost' IDENTIFIED BY '$2';"
mysql -uroot -p$4 -e "CREATE DATABASE IF NOT EXISTS $5;"
mysql -uroot -p$4 -e "GRANT USAGE ON $5.* TO '$1'@'localhost' IDENTIFIED BY '$2';"
mysql -uroot -p$4 -e "GRANT ALL PRIVILEGES ON $5.* TO '$1'@'localhost';"
mysql -uroot -p$4 -e "flush privileges;"
echo "<VirtualHost *>" >/etc/apache2/sites-available/$3
echo " DocumentRoot /home/$1/public_html/$3" >>/etc/apache2/sites-available/$3
echo " ServerName $3" >>/etc/apache2/sites-available/$3
echo " <Directory /home/$1/public_html/$3>" >>/etc/apache2/sites-available/$3
echo " allow from all" >>/etc/apache2/sites-available/$3
echo " AllowOverride AuthConfig FileInfo Indexes Limit Options" >>/etc/apache2/sites-available/$3
echo " Options FollowSymLinks SymLinksIfOwnerMatch +Indexes" >>/etc/apache2/sites-available/$3
echo " </Directory>" >>/etc/apache2/sites-available/$3
echo " ServerAlias www.$3" >>/etc/apache2/sites-available/$3
echo "</VirtualHost>" >>/etc/apache2/sites-available/$3
a2ensite $3
echo "$TTL 86400" >/etc/bind/$3
echo "$3. IN SOA www.$3. root.$3. (" >>/etc/bind/$3
echo " `date +%Y%m%d`00" >>/etc/bind/$3
echo " 8H" >>/etc/bind/$3
echo " 2H" >>/etc/bind/$3
echo " 4W" >>/etc/bind/$3
echo " 1D)" >>/etc/bind/$3
echo " IN NS `hostname`" >>/etc/bind/$3
echo "$3 A `ifconfig|awk '/Bcast:/ {print $2}'|cut -d":" -f2`" >>/etc/bind/$3
echo "www.$3 A `ifconfig|awk '/Bcast:/ {print $2}'|cut -d":" -f2`" >>/etc/bind/$3
echo "zone "$3" {" >>/etc/bind/named.conf.local
echo " type master;" >>/etc/bind/named.conf.local
echo " file "/etc/bind/$3";" >>/etc/bind/named.conf.local
echo " };" >>/etc/bind/named.conf.local
echo "127.0.0.1 $3" >>/etc/hosts
/etc/init.d/bind9 reload
/etc/init.d/apache2 force-reload

--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam

Henri Cook 09-13-2008 05:46 PM

drupal 6.x install script
 
Are you looking for advice on the script, or the idea of including it
in server? It's a laudable utility script but it's not something that I
would think should be packaged (unless it's a package of its own and
what it does is very clearly marked) - I can't think of any other
examples of similar scripts and as a sysadmin I would not expect
something like this to restart apache (this may be a production server)
or bind9 or add zones/config etc - the scope for this is really a very
personal, dedicated system. Most production systems i've seen have
their owns methods for zone addition, mass apache virtual hosting and
very often change the root username to something like 'sysad' or
'admin' for added security.



Does Drupal require its own username? I would generally install things
in ~henri/html/drupal.mydomain.com/public_html - and that's only unique
to my system, as far as i'm aware it's not a standard



Hope this helps,



Henri



Jim Tarvid wrote:

Rough cut on an install script. usage install_drupal
user pass domain dbpass dbname

The intent is to install drupal in user space such that http://domain/ brings
up Drupal's install screen.



This would allow users to design their website and prepare it for
uploading to a public server.



To do that

1) add the user

2) build the skeleton at /home/user

3) download and install drupal 6.4 from drupal.org

4) prep the drupal install tree

5) fix ownership and permissions

6) create the mysql user and database

7) create the apache virtual config file and enable

8) create the bind9 zone and add to named.conf.local

9) add domain to /etc/hosts file

10 reload bind9 and apache2



Some obvious improvements

1) error check the parameters

2) test existence before creating users, apache config files, bind
files, hosts modifications

3) error checking and recovery



This could lead to an ubuntu package



I'd appreciate wisdom and advice.






--

http://ls.net

http://drupal.ls.net





--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam

"Jim Tarvid" 09-13-2008 06:13 PM

drupal 6.x install script
 
More advice on the script at this point, my needs are met without a package. But packages exist in hardy and intrepid.

The drupal5 package in hardy is version 5.7 with known vulnerabilities. Current is 5.10

The drupal6 package in intrepid is in disarray.

In a production environment you need both dns and apache stanzas and a reload. The apache reload must take place after the user space is set up.

The wwwconfig-common scripts are heavy and not intuitive. Even the matter of adding the user non-interactively is not obvious. I don't know of an addzone script for bind9 nor an add virtual server script for apache2.


But indeed, the number of users wanting to set up a drupal web site on their own machine is more much larger than* the number of sysadmins who would like to set up drupal sites quickly (although I am in the latter). Further the setup on their machine should be isomorphic to that on a shared server.


The current situation on Ubuntu is sufficiently difficult that many people ask me for instructions for XAMPP or WAMPP on that other operating system.

Easy integration with NetBeans would be another neat trick.


Jim

On Sat, Sep 13, 2008 at 1:46 PM, Henri Cook <ubuntu-server@theplayboymansion.net> wrote:







Are you looking for advice on the script, or the idea of including it
in server? It's a laudable utility script but it's not something that I
would think should be packaged (unless it's a package of its own and
what it does is very clearly marked) - I can't think of any other
examples of similar scripts and as a sysadmin I would not expect
something like this to restart apache (this may be a production server)
or bind9 or add zones/config etc - the scope for this is really a very
personal, dedicated system. Most production systems i've seen have
their owns methods for zone addition, mass apache virtual hosting and
very often change the root username to something like 'sysad' or
'admin' for added security.



Does Drupal require its own username? I would generally install things
in ~henri/html/drupal.mydomain.com/public_html - and that's only unique
to my system, as far as i'm aware it's not a standard



Hope this helps,



Henri



Jim Tarvid wrote:

Rough cut on an install script. usage install_drupal
user pass domain dbpass dbname

The intent is to install drupal in user space such that http://domain/ brings
up Drupal's install screen.



This would allow users to design their website and prepare it for
uploading to a public server.



To do that

1) add the user

2) build the skeleton at /home/user

3) download and install drupal 6.4 from drupal.org

4) prep the drupal install tree

5) fix ownership and permissions

6) create the mysql user and database

7) create the apache virtual config file and enable

8) create the bind9 zone and add to named.conf.local

9) add domain to /etc/hosts file

10 reload bind9 and apache2



Some obvious improvements

1) error check the parameters

2) test existence before creating users, apache config files, bind
files, hosts modifications

3) error checking and recovery



This could lead to an ubuntu package



I'd appreciate wisdom and advice.






--

http://ls.net

http://drupal.ls.net







--
http://ls.net
http://drupal.ls.net


--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam


All times are GMT. The time now is 08:59 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.