Instalando o Webmin no Debian Lenny

Apesar de abertamente não ser fã das distribuições baseadas em Debian e até, o próprio Debian, vira e mexe tenho que montar soluções em cima do mesmo.
Uma das interfaces de administração que eu gosto sempre de ter nos servidores é o Webmin. Ele fornece a possibilidade de, no caso de não ter um cliente SSH na máquina, pelo menos fazer as operações básicas via esta interface.

Não há, pelo menos eu não encontrei, nenhum repositório oficial do Webmin para o Debian. Assim, procurei uma solução para instalar o Webmin no Debian Lenny ( 5.0 ). E, consegui através de um site, os passos necessários para colocar rodando o mesmo sem problema algum :-) 

Primeiramente, vai ser necessário possuir os seguintes pacotes instalados no seu Debian:

  • openssl
  • libssl-dev
  • build-essential

Para instalar, é só usar os famosos comandos. Sempre opto pelo aptitude ao invés do apt-get , pois o aptitude consegue resolver a maioria dos problemas de dependência dos pacotes, não causando aqueles famosos erros de inconsistência que acabamos achando em algumas máquinas por aí.

#apt-get update
#apt-get install openssl libssl-dev build-essential

Com isto instalado, é só passar finalmente para conseguir o Webmin. No meu caso, eu peguei o pacote linkado abaixo. Mas é interessante que você vá sempre ao site oficial do Webmin, e baixe o pacote oficial mais novo.

# cd /usr/src
# wget http://downloads.sourceforge.net/project/webadmin/webmin/1.500/webmin-1.500.tar.gz
# tar -xvzf webmin-1.500.tar.gz
# cd webmin-1.500
# ./setup.sh

***********************************************************************
*            Welcome to the Webmin setup script, version 1.500        *
***********************************************************************
Webmin is a web-based interface that allows Unix-like operating
systems and common Unix services to be easily administered.

Installing Webmin in /root/webmin-1.500 ...

***********************************************************************
Webmin uses separate directories for configuration files and log files.
Unless you want to run multiple versions of Webmin at the same time
you can just accept the defaults.

Config file directory [/etc/webmin]:
Log file directory [/var/webmin]:

***********************************************************************
Webmin is written entirely in Perl. Please enter the full path to the
Perl 5 interpreter on your system.

Full path to perl (default /usr/bin/perl):

Testing Perl ...
Perl seems to be installed ok

***********************************************************************
Operating system name:    Debian Linux
Operating system version: 5.0

***********************************************************************
Webmin uses its own password protected web server to provide access
to the administration programs. The setup script needs to know :
 - What port to run the web server on. There must not be another
   web server already using this port.
 - The login name required to access the web server.
 - The password required to access the web server.
 - If the webserver should use SSL (if your system supports it).
 - Whether to start webmin at boot time.

Web server port (default 10000):
Login name (default admin):        
Login password:
Password again:
The Perl SSLeay library is not installed. SSL not available.
Start Webmin at boot time (y/n): y
***********************************************************************
Creating web server config files..
..done

Creating access control file..
..done

Inserting path to perl into scripts..
..done

Creating start and stop scripts..
..done

Copying config files..
..done

Configuring Webmin to start at boot time..
Created init script /etc/init.d/webmin
..done

Creating uninstall script /etc/webmin/uninstall.sh ..
..done

Changing ownership and permissions ..
..done

Running postinstall scripts ..
..done

Attempting to start Webmin mini web server..
Starting Webmin server in /root/webmin-1.500
Pre-loaded WebminCore
..done

Feito isto,  agora é instalar a camada SSL que não está ativada por padrão neste tipo de instalação que fizemos. 

# cd /usr/src
# wget http://download.webmin.com/download/Net_SSLeay.pm-1.23.tar.gz
# tar zxvf Net_SSLeay.pm-1.23.tar.gz
# cd Net_SSLeay.pm-1.23
# perl Makefile.PL
# make install

Para testar, se o comando abaixo não gerar nenhum erro, está tudo bem.

#perl -e 'use Net::SSLeay'

Aí, é só ativar o suporte SSL logo lá na interface gráfica do Webmin.

  • Acesse a guia Webmin
  • Depois siga para Webmin Configuration
  • Logo após SSL Encription
  • Assim, use Yes para todas as opções:
    Enable SSL if available?

    Redirect non-SSL requests to SSL mode? ( Isto faz o seguinte. Se você entrar usando o protocol http, ele redireciona a conexão para o protocol https, que é mais seguro )
  • Para criar um certificado mais personalizado entre na aba Create certificate.
Feito isto tudo está ok :-)