Custom Search

Sunday, May 24, 2020

How to Install and Setup Django on Ubuntu 20.04 18.04

sudo apt-get python3-pip

python3 -V
pip3 -V

pip3 install django
ls /home/anna/.local/bin
export PATH=$PATH:/home/anna/.local/bin
django-admin --version

django-admin startproject myapp
cd myapp
python3 manage.py migrate

python3 manage.py createsuperuser

vi myapp/settings.py
ALLOWED_HOSTS = ['ip-address-of-server']

python3 manage.py runserver 0.0.0.0:8000

How to Install Certbot and Generate Let’s Encrypt SSL or TLS Certificate on Ubuntu 20.04 18.04

sudo apt install certbot
#sudo apt install python3-certbot-nginx
#sudo apt install python3-certbot-apache

#sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email you@mail.com -d mydomain.com
#sudo certbot-auto certonly --standalone -d mydomain.com  -d www.mydomain.com

#ls /etc/letsencrypt/live/mydomain.com
#fullchain.pem
#privkey.pem

#vi /etc/nginx/sites-available/mydomain.conf
#ssl on;
#ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem;
#ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem;

--nginx: Use the nginx plugin.
--apache: Use the Apache plugin.
--agree-tos: Agree to terms of service.
--redirect: Force HTTPS by 301 redirect.
--hsts: Add the Strict-Transport-Security header to every HTTP response. Forcing browser to always use TLS for the domain. Defends against SSL/TLS Stripping.
--staple-ocsp: Enables OCSP Stapling. A valid OCSP response is stapled to the certificate that the server offers during TLS.


Saturday, May 9, 2020

python distutils get_command_list

>>> from distutils import dist
>>> p = dist.Distribution()
>>>
>>>
>>> p.get_command_list()
[('build', 'build everything needed to install'), ('build_py', '"build" pure Python modules (copy to build directory)'), ('build_ext', 'build C/C++ extensions (compile/link to build directory)'), ('build_clib', 'build C/C++ libraries used by Python extensions'), ('build_scripts', '"build" scripts (copy and fixup #! line)'), ('clean', "clean up temporary files from 'build' command"), ('install', 'install everything from build directory'), ('install_lib', 'install all Python modules (extensions and pure Python)'), ('install_headers', 'install C/C++ header files'), ('install_scripts', 'install scripts (Python or otherwise)'), ('install_data', 'install data files'), ('sdist', 'create a source distribution (tarball, zip file, etc.)'), ('register', 'register the distribution with the Python package index'), ('bdist', 'create a built (binary) distribution'), ('bdist_dumb', 'create a "dumb" built distribution'), ('bdist_rpm', 'create an RPM distribution'), ('bdist_wininst', 'create an executable installer for MS Windows'), ('upload', 'upload binary package to PyPI'), ('check', 'perform some checks on the package')]
>>>
>>>

How to Deploy App on Minikube

curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get-helm-3 > get_helm.sh
chmod 700 get_helm.sh
./get_helm.sh

helm repo list
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo list
helm install redis bitnami/redis

helm delete redis
helm repo remove bitnami

How to Install Minikube on Ubuntu 20.04 18.04

Install VirtualBox:
sudo apt-get install -y virtualbox

Install kubelet:
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.5.1/bin/linux/amd64/kubectl
chmod +x kubectl
sudo mv kubectl /usr/local/bin/kubectl

curl -Lo minikube https://github.com/kubernetes/minikube/releases/download/v1.9.2/minikube-linux-amd64
chmod +x minikube
sudo mv minikube /usr/local/bin/

minikube start --vm-driver virtualbox

Show minikube cluster IP
minikube ip

kubectl get pods --all-namespaces
kubectl config view
minikube addons list

Stopping a Cluster Minikube
minikube stop

minikube delete

Minikube Logs
minikube logs

Dashboard
minikube dashboard

minikube version

How to Install Helm with Minikube

curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get-helm-3 > get_helm.sh
chmod 700 get_helm.sh
./get_helm.sh

helm repo list
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo list
helm install redis bitnami/redis

helm delete redis
helm repo remove bitnami

Friday, May 8, 2020

How to Uninstall Docker or Docker CE on Ubuntu 20.04

sudo apt-cache policy docker*
sudo apt-cache policy docker.io
sudo apt purge docker.io
sudo apt autoremove


sudo apt-cache policy docker*
sudo apt-cache policy docker-ce
sudo apt purge docker-ce
sudo apt autoremove

How to Install docker on Ubuntu 20.04

sudo apt update
sudo apt install docker.io
sudo systemctl enable --now docker
sudo systemctl start docker
sudo systemctl status docker
docker --version
docker run hello-world

How to Install Docker CE on Ubuntu 20.04

sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo bash -c 'echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu eoan stable" > /etc/apt/sources.list.d/docker-ce.list'

sudo apt-get update
sudo apt-cache policy docker-ce
sudo apt-get install -y docker-ce
sudo systemctl status docker