initial_config_deb
This is an old revision of the document!
Table of Contents
Configuração inicial
Pacotes essenciais
$ su - # apt update # apt install vim wget curl git sudo accountsservice software-properties-common \ bash-completion apt-transport-https \ ca-certificates gnupg2 lsb-release
Outros
# apt install lvm2 build-essential jq
Se a instalação for em um ESXI acrescentar
# apt install open-vm-tools
Bash usuário root
- .bashrc
# cat .bashrc # ~/.bashrc: executed by bash(1) for non-login shells. # Note: PS1 and umask are already set in /etc/profile. You should not # need this unless you want different defaults for root. # PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ ' # umask 022 PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u\[\033[01;34m\]@\[\033[01;33m\]\h\[\033[01;34m\][\[\033[00m\]\[\033[01;37m\]\w\[\033[01;34m\]]\[\033[01;31m\]\$\[\033[00m\] ' # You may uncomment the following lines if you want `ls' to be colorized: export LS_OPTIONS='--color=auto' eval "$(dircolors)" alias ls='ls $LS_OPTIONS' # alias ll='ls $LS_OPTIONS -l' # alias l='ls $LS_OPTIONS -lA' # alias egrep='egrep --color=auto' alias fgrep='fgrep --color=auto' alias grep='grep --color=auto' # Some more alias to avoid making mistakes: alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' alias vi='vim' alias editor='vi' alias ping='ping -c3' export HISTTIMEFORMAT='%d-%m-%Y %H:%M- ' #export HISTTIMEFORMAT='%F %T ' #export PROMPT_COMMAND="history -c"
Configuração de Usuário
# usermod -aG sudo suporte
Ou
# visudo -f /etc/sudoers.d/suporte suporte ALL=(ALL) NOPASSWD:ALL
VIM
Rede
$ cat /etc/network/interfaces # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # The primary network interface allow-hotplug ens192 iface ens192 inet static address 177.75.176.40/27 gateway 177.75.176.33 iface ens192 inet6 static address 2804:694:3000:8000::40/64 gateway 2804:694:3000:8000:: # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 177.75.176.25 2804:694:4c00:4001::1 dns-search juntotelecom.com.br
$ sudo hostnamectl set-hostname vm-01.juntotelecom.com.br
$ echo -e "127.0.0.1\tvm-01.juntotelecom.com.br\tvm-01" | sudo tee -a /etc/hosts
NTP
$ sudo timedatectl set-time '2022-05-05 15:30:00'
$ sudo timedatectl set-timezone America/Sao_Paulo
$ timedatectl status
Local time: ter 2022-04-05 15:31:30 -03
Universal time: ter 2022-04-05 18:31:30 UTC
RTC time: ter 2022-04-05 18:31:30
Time zone: America/Sao_Paulo (-03, -0300)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
$ sudo apt update $ sudo apt install chrony
$ sudo vim /etc/chrony/chrony.conf [...] #pool 2.debian.pool.ntp.org iburst pool pool.ntp.br iburst [...]
$ sudo timedatectl set-ntp true
$ sudo systemctl restart chronyd
$ chronyc sources -v .-- Source mode '^' = server, '=' = peer, '#' = local clock. / .- Source state '*' = current best, '+' = combined, '-' = not combined, | / 'x' = may be in error, '~' = too variable, '?' = unusable. || .- xxxx [ yyyy ] +/- zzzz || Reachability register (octal) -. | xxxx = adjusted offset, || Log2(Polling interval) --. | | yyyy = measured offset, || \ | | zzzz = estimated error. || | | \ MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^- b.ntp.br 2 6 17 24 -186us[ -186us] +/- 45ms ^? a.st1.ntp.br 0 7 0 - +0ns[ +0ns] +/- 0ns ^? gps.jd.ntp.br 0 7 0 - +0ns[ +0ns] +/- 0ns ^? c.ntp.br 0 7 0 - +0ns[ +0ns] +/- 0ns ^? a.ntp.br 0 7 0 - +0ns[ +0ns] +/- 0ns ^* a.ntp.br 2 6 17 26 +303us[ -54us] +/- 3343us ^? b.ntp.br 0 7 0 - +0ns[ +0ns] +/- 0ns ^- c.ntp.br 2 6 17 25 +1166us[+1166us] +/- 38ms
$ chronyc tracking Reference ID : C8A00008 (a.ntp.br) Stratum : 3 Ref time (UTC) : Tue Apr 05 18:35:49 2022 System time : 0.000000057 seconds fast of NTP time Last offset : -0.000357560 seconds RMS offset : 0.000357560 seconds Frequency : 26.038 ppm fast Residual freq : -24.961 ppm Skew : 0.250 ppm Root delay : 0.002586446 seconds Root dispersion : 0.003777417 seconds Update interval : 0.8 seconds Leap status : Normal
$ chronyc sourcestats Name/IP Address NP NR Span Frequency Freq Skew Offset Std Dev ============================================================================== b.ntp.br 5 5 71 +13.665 80.742 +1093us 104us a.st1.ntp.br 0 0 0 +0.000 2000.000 +0ns 4000ms gps.jd.ntp.br 0 0 0 +0.000 2000.000 +0ns 4000ms c.ntp.br 0 0 0 +0.000 2000.000 +0ns 4000ms a.ntp.br 0 0 0 +0.000 2000.000 +0ns 4000ms a.ntp.br 5 3 70 -2.523 42.783 -68us 238us b.ntp.br 0 0 0 +0.000 2000.000 +0ns 4000ms c.ntp.br 5 3 71 -0.930 6.718 +1140us 25us
Alterando a porta do SSH
$ sudo sed -i '/#Port 22/a Port 22022' /etc/ssh/sshd_config
$ sudo cat /etc/ssh/sshd_config | egrep "#Port" -A1 #Port 22 Port 22022
$ sudo systemctl restart sshd.service
$ ss -nltp | grep 22022 LISTEN 0 128 0.0.0.0:22022 0.0.0.0:* LISTEN 0 128 [::]:22022 [::]:*
initial_config_deb.1753560543.txt.gz · Last modified: by wikiadm
