Distros

Nesse artigo será exibido detalhadamente os processos feito via terminal para a instalação dos programas

After Install Distros

https://rafandroid.com/ventoy-como-criar-um-pen-drive-multibootavel-no-ubuntu-linux/

https://www.tecmint.com/install-xrdp-on-ubuntu/

https://imagemagick.org/

wget https://download.imagemagick.org/ImageMagick/download/binaries/magick

chmod +x magick

./magick --version

shutter

sudo apt-add-repository ppa:shutter/ppa

sudo apt-get update

sudo apt-get install shutter

chrome

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

sudo dpkg -i google-chrome-stable_current_amd64.deb

google-chrome --version

apt-cache search --names-only 'google-chrome'

wget https://dl.google.com/linux/direct/chrome-remote-desktop_current_amd64.deb

~~~

# Aperfeiçar esse trecho pois gera um bug na inicialização exibindo autenticação

sudo dpkg -i chrome-remote-desktop_current_amd64.deb

sudo usermod -a -G chrome-remote-desktop $USER

systemctl status chrome-remote-desktop

## Fix: “Turn On” Chrome remote desktop in Ubuntu

ls ~/.config
ls ~/.config/chrome-remote-desktop
mkdir ~/.config/chrome-remote-desktop

## Fix: black screen

https://github.com/GObaddie/ubuntu_chrome_remote_desktop

~~~

## Fix: dpkg: problemas com dependências

sudo apt-get -f install

https://chrome.google.com/webstore/detail/cors-unblock/lfhmikememgdcahcdlaciloancbhjino/

https://add0n.com/access-control.html

After Install

sudo apt-get install \
apt-transport-https \
build-essential \
ca-certificates \
curl \
git-flow \
gnome-tweak-tool \
gnupg \
gufw \
jq \
libcanberra-gtk-module \
linux-tools-generic \
lsb-release \
meld \
openssh-server \
preload \
software-properties-common \
tlp \
ubuntu-restricted-extras \
vlc \
xserver-xephyr

docker


# https://www.kali.org/docs/containers/installing-docker-on-kali/
# https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository

sudo apt-get install docker-ce docker-ce-cli containerd.io

# Install latest docker-compose

sudo apt remove docker-compose

DOCKER_COMPOSE_VERSION=$(curl --silent https://api.github.com/repos/docker/compose/releases/latest | jq .name -r)
echo $DOCKER_COMPOSE_VERSION
sudo curl -L "https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version

# not workd rabbit

sudo rm /usr/local/bin/docker-compose

docker-compose --version

# Restart OS

...

docker version
docker info

# Fix: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.39/images/search?limit=25&term=ubuntu: dial unix /var/run/docker.sock: connect: permission denied

# By default the docker daemon always runs as the root user, therefore you need to prepend sudo to your Docker command(s).

groups

# Add your user to the docker group.

sudo usermod -aG docker $USER

# Log out and log back in so that your group membership is re-evaluated.

# Verify that you can run docker commands without sudo.

docker run hello-world

# more ...

docker info
docker search ubuntu
docker container ls
docker-compose version

flatpak

https://flatpak.org/setup/Ubuntu/

sudo apt install \
flatpak \
gnome-software-plugin-flatpak

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

# To complete setup, restart your system

After Install

sudo service ssh start

    ip addr show

    ssh [email protected]

sudo tlp-stat

ps ax | grep preload

snapcraft


# https://snapcraft.io/docs/installing-snap-on-kali
# https://stackoverflow.com/questions/57121916/the-command-could-not-be-located-because-snap-bin-is-not-included-in-the-path

# https://snapcraft.io/store

snap list
snap version

sudo snap install keepassxc

sudo snap install code --classic

sudo snap install google-cloud-sdk --classic

Fix: https://code.visualstudio.com/docs/setup/linux#_visual-studio-code-is-unable-to-watch-for-file-changes-in-this-large-workspace-error-enospc

FIX: [nodemon] Internal watch failed: ENOSPC: System limit for number of file watchers reached, watch

cat /proc/sys/fs/inotify/max_user_watches

cat /etc/sysctl.conf

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

cat /etc/sysctl.conf

cat /proc/sys/fs/inotify/max_user_watches

extensions

code --list-extensions --show-versions

# OR

# 1 - Launch VS Code
# 2 - Quick Open (Ctrl+P), paste the following command, and press enter.

ext install <extension-id>
sudo snap install heroku --classic

heroku -v

git config


# Test SSH authentication

ssh -T [email protected]

ssh -T [email protected]

ssh -T [email protected]

# FIX: [email protected]: Permission denied (publickey)
# Como obter a SSH Key
# cat ~/.ssh/id_rsa.pub
# Como criar a SSH Key
# ssh-keygen -t rsa
# e adicionar em
# https://github.com/settings/keys
# https://bitbucket.org/account/settings/ssh-keys/
# https://gitlab.com/-/profile/keys

#

git config --global credential.helper cache
git config --global user.name "mozgbrasil"
git config --global user.email "[email protected]"

# FIX: Error: fatal: The remote end hung up unexpectedly, https://confluence.atlassian.com/stashkb/git-push-fails-fatal-the-remote-end-hung-up-unexpectedly-282988530.html

git config --global http.postBuffer 524288000

git config --global --list

#

git config --local user.name "marcio.amorim"
git config --local user.email "[email protected]"

git config --local --list

# Fix: The git repository at '*' has too many active changes, only a subset of Git features will be enabled.
# https://docs.github.com/en/github/using-git/configuring-git-to-handle-line-endings

git config --global core.autocrlf input


# https://tassioauad.com/2018/01/03/how-to-clone-all-branches-on-git/

git config --global alias.clone-branches '! git branch -a | sed -n "/\/HEAD /d; /\/master$/d; /remotes/p;" | xargs -L1 git checkout -t'

snapcraft

sudo snap install gimp

sudo snap install inkscape

sudo snap install shutter

sudo snap install blender --classic

sudo snap install chromium

sudo snap install google-cloud-sdk --classic

sudo snap install riseup-vpn --classic

sudo snap install konversation

sudo snap install ksnip

sudo snap install shotcut --classic

sudo snap install glade

sudo snap install dbeaver-ce

sudo snap install squirrelsql

sudo snap install android-studio --classic

https://reactnative.dev/docs/environment-setup

echo '# Configure the ANDROID_HOME environment variable' >> ~/.bashrc
echo 'export ANDROID_HOME="$HOME/Android/Sdk"' >> ~/.bashrc
echo 'export PATH="$PATH:$ANDROID_HOME/emulator"' >> ~/.bashrc
echo 'export PATH="$PATH:$ANDROID_HOME/tools"' >> ~/.bashrc
echo 'export PATH="$PATH:$ANDROID_HOME/tools/bin"' >> ~/.bashrc
echo 'export PATH="$PATH:\$ANDROID_HOME/platform-tools"' >> ~/.bashrc

# echo 'export ANDROID_SDK_ROOT="\$ANDROID_HOME"' >> ~/.bashrc

# echo 'export ANDROID_AVD_HOME="/home/marcio/.android/avd/Pixel_2_API_30.avd"' >> ~/.bashrc

source ~/.bashrc # load the config into your current shell

nano ~/.bashrc # check

echo \$ANDROID_HOME

echo \$PATH

sudo snap install intellij-idea-community --classic

sudo snap install netbeans --classic

sudo snap install eclipse --classic

sudo snap install rubymine --classic

sudo snap install scrcpy

sudo snap install flutter --classic

sudo snap install flutter-gallery

sudo snap install flokk-contacts

PPA (Personal Package Archives)

apt-cache search --names-only 'webp' | grep open

sudo apt install pavucontrol # Fix: hdmi sounds - accer notebook


which openssh-server || (sudo apt-get install openssh-server -y )

GNOME settings

gsettings set org.gnome.desktop.interface clock-show-seconds true

gsettings set org.gnome.desktop.interface clock-show-weekday true

Display live hosts on the network

nmap -sP "$(ip -4 -o route get 1 | cut -d ' ' -f 7)"/24 | grep report | cut -d ' ' -f 5-

DB Visualizer

cd ~/Downloads

wget https://www.dbvis.com/product_download/dbvis-11.0.3/media/dbvis_linux_11_0_3.deb

sudo dpkg -i dbvis_linux_11_0_3.deb

mysql-workbench

cd ~/Downloads

wget https://dev.mysql.com/get/Downloads/MySQLGUITools/mysql-workbench-community_8.0.20-1ubuntu20.04_amd64.deb

sudo dpkg -i mysql-workbench-community_8.0.20-1ubuntu20.04_amd64.deb

# Fix: dpkg: problemas com dependências

sudo apt-get -f install

Java

Oracle Java 11 e 14

https://launchpad.net/~linuxuprising/+archive/ubuntu/java

sudo add-apt-repository ppa:linuxuprising/java

sudo apt-get update

Java 8 a 14

sudo apt install openjdk-8-jdk

React use java 8

java -version
javac -version
which java
echo \$JAVA_HOME
update-alternatives --list java
update-alternatives --display java

sudo update-alternatives --config java # Escolha a devida opção

java -version

ls /usr/lib/jvm
ls /usr/lib/jvm/java-8-openjdk-amd64/bin

cat /etc/environment

echo \$(jrunscript -e 'java.lang.System.out.println(java.lang.System.getProperty("java.home"));')

echo 'System.out.println(java.lang.System.getProperty("java.home"));' | jshell -

adicionar

export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/"

export JAVA_HOME="\$(jrunscript -e 'java.lang.System.out.println(java.lang.System.getProperty("java.home"));')"

sudo nano /etc/environment

source /etc/environment

Homebrew - Package Manager for macOS (or Linux)

https://brew.sh/

/bin/bash -c "\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

echo '# Configure the Homebrew environment variable' >> ~/.profile
echo 'eval \$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)' >> ~/.profile

nano ~/.profile

Add Homebrew to your PATH

eval \$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)

- We recommend that you install GCC by running:

brew install gcc

Ainda não executei

For compilers to find [email protected] you may need to set:

export LDFLAGS="-L/home/linuxbrew/.linuxbrew/opt/[email protected]/lib"
export CPPFLAGS="-I/home/linuxbrew/.linuxbrew/opt/[email protected]/include"

For pkg-config to find [email protected] you may need to set:

export PKG_CONFIG_PATH="/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/pkgconfig"

https://facebook.github.io/watchman/docs/install/#installing-on-macos-or-linux-via-homebrew

brew update
brew install watchman

See: https://docs.brew.sh/Homebrew-and-Python

[email protected] is keg-only, which means it was not symlinked into /home/linuxbrew/.linuxbrew, because this is an alternate version of another formula.

If you need to have [email protected] first in your PATH run:

echo 'export PATH="/home/linuxbrew/.linuxbrew/opt/[email protected]/bin:\$PATH"' >> ~/.profile

For compilers to find [email protected] you may need to set:

export LDFLAGS="-L/home/linuxbrew/.linuxbrew/opt/[email protected]/lib"
export CPPFLAGS="-I/home/linuxbrew/.linuxbrew/opt/[email protected]/include"

For pkg-config to find [email protected] you may need to set:

export PKG_CONFIG_PATH="/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/pkgconfig"

watchman --version

brew list

ImageMagick

https://github.com/ImageMagick/ImageMagick/issues/396#issuecomment-602026541

update(s)

sudo apt update && sudo apt upgrade

flatpak update

sudo snap refresh

npm update --global

gem update --system

### pypi

https://pypi.org/

which pip
pip3 --help
pip3 --version

pip3 check
pip3 list
pip3 help install

python3 -m pip --version
python3 -m pip check
python3 -m pip list

Dica:

Após criar uma pasta e compartilhar pelo Nautilus só deve funcionar a autenticação após ser criado o devido usuário no Samba

sudo smbpasswd -a \$USER

Devilbox

http://devilbox.org/

Install

mkdir -p /home/marcio/dados/containers_docker

cd ~/dados/containers_docker

git clone https://github.com/cytopia/devilbox.git

cd devilbox
ls

wget https://gist.githubusercontent.com/mozgbrasil/bce7f1318cc3bc762db4319cc474ee59/raw/e2e0a21588b1d1528f577c8dd1b526edde45aeb1/.env

wget docker-compose.yml https://gist.githubusercontent.com/mozgbrasil/bce7f1318cc3bc762db4319cc474ee59/raw/e2e0a21588b1d1528f577c8dd1b526edde45aeb1/docker-compose.yml

docker-compose up

Virtual Hosts

mkdir -p ~/dados/mount/www/localhost/htdocs/

sudo nano /etc/hosts
127.0.0.1 localhost.loc

cd ~/dados/mount/www/localhost/htdocs/

ln -s /home/marcio/dados/projects

echo "<?php phpinfo(); ?>" > phpinfo.php

cat > .htaccess <<- _EOF_

# enable directory browsing

Options +Indexes
_EOF_

Update

cd ~/dados/containers_docker

mkdir tmp
mv devilbox tmp/\$(date '+%Y-%m-%d')-devilbox

git clone https://github.com/cytopia/devilbox.git

diff --brief --recursive tmp/\$(date '+%Y-%m-%d')-devilbox devilbox

meld tmp/\$(date '+%Y-%m-%d')-devilbox devilbox

Commands

cd ~/dados/containers_docker/devilbox
docker-compose down --remove-orphans
docker-compose up

docker --version && docker images && docker images -a && docker images ps && docker ps && docker ps -a && docker network ls

docker stats --all

docker stop \$(docker ps -a -q) #stop ALL containers

docker rm -f \$(docker ps -a -q) # remove ALL containers

sudo netstat -tulpn # To list open ports use the netstat command

service --status-all
sudo service mysql stop
sudo service apache2 stop
sudo service php7.2-fpm stop

git rev-parse HEAD
id
ls -lah
ls -la data/www
docker-compose up

./shell.sh # Enter the container
cd /shared/httpd/localhost/htdocs/projects/magento2

rm composer.lock
mv composer.json composer-bkp.json
ls
composer create-project --repository=https://repo.magento.com/ magento/project-community-edition magento2 -vvv

Fix: tail: recursos esgotados do inotify, tail: inotify não pôde ser usado; revertendo para sondagem (polling)

cat /proc/sys/fs/inotify/max_user_instances # 128
cat /proc/sys/fs/inotify/max_user_watches # 8192
sudo sysctl -w fs.inotify.max_user_instances=12345
sudo sysctl -w fs.inotify.max_user_watches=640123

Sobre o Ubuntu

Para começar a atualização do Ubuntu do sistema, primeiro precisamos atualizar a lista de índice de pacotes. Abra o terminal e digite:

sudo apt update

Podemos instalar a atualização para todos os pacotes de uma só vez: A forma a seguir vai atualizar todas as versões dos pacotes instalados, sem remover pacotes.

sudo apt upgrade

Tudo feito. Seu sistema Ubuntu agora está totalmente atualizado.

Durante a atualização inicial do sistema, alguns dos pacotes podem se tornar obsoletos e, portanto, não são mais necessários. Para remover todos os pacotes desnecessários, execute:

sudo apt autoremove

Para analise do Kernel

dmesg

Para analise da Bios

sudo dmidecode -t bios

UFW ( Uncomplicated Firewall ) é um firewall padrão no Ubuntu 18.04 Bionic Beaver Linux.

Por padrão, o UFW está desativado. Você pode verificar o status do seu firewall executando o seguinte comando:

sudo ufw status

Para habilitar a execução do firewall:

sudo ufw enable

Sincronia para espelhar discos

–archive archive mode; equals -rlptgoD (no -H,-A,-X) –update skip files that are newer on the receiver –compress compress file data during the transfer –delete delete extraneous files from destination dirs –verbose increase verbosity –progress show progress during transfer

rsync –archive –update –compress –delete –verbose –progress /home/marcio/Downloads/ /media/marcio/HDD/Downloads/

rsync –archive –update –compress –delete –verbose –progress /home/marcio/dados/ /media/marcio/HDD/dados/

Sincronia entre maquinas locais

rsync –archive –compress –verbose –progress /home/marcio/dados/projects/ [email protected]:/home/marcio/dados/projects/

rsync –archive –compress –verbose –progress /media/marcio/HDJMicron/videos/ [email protected]:/media/marcio/HDD/videos/

rsync -Pav -e “ssh -i $HOME/.ssh/aws-eb” [email protected]:/var/app/current/ /home/marcio/Downloads/070024

Sincronia entre maquinas e dispositivo USB

Será copiado a devida pasta para o diretório

rsync –archive –compress –verbose –progress ~/dados/projects /media/marcio/usb-ext4/dados/

rsync –archive –compress –verbose –progress ~/dados/projects /media/marcio/Expansion\ Drive/MeusBackups/dados/projects-2019-10-07/

rsync -av –progress ~/Imagens /media/marcio/Expansion\ Drive/MeusBackups/backup_inspiron_7520_01052019/ rsync -av –progress ~/Downloads /media/marcio/Expansion\ Drive/MeusBackups/backup_inspiron_7520_01052019/ rsync -av –progress ~/dados /media/marcio/Expansion\ Drive/MeusBackups/backup_inspiron_7520_01052019/

rsync -av –progress /media/marcio/HDJMicron/2020-04-23/marcio-Inspiron-5548/dados/projects /home/marcio/dados/

Download via SCP “Secure Copy”

scp -r [email protected]:/home/marcio/Imagens/ /home/marcio/Imagens/

Upload via SCP “Secure Copy”

scp -r /home/marcio/Downloads/ [email protected]:/home/marcio/Downloads/

Como criar a SSH Key

ssh-keygen -t rsa

Como obter a SSH Key

cat ~/.ssh/id_rsa.pub

Efetuar login no SSH com chave ppk

https://askubuntu.com/questions/818929/login-ssh-with-ppk-file-on-ubuntu-terminal

sudo apt-get install putty-tools

puttygen yourkey.ppk -O private-openssh -o yourkey.pem

chmod 400 yourkey.pem

ssh -i yourkey.pem [email protected]

Conectar via SFTP pelo nautilus

sftp://[email protected]

###Conectar via Samba pelo nautilus

smb://192.168.0.4

Conectar via ssh pelo terminal

ssh [email protected]

Obter a versão do PHP via terminal

php -r \@phpinfo()\; grep ‘PHP Version’ -m 1
php -i grep ‘PHP Version’ -m 1

Execução comando condicional em linha

sh -c ‘if [ “$TRAVIS_PHP_VERSION” = “5.4” ]   [ “$TRAVIS_PHP_VERSION” = “5.5” ]; then echo ‘0’; else echo ‘1’; fi;’

How to check if php-fpm is running

php-fpm –test php-fpm

ps aux grep php-fpm

netstat -lntp

to see which group the current user belongs to:

groups groups marcio

to list the group members along with their GIDs.

id $USER

Visualizar erros do servidor

No terminal pode ser o comando para a visualização do log de erro do servidor

tail -f /var/log/apache2/error.log

Remote

telnet 172.16.238.10 3306 # mysql

telnet 172.16.238.10 5432 # pgsql

telnet localhost 27017 # mongodb

curl –connect-timeout 10 –silent –show-error 0.0.0.0:27017

curl –connect-timeout 10 –silent –show-error 172.19.0.20:27017

Monitorando MySQL

Na necessidade de acessar o MySQL Client e ver os processos

mysql -h ‘172.16.238.10’ -u root -p

show processlist;

ou melhor ainda

mysqladmin -u root -p -i 1 processlist

mysql config

mysql -h ‘127.0.0.1’ -P ‘3306’ -u ‘root’ -p’12345’ -e “SHOW GLOBAL VARIABLES LIKE ‘innodb_buffer_pool_size’;”

mysql –help

sudo echo “innodb_buffer_pool_size = 8M” » /etc/mysql/mysql.conf.d/mysqld.cnf

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

cat /etc/mysql/mysql.conf.d/mysqld.cnf

sudo systemctl status mysql sudo systemctl restart mysql

mysql -h ‘127.0.0.1’ -P ‘3306’ -u ‘root’ -p’12345’ -e “SHOW GLOBAL VARIABLES LIKE ‘innodb_buffer_pool_size’;”

Recursively fix bad file permissions

A common suggestion is to use which means:

755 for directories: full control for the user, and everyone else can traverse directories.

644 for files: read-write permissions for the user, and read-only for everyone else.

find /home/marcio/dados/projects/ -not ( -wholename “.git” -prune ) -type f -exec echo [email protected] {} \;

find /home/marcio/dados/projects/ -not ( -wholename “.git” -prune ) -type d -exec echo [email protected] {} \;

find /home/marcio/dados/projects/ -not ( -wholename “.git” -prune ) -type f -exec chmod 644 {} \;

find /home/marcio/dados/projects/ -not ( -wholename “.git” -prune ) -type d -exec chmod 755 {} \;


### NVM

# https://github.com/rvm/ubuntu_rvm

```bash
sudo apt install software-properties-common libpq-dev git

git --version

After install

rvm info
rvm gemset list

which ruby
ruby --version

ruby -e 'puts Gem.default_dir'

gem --version
gem env
gem list

diffuse

sudo add-apt-repository ppa:nrbrtx/python2-stuff
sudo apt-get update
sudo apt-get install diffuse

Node.js

NVM - Node Version Manager

# https://www.npmjs.com/
# https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
# Global Modules without sudo

# https://github.com/nvm-sh/nvm#installing-and-updating

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash

command -v nvm
nvm ls

nvm install v12.18.3 # (Latest LTS: Erbium)

nvm run node --version
node -v
npm -v

npm config list
npm list -g --depth 0

ncu --global
npm update --global # --unsafe-perm

npm list --depth 0

npm install -g nodemon
npm install -g gulp
npm install -g create-react-app
npm install -g lerna
npm install -g npm-check-updates
npm install -g eslint
npm install -g prettier
npm install -g @prettier/plugin-php
npm install -g typescript

npm install -g concurrently
npm install -g expo-cli
npm install -g express-generator
npm install -g npm-audit-resolver
npm install -g npm-check
npm install -g pm2
npm install -g react-devtools
npm install -g react-native-cli
npm install -g syncpack
npm install -g ts-node
npm install -g web-ext

npx "<LIBRARY>"

yarn


# https://classic.yarnpkg.com/en/docs/install#debian-stable

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -

echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

sudo apt-get update && sudo apt-get install yarn

node -v

yarn -v

yarn config list

yarn config set workspaces-experimental true

Jekyll

# Run Jekyll

cd ~/dados/projects/mozgbrasil.github.io

bundle -v

bundle install

jekyll -v

JEKYLL_ENV=production bundle exec jekyll serve --watch --verbose

flathub

https://flathub.org/

flatpak install flathub com.github.huluti.ImCompressor

flatpak install flathub com.github.micahflee.torbrowser-launcher

flatpak install flathub com.obsproject.Studio

flatpak install flathub org.audacityteam.Audacity

flatpak install flathub org.avidemux.Avidemux

flatpak install flathub org.wireshark.Wireshark

sudo usermod -a -G wireshark $USER