Difference between revisions of "SME Site Maker"

From SME Server
Jump to navigationJump to search
 
(54 intermediate revisions by 5 users not shown)
Line 1: Line 1:
== SME Site Maker ==
+
{{Languages}}
 +
<!-- here we define the contrib name variable -->
 +
<!-- we get the page title, remove suffix for translated version; if needed you can define there with the value you want-->
 +
{{#vardefine:contribname| {{lc: {{#titleparts:  sitemaker  |1}} }} }}
 +
{{#vardefine:smecontribname| smeserver-{{lc: {{#titleparts:  sitemaker  |1}} }} }}
 +
<!-- we define the language -->
 +
{{#vardefine:lang| {{lc:  {{#titleparts:    {{PAGENAME}} | | -1}}  }} |en }}
  
This script is designed to help you when create a new web site under /opt directory.
+
==Purpose==
 +
This script is designed to help you when create a new web site under /opt directory. If you want to create a site under an ibay, do not use this script.
 +
The main purpose is to automate the time consuming (and sometimes confusing) process of installing an application to the /opt directory. If you do not use SMESiteMaker you must create the dir, conf files, and DB configs manually from the command line. With SMESiteMaker,  you only have to answer the questions in the wizard.
  
If you improve or add new functions, please update this wiki page.
+
The script creates the basic environment for your site, such as directory, permissions, apache configuration, add, replace or leave databases and user, and restart the pertinent services. Of course you can edit the final config file (under /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/'''99SMESiteMaker_''yourconfname''''') to add your own parameters, but generally default is ok.
  
{{drawBoxNote|content=Please feel free to modify or add info to this howto, and make corrections in typos, because I don't speak english very good.}}
+
=== Version ===
 +
{{ #smeversion: smeserver-sitemaker}}
  
Your can download from here: [http://www.unixlan.com.ar/SMESM/SMESiteMaker_v1.0.tar.gz SMESiteMaker] (It's possible to upload non image files to wiki?)
+
==Installation==
 +
  yum --enablerepo=smecontribs install smeserver-sitemaker
  
Untar and execute.
+
==Uninstall==
 +
yum remove smeserver-sitemaker
 +
==Usage==
 +
Type at command prompt:
 +
smesm
  
Enjoy.
+
The script gives you information and prompts for answers at each step.
  
----
+
==Reverting changes==
 +
If you make a mistake or want to revert the changes, first remove the directory you choose to locate your site under /opt. Then remove the file /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/99SMESiteMaker_yourconfname. If you create a DB then remove DB and User if they are new and no longer needed.
  
Code:
+
Finally expand template and restart the service:
  
#!/bin/bash
 
 
# Author: Normando Hall (PicsOne)
 
# Version: 1.0
 
# 06/06/2007
 
 
clear
 
echo "========================================================"
 
echo "=                SME Site Maker Script                ="
 
echo "=                                                      ="
 
echo "= This script will configure your SME webserver, and  ="
 
echo "= make the necesary directory to hold your site.      ="
 
echo "=                                                      ="
 
echo "= No express or implied warranties are provided and its="
 
echo "= usage is at your own risk.                          ="
 
echo "=                                                      ="
 
echo "= If you feel confortable with the above then press    ="
 
echo "= enter if not press Ctrl+C to abort the configuration ="
 
echo "= script.                                              ="
 
echo "=                                                      ="
 
echo "========================================================"
 
read x
 
custom_httpd_dir=/etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
 
clear
 
######################### - Site ROOT - ##################################3
 
f_root=""
 
ANSWER=1
 
while [ $ANSWER = 1 ]
 
do
 
        clear
 
        echo " Please enter a directory name where you put the site files."
 
echo " The directory is created under /opt dir."
 
        echo " Example \"mySite\" without \" \". No include end or trailing slash"
 
        echo ":"
 
read files_root
 
if [  "$files_root"  != "" ]
 
then
 
f_root=/opt/$files_root
 
if [ -d $f_root ]
 
then
 
clear
 
echo " This directory already exist. If you want to remove and all contents"
 
echo " hit Y, or N to continue without change"
 
echo " (Y/N/Enter)"
 
        echo ":"
 
read YESNO
 
case "$YESNO" in
 
"Y" | "y" )
 
YESNO=1
 
rm -rf $f_root;;
 
"N" | "n" )
 
YESNO=2;;
 
*)
 
YESNO=2;;
 
esac
 
fi
 
ANSWER=0 
 
 
if [ "$YESNO" != "2" ]
 
then
 
mkdir -p $f_root
 
chown root.www $f_root
 
chmod 644 $f_root
 
fi
 
 
else
 
clear
 
        echo
 
        echo "You have not enter a directory name. Hit enter to try again"
 
read x
 
fi
 
done
 
#################### -ALIAS - ######################################
 
clear
 
a_root=""
 
ANSWER=1
 
while [ $ANSWER = 1 ]
 
do
 
        clear
 
        echo
 
        echo "Please enter an alias name to access your site."
 
        echo "Example \"wiki\" without \" \". No include end or trailing slash"
 
        echo ":"
 
 
read alias_root
 
if [  "$alias_root"  != "" ]
 
then
 
a_root=/$alias_root
 
ANSWER=0
 
else
 
clear
 
        echo
 
        echo "You have not provide an alias name. Hit enter to try again"
 
read x
 
fi
 
done
 
##################### - SSL - ####################################
 
clear
 
f_ssl=""
 
        clear
 
        echo
 
        echo "Do you want to force SSL?"
 
        echo "This is used to force to secure http (https)"
 
        echo "(Y/N/Enter)"
 
        echo ":"
 
 
read YESNO
 
case "$YESNO" in
 
"Y" | "y" )
 
f_ssl="1";;
 
"N" | "n" )
 
f_ssl="0";;
 
*)
 
f_ssl="0";;
 
esac
 
############################ - INDEX - ############################################
 
clear
 
f_idx=""
 
        clear
 
        echo
 
        echo "Do you want to allow directory index?"
 
        echo "This is used to index a directory if no index.htm/l or index.php file is available"
 
        echo "(Y/N/Enter)"
 
        echo ":"
 
read YESNO
 
case "$YESNO" in
 
"Y" | "y" )
 
f_idx="1";;
 
"N" | "n" )
 
f_idx="0";;
 
*)
 
f_idx="0";;
 
esac
 
#################### - AllowOverride - ######################################
 
clear
 
f_aov=""
 
        clear
 
        echo
 
        echo "Do you want to set AllowOverride All?"
 
        echo "This is used to allow process .htaccess files in your site dir"
 
        echo "(Y/N/Enter)"
 
        echo ":"
 
read YESNO
 
case "$YESNO" in
 
"Y" | "y" )
 
f_aov="1";;
 
"N" | "n" )
 
f_aov="0";;
 
*)
 
f_aov="0";;
 
esac
 
####################### - Includes - ###################################
 
clear
 
f_inc=""
 
        clear
 
        echo
 
        echo "Do you want to allow includes?"
 
        echo "(Y/N/Enter)"
 
        echo ":"
 
read YESNO
 
case "$YESNO" in
 
"Y" | "y" )
 
f_inc="1";;
 
"N" | "n" )
 
f_inc="0";;
 
*)
 
f_inc="0";;
 
esac
 
##################### - PHP - #####################################
 
clear
 
php=""
 
        clear
 
        echo
 
        echo "Do you want to execute PHP?"
 
        echo "(Y/N/Enter)"
 
        echo ":"
 
read YESNO
 
case "$YESNO" in
 
"Y" | "y" )
 
php="1";;
 
"N" | "n" )
 
php="0";;
 
*)
 
php="0";;
 
esac
 
 
if [ "$php" = "1" ]
 
then
 
        clear
 
        echo
 
        echo "Do you want to allow_url_fopen?"
 
        echo "This allow open and access remote files in your php scripts"
 
        echo "(Y/N/Enter)"
 
        echo ":"
 
read YESNO
 
case "$YESNO" in
 
"Y" | "y" )
 
f_fop="1";;
 
"N" | "n" )
 
f_fop="0";;
 
*)
 
f_fop="0";;
 
esac
 
        clear
 
        echo
 
        echo "If you have eaccelerator, want to enabled?"
 
        echo "(Y/N/Enter)"
 
        echo ":"
 
read YESNO
 
case "$YESNO" in
 
"Y" | "y" )
 
f_eac="1";;
 
"N" | "n" )
 
f_eac="0";;
 
*)
 
f_eac="0";;
 
esac
 
        clear
 
        echo
 
        echo "Do you want to allow register globals?"
 
        echo "(Y/N/Enter)"
 
        echo ":"
 
read YESNO
 
case "$YESNO" in
 
"Y" | "y" )
 
f_rgl="1";;
 
"N" | "n" )
 
f_rgl="0";;
 
*)
 
f_rgl="0";;
 
esac
 
fi
 
###################### - CGI - #######################################
 
clear
 
cgi=""
 
        clear
 
        echo
 
        echo "Do you want to execute CGI?"
 
        echo "(Y/N/Enter)"
 
        echo ":"
 
read YESNO
 
case "$YESNO" in
 
"Y" | "y" )
 
cgi="1";;
 
"N" | "n" )
 
cgi="0";;
 
*)
 
cgi="0";;
 
esac
 
 
if [ "$cgi" = "1" ]
 
then
 
ANSWER=1
 
while [ $ANSWER = 1 ]
 
do
 
        clear
 
        echo
 
        echo "Please enter a directory name to hold your cgi scripts."
 
        echo "If you don't enter a directory, assume you want to allow cgi scripts in $f_root root directory."
 
        echo "If you provide a directory, this is created under $f_root/your_cgi_dir directory"
 
        echo ":"
 
read cgi_root
 
if [  "$cgi_root"  != "" ]
 
then
 
c_root=$f_root/$cgi_root
 
YESNO=1
 
if [ -d $c_root ]
 
then
 
clear
 
echo "This directory already exist. If you want to remove and all contents"
 
echo "hit Y, or N to continue without change"
 
echo "(Y/N/Enter)"
 
echo ":"
 
read YESNO
 
case "$YESNO" in
 
"Y" | "y" )
 
YESNO=1
 
rm -rf $c_root;;
 
"N" | "n" )
 
YESNO=2;;
 
*)
 
YESNO=2;;
 
esac
 
fi
 
ANSWER=0
 
 
if [ "$YESNO" != "2" ]
 
then
 
mkdir -p $c_root
 
chown root.www $c_root
 
chmod 777 $c_root
 
fi
 
else
 
ANSWER=0
 
c_root=$f_root
 
fi
 
done
 
 
if [ "$c_root" = "$f_root" ]
 
then
 
ca_root=$a_root
 
chown root.www $ca_root
 
chmod 777 $ca_root
 
else
 
clear
 
###################### - CGI ALIAS -#########################################
 
ca_root=""
 
ANSWER=1
 
while [ $ANSWER = 1 ]
 
do
 
        clear
 
        echo
 
        echo "Please, provide a cgi alias."
 
        echo ":"
 
read calias_root
 
if [  "$calias_root"  != "" ]
 
then
 
ca_root=/$calias_root
 
ANSWER=0
 
else
 
clear
 
        echo
 
        echo "You have not enter a cgi alias name. Hit enter to try again"
 
read x
 
fi
 
done
 
fi
 
fi
 
#################### - Configuration NAME - ############################################
 
clear
 
c_name=""
 
ANSWER=1
 
while [ $ANSWER = 1 ]
 
do
 
        clear
 
        echo
 
        echo "Please enter a name for this configuration."
 
        echo ":"
 
read conf_name
 
if [  "$conf_name"  != "" ]
 
then
 
c_name=99SMESiteMaker_$conf_name
 
ANSWER=0
 
else
 
clear
 
        echo
 
        echo "You have not provide a configuration name. Hit enter to try again"
 
read x
 
fi
 
done
 
 
 
################ - Final Step - ####################################
 
c_file=$custom_httpd_dir/$c_name
 
if [ -d $custom_httpd_dir ]
 
then
 
custom_httpd_dir=$custom_httpd_dir
 
#Anyone know a negate if for check? = if [directory NOT exist $dir]
 
else
 
mkdir -p $custom_httpd_dir
 
fi
 
fopt=""
 
touch $c_file
 
echo ' ' > $c_file
 
echo "Alias $a_root $f_root" >> $c_file
 
if [ "$cgi" = "1" ]
 
then
 
echo "ScriptAlias $ca_root $c_root" >> $c_file
 
fi
 
echo "<Directory $f_root>" >> $c_file
 
if [ "$f_ssl" = "1" ]
 
then
 
echo 'SSLRequireSSL on' >> $c_file
 
#echo 'RequireSSL on' >> $c_file #for SME6
 
fi
 
if [ "$php" = "1" ]
 
then
 
echo 'AddType application/x-httpd-php .php .php3 .phtml' >> $c_file
 
fi
 
if [ "$f_idx" = "1" ]||[ "$f_inc" = "1" ]||[ "$f_aov" = "1" ]
 
then
 
fopt="Options "
 
if [ "$f_idx" = "1" ]
 
then
 
fopt="$fopt Indexes "
 
fi
 
if [ "$f_inc" = "1" ]
 
then
 
fopt="$fopt +Includes "
 
fi
 
if [ "$f_aov" = "1" ]
 
then
 
fopt="$fopt FollowSymLinks "
 
fi
 
echo "$fopt" >> $c_file
 
if [ "$f_aov" = "1" ]
 
then
 
echo 'AllowOverride all' >> $c_file
 
fi
 
fi
 
echo 'order deny,allow' >> $c_file
 
echo 'deny from all' >> $c_file
 
echo 'allow from all' >> $c_file
 
if [ "$php" = "1" ]
 
then
 
 
if [ "$f_fop" = "1" ]
 
then
 
echo 'php_flag register_globals on' >> $c_file
 
else
 
echo 'php_flag register_globals off' >> $c_file
 
fi
 
 
if [ "$f_rgl" = "1" ]
 
then
 
echo 'php_admin_flag allow_url_fopen on' >> $c_file
 
else
 
echo 'php_admin_flag allow_url_fopen off' >> $c_file
 
fi
 
 
if [ "$f_eac" = "1" ]
 
then
 
echo 'php_admin_value eaccelerator.enable 1' >> $c_file
 
fi
 
 
fi
 
echo '</Directory>' >> $c_file
 
 
clear
 
# for debug only
 
# echo "$files_root"
 
# echo "$f_root"
 
# echo "$alias_root"
 
# echo "$a_root"
 
# echo "$f_ssl"
 
# echo "$f_idx"
 
# echo "$f_aov"
 
# echo "$f_inc"
 
# echo "$php"
 
# echo "$f_fop"
 
# echo "$f_eac"
 
# echo "$f_rgl"
 
# echo "$cgi"
 
# echo "$cgi_root"
 
# echo "$c_root"
 
# echo "$calias_root"
 
# echo "$ca_root"
 
# echo "$conf_name"
 
# echo "$c_name"
 
# echo "$custom_httpd_dir"
 
# echo "$c_file"
 
# echo "$fopt"
 
 
 
  expand-template /etc/httpd/conf/httpd.conf
 
  expand-template /etc/httpd/conf/httpd.conf
 
  /etc/init.d/httpd-e-smith restart
 
  /etc/init.d/httpd-e-smith restart
# /sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf  # For SME6
+
 
# service httpd restart         # For SME6
+
==Adding functionality?==
echo "====================================================="
+
If you improve or add new functions to the script, please update this wiki page and upload the new version at [[Bugzilla:2975]].
echo "= Installation of you site is complete.             ="
+
 
  echo "= Now you can copy your site files under $f_root.  ="
+
==Comments & Support==
  echo "= Access your site in http://your_domain/$alias_root="
+
Please, use this thread in the forum for questions or comments:
  echo "====================================================="
+
[http://forums.contribs.org/index.php?topic=38883 New SME SM thread]
 +
 
 +
[http://forums.contribs.org/index.php?topic=36516.msg162056#msg162056 Old SME SM thread]
 +
 
 +
==Screen Capture==
 +
[[Image:Smesm.png]]
 +
 
 +
 
 +
 
 +
==Improvements==
 +
 
 +
You can improve the script adding new functions, and specially re-writing my bad english text strings.
 +
 
 +
You can add functions to handle perl, and custom apache and php directives.
 +
 
 +
The idea of this script can be used as the new panel development, for add and configure the web site via server-manager.
 +
 
 +
Here I list the variables used into the script and their signify:
 +
 
 +
$files_root - Root directory name
 +
  $f_root - Root Pathname
 +
$alias_root - HTTP alias choosed
 +
$a_root - HTTP alias configured
 +
$f_ssl - Flag SSLRequireSSL on
 +
$f_idx - Flag Indexes
 +
$f_aov - Flag AllowOverride
 +
$f_php - Flag PHP
 +
$f_fop - Flag allow_url_fopen
 +
$f_eac - Flag Eaccelerator
 +
$f_rgl - Flag register_globals
 +
$f_obd - Flag open_basedir
 +
$open_bd - Open Basedir directories
 +
$fopt - Temp var used in Options
 +
$f_cgi - Flag CGI
 +
$f_cgisamedir - Flag indicating cgi dir is the same as root dir
 +
$cgi_root - CGI directory name
 +
$c_root - CGI pathname configured
 +
$calias_root - CGI alias choosed
 +
  $ca_root - Add "/" in CGI Alias
 +
$db_on - Flag MySQL
 +
$db_host - host db
 +
$db_name - name db
 +
$db_pass - pass db
 +
$db_user - user db
 +
$query_file - temp query file
 +
$db_new - temp variable new db
 +
$db_unew - temp variable new user
 +
$custom_httpd_dir - /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
 +
$conf_name - Name for this configuration
 +
$c_name - 99SMESiteMaker_$conf_name
 +
  $c_file - $custom_httpd_dir/$c_name
 +
 
 +
 
 +
 
 +
==Bugs==
 +
Please raise bugs under the SME-Contribs section in {{BugzillaFileBug|product=|component=|title= bugzilla}}
 +
and select the {{#var:smecontribname}} component or use {{BugzillaFileBug|product=SME%20Contribs|component={{#var:smecontribname}}|title=this link}}
 +
 
 +
Below is an overview of the current issues for this contrib:{{#bugzilla:columns=id,product,version,status,summary|sort=id|order=desc|component={{#var:smecontribname}} |noresultsmessage=No open bugs found.}}
 +
 
 +
==Changelog==
 +
Only released version in smecontrib are listed here.
 +
 
 +
{{#smechangelog: {{#var:smecontribname}} }}
 +
 
 +
----
 +
 
 +
[[Category: Deprecated_Contrib]]
 +
[[Category:Webapps]]

Latest revision as of 07:31, 11 July 2022




Purpose

This script is designed to help you when create a new web site under /opt directory. If you want to create a site under an ibay, do not use this script. The main purpose is to automate the time consuming (and sometimes confusing) process of installing an application to the /opt directory. If you do not use SMESiteMaker you must create the dir, conf files, and DB configs manually from the command line. With SMESiteMaker, you only have to answer the questions in the wizard.

The script creates the basic environment for your site, such as directory, permissions, apache configuration, add, replace or leave databases and user, and restart the pertinent services. Of course you can edit the final config file (under /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/99SMESiteMaker_yourconfname) to add your own parameters, but generally default is ok.

Version

smeserver-sitemaker
The latest version of smeserver-sitemaker is available in the SME repository, click on the version number(s) for more information.


Installation

yum --enablerepo=smecontribs install smeserver-sitemaker

Uninstall

yum remove smeserver-sitemaker

Usage

Type at command prompt:

smesm

The script gives you information and prompts for answers at each step.

Reverting changes

If you make a mistake or want to revert the changes, first remove the directory you choose to locate your site under /opt. Then remove the file /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/99SMESiteMaker_yourconfname. If you create a DB then remove DB and User if they are new and no longer needed.

Finally expand template and restart the service:

expand-template /etc/httpd/conf/httpd.conf
/etc/init.d/httpd-e-smith restart

Adding functionality?

If you improve or add new functions to the script, please update this wiki page and upload the new version at Bugzilla:2975.

Comments & Support

Please, use this thread in the forum for questions or comments: New SME SM thread

Old SME SM thread

Screen Capture

Smesm.png


Improvements

You can improve the script adding new functions, and specially re-writing my bad english text strings.

You can add functions to handle perl, and custom apache and php directives.

The idea of this script can be used as the new panel development, for add and configure the web site via server-manager.

Here I list the variables used into the script and their signify:

$files_root - Root directory name
$f_root - Root Pathname
$alias_root - HTTP alias choosed
$a_root - HTTP alias configured
$f_ssl - Flag SSLRequireSSL on
$f_idx - Flag Indexes
$f_aov - Flag AllowOverride
$f_php - Flag PHP
$f_fop - Flag allow_url_fopen
$f_eac - Flag Eaccelerator
$f_rgl - Flag register_globals
$f_obd - Flag open_basedir
$open_bd - Open Basedir directories
$fopt - Temp var used in Options
$f_cgi - Flag CGI
$f_cgisamedir - Flag indicating cgi dir is the same as root dir
$cgi_root - CGI directory name
$c_root - CGI pathname configured
$calias_root - CGI alias choosed
$ca_root - Add "/" in CGI Alias
$db_on - Flag MySQL
$db_host - host db
$db_name - name db
$db_pass - pass db
$db_user - user db
$query_file - temp query file
$db_new - temp variable new db
$db_unew - temp variable new user
$custom_httpd_dir - /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
$conf_name - Name for this configuration
$c_name - 99SMESiteMaker_$conf_name
$c_file - $custom_httpd_dir/$c_name


Bugs

Please raise bugs under the SME-Contribs section in bugzilla

and select the smeserver-sitemaker component or use this link


Below is an overview of the current issues for this contrib:

No open bugs found.

Changelog

Only released version in smecontrib are listed here.