source: trunk/INSTALL/arquivos/scripts/http.sh @ 7503

Revision 7503, 4.2 KB checked in by wmerlotto, 12 years ago (diff)

Ticket #3191 - Alteracoes no instalador, para suportar novo SO e para realizar pequenos ajustes.

RevLine 
[5797]1
2# Servico HTTP (APACHE)
3
4# Parte comum da instalação da "aplicação" do Expresso para todos os SOs.
5# Parametro 1: diretório destino para onde os arquivos do Expresso serão copiados.
6cpexpresso ()
7{
[6080]8        # Faz a configuracao da nova API antes de copiar os arquivos
9        config_api
10
[5802]11        DIR_EXPRESSO="$1/expresso"
[7503]12        # Caso ja exista o diretorio destino, altera o nome
13        [ -e $DIR_EXPRESSO ] && mv $DIR_EXPRESSO $DIR_EXPRESSO-`date +"%F"`
[5797]14        # Copia o Expresso para o diretório indicado como parâmetro
15        echo "Copiando arquivos do Expresso Livre..."
[6173]16        cp -r "`dirname $PWD`" $DIR_EXPRESSO
[5797]17        # Copia o mkntpwd para o home do Expresso
18        mkdir -p /home/expressolivre
19        cp $ARQS/home/expressolivre/* /home/expressolivre/
20       
21        # Requisita a senha
22        get_pass
23        HEADER_PWD=`php $ARQS/scripts/pass.php $LDAP_PWD`
[5802]24        sed -e "s/HEADER_PWD/$HEADER_PWD/g" -e "s|EXPRESSO_DIR|$DIR_EXPRESSO|g" $ARQS/header.inc.php > $DIR_EXPRESSO/header.inc.php
[5840]25        chmod 640 $DIR_EXPRESSO/header.inc.php
[5818]26       
[5797]27        # Requisita o domino para corrigir o hosts do servidor, utilizado pelo apache
28        get_org
29        # Faz backup do hosts
[7278]30        cp -f /etc/hosts /etc/hosts.`date "+%s"` || log_erro "Erro ao copiar o /etc/hosts!"
[5797]31        NOVOHOSTS=`mktemp`
32        echo "127.0.0.1 $DOMAIN localhost `hostname`" > $NOVOHOSTS
[7278]33        cat /etc/hosts >> $NOVOHOSTS || log_erro "Erro ao agregar o /etc/hosts!"
[5797]34        mv -f $NOVOHOSTS /etc/hosts
[5871]35       
[6080]36        #Script para o CRON
37        sed -e "s|EXPRESSO_DIR|$DIR_EXPRESSO|g" $ARQS/expresso-cron > /tmp/expresso-cron
38}
[5871]39
[6080]40# Configura os arquivos da nova API
41config_api ()
42{
[6173]43        # Para pegar a organizacao e principalmente o LDAP_DN
[6080]44        get_org
45        # A principio so sera necessario configurar o LDAP
46        ARQ_LDAP="../prototype/config/OpenLDAP.srv"
[6173]47        mv $ARQ_LDAP "$ARQ_LDAP.orig"
48        cat "$ARQ_LDAP.orig" | sed -e "s/LDAP_DN/$LDAP_DN/g" > $ARQ_LDAP
[5797]49}
50
51http_debian ()
52{
53        # Instala o apache2 juntamente com o PHP5 e seus respectivos módulos
54        apt-get install -y apache2-mpm-prefork libapache2-mod-php5 apache2-utils \
[6983]55                php5 php5-common php5-dev php5-gd php5-imap php5-ldap php5-pgsql php5-cgi php5-cli php5-curl php5-xmlrpc php5-memcache php5-pspell \
[7278]56                libgv-php5 zip unzip memcached
[5797]57        # Copia os arquivos do Expresso Livre
58        cpexpresso "/var/www"
59        chown -R www-data:www-data /var/www/expresso /home/expressolivre
60
61        # descomente para gerar o certificado para o https
62        #apache2-ssl-certificate;
63        a2enmod rewrite
64        a2enmod ssl
[6080]65
66        # Ativa o script do CRON para o Debian e similares
67        sed -e "s|#DEBIAN||g" /tmp/expresso-cron > /etc/cron.d/expresso
[5797]68}
69
[6261]70http_debian_6 ()
[5797]71{
72        http_debian
[7278]73        # O nome do pacote do memcache no Debian é diferente do Ubuntu
74        apt-get -y install libmemcached5 || log_erro "Pacote nao encontrado"
[5797]75        # Copia a configuração do servidor apache2
76        cp -a debian/squeeze/etc/apache2/apache2.conf /etc/apache2/
77        cp -a debian/squeeze/etc/apache2/ports.conf /etc/apache2/
78        cp -a debian/squeeze/etc/apache2/sites-available/expresso /etc/apache2/sites-available/
79        cp -a debian/squeeze/etc/apache2/ssl/ /etc/apache2/
80
81        a2ensite expresso
82        a2dissite default
83
84        # Copia a configuração do PHP
85        #cp -a debian/squeeze/etc/php5/apache2/php.ini /etc/php5/apache2/
[5871]86        /etc/init.d/cron restart
[5840]87        /etc/init.d/apache2 restart
[7503]88
89        ## Alteracao para compatibilizar o diretorio de sessao do PHP
90        # o diretorio padrao da sessao do PHP eh do Centos.
91        sed -e "s|/dev/shm|/var/lib/php5|g" ../.htaccess > $DIR_EXPRESSO/.htaccess
[5797]92}
93
[7503]94http_ubuntu_1204 ()
[5836]95{
[6261]96        http_debian_6
[7503]97        # O nome do pacote do memcache no Ubuntu é diferente do Debian
[7278]98        apt-get -y install libmemcached6
[7503]99
100        cp -a ubuntu/12.04/etc/apache2/apache2.conf /etc/apache2/
[5871]101        /etc/init.d/cron restart
[5836]102        /etc/init.d/apache2 restart
103}
104
[5797]105http_rhel ()
106{
107        yum -y install httpd mod_ssl \
108                php php-cli php-ldap php-pgsql php-imap php-mbstring php-gd php-xml \
[6983]109                php-pecl-memcache graphviz-php php-pspell \
110                unzip zip memcached libmemcached
[5797]111
112        cpexpresso "/var/www/html"
113        chown -R apache:apache /var/www/html/expresso /home/expressolivre
114
115        chkconfig httpd on
[6080]116
117        # Ativa o script do CRON para o RedHat e similares
118        sed -e "s|#CENTOS||g" /tmp/expresso-cron > /etc/cron.d/expresso
[5797]119}
120
[6261]121http_rhel_6 ()
[5797]122{
123        http_rhel
124        # Para pegar ou definir o DOMAIN
125        get_org
126
127        cp -a rhel/6/etc/httpd/conf/httpd.conf /etc/httpd/conf/
128        sed -e "s/DOMAIN/$DOMAIN/g" rhel/6/etc/httpd/conf.d/expresso.conf > /etc/httpd/conf.d/expresso.conf
129        cp -a rhel/6/etc/httpd/conf.d/ssl.conf /etc/httpd/conf.d/
[5871]130        /etc/init.d/crond restart
[5797]131        service httpd restart
132}
133
Note: See TracBrowser for help on using the repository browser.