Porque escolher Oracle Cloud
TODO
hospedado gratuitamente.Porque escolher Ubuntu 22.04
A Camada Grátis do Oracle Cloud pode ser feita acessando a URL https://signup.oraclecloud.com/. Você obterá uma avaliação de 30 dias com um crédito de 300 dólares; depois disso, sua assinatura de Créditos Universais começará. Sua conta será ativada automaticamente e você receberá um e-mail de boas-vindas.
Neste momento, abra seu email, complete as etapas finais. Vai ser solicitado um Cartão de Crédito, mas não se preocupe, é apenas uma precaução por parte da Oracle para quando/se
você quiser aderir ao plano pago. Já tenho esse cadastro há mais de ano e nunca fui cobrado pelo plano Always Free.
Criando uma Instância, você poderá acessá-la através de uma conexão Secure Shell (SSH) no endereço IP público disponibilizado.
OBS: Para criar seus próprios pares de chaves, você pode usar uma ferramenta de terceiros como OpenSSH em sistemas de estilo UNIX (incluindo Linux, Solaris, BSD e OS X) ou o Gerador de Chaves PuTTY no Windows.
Um bom tutorial para Ubuntu 22.04 encontra-se aqui: https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys-on-ubuntu-22-04
id_rsa.pub
selecionadaSUPER DICA
Por default, uma instância disponibiliza 50GB de HD. O total de HD disponibilizado na sua conta Always Free é de 200GB. Então é possível criar até dois servidores com 100GB cada. Uma das opções do Boot volume é Specify a custom boot volume size que preenchemos com 100GB.
ssh [email protected]
The authenticity of host '134.65.23.213 (134.65.23.213)' can't be established.
ED25519 key fingerprint is SHA256:aMMDD2JLiP1e9OsGeMsIkxKMToaFH0Ugqv1nfH2bq+A.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '134.65.23.213' (ED25519) to the list of known hosts.
Welcome to Ubuntu 22.04.1 LTS (GNU/Linux 5.15.0-1021-oracle x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Fri Dec 16 14:12:32 UTC 2022
System load: 0.20751953125 Processes: 118
Usage of /: 2.0% of 96.73GB Users logged in: 0
Memory usage: 23% IPv4 address for ens3: 10.0.0.30
Swap usage: 0%
0 updates can be applied immediately.
The list of available updates is more than a week old.
To check for new updates run: sudo apt update
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
ubuntu@ubuntu-04:~$
ubuntu@ubuntu-04:~$ free -h
total used free shared buff/cache available
Mem: 964Mi 195Mi 361Mi 1.0Mi 406Mi 613Mi
Swap: 0B 0B 0B
ubuntu@ubuntu-04:~$ df -hT
Filesystem Type Size Used Avail Use% Mounted on
tmpfs tmpfs 97M 1.1M 96M 2% /run
/dev/sda1 ext4 97G 2.0G 95G 2% /
tmpfs tmpfs 483M 0 483M 0% /dev/shm
tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock
/dev/sda15 vfat 105M 5.3M 100M 5% /boot/efi
tmpfs tmpfs 97M 4.0K 97M 1% /run/user/1001
ubuntu@ubuntu-04:~$
ubuntu@ubuntu-04:~$ sudo cp /home/ubuntu/.ssh/authorized_keys /root/.ssh/authorized_keys
Agora saia dessa sessão como usuário ubuntu
e conecte-se como root
ubuntu@ubuntu-04:~$ exit
logout
Connection to 134.65.23.213 closed.
jarbelix@jarbelix-Nitro-AN515-44:~$ ssh [email protected]
Welcome to Ubuntu 22.04.1 LTS (GNU/Linux 5.15.0-1021-oracle x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Fri Dec 16 14:17:14 UTC 2022
System load: 0.02978515625 Processes: 114
Usage of /: 2.0% of 96.73GB Users logged in: 0
Memory usage: 22% IPv4 address for ens3: 10.0.0.30
Swap usage: 0%
0 updates can be applied immediately.
The list of available updates is more than a week old.
To check for new updates run: sudo apt update
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
root@ubuntu-04:~#
fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab
free -h
total used free shared buff/cache available
Mem: 964Mi 188Mi 364Mi 1.0Mi 411Mi 620Mi
Swap: 4.0Gi 0B 4.0Gi
cat <<EOF > /etc/sysctl.d/99-swappiness.conf
# https://www.shellhacks.com/swappiness-in-linux-ubuntu-how-to-change/
vm.swappiness=5
EOF
sysctl -f --system
cat /proc/sys/vm/swappiness
apt update
apt dist-upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
Try Ubuntu Pro beta with a free personal subscription on up to 5 machines.
Learn more at https://ubuntu.com/pro
The following NEW packages will be installed:
linux-headers-5.15.0-1025-oracle linux-image-5.15.0-1025-oracle
linux-modules-5.15.0-1025-oracle linux-modules-extra-5.15.0-1025-oracle
linux-oracle-headers-5.15.0-1025
The following packages have been kept back:
apport python3-apport python3-problem-report python3-tz
The following packages will be upgraded:
binutils binutils-common binutils-x86-64-linux-gnu ca-certificates cloud-init initramfs-tools
initramfs-tools-bin initramfs-tools-core kpartx libbinutils libbpf0 libctf-nobfd0 libctf0
libexpat1 libglib2.0-0 libglib2.0-bin libglib2.0-data libnetplan0 libnfsidmap1 libpython3.10
libpython3.10-minimal libpython3.10-stdlib libsqlite3-0 libxml2 linux-headers-oracle
linux-image-oracle linux-oracle login multipath-tools netplan.io nfs-common passwd
python3-distupgrade python3.10 python3.10-minimal rsync snapd tmux tzdata
ubuntu-advantage-tools ubuntu-release-upgrader-core
41 upgraded, 5 newly installed, 0 to remove and 4 not upgraded.
25 standard LTS security updates
Need to get 155 MB of archives.
After this operation, 584 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
iptables -F
netfilter-persistent save
systemctl disable --now netfilter-persistent
iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain InstanceServices (0 references)
target prot opt source destination
SUPER-DICA
Por segurança, a configuração default no Virtual Cloud Networks, as Ingress Rules liberam apenas a porta22
.
Para disponibilizar seviços é necessário liberar as portas necessárias. Veja abaixo um exemplo
permissiva