Upgrade do PHP 5.4 para o PHP 7.4 no CentOS 7
Veirique a versão do seu PHP.
| 
					 1  | 
						php -v  | 
					
O retorno deve ser: PHP 5.4.16 (cli) (built: Apr 12 2018 19:02:01) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies Instale agora os repositórios REMI e EPEL
| 
					 1 2  | 
						rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm rpm -Uvh https://rpms.remirepo.net/enterprise/remi-release-7.rpm  | 
					
Verifique no arquivo /etc/yum.repos.d/remi.repo se na sessão remi o flag enabled está igual a […]
Como dar permissão de root para um usuário no CentOS 7
Acesse seu servidor e crie um novo usuário. Depois de criar este novo usuário rode o comando abaixo:
| 
					 1  | 
						usermod -aG wheel <username criado>  | 
					
Agora este usuário terá permissão de root no servidor.
Upgrade do php 7.2 para 7.3 no CentOS 7
Desabilite o repositório do php 7.2
| 
					 1  | 
						yum-config-manager --disable remi-php72  | 
					
Agora habilite o repositório do php 7.3
| 
					 1  | 
						yum-config-manager --enable remi-php73  | 
					
Feito isto, basta fazer um update
| 
					 1  | 
						yum update  | 
					
O PHP será atualizado da versão 7.2 para a versão 7.3
| 
					 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132  | 
						Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile  * epel: mirror.uic.edu  * remi-php73: mirror.team-cymru.com  * remi-safe: mirror.team-cymru.com  * webtatic: us-east.repo.webtatic.com remi-php73                                                              | 3.0 kB  00:00:00 remi-php73/primary_db                                                   | 201 kB  00:00:00 Resolving Dependencies --> Running transaction check ---> Package php.x86_64 0:7.2.22-1.el7.remi will be updated ---> Package php.x86_64 0:7.3.9-1.el7.remi will be an update ---> Package php-cli.x86_64 0:7.2.22-1.el7.remi will be updated ---> Package php-cli.x86_64 0:7.3.9-1.el7.remi will be an update ---> Package php-common.x86_64 0:7.2.22-1.el7.remi will be updated ---> Package php-common.x86_64 0:7.3.9-1.el7.remi will be an update ---> Package php-gd.x86_64 0:7.2.22-1.el7.remi will be updated ---> Package php-gd.x86_64 0:7.3.9-1.el7.remi will be an update ---> Package php-json.x86_64 0:7.2.22-1.el7.remi will be updated ---> Package php-json.x86_64 0:7.3.9-1.el7.remi will be an update ---> Package php-ldap.x86_64 0:7.2.22-1.el7.remi will be updated ---> Package php-ldap.x86_64 0:7.3.9-1.el7.remi will be an update ---> Package php-mbstring.x86_64 0:7.2.22-1.el7.remi will be updated ---> Package php-mbstring.x86_64 0:7.3.9-1.el7.remi will be an update ---> Package php-mysqlnd.x86_64 0:7.2.22-1.el7.remi will be updated ---> Package php-mysqlnd.x86_64 0:7.3.9-1.el7.remi will be an update ---> Package php-pdo.x86_64 0:7.2.22-1.el7.remi will be updated ---> Package php-pdo.x86_64 0:7.3.9-1.el7.remi will be an update ---> Package php-pecl-mcrypt.x86_64 0:1.0.2-2.el7.remi.7.2 will be updated ---> Package php-pecl-mcrypt.x86_64 0:1.0.2-2.el7.remi.7.3 will be an update ---> Package php-xml.x86_64 0:7.2.22-1.el7.remi will be updated ---> Package php-xml.x86_64 0:7.3.9-1.el7.remi will be an update --> Finished Dependency Resolution Dependencies Resolved ===============================================================================================  Package                 Arch           Version                       Repository          Size =============================================================================================== Updating:  php                     x86_64         7.3.9-1.el7.remi              remi-php73         3.2 M  php-cli                 x86_64         7.3.9-1.el7.remi              remi-php73         4.9 M  php-common              x86_64         7.3.9-1.el7.remi              remi-php73         1.1 M  php-gd                  x86_64         7.3.9-1.el7.remi              remi-php73          80 k  php-json                x86_64         7.3.9-1.el7.remi              remi-php73          65 k  php-ldap                x86_64         7.3.9-1.el7.remi              remi-php73          82 k  php-mbstring            x86_64         7.3.9-1.el7.remi              remi-php73         510 k  php-mysqlnd             x86_64         7.3.9-1.el7.remi              remi-php73         233 k  php-pdo                 x86_64         7.3.9-1.el7.remi              remi-php73         127 k  php-pecl-mcrypt         x86_64         1.0.2-2.el7.remi.7.3          remi-php73          29 k  php-xml                 x86_64         7.3.9-1.el7.remi              remi-php73         207 k Transaction Summary =============================================================================================== Upgrade  11 Packages Total download size: 11 M Is this ok [y/d/N]: y Downloading packages: Delta RPMs disabled because /usr/bin/applydeltarpm not installed. (1/11): php-7.3.9-1.el7.remi.x86_64.rpm                                 | 3.2 MB  00:00:00 (2/11): php-cli-7.3.9-1.el7.remi.x86_64.rpm                             | 4.9 MB  00:00:00 (3/11): php-common-7.3.9-1.el7.remi.x86_64.rpm                          | 1.1 MB  00:00:00 (4/11): php-gd-7.3.9-1.el7.remi.x86_64.rpm                              |  80 kB  00:00:00 (5/11): php-json-7.3.9-1.el7.remi.x86_64.rpm                            |  65 kB  00:00:00 (6/11): php-ldap-7.3.9-1.el7.remi.x86_64.rpm                            |  82 kB  00:00:00 (7/11): php-mysqlnd-7.3.9-1.el7.remi.x86_64.rpm                         | 233 kB  00:00:00 (8/11): php-mbstring-7.3.9-1.el7.remi.x86_64.rpm                        | 510 kB  00:00:00 (9/11): php-pdo-7.3.9-1.el7.remi.x86_64.rpm                             | 127 kB  00:00:00 (10/11): php-xml-7.3.9-1.el7.remi.x86_64.rpm                            | 207 kB  00:00:00 (11/11): php-pecl-mcrypt-1.0.2-2.el7.remi.7.3.x86_64.rpm                |  29 kB  00:00:00 ----------------------------------------------------------------------------------------------- Total                                                           17 MB/s |  11 MB  00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction   Updating   : php-json-7.3.9-1.el7.remi.x86_64                                           1/22   Updating   : php-common-7.3.9-1.el7.remi.x86_64                                         2/22 warning: /etc/php.ini created as /etc/php.ini.rpmnew   Updating   : php-cli-7.3.9-1.el7.remi.x86_64                                            3/22   Updating   : php-pdo-7.3.9-1.el7.remi.x86_64                                            4/22   Updating   : php-mysqlnd-7.3.9-1.el7.remi.x86_64                                        5/22   Updating   : php-7.3.9-1.el7.remi.x86_64                                                6/22   Updating   : php-xml-7.3.9-1.el7.remi.x86_64                                            7/22   Updating   : php-ldap-7.3.9-1.el7.remi.x86_64                                           8/22   Updating   : php-mbstring-7.3.9-1.el7.remi.x86_64                                       9/22   Updating   : php-pecl-mcrypt-1.0.2-2.el7.remi.7.3.x86_64                               10/22   Updating   : php-gd-7.3.9-1.el7.remi.x86_64                                            11/22   Cleanup    : php-7.2.22-1.el7.remi.x86_64                                              12/22   Cleanup    : php-cli-7.2.22-1.el7.remi.x86_64                                          13/22   Cleanup    : php-mysqlnd-7.2.22-1.el7.remi.x86_64                                      14/22   Cleanup    : php-pdo-7.2.22-1.el7.remi.x86_64                                          15/22   Cleanup    : php-gd-7.2.22-1.el7.remi.x86_64                                           16/22   Cleanup    : php-pecl-mcrypt-1.0.2-2.el7.remi.7.2.x86_64                               17/22   Cleanup    : php-mbstring-7.2.22-1.el7.remi.x86_64                                     18/22   Cleanup    : php-ldap-7.2.22-1.el7.remi.x86_64                                         19/22   Cleanup    : php-xml-7.2.22-1.el7.remi.x86_64                                          20/22   Cleanup    : php-json-7.2.22-1.el7.remi.x86_64                                         21/22   Cleanup    : php-common-7.2.22-1.el7.remi.x86_64                                       22/22   Verifying  : php-xml-7.3.9-1.el7.remi.x86_64                                            1/22   Verifying  : php-ldap-7.3.9-1.el7.remi.x86_64                                           2/22   Verifying  : php-common-7.3.9-1.el7.remi.x86_64                                         3/22   Verifying  : php-cli-7.3.9-1.el7.remi.x86_64                                            4/22   Verifying  : php-mbstring-7.3.9-1.el7.remi.x86_64                                       5/22   Verifying  : php-7.3.9-1.el7.remi.x86_64                                                6/22   Verifying  : php-pecl-mcrypt-1.0.2-2.el7.remi.7.3.x86_64                                7/22   Verifying  : php-pdo-7.3.9-1.el7.remi.x86_64                                            8/22   Verifying  : php-json-7.3.9-1.el7.remi.x86_64                                           9/22   Verifying  : php-gd-7.3.9-1.el7.remi.x86_64                                            10/22   Verifying  : php-mysqlnd-7.3.9-1.el7.remi.x86_64                                       11/22   Verifying  : php-gd-7.2.22-1.el7.remi.x86_64                                           12/22   Verifying  : php-cli-7.2.22-1.el7.remi.x86_64                                          13/22   Verifying  : php-pdo-7.2.22-1.el7.remi.x86_64                                          14/22   Verifying  : php-pecl-mcrypt-1.0.2-2.el7.remi.7.2.x86_64                               15/22   Verifying  : php-common-7.2.22-1.el7.remi.x86_64                                       16/22   Verifying  : php-ldap-7.2.22-1.el7.remi.x86_64                                         17/22   Verifying  : php-xml-7.2.22-1.el7.remi.x86_64                                          18/22   Verifying  : php-7.2.22-1.el7.remi.x86_64                                              19/22   Verifying  : php-mysqlnd-7.2.22-1.el7.remi.x86_64                                      20/22   Verifying  : php-json-7.2.22-1.el7.remi.x86_64                                         21/22   Verifying  : php-mbstring-7.2.22-1.el7.remi.x86_64                                     22/22 Updated:   php.x86_64 0:7.3.9-1.el7.remi              php-cli.x86_64 0:7.3.9-1.el7.remi   php-common.x86_64 0:7.3.9-1.el7.remi       php-gd.x86_64 0:7.3.9-1.el7.remi   php-json.x86_64 0:7.3.9-1.el7.remi         php-ldap.x86_64 0:7.3.9-1.el7.remi   php-mbstring.x86_64 0:7.3.9-1.el7.remi     php-mysqlnd.x86_64 0:7.3.9-1.el7.remi   php-pdo.x86_64 0:7.3.9-1.el7.remi          php-pecl-mcrypt.x86_64 0:1.0.2-2.el7.remi.7.3   php-xml.x86_64 0:7.3.9-1.el7.remi Complete!  | 
					
Ao final verifique a versão com o php -v e reinicie o apache para a nova versão ser usada.
Testar velocidade do link de Internet de um servidor linux
Algumas vezes é necessário saber como está a velocidade do link a partir do seu servidor. Quando é Windows temos diversos sites que fazem este teste, porém e quando é Linux (console)? Podemos faze o teste usando o speedtest-cli através da linha de comando. Abaixo mostramos o passo a passo para instalar em um CentOS […]
Protegendo o Apache com fail2ban no Centos 7
Estamos levando em consideração que você já tem os requisitos como iptables e etc instalado no seu servidor. Instalação: Instalando o repositório (se não tiver instalado)
| 
					 1  | 
						yum install epel-release  | 
					
Instalando o fail2ban
| 
					 1  | 
						yum install fail2ban  | 
					
Ativando o serviço
| 
					 1  | 
						systemctl enable fail2ban  | 
					
Copie o arquivo jail.conf para jail.local
| 
					 1 2  | 
						cd /etc/fail2ban cp jail.conf jail.local  | 
					
Agora você deve abrir o jail.local e fazer as configurações que achar necessário. […]
Erro Postfix – The sender address is not a valid RFC-5321 address
Caso você tenha alguma site que envie e-mail e o mesmo não chegue ao destinho, sugerimos que você analise o maillog. Caso o erro ao enviar seja The sender address is not a valid RFC-5321 address (fornecido pelo servidor de destino) a solução é simples. Isto acontece bastante com o Gmail (Google). Se o e-mail […]
Como remover o APF (Advance Policy Firewall) Firewall do CentOS
O APF não tem um scripr uninstall, sendo assim temos que remover na mão. Seguem os passos.
| 
					 1 2 3 4 5  | 
						chkconfig apf off /etc/init.d/apf stop rm -rf /etc/apf rm -f /etc/cron.daily/fw rm -f /etc/init.d/apf  | 
					
Como remover o firewalld e instalar o iptables no CentOS 7
Com a grande oferta de máquinas virtuais a um custo baixo somos obrigados a lidar com algumas limitações. Nosso caso foi com uma máquina muito barata e a “jogada” deles foi limitar a quantidade de pacotes filtrados pelo iptables. Sendo assim não conseguimos usar o firewalls comuns para Linux como AFP e CSF. Temos que […]
Configurar e instalar o firewalld no CentOS 7 em uma máquina virtual
Para iniciar o firewalld rode o comando.
| 
					 1  | 
						service start firewalld   | 
					
Se ocorrer o erro abaixo …
| 
					 1  | 
						Failed to start firewalld.service: Unit is masked.  | 
					
… a solução para isto é rodar o comando abaixo.
| 
					 1  | 
						systemctl unmask firewalld  | 
					
Feito isto desisntale e reinstale o firewalld. Para quem não está familiarizado, seguem os comandos. Para remover …
| 
					 1  | 
						yum remove firewalld  | 
					
Para instalar …
| 
					 1  | 
						yum install firewalld  | 
					
Feito isto basta iniciar o serviço […]
Redirecionar todo um site para outro endereço exceto um diretório pelo .htaccess
Para redirecionar todo um site para um outro endereço exceto um diretório pelo .htaccess é simples. Abra ou crie o arquivo .htaccess na raiz do diretório do seu site. Coloque no inicio do arquivo o conteúdo abaixo, fazendo as devidas alterações.
| 
					 1 2  | 
						RewriteEngine on RewriteRule !^teste($|/) http://www.novosite.com.br%{REQUEST_URI} [L,R=301]  | 
					
O trecho acima está redirecionando qualquer endereço exceto a pasta teste para o […]