6/25/20

Install TensorFlow on Jetson Xavier




Installing Dependencies

sudo apt update
sudo apt install libhdf5-serial-dev hdf5-tools libhdf5-dev zlib1g-dev zip libjpeg8-dev liblapack-dev libblas-dev gfortran

sudo apt install python3-dev 
sudo apt install python3-pip
sudo pip3 install -U pip testresources setuptools

sudo pip3 install -U numpy==1.16.1 future==0.17.1 mock==3.0.5 h5py==2.9.0 keras_preprocessing==1.0.5 keras_applications==1.0.8 gast==0.2.2 futures protobuf pybind11


Installing TensorFlow

sudo pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v44 tensorflow

sudo pip3 install --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v42 tensorflow-gpu

4/22/20

Install and Deploy Kubernetes on Ubuntu


# Install Docker

sudo apt-get -y remove docker docker-engine docker.io containerd runc
sudo apt-get -y update
sudo apt-get install -y 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 add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get -y update
sudo apt-get -y install docker-ce docker-ce-cli containerd.io
sudo usermod -a -G docker $USER


# Install Kubernetes

sudo apt-get update && sudo apt-get install -y apt-transport-https
sudo curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt-add-repository "deb http://apt.kubernetes.io/ kubernetes-xenial main"
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl kubernetes-cni

# Disable swap memory

sudo swapoff -a

# Initialize Kubernetes

sudo kubeadm init --pod-network-cidr=192.168.0.0/16

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

sudo kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

# Join Nodes

kubeadm join 192.168.0.10:6443 --token e8dzsm.gtyjl7vlyljn3xyd \
--discovery-token-ca-cert-hash sha256:d6ad7ec4f706b394b0a01b6cba229ab100bc903fdaa33463482e28df5fc28e97

# Get List of Nodes

sudo kubectl get nodes

3/6/20

Kubernetes TLS certificate errors


Error:
Unable to connect to the server: x509: certificate signed by unknown authority

Fix:
unset KUBECONFIG
export KUBECONFIG=/etc/kubernetes/admin.conf

mv  $HOME/.kube $HOME/.kube.bak
mkdir $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

Sudo without password in Ubuntu/Debian



sudo visudo
user ALL=(ALL) NOPASSWD:ALL

3/5/20

MacOS Connect to KVM

Install:
brew tap jeffreywildman/homebrew-virt-manager
brew install virt-manager virt-viewer libvirt

Fix error (g-io-error-quark: Error opening file /usr/local/Cellar/libosinfo/1.7.1/share/libosinfo/pci.ids: No such file or directory (1)):

mkdir -p /usr/local/Cellar/libosinfo/1.7.1/share/libosinfo/
cd /usr/local/Cellar/libosinfo/1.7.1/share/libosinfo/
wget https://pci-ids.ucw.cz/v2.2/pci.ids
wget http://www.linux-usb.org/usb.ids

Copy ssh key:
ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]_address

Connect:
virt-manager -c 'qemu+ssh://[email protected]_address/system?socket=/var/run/libvirt/libvirt-sock'

9/5/19

Migrating Local Mongo to MongoDB Atlas



Stop database writes
#> mongo --host=localhost --eval "db.fsyncLock()"

Back up the data from the localhost database
#> mongodump --host=localhost --port=27017

Write the data to MongoDB Atlas
#> mongorestore --ssl --host cluster0-shard-00-00-qfovx.mongodb.net --port 27017 -u user -p password dump

6/14/19

uWSGI with Python 3.7 in Ubuntu 18

Packages
sudo apt install python3.7 python3.7-dev uwsgi uwsgi-src uuid-dev libcap-dev libpcre3-dev

Build
cd ~
export PYTHON=python3.7
uwsgi --build-plugin "/usr/src/uwsgi/plugins/python python37"

Install
sudo mv python37_plugin.so /usr/lib/uwsgi/plugins/python37_plugin.so
sudo chmod 644 /usr/lib/uwsgi/plugins/python37_plugin.so

10/16/18

SSLError(SSLError(1, u'[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:661)'),))

pip install pyOpenSSL
pip install ndg-httpsclient
pip install pyasn1

or

easy_install pyOpenSSL
easy_install ndg-httpsclient
easy_install pyasn1

9/28/18

Enable and use the RabbitMQ management console

sudo rabbitmq-plugins enable rabbitmq_management
sudo chown -R rabbitmq:rabbitmq /var/lib/rabbitmq/

sudo rabbitmqctl add_user mqadmin password
sudo rabbitmqctl set_user_tags mqadmin administrator
sudo rabbitmqctl set_permissions -p / mqadmin ".*" ".*" ".*"

http://Server-IP:15672/

9/18/18

Docker VPN

Create digitalocean docker droplet

Run:
CID=$(docker run -d --restart=always --privileged -p 1194:1194/udp -p 443:443/tcp umputun/dockvpn)

docker run -t -i -p 8080:8080 --volumes-from $CID umputun/dockvpn serveconfig

Download vpn config: 
https://<server_ip>:8080/

Download vpn client:

MacOS:
https://code.google.com/p/tunnelblick/wiki/DownloadsEntry#Tunnelblick_Stable_Release

Other:
https://openvpn.net/