[Tutorial] Instalando o ISPconfig3 no Debian

Dicas e conf's para servidores Linux
Avatar do usuário
marceloleaes
Administrator
Administrator
Mensagens: 1516
Registrado em: 10 Jun 2013 12:45
Localização: Novo Hamburgo
Idade: 41
Contato:
Status: Offline

[Tutorial] Instalando o ISPconfig3 no Debian

Mensagem por marceloleaes »

Configurando o sistema e instalando dependências necessárias:

cd /tmp
apt-get update
apt-get upgrade
aptitude install ssh openssh-server vim-nox
-----------------------------------------------------------------------------
nano /etc/network/interfaces
-----------------------------------------------------------------------------
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address 192.168.0.100
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
-----------------------------------------------------------------------------
echo 8.8.8.8 > /etc/resolv.conf
/etc/init.d/networking restart
-----------------------------------------------------------------------------
nano /etc/hosts
-----------------------------------------------------------------------------
127.0.0.1      localhost.localdomain  localhost
192.168.0.100  servidor.exemplo.com.br    servidor

::1    localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
-----------------------------------------------------------------------------
echo servidor.exemplo.com.br > /etc/hostname
/etc/init.d/hostname.sh start

aptitude update
aptitude safe-upgrade
reboot
ln -sf /bin/bash /bin/sh
/etc/init.d/apparmor stop
update-rc.d -f apparmor remove
aptitude remove apparmor apparmor-utils
aptitude install ntp ntpdate
aptitude install postfix postfix-mysql postfix-doc mysql-client mysql-server courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl libsasl2-2 libsasl2-modules libsasl2-modules-sql sasl2-bin libpam-mysql openssl maildrop getmail4 rkhunter binutils
-----------------------------------------------------------------------------
New password for the MySQL "root" user: <-- passwd para root do mysql
Repeat password for the MySQL "root" user: <-- repetir passwd
Create directories for web-based administration? <-- No
General type of mail configuration: <-- Internet Site
System mail name: <-- servidor.exemplo.com.br
SSL certificate required <-- Ok
-----------------------------------------------------------------------------
nano /etc/mysql/my.cnf
-----------------------------------------------------------------------------
#bind-address          = 127.0.0.1
-----------------------------------------------------------------------------
/etc/init.d/mysql restart
cd /etc/courier
rm -f /etc/courier/imapd.pem
rm -f /etc/courier/pop3d.pem
-----------------------------------------------------------------------------
nano /etc/courier/imapd.cnf
-----------------------------------------------------------------------------
CN=servidor.exemplo.com.br
-----------------------------------------------------------------------------
nano /etc/courier/pop3d.cnf
-----------------------------------------------------------------------------
CN=servidor.exemplo.com.br
-----------------------------------------------------------------------------
mkimapdcert
mkpop3dcert
/etc/init.d/courier-imap-ssl restart
/etc/init.d/courier-pop-ssl restart
aptitude install amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 arj nomarch lzop cabextract apt-listchanges libnet-ldap-perl libauthen-sasl-perl clamav-docs daemon libio-string-perl libio-socket-ssl-perl libnet-ident-perl zip libnet-dns-perl
aptitude install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-php5 php5 php5-common php5-gd php5-mysql php5-imap phpmyadmin php5-cli php5-cgi libapache2-mod-fcgid apache2-suexec php-pear php-auth php5-mcrypt mcrypt php5-imagick imagemagick libapache2-mod-suphp
-----------------------------------------------------------------------------
Apache2
-----------------------------------------------------------------------------
a2enmod
suexec
rewrite
ssl
actions
include
aptitude install pure-ftpd-common pure-ftpd-mysql quota quotatool
-----------------------------------------------------------------------------
nano /etc/default/pure-ftpd-common
-----------------------------------------------------------------------------
STANDALONE_OR_INETD=standalone
VIRTUALCHROOT=true
-----------------------------------------------------------------------------
/etc/init.d/pure-ftpd-mysql restart
-----------------------------------------------------------------------------
nano /etc/fstab ( Adicionar usrquota,grpquota a partição / )
-----------------------------------------------------------------------------
# /etc/fstab: static file system information.
#
# <file system> <mount point>  <type>  <options>      <dump>  <pass>
proc            /proc          proc    defaults        0      0
# /dev/sda1
UUID=e7f9e640-1254-462f-b314-6471ce83db4d /              ext3    relatime,errors=remount-ro,usrquota,grpquota 0      1
# /dev/sda5
UUID=32b41e4e-4d4a-4825-8922-27e8c6aeeb45 none            swap    sw              0      0
/dev/scd0      /media/cdrom0  udf,iso9660 user,noauto,exec,utf8 0      0
-----------------------------------------------------------------------------
touch /quota.user /quota.group
chmod 600 /quota.*
mount -o remount /
quotacheck -avugm
quotaon -avug
aptitude install g++ libc6 gcc gawk make texinfo libmysqlclient15-dev

Baixando, preparando e compilando o MyDNS

cd /tmp
wget http://heanet.dl.sourceforge.net/source ... .27.tar.gz
tar xvfz mydns-1.2.8.27.tar.gz
cd mydns-1.2.8
./configure
make
make install

-----------------------------------------------------------------------------
nano /etc/init.d/mydns ( Criar daemon do MyDNS )
-----------------------------------------------------------------------------

#! /bin/sh
#
# mydns        Start the MyDNS server
#
# Author:      Philipp Kern <[email protected]>.
#              Based upon skeleton 1.9.4 by Miquel van Smoorenburg
#              <[email protected]> and Ian Murdock <[email protected]>.
#

set -e

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/sbin/mydns
NAME=mydns
DESC="DNS server"

SCRIPTNAME=/etc/init.d/$NAME

# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0

case "$1" in
  start)
        echo -n "Starting $DESC: $NAME"
        start-stop-daemon --start --quiet \
                --exec $DAEMON -- -b
        echo "."
        ;;
  stop)
        echo -n "Stopping $DESC: $NAME"
        start-stop-daemon --stop --oknodo --quiet \
                --exec $DAEMON
        echo "."
        ;;
  reload|force-reload)
        echo -n "Reloading $DESC configuration..."
        start-stop-daemon --stop --signal HUP --quiet \
                --exec $DAEMON
        echo "done."
        ;;
  restart)
        echo -n "Restarting $DESC: $NAME"
        start-stop-daemon --stop --quiet --oknodo \
                --exec $DAEMON
        sleep 1
        start-stop-daemon --start --quiet \
                --exec $DAEMON -- -b
        echo "."
        ;;
  *)
        echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
        exit 1
        ;;
esac

exit 0
-----------------------------------------------------------------------------
chmod +x /etc/init.d/mydns
update-rc.d mydns defaults
aptitude install vlogger webalizer build-essential autoconf automake1.9 libtool flex bison

Baixando, preparando e compilando o Jailkit

cd /tmp
wget http://olivier.sessink.nl/jailkit/jailkit-2.5.tar.gz
tar xvfz jailkit-2.5.tar.gz
cd jailkit-2.5
./configure
make
make install
cd ..
rm -rf jailkit-2.5*

aptitude install fail2ban

Instalando e configurando o Squirrelmail

aptitude install squirrelmail
ln -s /usr/share/squirrelmail/ /var/www/webmail
squirrelmail-configure

-----------------------------------------------------------------------------
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1.  Organization Preferences
2.  Server Settings
3.  Folder Defaults
4.  General Options
5.  Themes
6.  Address Books
7.  Message of the Day (MOTD)
8.  Plugins
9.  Database
10. Languages

D.  Set pre-defined settings for specific IMAP servers

C  Turn color on
S  Save data
Q  Quit

Command >> <-- D


SquirrelMail Configuration : Read: config.php
---------------------------------------------------------
While we have been building SquirrelMail, we have discovered some
preferences that work better with some servers that don't work so
well with others.  If you select your IMAP server, this option will
set some pre-defined settings for that server.

Please note that you will still need to go through and make sure
everything is correct.  This does not change everything.  There are
only a few settings that this will change.

Please select your IMAP server:
    bincimap    = Binc IMAP server
    courier    = Courier IMAP server
    cyrus      = Cyrus IMAP server
    dovecot    = Dovecot Secure IMAP server
    exchange    = Microsoft Exchange IMAP server
    hmailserver = hMailServer
    macosx      = Mac OS X Mailserver
    mercury32  = Mercury/32
    uw          = University of Washington's IMAP server

    quit        = Do not change anything
Command >> <-- courier


SquirrelMail Configuration : Read: config.php
---------------------------------------------------------
While we have been building SquirrelMail, we have discovered some
preferences that work better with some servers that don't work so
well with others.  If you select your IMAP server, this option will
set some pre-defined settings for that server.

Please note that you will still need to go through and make sure
everything is correct.  This does not change everything.  There are
only a few settings that this will change.

Please select your IMAP server:
    bincimap    = Binc IMAP server
    courier    = Courier IMAP server
    cyrus      = Cyrus IMAP server
    dovecot    = Dovecot Secure IMAP server
    exchange    = Microsoft Exchange IMAP server
    hmailserver = hMailServer
    macosx      = Mac OS X Mailserver
    mercury32  = Mercury/32
    uw          = University of Washington's IMAP server

    quit        = Do not change anything
Command >> courier

              imap_server_type = courier
        default_folder_prefix = INBOX.
                  trash_folder = Trash
                  sent_folder = Sent
                  draft_folder = Drafts
            show_prefix_option = false
          default_sub_of_inbox = false
show_contain_subfolders_option = false
            optional_delimiter = .
                delete_folder = true

Press any key to continue... <-- ENTER


SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1.  Organization Preferences
2.  Server Settings
3.  Folder Defaults
4.  General Options
5.  Themes
6.  Address Books
7.  Message of the Day (MOTD)
8.  Plugins
9.  Database
10. Languages

D.  Set pre-defined settings for specific IMAP servers

C  Turn color on
S  Save data
Q  Quit

Command >> <-- S


SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1.  Organization Preferences
2.  Server Settings
3.  Folder Defaults
4.  General Options
5.  Themes
6.  Address Books
7.  Message of the Day (MOTD)
8.  Plugins
9.  Database
10. Languages

D.  Set pre-defined settings for specific IMAP servers

C  Turn color on
S  Save data
Q  Quit

Command >> <-- Q
-----------------------------------------------------------------------------
Testar acesso ao webmail -> http://192.168.0.100/webmail
-----------------------------------------------------------------------------

Baixando configurando e instalando o ISPConfig 3

cd /tmp
wget http://downloads.sourceforge.net/ispcon ... se_mirror=
tar xvfz ISPConfig-3.0.1.tar.gz
cd ispconfig3_install/install/

php -q install.php

--------------------------------------------------------------------------------
_____ ___________  _____              __ _
|_  _/  ___| ___ \ /  __ \            / _(_)
  | | \ `--.| |_/ / | /  \/ ___  _ __ | |_ _  __ _
  | |  `--. \  __/  | |    / _ \| '_ \|  _| |/ _` |
_| |_/\__/ / |    | \__/\ (_) | | | | | | | (_| |
\___/\____/\_|      \____/\___/|_| |_|_| |_|\__, |
                                              __/ |
                                            |___/
--------------------------------------------------------------------------------


>> Initial configuration

Operating System: Debian Lenny/Sid or compatible

    Following will be a few questions for primary configuration so be careful.
    Default values are in [brackets] and can be accepted with <ENTER>.
    Tap in "quit" (without the quotes) to stop the installer.


Select language (en,de) [en]: <-- ENTER

Installation mode (standard,expert) [standard]: <-- ENTER

Full qualified hostname (FQDN) of the server, eg server1.domain.tld  [servidor.exemplo.com.br]: <-- ENTER

MySQL server hostname [localhost]: <-- ENTER

MySQL root username [root]: <-- ENTER

MySQL root password []: <-- Passwd do usuário root do MySQL

MySQL database to create [dbispconfig]: <-- ENTER

MySQL charset [utf8]: <-- ENTER

Generating a 2048 bit RSA private key
..........................................................+++
.+++
writing new private key to 'smtpd.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]: <-- ENTER
State or Province Name (full name) [Some-State]: <-- ENTER
Locality Name (eg, city) []: <-- ENTER
Organization Name (eg, company) [Internet Widgits Pty Ltd]: <-- ENTER
Organizational Unit Name (eg, section) []: <-- ENTER
Common Name (eg, YOUR name) []: <-- ENTER
Email Address []: <-- ENTER
Configuring Jailkit
Configuring SASL
Configuring PAM
Configuring Courier
Configuring Spamassassin
Configuring Amavisd
Configuring Getmail
Configuring Pureftpd
Configuring MyDNS
Configuring Apache
Configuring Firewall
Installing ISPConfig
ISPConfig Port [8080]: <-- ENTER

Configuring DBServer
Installing Crontab
no crontab for root
no crontab for getmail
Restarting services ...
* Stopping MySQL database server mysqld
  ...done.
* Starting MySQL database server mysqld
  ...done.
* Checking for corrupt, not cleanly closed and upgrade needing tables.
* Stopping Postfix Mail Transport Agent postfix
  ...done.
* Starting Postfix Mail Transport Agent postfix
  ...done.
* Stopping SASL Authentication Daemon saslauthd
  ...done.
* Starting SASL Authentication Daemon saslauthd
  ...done.
Stopping amavisd: amavisd-new.
Starting amavisd: amavisd-new.
* Stopping ClamAV daemon clamd
  ...done.
* Starting ClamAV daemon clamd
LibClamAV Warning: ***********************************************************
LibClamAV Warning: ***  This version of the ClamAV engine is outdated.    ***
LibClamAV Warning: *** DON'T PANIC! Read http://www.clamav.net/support/faq ***
LibClamAV Warning: ***********************************************************
  ...done.
* Stopping Courier authentication services authdaemond
  ...done.
* Starting Courier authentication services authdaemond
  ...done.
* Stopping Courier IMAP server...
  ...done.
* Starting Courier IMAP server...
  ...done.
* Stopping Courier IMAP-SSL server...
  ...done.
* Starting Courier IMAP-SSL server...
  ...done.
* Stopping Courier POP3 server...
  ...done.
* Starting Courier POP3 server...
  ...done.
* Stopping Courier POP3-SSL server...
  ...done.
* Starting Courier POP3-SSL server...
  ...done.
* Restarting web server apache2
... waiting    ...done.
Restarting ftp server: Running: /usr/sbin/pure-ftpd-mysql-virtualchroot -l mysql:/etc/pure-ftpd/db/mysql.conf -l pam -E -u 1000 -O clf:/var/log/pure-ftpd/transfer.log -b -A -B
--------------------------------------------------------------------------------
Installation completed. Acessar para testar http://192.168.0.100:8080
--------------------------------------------------------------------------------
Login padrão: admin admin

Procedimento para update através do espelho ( SVN betas em desenvolvimento )

ispconfig_update.sh
Select update method (stable,svn) [stable]: <-- ENTER

This application will update ISPConfig 3 on your server.
MySQL root password []: <-- Passwd do usuário root do MySQL

Reconfigure Services? (yes,no) [yes]: <-- ENTER

ISPConfig Port [8080]: <-- ENTER

Reconfigure Crontab? (yes,no) [yes]: <-- ENTER

Procedimento de backup após Update

mkdir /home/backup
chmod 700 /home/backup
cd /home/backup
mysqldump -u root -p dbispconfig > dbispconfig.sql
tar pcfz ispconfig_software.tar.gz /usr/local/ispconfig
tar pcfz etc.tar.gz /etc


"Transportai um punhado de terra todos os dias e fareis uma montanha." Confúcio

Voltar para “Servidores”