Configurar servidor
—————————————
Hostname
nano /etc/hostname
caduceu
—————————————
Hosts
nano /etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.1.4 caduceu.antonini.psc.br caduceu
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.1.1 caduceu
—————————————
Resolv.conf
criar o arquivo
nano /etc/resolv.conf.tail
Digitar nele
nameserver 192.168.1.4
domain antonini.psc.br
—————————————
IP fixo
Renomear o arquivo interfaces original
mv /etc/network/interfaces interfaces-dhcp
Criar um novo arquivo interfaces
nano /etc/network/interfaces
colocar dentro:
#Não esquecer de identar as linhas dos IPs
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
auto eth0
iface eth0 inet static
address 192.168.1.4
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
# dns-* options are implemented by the resolvconf package, if installed
# dns-nameservers 179.184.27.64
# dns-search antonini.psc.br
após “comandar”
systemctl daemon-reload
Acrescentar no final do arquivo dhcpcd.conf
nano /etc/dhcpcd.conf
interface eth0
static ip_address=192.168.1.4/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1
depois reboot
Dica aqui: https://www.modmypi.com/blog/how-to-give-your-raspberry-pi-a-static-ip-address-update
—————————————
Instalar Bind9
sudo apt-get install bind9 dnsutils
nano /etc/bind/named.conf.local
Incluir no final:
zone “antonini.com.br” IN {
type master;
file “/etc/bind/db.com”;
};
zone “antonini.psc.br” IN {
type master;
file “/etc/bind/db.psc”;
};
zone “cienciasdasaude.med.br” IN {
type master;
file “/etc/bind/db.ciencias”;
};
zone “antonini.med.br” IN {
type master;
file “/etc/bind/db.med”;
};
zone “27.184.179.in-addr.arpa” {
type master;
file “/etc/bind/db.192”;
};
Criar o arquivo db.psc:
nano /etc/bind/db.com
Colar dentro dele:
$TTL 604800
@ IN SOA caduceu.antonini.com.br. root.antonini.antonini.psc.br. (
01012005 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS caduceu.antonini.com.br.
@ IN MX 5 mail
@ IN A 177.207.211.213
caduceu IN A 177.207.211.213
mail IN A 177.207.211.213
www IN A 177.207.211.213
ftp IN A 177.207.211.213
blogmed IN A 177.207.211.213
midia IN A 177.207.211.213
Criar o arquivo db.psc:
nano /etc/bind/db.psc
Colar dentro dele:
$TTL 604800
@ IN SOA caduceu.antonini.psc.br. root.antonini.antonini.psc.br. (
01012005 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS caduceu.antonini.psc.br.
@ IN MX 5 mail
@ IN A 177.207.211.213
caduceu IN A 177.207.211.213
mail IN A 177.207.211.213
www IN A 177.207.211.213
ftp IN A 177.207.211.213
blogmed IN A 177.207.211.213
midia IN A 177.207.211.213
Criar o arquivo db.ciencias
nano /etc/bind/db.ciencias
$TTL 604800
@ IN SOA caduceu.cienciasdasaude.med.br. root.antonini.antonini.psc.br. (
01012005 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS caduceu.cienciasdasaude.med.br.
@ IN MX 5 mail
@ IN A 177.207.211.213
caduceu IN A 177.207.211.213
mail IN A 177.207.211.213
www IN A 177.207.211.213
ftp IN A 177.207.211.213
Criar o arquivo db.med:
nano /etc/bind/db.med
Colar dentro dele:
$TTL 604800
@ IN SOA caduceu.antonini.med.br. root.antonini.antonini.med.br. (
01012005 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS caduceu.antonini.med.br.
@ IN MX 5 mail
@ IN A 177.207.211.213
caduceu IN A 177.207.211.213
mail IN A 177.207.211.213
www IN A 177.207.211.213
ftp IN A 177.207.211.213
blogmed IN A 177.207.211.213
Criar o arquivo db.rev
nano /etc/bind/db.192
@ IN SOA caduceu.antonini.psc.br. antonini.antonini.psc.br. (
2015121608 ; serial, todays date + todays serial #
7200 ; refresh, seconds
540 ; retry, seconds
604800 ; expire, seconds
86400 ) ; minimum, seconds
;
213 3600 PTR antonini.psc.br.
213 3600 PTR antonini.com.br.
213 3600 PTR cienciasdasaude.med.br.
213 3600 PTR antonini.med.br.
/etc/init.d/bind9 force-reload
/etc/init.d/bind9 restart
—————————————
Instalar LAMP
sudo apt-get install apache2 apache2-utils
sudo apt-get install libapache2-mod-php5 php5 php-pear php5-xcache php5-mysql php5-curl php5-gd
cd /var/www/
sudo echo “<?php phpinfo(); ?>” | sudo tee index.php
sudo apt-get install mysql-server mysql-client
sudo apt-get install phpmyadmin
> Reconfigurar webserver: apache
> Configurar base de dados dbconfig-common para o phpmyadmin sim (ou yes)
> Digitar a senha do usuário administrativo do MySQL : senha do MySQL
> Digitar uma senha para o PHPMySQL : usar a mesma senha do MySQL
abrir o arquivo
nano /etc/apache2/apache2.conf
incluir no final do arquivo a linha
Include /etc/phpmyadmin/apache.conf
Caso o phpmyadmin dê erro (não encontrado ou acesso negado) digitar no terminal:
sudo ln -s /usr/share/phpmyadmin /var/www/
—————————————
Instalar vsftpd
apt-get install vsftpd
depois:
nano /etc/vsftpd.conf
Faça as seguintes alterações:
*anonymous_enable=YES para anonymous_enable=NO
*Remova local_enable=YES e write_enable=YES apagando o símbolo # à frente de cada linha.
*A seguir, vá para o fim do arquivo e acrescente:
force_dot_files=YES
Criar link simbólico para o usuário pi acessar a pasta var/www
ln -s /var/www/ ~/www
—————————————
Criar website no apache
mkdir /var/www/html/psc
chmod 777 -R /var/www/html/psc
cd /etc/apache2/sites-available/
nano antonini.psc.br.conf
<VirtualHost *:80>
ServerAdmin antonini@antonini.psc.br
ServerName antonini.psc.br
ServerAlias www.antonini.psc.br
DocumentRoot /var/www/html/psc/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
depois:
a2ensite antonini.psc.br.conf
/etc/init.d/apache2 reload
/etc/init.d/apache2 restart
—————————————
mkdir /var/www/html/blogmed
chmod 777 -R /var/www/html/blogmed
cd /etc/apache2/sites-available/
nano blogmed.antonini.psc.br.conf
<VirtualHost *:80>
ServerAdmin antonini@antonini.psc.br
ServerName blogmed.antonini.psc.br
DocumentRoot /var/www/html/midia/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
depois:
a2ensite blogmed.antonini.psc.br.conf
etc/init.d/apache2 reload
/etc/init.d/apache2 restart
—————————————
mkdir /var/www/html/midia
chmod 777 -R /var/www/html/midia
cd /etc/apache2/sites-available/
nano midia.antonini.psc.br.conf
<VirtualHost *:80>
ServerAdmin antonini@antonini.psc.br
ServerName midia.antonini.psc.br
DocumentRoot /var/www/html/midia/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
depois:
a2ensite midia.antonini.psc.br.conf
/etc/init.d/apache2 reload
/etc/init.d/apache2 restart
—————————————
mkdir /var/www/html/ciencias
chmod 777 -R /var/www/html/ciencias
nano cienciasdasaude.med.br.conf
<VirtualHost *:80>
ServerAdmin antonini@antonini.psc.br
ServerName cienciasdasaude.med.br
ServerAlias www.cienciasdasaude.med.br
DocumentRoot /var/www/html/ciencias/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
depois:
a2ensite cienciasdasaude.med.br.conf
/etc/init.d/apache2 reload
/etc/init.d/apache2 restart
—————————————
Apagar pacotes baixados
apt-get clean :mrgreen:
—————————————
Descobrir o UUID de um disco, pendrive ou dispositivo
ls -alh /dev/disk/by-uuid/
Disco rígido Samsung 1TB
da73d3f8-1058-484d-b00c-18859bc707f7
Pendrive Kingstone USB 3.0 128GB
a8cb019e-aac4-4bf0-83cc-67cc27e20f76
UUID=<dispositivo> /var ext4 defaults,noatime 0 3
—————————————
fstab no Raspberry Pi
proc /proc proc defaults 0 0
/dev/mmcblk0p6 /boot vfat defaults 0 2
/dev/mmcblk0p7 / ext4 defaults,noatime 0 1
UUID=<nº> /var ext4 defaults,noatime 0 3
# a swapfile is not a swap partition, no line here
# use dphys-swapfile swap[on|off] for that
—————————————