Diferència entre revisions de la pàgina «ASIX/M08/UF1/P41/2»

De Lordwektabyte Wiki
Salta a la navegació Salta a la cerca
Línia 181: Línia 181:
  
 
(...)
 
(...)
 +
</source>
 +
 +
Habilitarem l'arrencada automàtica del servidor web Apache (httpd) i el reiniciarem per carregar els canvis:
 +
<source>
 +
systemctl enable  httpd.service
 +
systemctl restart  httpd.service
 +
</source>
 +
 +
====Instal·larem Amavisd-new, SpamAssassin, ClamAV, i Postgrey====
 +
Se'ns instal·laran moltes dependències (uns 180MB entre tot, al moment d'escriure això).
 +
<source>
 +
yum -y install amavisd-new spamassassin clamav-server clamav-data clamav-update clamav-filesystem clamav clamav-scanner-systemd clamav-devel clamav-lib clamav-server-systemd unzip bzip2 perl-DBD-mysql postgrey re2c
 
</source>
 
</source>

Revisió del 14:19, 22 nov 2018

https://www.howtoforge.com/tutorial/perfect-server-centos-7-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig/2/

Requeriments

Programari

PHP 7

Haurem d'afegir primer el repositori EPEL amb

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

i el repositori REMI:

yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

També serà necessari instal·lar una utilitat de yum que permet canviar repositoris per defecte, de manera que quan instal·lem PHP, ens agafi el del repositori EPEL amb la versió 7:

yum install yum-utils

Una vegada instal·lades aquestes utilities, seleccionarem el repositori que volem activar segons la sub-versió que volguem instal·lar de PHP: 7.0, 7.1 o 7.2: En aquest cas, instal·lo la versió 7.2

yum-config-manager --enable remi-php72

Una vegada activat el repo amb la versió de PHP seleccionada, instal·larem la versió 7.2 amb la comanda

yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo

Per a comprovar la versió de PHP que està instal·lada i en funcionament actualment podem executar un

php -v

I ens donarà una sortida:

PHP 7.2.12 (cli) (built: Nov  6 2018 16:40:25) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

Això és senyal que s'ha instal·lat i està a punt el PHP 7.2.5. Ara és qüestió de recarregar la configuració del servidor web Apache perquè utilitzi la versió PHP nova.

systemctl reload httpd

Development tools

Segons la documentació, hem d'instal·lar un conjunt de paquets amb la següent comanda:

yum -y groupinstall 'Development Tools'

Apache, MariaDB, PHPMyAdmin

yum -y install ntp httpd mod_ssl mariadb-server php php-mysql php-mbstring phpmyadmin

Dovecot

yum -y install dovecot dovecot-mysql dovecot-pigeonhole

Crearem un arxiu de configuració buit per al Dovecot:

touch /etc/dovecot/dovecot-sql.conf
ln -s /etc/dovecot/dovecot-sql.conf /etc/dovecot-sql.conf
ln -s /etc/dovecot/dovecot.conf /etc/dovecot.conf

Habilitarem l'engegada automàtica i arrencarem el servei per primera vegada:

systemctl enable dovecot
systemctl start dovecot

Postfix

Instal·larem el programari postfix (pot ser que vagi preinstal·lat amb la minimal install de CentOS):

yum -y install postfix

També engegarem i habilitarem el servidor MariaDB per a la base de dades i reiniciarem el servei de postfix

systemctl enable mariadb.service
systemctl start mariadb.service

systemctl enable postfix.service
systemctl restart postfix.service

Getmail

L'instal·larem com la resta de paquets

yum -y install getmail

Posada a punt MariaDB

Executarem el mysql_secure_installation per tal de configurar una contrasenya de root per al MariaDB, eliminar taules d'exemple, etc.

mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] 
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] 
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] 
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] 
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Configuració Apache - PHPMyAdmin

Obrirem l'arxiu /etc/httpd/conf.d/phpMyAdmin.conf amb un editor de text i buscarem la aquesta secció i la deixarem de la següent manera:

(...)

<IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       #Require ip 127.0.0.1
       #Require ip ::1
        Require all granted
     </RequireAny>
   </IfModule>

(...)

Després canviarem el mètode d'autenticació de PHPMyAdmin editant l'arxiu /etc/phpMyAdmin/config.inc.php de manera que tingui el següent contingut a la secció corresponent. Canviarem el valor per defecte cookie per http.

(...)

$cfg['Servers'][$i]['auth_type']     = 'http';

(...)

Habilitarem l'arrencada automàtica del servidor web Apache (httpd) i el reiniciarem per carregar els canvis:

systemctl enable  httpd.service
systemctl restart  httpd.service

Instal·larem Amavisd-new, SpamAssassin, ClamAV, i Postgrey

Se'ns instal·laran moltes dependències (uns 180MB entre tot, al moment d'escriure això).

yum -y install amavisd-new spamassassin clamav-server clamav-data clamav-update clamav-filesystem clamav clamav-scanner-systemd clamav-devel clamav-lib clamav-server-systemd unzip bzip2 perl-DBD-mysql postgrey re2c