Apr 26, 2024

 

Installing multiple versions of python on linux using pyenv and create virtual environment.

python3 --version

 

 2. Install version 3.10.13 (chose the version you need)

cd
sudo apt install curl git gcc make libssl-dev libbz2-dev
sudo apt install  python3-setuptools
sudo apt install python3-pip
curl https://pyenv.run | bash
cd .pyenv/bin
./pyenv install --list
./pyenv install 3.10.13
cd ~/.pyenv/versions/3.10.13/bin/
./python3.10 --version

cd ~/.pyenv/versions/3.10.13/bin/
./python3.10 -m venv ~/.venv310


4. To activate virtual environment

cd
source .venv310/bin/activate
(.venv310):~$

 








 


Apr 25, 2024

 

Top 4 steps to secure debian / ubuntu

grep security /etc/apt/sources.list > /tmp/security.list
sudo apt-get upgrade -oDir::Etc::Sourcelist=/tmp/security.list'

 

apt-get install rsyslog
apt-get install fail2ban

 

vi /etc/myufw.sh

#!/bin/bash
ufw=/usr/sbin/ufw
$ufw disable
$ufw default deny incoming
$ufw default allow outgoing
$ufw allow ssh
$ufw allow https
$ufw allow 5000
$ufw allow 3000
$ufw allow 7000
$ufw - force enable

$sudo chmod +x /etc/myufw.sh

$ sudo chmod /etc/myufw.sh

$ sudo iptables -L -n

 

vi /etc/ssh/sshd_config and check following 2 lines
PasswordAuthentication no
PermitRootLogin no

$sudo systemctl restart ssh