Não tinha o propósito de mudar a distribuição do meu notebook esse ano, mais devido a alguns problemas com o Mint, decidi mudar e experimentar uma nova distribuição, e o escolhido foi o Arch Linux. E como necessito desses pacotes para estudar, aí vai um pequeno tutorial de como deixar o Nginx, Mysql, Php-FPM e phpMyAdmin configurados no Arch Linux e derivados.
1) Atualizar os pacotes do sistema
# pacman -Syu
2) Instalar o Mysql
# pacman -S mysql
# mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
# sudo systemctl start mysqld && mysql_secure_installation
A instalação iniciará e você será questionado sobre a senha de superusuário para prosseguir, pressione enter e prossiga conforme as opções:
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] y ... 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] y ... 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] y - 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.
3) Instalar o Nginx
# pacman -S nginx
# systemctl start nginx
Para confirmar que o serviço está rodando
# systemctl status nginx
4) Instalar o PHP-FPM
# pacman -S php-fpm
5) Instalar o phpMyAdmin
# pacman -S phpmyadmin php-mcrypt
6) Configurar o php.ini
É necessário habilitar as seguintes extensões no php.ini, retirando o comentário do início da linha (;).
#nano /etc/php/php.ini
extension=mysqli.so extension=mcrypt.so
Retire também o comentário da linha:
mysqli.allow_local_infile = On
Ainda no php.ini, pesquise a linha open_basedir e adicione os seguintes diretórios:
open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps/
7) Habilitar o Php-FPM Fast CGI no Nginx
Agora vamos habilitar o php-fpm no nginx. Faça uma cópia do arquivo nginx.conf e substitua o conteúdo por esse abaixo, ou adicione no seu arquivo o que está em negrito logo abaixo:
Criando cópia de backup:
# cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bkp
Editar o arquivo:
# nano /etc/nginx/nginx.conf
user html; worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; location / { root /usr/share/nginx/html; index index.html index.htm index.php; } location /phpmyadmin { rewrite ^/* /phpMyAdmin last; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 location ~ \.php$ { fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_index index.php; root /srv/http; include fastcgi.conf; } } }
8) Ativando serviços na inicialização do sistema
# systemctl enable nginx
# systemctl enable mysqld
# systemctl enable php-fpm
Bem, agora você já tem tudo pronto na sua máquina. Confira acessando o endereço http://localhost ou http://localhost/phpmyadmin. Agora é continuar estudando e descobrir todo o poder que o nginx pode oferecer.
Bons estudos e até mais!
Quer saber mais sobre o pacman? Leitura recomendada:
[mks_button size=”medium” title=”Usando Pacman no Arch Linux e Derivados – Parte 1″ style=”rounded” url=”https://sempreupdate.org/gnulinux/2015/usando-o-pacman-no-arch-linux-e-derivados-parte-1/” target=”_blank” bg_color=”#ff1e1e” txt_color=”#020202″ icon=”” icon_type=””]
[mks_button size=”medium” title=”Usando Pacman no Arch Linux e Derivados – Parte 2″ style=”rounded” url=”https://sempreupdate.org/gnulinux/tutoriais/2015/usando-o-pacman-no-arch-linux-e-derivados-parte-2/” target=”_blank” bg_color=”#ff1e1e” txt_color=”#020202″ icon=”” icon_type=””]
[mks_button size=”medium” title=”Usando Pacman no Arch Linux e Derivados – Parte 3″ style=”rounded” url=”https://sempreupdate.org/gnulinux/tutoriais/2015/usando-o-pacman-no-arch-linux-e-derivados-parte-3/” target=”_blank” bg_color=”#ff1e1e” txt_color=”#020202″ icon=”” icon_type=””]
Referências:
[mks_button size=”medium” title=”Fonte 1″ style=”squared” url=”http://www.tecmint.com/install-nginx-php-mysql-with-mariadb-engine-and-phpmyadmin-in-arch-linux/” target=”_blank” bg_color=”#ffffff” txt_color=”#020202″ icon=”” icon_type=””]
[mks_button size=”medium” title=”Fonte 2″ style=”squared” url=”https://www.digitalocean.com/community/tutorials/how-to-install-lemp-nginx-mysql-php-stack-on-arch-linux” target=”_blank” bg_color=”#ffffff” txt_color=”#020202″ icon=”” icon_type=””]
[mks_button size=”medium” title=”Fonte 3″ style=”squared” url=”https://wiki.archlinux.org/index.php/MySQL” target=”_blank” bg_color=”#ffffff” txt_color=”#020202″ icon=”” icon_type=””]
[mks_button size=”medium” title=”Fonte 4″ style=”squared” url=”https://wiki.archlinux.org/index.php/phpMyAdmin” target=”_blank” bg_color=”#ffffff” txt_color=”#020202″ icon=”” icon_type=””]
Sobre o Autor