Para quem quer ter tudo centralizado em um único servidor, o seu site + e-mails, o
ISPConfig facilita muito.
Vamos por a mão na massa, onde nessa instalação, vamos instalar tudo em um servidor, caso queria ter uma hospedagem com e-mails + FTP tudo em um único servidor.
Bom, vamos por a mão na massa agora:
Após a instalação do
CentOS efetue o update:
# yum update -y
Agora, desative o
SELinux:
# vim /etc/selinux/config
Altere a linha:
SELINUX=enforcing
Para:
SELINUX=disabled
Coloque no "/etc/hosts", o nome do servidor e o IP:
Ex.:
# cat /etc/hosts
192.168.1.254 server.teste.org server
Reinicie o servidor:
# reboot
Agora, vamos adicionar os repositório do
RPMFusion e
EPEL:
# rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Instale o pacote "yum-priorities":
# yum install yum-priorities -y
Agora, edite o arquivo "/etc/yum.repos.d/epel.repo" e adicione o parâmetro "priority=10". Como no exemplo:
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
priority=10
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Agora atualize:
# yum update -y
Agora, instale o pacote de desenvolvimento:
# yum groupinstall 'Development Tools' -y
Agora instale o pacote "quota":
# yum install quota -y
Edite o seu "/etc/fstab" e adicione:
usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0
Exemplo:
# vim /etc/fstab
#
# /etc/fstab
# Created by anaconda on Mon Aug 5 20:05:37 2013
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=b77f0818-c7ed-486e-9506-221d20976c09 / ext4 defaults,usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0 1 1
UUID=68a34532-f890-480c-abc5-65a9ffd9a8d1 swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
Agora, execute os comandos:
# mount -o remount /
# quotacheck -avugm
# quotaon -avug
Agora vamos para a instalação do
PHP, phpMyAdmin, Apache e
MySQL:
# yum install ntp httpd httpd-devel mod_ssl mysql-server mysql-devel php php-devel php-mysql php-mbstring phpmyadmin -y
Instale o Dovecot:
# yum install dovecot dovecot-mysql -y
Instale o Postfix:
# yum install postfix -y
Instale o GetMail:
# yum install getmail -y
Coloque na inicialização o servidor:
# chkconfig httpd on
# chkconfig dovecot on
# chkconfig mysqld on
# chkconfig postfix on
Inicie os serviços:
# service httpd start
# service postfix start
# service dovecot start
Inicie o serviço do MySQL e defina uma senha para o mesmo:
# service mysqld start
# mysqladmin -u root password '12345'
Instale agora
Amavisd, SpamAssassin e o
ClamAV:
# yum install amavisd-new spamassassin clamav clamd unzip bzip2 unrar perl-DBD-mysql -y
Agora, execute os comandos:
# sa-update
# chkconfig amavisd on
# chkconfig --del clamd
# chkconfig clamd.amavisd on
# /usr/bin/freshclam
# /etc/init.d/amavisd start
# /etc/init.d/clamd.amavisd start
Instale agora
Apache com "mod_php", "mod_fcgi/PHP5", e o
suPHP:
# yum install php php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc php-pecl-apc php-mbstring php-mcrypt php-mssql php-snmp php-soap php-tidy curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel mod_fcgid php-cli -y
No arquivo "/etc/php.ini", descomente a linha:
cgi.fix_pathinfo=1
Instalação do
suPhp:
# cd /tmp
# wget http://suphp.org/download/suphp-0.7.1.tar.gz
# tar xvfz suphp-0.7.1.tar.gz
# cd suphp-0.7.1/
# ./configure --prefix=/usr --sysconfdir=/etc --with-apr=/usr/bin/apr-1-config --with-apxs=/usr/sbin/apxs --with-apache-user=apache --with-setid-mode=owner --with-php=/usr/bin/php-cgi --with-logfile=/var/log/httpd/suphp_log --enable-SUPHP_USE_USERGROUP=yes
# make
# make install
Crie o arquivo "suphp.conf":
# vim /etc/httpd/conf.d/suphp.conf
E adicione:
LoadModule suphp_module modules/mod_suphp.so
Crie o arquivo "/etc/suphp.conf":
# vim /etc/suphp.conf
E adicione:
[global]
;Path to logfile
logfile=/var/log/httpd/suphp.log
;Loglevel
loglevel=info
;User Apache is running as
webserver_user=apache
;Path all scripts have to be in
docroot=/
;Path to chroot() to before executing script
;chroot=/mychroot
; Security options
allow_file_group_writeable=true
allow_file_others_writeable=false
allow_directory_group_writeable=true
allow_directory_others_writeable=false
;Check wheter script is within DOCUMENT_ROOT
check_vhost_docroot=true
;Send minor error messages to browser
errors_to_browser=false
;PATH environment variable
env_path=/bin:/usr/bin
;Umask to set, specify in octal notation
umask=0077
; Minimum UID
min_uid=100
; Minimum GID
min_gid=100
[handlers]
;Handler for php-scripts
x-httpd-suphp="php:/usr/bin/php-cgi"
;Handler for CGI-scripts
x-suphp-cgi="execute:!self"
Agora instale o
Ruby:
# yum install ruby ruby-devel -y
Instale agora o "mod_ruby":
# cd /tmp
# wget http://fossies.org/unix/www/apache_httpd_modules/mod_ruby-1.3.0.tar.gz
# tar zxvf mod_ruby-1.3.0.tar.gz
# cd mod_ruby-1.3.0/
# ./configure.rb --with-apr-includes=/usr/include/apr-1
# make
# make install
Crie o arquivo de configuração "/etc/httpd/conf.d/ruby.conf":
# vim /etc/httpd/conf.d/ruby.conf
E adicione:
LoadModule ruby_module modules/mod_ruby.so
RubyAddPath /1.8
E reinicie o Apache:
# service httpd restart
Agora instale o "mod_python":
# yum install mod_python -y
Reinicie o Apache:
# service httpd restart
Instale o "Pure-FTPD":
# yum install pure-ftpd -y
Coloque na inicialização e inicie o serviço:
# chkconfig pure-ftpd on
# service pure-ftpd start
Instale o
OpenSSL:
# yum install openssl -y
Agora, no arquivo "/etc/pure-ftpd/pure-ftpd.conf", descomente a linha "TLS":
# vim /etc/pure-ftpd/pure-ftpd.conf
TLS
Agora, vamos criar o certificado:
# mkdir -p /etc/ssl/private/
# openssl req -x509 -nodes -days 7300 -newkey rsa:2048 -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem
# chmod 600 /etc/ssl/private/pure-ftpd.pem
Reinicie o Pure-FTPD:
# service pure-ftpd restart
Instalando o
BIND:
# yum install bind bind-utils -y
E deixe seu "named.conf" assim:
# vim /etc/named.conf
options {
listen-on port 53 { any; };
listen-on-v6 port 53 { any; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { any; };
recursion yes;
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "." IN {
type hint;
file "named.ca";
};
include "/etc/named.conf.local";
Crie o arquivo "/etc/named.conf.local":
# touch /etc/named.conf.local
Coloque na inicialização e inicie o mesmo:
# chkconfig named on
# service named start
Instale agora o
Webalizer, AWStats:
# yum install webalizer awstats perl-DateTime-Format-HTTP perl-DateTime-Format-Builder -y
Instale agora o Jailkit:
# cd /tmp
# wget http://olivier.sessink.nl/jailkit/jailkit-2.15.tar.gz
# tar xvfz jailkit-2.15.tar.gz
# cd jailkit-2.15
# ./configure
# make
# make install
# cd ..
# rm -rf jailkit-2.15*
Instale agora o
fail2ban:
# yum install fail2ban -y
Altere no arquivo "/etc/fail2ban/fail2ban.conf" a linha do log:
# vim /etc/fail2ban/fail2ban.conf
Deixando assim:
logtarget = /var/log/fail2ban.log
Coloque na inicialização e inicie o serviço:
# chkconfig fail2ban on
# Service fail2ban start
Instale o
rkhunter:
# yum install rkhunter -y
Agora instale o
SquirrelMail:
# yum install squirrelmail -y
Execute o comando para configurar o SquirrelMail:
# /usr/share/squirrelmail/config/conf.pl
Use o comando:
Command >> D
Agora:
Command >>
dovecot
Press enter to continue... Pressione ENTER
Command >> S
Command >> Q