quarta-feira, maio 30, 2007

Trocando o certificado do apache-ssl do Debian

O pacote apache-ssl do Debian é rápido e simples de instalar, basta apt-get install apache-ssl. Mas ele gera um certificado padrão com validade de 1 mês. Então vamos trocar o certificado dele e colocar para vencer daqui 10 anos ( 3650 dias ) ...


# cd /tmp
# openssl genrsa -out chave.key 1024
# chmod 600 chave.key

No próximo passo, preencha as informações. Lembrando que em common name você deve que colocar o endereço pelo qual os usuários irão acessar o site. Ex.: https://www.exemplo.com , logo common name é www.exemplo.com

# openssl req -new -key chave.key -out chave.csr
# openssl x509 -req -days 3650 -in chave.csr -signkey chave.key -out chave.crt
# cd /etc/apache-ssl/
# mv apache.pem apache.pem.antigo
# cat /tmp/chave.key > apache.pem
# cat /tmp/chave.crt >> apache.pem
# chmod 600 apache.pem
# /etc/init.d/apache-ssl restart

: )

quarta-feira, maio 02, 2007

Tutorial de instalação Coldfusion MX 7 no Debian 4.0 ( codinome Etch)

Neste artigo demonstro a instalação do Coldfusion MX 7 utilizando os pacotes do Debian Etch, isso facilita .. e muito manutenções posteriores. Com poucas alterações pode ser instalados com apache compilado e em outras distribuições.

Não sou amante do Coldfusion, nem mesmo programo nesta liguagem e não me pronuncio diante de flames ... simplesmente tenho clientes que utilizam servidores de aplicação com esta ferramenta. :)

Coldfusion: O Colfusion MX 7 Enterprise Server é proprietário, neste artigo irei deixá-lo funcionando em Trial, que tem as mesmas funcionalidades Enterprise, apesar de expirar em 30 dias. Você terá que ter a licensa ou adquirí-la para utilizar por mais de 30 dias.


Vamos lá:

Download de Pacotes

Primeiro baixe o coldfusionmx 7 no site da adobe ou copie do seu CD origial.

www.adobe.com

Esta instalação foi feita com a versão 702 , não deve ter problemas nas próximas versões.

Instalação de Pacotes

Partindo do princípio do artigo, vamos instalar o apache, lembrando que o mpm utilizado é o de sua preferência.

# apt-get install apache2 apache2-mpm-prefork

Pacotes Recomendados para compatibilidade:

# apt-get install libstdc++6 libstdc++5 libstdc++2.10-glibc2.2

Pacotes de bibliotecas gráficas.

# apt-get install libxp6 libxtst6 libxt6

Entre na pasta onde foi feito o download do Coldfusion MX 7

# chmod +x coldfusion-702-lin.bin

Depois execute o instalador.

# ./coldfusion-701-lin.bin
Preparing to install...
Extracting the JRE from the installer archive...
Unpacking the JRE...
Extracting the installation resources from the installer archive...
Configuring the installer for this system's environment...

Launching installer...

Preparing CONSOLE Mode Installation...

===============================================================================
Choose Locale...
----------------

->1- English


CHOOSE LOCALE BY NUMBER: 1
===============================================================================
(created with InstallAnywhere by Zero G)
-------------------------------------------------------------------------------

===============================================================================
Introduction
------------

Welcome to the Install Wizard for Macromedia ColdFusion MX 7

This wizard installs Macromedia ColdFusion MX 7 on your computer or produces
an EAR or WAR file for deployment on your J2EE application server. Macromedia
recommends that you exit from all running applications before proceeding.

Respond to each prompt to proceed to the next step in the installation. If you
want to change something on a previous step, type 'back'.

You may cancel this installation at any time by typing 'quit'.

WARNING: This program is protected by copyright laws and international
treaties.

PRESS TO CONTINUE:

===============================================================================
License Agreement
-----------------

Leia e tecle enter até chegar a pergunta abaixo:


DO YOU ACCEPT THE TERMS OF THIS LICENSE AGREEMENT?
(Y/N) : Y


Responda que Y


===============================================================================
Pre-Installation Check
----------------------

The installer has found the following errors/warnings:

Warning: C++ compatibility pack

The installer was unable to determine if the C++ compatibility pack is
installed by running the following command: rpm --query compat-libstdc++
If this machine uses a version of glibc that is 2.2.5.x or higher the
compatibility pack is necessary for C++ custom tags, Verity, and web server
connectors to work properly.

For more information see the installation manual at
http://www.macromedia.com/go/livedocs_cfmx7docs

PRESS TO CONTINUE WITH THE INSTALLER:

===============================================================================
Install Type
------------

If you do not have a serial number, select either 30-day trial or Developer
Edition.

->1- Install new version of ColdFusion MX with a serial number
2- 30-day trial
3- Developer Edition

Installation Choice: 2

Vamos escolher a opção 2 que a versão Trial e depois você atualiza a licensa no CF administrator.


===============================================================================
Installer Configuration
-----------------------

What kind of installation do you want?

->1- Server configuration
2- Multiserver configuration
3- J2EE configuration (EAR file)
4- J2EE configuration (WAR file)

Please select one of the following options: 1

Vamos configurar somente o coldfusion por enquanto, opção 1.


===============================================================================
Is Macromedia ColdFusion MX 7 (Server Configuration) Installed?
---------------------------------------------------------------

You cannot install the server configuration of Macromedia ColdFusion MX 7 if it is already installed on this computer.

Is there already a server configuration of Macromedia ColdFusion MX 7 installed?

1- Yes
->2- No

ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS TO ACCEPT THE DEFAULT:
: 2

Provavelmente você não terá CF instalado, se tiver não será abordado aqui apesar de não mudar muita coisa. Opção 2.


===============================================================================
Sub-component installation
--------------------------

The following options are available for installation.

An option with "[X]" in front will be installed and an option with "[ ]" will
not. Choosing an option will toggle it on or off

[X] 1) Getting Started Experience, Tutorials, & Documentation
[X] 2) ColdFusion MX 7 Search Services
[X] 3) Start ColdFusion on system init

4) Continue with installation

Select an option: 1

Selecione a opção 1 para desmarcar a instalação das documentações, tutoriais e etc .... a não ser que queira instalar.

===============================================================================
Sub-component installation

[ ] 1) Getting Started Experience, Tutorials, & Documentation
[X] 2) ColdFusion MX 7 Search Services
[X] 3) Start ColdFusion on system init

4) Continue with installation

Select an option: 4

Desmarcado a opção 1, marque agora a 4 para continuarmos com a instalação.


===============================================================================
Choose Install Folder
---------------------

Select the directory in which to install Macromedia ColdFusion MX 7.

Directory:

Default Install Folder: /opt/coldfusionmx7

ENTER AN ABSOLUTE PATH, OR PRESS TO ACCEPT THE DEFAULT
:

Precione enter para o path default ou coloque onde você quer que instale, recomendo apenas Enter.


===============================================================================
Earlier Versions of Macromedia ColdFusion installed?
----------------------------------------------------

If you installed an earlier version of ColdFusion on this computer, you can migrate your settings to Macromedia ColdFusion MX 7.

Is there an earlier version of ColdFusion installed on this computer (for example, ColdFusion 5 or ColdFusion MX)?

1- Yes
->2- No

ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS TO ACCEPT THE DEFAULT:
: 2

Digite a Opção 2.

===============================================================================
Configure Web Servers
---------------------

Please configure your web server(s). If you do not configure a web server the
built-in web server will be used on port 8500 or the next available port.

1- Add Web Server Configuration
->2- Continue with installation

Choice: 2

Digite a opção 2, depois configuramos o servidor Web.


===============================================================================
Runtime User
------------

Enter the name of the runtime user. This user must exist already on the system.

User Name: (DEFAULT: nobody): www-data

Vamos usar o usuário do apache, se for utilizar outro, terá que estar cadastrado no sistema.

===============================================================================
Administrator Password
----------------------

Enter the password that you will use to control access to the ColdFusion MX
Administrator.

This field is required.

Password:
Confirm Password:
Confirm Password:

Insira a senha do CF administrator.

===============================================================================
RDS Password
------------

The ColdFusion Remote Development Service (RDS) lets developers using
Macromedia tools remotely connect to this server for development purposes.

If this is a production server, Macromedia recommends that you disable RDS.
Note, however, that disabling RDS also disables the directory browsing applets
in the ColdFusion Administrator and some of the functionality in the Report
Designer.

Enable RDS (required for Report Builder and DW Extensions) (Y/N)
: N

Opção N, a não ser que utilize este recurso.


===============================================================================
Installation Confirmation
-------------------------

Installation Type:
Server configuration

Licensing:
30-day trial

Installation Directories:
Product: /opt/coldfusionmx7
Web root: /opt/coldfusionmx7/wwwroot

Server Information:
Web Server: Built-in Web Server
Port: 8500
Search Service: installed
Sample Apps: not installed
RDS: disabled

Disk Space Information (for Installation Target):
Required: 403,194,052 bytes
Available: 1,651,998,720 bytes

PRESS TO CONTINUE:


===============================================================================
Installing...
-------------

[==================|==================|==================|==================]
[------------------|------------------|------------------|------------------]

===============================================================================
Installation Complete
---------------------

You have successfully completed the first step in installing Macromedia
ColdFusion MX 7.

To continue with your installation, go to /opt/coldfusionmx7/bin and type
"./coldfusion start" to start your server.

Once the server is started log in to the Configuration Wizard at
http://[machinename]:8500/CFIDE/administrator/index.cfm

PRESS TO EXIT THE INSTALLER:

#

Tente iniciar o coldfusion com o comando:

/opt/coldfusionmx7/bin/coldfusion start

Vai dar erro, problemas com a libc6.


Para corrigir este problema abra o script de inicialização do coldfusion:

# vi /opt/coldfusionmx7/bin/coldfusion

Procure por LD_ASSUME_KERNEL e comente todo o if, assim:

....
# if [ ! "$SUSEFLAG" ]; then
# LD_ASSUME_KERNEL=2.2.9
# export LD_ASSUME_KERNEL
# fi
.....

Tente iniciar o coldfusion novamente:

/opt/coldfusionmx7/bin/coldfusion start

Provavelmente irá iniciar normalmente.

Para depurar você pode olhar o log do Server do Coldfusion em:

/opt/coldfusionmx7/logs/cfserver.log

Obs.: O Coldfusion demora um pouco para iniciar, mesmo depois de levantado, por isso tenha calma ao acessá-lo em seguida.

Tudo certo acesse no seu navegador:

http://ip-servidor-coldfusion:8500/CFIDE/administrator/

Deverá pedir usuário e senha, coloque e faça suas configurações.


Agora vamos integrar o Coldfusion ao apache2.

O apache2 do Debian Etch é a versão 2.2.

O wsconfig é o conector do CF com o apache e é incompatível com o apache 2.2. A adobe
disponibilizou um hotfix para a atualização deste conector para o Apache 2.2.

Talvez este hotfix já esteja no pacote do CF 7, mas até este caso não estava, portanto se ao tentar usar o conector e se deparar um erro relacionado a isso:

"undefined symbol: ap_run_http_method"

Terá que atualizar o wsconfig.

Então, para atualizar o conector:

Entre em /opt/coldfusionmx7/runtime/lib/

Baixe o hotfix:

# wget http://www.adobe.com/support/coldfusion/ts/documents/8001e97/wsconfig.zip

Renomeie o arquivo para backup

# mv wsconfig.jar wsconifg-apache20.jar

Aplicando o hotfix do conector do CF para o Apache2.2

# unzip wsconfig.zip

Pronto, o wsconfig foi substituido pelo hotfix

Agora sim, vamos integrar o CF ao apache2 com o seguinte comando:

# /opt/coldfusionmx7/runtime/bin/wsconfig -server coldfusion -ws apache -dir /etc/apache2/ -bin /usr/sbin/apache2 -script /usr/sbin/apache2ctl -coldfusion

Se receber um OK é porque está tudo bem e seu apache reiniciou sem erros.

Veja a configuração que foi adicionada ao apache referente ao CF:

# cat /etc/apache2/httpd.conf

# JRun Settings
LoadModule jrun_module /opt/coldfusionmx7/runtime/lib/wsconfig/1/mod_jrun22.so

IfModule>
JRunConfig Verbose false
JRunConfig Apialloc false
JRunConfig Ssl false
JRunConfig Ignoresuffixmap false
JRunConfig Serverstore /opt/coldfusionmx7/runtime/lib/wsconfig/1/jrunserver.store
JRunConfig Bootstrap 127.0.0.1:51011
#JRunConfig Errorurl
#JRunConfig ProxyRetryInterval 600
#JRunConfig ConnectTimeout 15
#JRunConfig RecvTimeout 300
#JRunConfig SendTimeout 15
AddHandler jrun-handler .jsp .jws .cfm .cfml .cfc .cfr .cfswf
/IfModule>

Edite este arquivo
/etc/apache2/httpd.conf e antes do "
/IfModule>" coloque esta linha:

DirectoryIndex index.cfm

Para que o apache chame pelo index do CF.

Reinicie o apache

#/etc/init.d/apache2 restart

Agora crie uma página .cfm em /var/www e acesse no navegador para verficar a integração.

http://ip-servidor-coldfusion/teste.cfm


Por questões de segurança, agora que o apache está integrado com o CF, não iremos prescisar mais de conectar pela porta 8500, logo vamos desabilitar.

Entre em:

# cd /opt/coldfusionmx7/runtime/servers/coldfusion/SERVER-INF/

Edite o arquivo jrun.xml

# vi jrun.xml

Procure pela seguinte parte:

service class="jrun.servlet.http.WebService" name="WebService"
attribute name="port">8500
*

********attribute name="deactivated">false
********** ALTERE AQUI de false para true
attribute name="activeHandlerThreads">8

attribute name="minHandlerThreads">1

attribute name="maxHandlerThreads">1000

attribute name="mapCheck">0

attribute name="threadWaitTimeout">300
attribute name="backlog">500
attribute name="timeout">300
/service>


A linha alterada é deactivated, que está false, coloque true.

Reinicie o coldfusion e sua porta 8500 foi desativada.

Para acessar o CF administrator, você pode criar um link assim:

# ln -s /opt/coldfusionmx7/wwwroot/CFIDE/ /var/www/


Agora pode acessar:

http://ip-servidor-coldfusion/CFIDE/administrator/


Neste momento acredito que você tenha tudo funcionando.


Problemas com acentos

eu costumo fazer alguns procedimentos, meio que reduntantes, mas que , estranhamente
costumam dar problemas, caso não os faço, então se tiver problemas com acentos, veja estas mandingas para o Debian.

Mais uma vez vamos editar o script que inicia o coldfusion em

# vi /opt/coldfusionmx7/bin/coldfusion

Inclua bem no início do arquivo, depois de #!/bin/sh ... estas duas linhas:

export LC_ALL=pt_BR.ISO8859-1
export LANG=pt_BR.ISO8859-1

Insira as duas linhas acima também no /etc/profile.

Mais uma ...

configure os locales do sistema com o comando localedef

# localedef pt_BR -i pt_BR -f ISO-8859-1



Iniciando automaticamente

# ln -s /opt/coldfusionmx7/bin/coldfusion /etc/init.d/coldfusionmx7
#update-rc.d coldfusionmx7 defaults


Agora reinicie sua máquina ...


Acho que é isso .

se tiverem algum problema entrem em contato para consertarmos o artigo...


Valeu !