domingo, 22 de agosto de 2021

Cinnamon Installer for Ubuntu Minimal



#!/bin/bash
#Cinnamon Installer for Ubuntu Minimal 18.04 (works also on 20.04)

clear
echo "Cinnamon Installer for use with Ubuntu Minimal / Ubuntu Server"
sudo apt-get -y update
sudo apt-get -y install software-properties-common
sudo add-apt-repository ppa:embrosyn/cinnamon
sudo apt-get -y update
sudo apt-get -y dist-upgrade
sudo apt-get -y install xorg dkms
sudo apt-get -y install cinnamon network-manager upower acpi-support synaptic
sudo apt-get -y install lightdm lightdm-gtk-greeter --no-install-recommends 
sudo apt-get -y install gnome-system-monitor
# Sources & Drivers GUI configuration
sudo apt-get -y install software-properties-gtk

#Sound Install
sudo apt-get -y install alsa

# Optionals
sudo apt-get -y install virtualbox-guest-dkms virtualbox-guest-x11 virtualbox-guest-utils 
sudo apt-get -y install chromium-browser

# Upgrade it with
sudo do-release-upgrade

# Source: https://quidsup.net/sh/cinnamon.sh

segunda-feira, 5 de julho de 2021

Using ssh key for authorization

First, generate your key: 
ssh-keygen
Then copy the key around on your servers/desktops: 
ssh-copy-id -i .ssh/id_rsa.pub user@ip-address 
That's all. You will never be asked for the password again. 
I also recommend removing password authorization in general but that's up to you.

terça-feira, 22 de junho de 2021

Copy or export Remmina remote desktop files to another Ubuntu install

Backup with: 
$ cd ~ $ tar -czf remmina_backup.tgz .local/share/remmina/ .config/remmina/ .local/share/keyrings .ssh/

Restore with: 
$ cd ~ $ tar -xf remmina_backup.tgz

 

Source

sábado, 6 de fevereiro de 2021

Debian server configurator



curl -s -L https://gist.githubusercontent.com/cmadera/6c2d0bab1560cd04a49e4adc53ff3dc1/raw/59686f48e573ec0c56a3c27afa479d5402002281/first-setup.sh | bash


or


rm first-setup.sh
cat > first-setup.sh << "EOF"
#!/bin/bash

echo "source: https://opensource.com/article/20/1/improve-bash-scripts"
if [ "$USER" != 'root' ]; then
     echo "Sorry, this script must be run as root and you are $USER"
     exit 1
fi

read -p "enter a user please:" USERNAME
echo $user
read -p "enter a password please:" PASSWORD
echo $password

##########################
echo "Setup UPGRADE"
apt update -y && apt upgrade -y
apt install sudo

##########################
echo "Create user"
read -p "Add new User? [Y/n]: " answuser
 if [ "$answuser" == 'y' ]; then
  useradd -m -p $(openssl passwd -1 ${PASSWORD}) -s /bin/bash -G sudo ${USERNAME}
  echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
 fi

##########################
echo "Setup SSH Config"
read -p "Apply ssh security? [Y/n]: " answsec
 if [ "$answsec" == 'y' ]; then
    ### SSH Config
    cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bkp
    sed '/MaxAuthTries/d' /etc/ssh/sshd_config.bkp > /etc/ssh/sshd_config
    echo "MaxAuthTries 3" >> /etc/ssh/sshd_config
    grep "^MaxAuthTries" /etc/ssh/sshd_config

    cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bkp
    sed '/PermitRootLogin/d' /etc/ssh/sshd_config.bkp > /etc/ssh/sshd_config
    echo "PermitRootLogin no" >> /etc/ssh/sshd_config
    grep "^PermitRootLogin" /etc/ssh/sshd_config

    /etc/init.d/ssh restart
 fi

##########################
echo "Install Basics"
apt install -y curl git net-tools build-essential tmux screen
apt install -y neofetch
apt install -y cockpit

##########################
echo "Setup .bash_aliases"
if [ "$answuser" == 'y' ]; then
    if [ -f /home/${USERNAME}/.bash_aliases ]; then
        rm /home/${USERNAME}/.bash_aliases
    fi

    echo "alias get='sudo apt-get install -y'" >> /home/${USERNAME}/.bash_aliases 
    echo "alias df='df -h'" >> /home/${USERNAME}/.bash_aliases 
    echo "alias ls='ls -la'" >> /home/${USERNAME}/.bash_aliases 
    echo "alias upgrade='sudo apt-get update -y && sudo apt-get full-upgrade -y && sudo apt-get autoremove -y'" >> /home/${USERNAME}/.bash_aliases 
    echo "alias cdwww='cd /var/www/html'" >> /home/${USERNAME}/.bash_aliases 
    echo "alias myip='curl ifconfig.me'" >> /home/${USERNAME}/.bash_aliases 
    echo "alias version='lsb_release -a'" >> /home/${USERNAME}/.bash_aliases 

    sudo chown ${USERNAME}:${USERNAME} /home/${USERNAME}/.bash_aliases
fi

EOF

bash first-setup.sh

domingo, 26 de julho de 2020

Install MySQL on Debian

# Check here: https://dev.mysql.com/downloads/repo/apt/
wget http://repo.mysql.com/mysql-apt-config_0.8.16-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.16-1_all.deb
sudo apt update 
sudo apt install mysql-server
sudo systemctl restart mysql
sudo mysql_secure_installation
mysql -u root -p

Install PHP 7.3 on Debian 9 / Debian 8




sudo apt -y install lsb-release apt-transport-https ca-certificates 
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php7.3.list
sudo apt update
sudo apt -y install php7.3

Common Alias

For Debian

vi .bashrc
alias get='sudo apt-get install -y'
alias df='df -h'
alias ls='ls -la'
alias upgrade='sudo apt-get update -y && sudo apt-get autoremove -y'
alias cdwww='cd /var/www/html'
alias myip='curl ifconfig.me'
alias version='lsb_release -a'

For CentOS

vi .bashrc
alias get='sudo yum install -y'
alias df='df -h'
alias ls='ls -la'
alias upgrade='sudo yum update -y'
alias cdwww='cd /var/www/html'
alias myip='curl ifconfig.me'
alias version='hostnamectl'