воскресенье, 20 октября 2019 г.

Enable ssh (passwordless authentication) Linux


ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub | ssh   root@10.60.40.112 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
cat ~/.ssh/id_rsa.pub | ssh   root@10.60.40.113 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
cat ~/.ssh/id_rsa.pub | ssh   root@10.60.40.114 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
cat ~/.ssh/id_rsa.pub | ssh   root@10.60.40.115 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
cat ~/.ssh/id_rsa.pub | ssh   root@10.60.40.116 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
cat ~/.ssh/id_rsa.pub | ssh   root@10.60.40.117 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"

среда, 11 сентября 2019 г.

Git Cheat Sheet


SETUP
Configuring user information used across all local repositories

git config --global user.name “[firstname lastname]”
set a name that is identifiable for credit when review version history

git config --global user.email “[valid-email]”
set an email address that will be associated with each history marker

git config --global color.ui auto
set automatic command line coloring for Git for easy reviewing

SETUP & INIT
Configuring user information, initializing and cloning repositories

понедельник, 22 июля 2019 г.

Kubernetes - Delete CNI plugin





Weave
kubectl delete -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
rm /opt/cni/bin/weave-*

Flannel
kubectl delete -f https://raw.githubusercontent.com/coreos/flannel/bc79dd1505b0c8681ece4de4c0d86c5cd2643275/Documentation/kube-flannel.yml

среда, 19 июня 2019 г.

Kubernetes - Backup and Restore


How to backup and restore Kubernetes Cluster ?

Kurbernetes - Get the Join Command

Generate a new token:
sudo kubeadm token generate
List the tokens:
sudo kubeadm token list
Print the kubeadm join command to join a node to the cluster:
sudo kubeadm token create [token_name] --ttl 2h --print-join-command
Or...
*Get the Join Command in Kubernetes
kubeadm token create --print-join-command

Kubernetes - Drain, Uncordon, Delete Nodes


How to get out a node from a cluster for a maintenance ?

Upgrade Kubernetes Cluster


How to upgrade a Kubernetes Cluster?

понедельник, 10 июня 2019 г.

Install Kubernetes on CentOS 7

Installation and Setup

VMware VCSA Troubleshooting


Check if the service responds on port
telnet vcenter_fqdn 9443

Set new password for vcsa
/usr/lib/vmware-vmdir/bin/vdcadmintool

Set the new password to inventory service
/opt/likewise/bin/lwregshell
cd HKEY_THIS_MACHINE\services\vmdir\
set_value dcAccountPassword "new password"
quit

Restart all services
service-control --start --all

воскресенье, 2 июня 2019 г.

Как подготовиться к экзамену AWS Certified Solution Architect - Associate ?


1. Пройти курс на Linux Academy или aCloud.ru
    - люди говорят, что cloudguru лучше под сдачу экзамена заточен...
2. Пройти не только теорию, но и практические лабораторные в пункте 1
3. Выучить лимиты и "полезные табилцы"
    -
    - Cram карточки https://www.cram.com/flashcards/aws-10741536
      очень удобно на телефоне их решать.
4. Найти хорошие тесты, для практики.
    Мне посоветовали этие. И я очень доволен.
    https://www.udemy.com/DOJO
    https://www.udemy.com/SkillCertPro

пятница, 26 апреля 2019 г.

Install Jenkins CentOS 7.6

How to Install and Configure Jenkins

Install Jenkins
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
yum -y install jenkins

yum -y install java-1.8.0-openjdk

systemctl enable jenkins
systemctl start jenkins

yum -y install setroubleshoot-server selinux-policy-devel
sepolicy network -t http_port_t
semanage port -m -t http_port_t -p tcp 8080

Nginx Reverse Proxy config

Configure Jenkins

Jenkins User

cat /etc/passwd |grep jenkins
jenkins:x:998:996:Jenkins Automation Server:/var/lib/jenkins:/bin/false

change false to bash
vi /etc/passwd
jenkins:x:998:996:Jenkins Automation Server:/var/lib/jenkins:/bin/bash

set a password for jenkins
passwd jenkins
<enter your password>

su - jenkins

ssh-keygen
ssh-copy-id jenkins@localhost

visudo

   after
root    ALL=(ALL)       ALL
   add
jenkins ALL=(ALL)       NOPASSWD: ALL



среда, 24 апреля 2019 г.

Docker LA


docker node inspect --pretty NODEID
docker node demote NID

CheatSheet
https://www.docker.com/sites/default/files/Docker_CheatSheet_08.09.2016_0.pdf

docker commit -m "COMMENTs" -a "author" nasty_girl tcox/ubusshd:v1

DockerFile
#Custom Ubuntu image with SSH installed

FROM ubuntu:xenial
MAINTAINER ryanblack <ryanblack@inbox.ru>
RUN apt-get update
RUN apt-get install -y telnet openssh-server

воскресенье, 14 апреля 2019 г.

понедельник, 18 марта 2019 г.

UniFi Controller Setup for Ubiquiti Access Points

How to set up a UniFi controller and add WiFi Access Points to it.
Controller is available for Windows, as well as for Linux.

Install UniFi controller


Download and install the controller for you OS
https://www.ui.com/download/unifi

Setup you Access Point

Before you start the access point, you have to setup special DHCP settings on your router or DHCP server you have. You´ll need the MAC-address of your Access Point. On the Acccess Point's back you'll find smth linke 1709KF09FC27CEF1E-IZSvX6 - the MAC part is: F09F C27C EF1E
Convert it into Cisco format:
just add 01 + MAC (and place the dots in the proper positions) - 01f0.9fc2.7cef.ef

Cisco DHCP setup for your Access Points.
ip dhcp pool UniFi411
   host 192.168.4.11 255.255.255.0 - IP Адрес для ваше точки доступа
   client-identifier 01f0.9fc2.7cef.ef   - MAC точки доступа
   client-name UniFi411                    - Имя, на ваше усмотрение
   option 43 hex 0104.c0a8.033a     - Адрес UniFi контроллера

Convert the IP into HEX format (for 43 dhcp option):

After the Access Point will appear in your UniFi controller - click Adopt.

Reset to Factory Defaults

1) Connecto over SSH to the Access Point and execute:
     syswrapper.sh restore-default
OR
2) Press Reset button on AP's back more than 5 sec. Sometimes you need firstly shutdown the access point, press Reset, turn on the AP back, wait more than 5 seconds, then release Reset button.

воскресенье, 10 марта 2019 г.

Install Docker on Ubuntu/Debian

Installation steps Ubuntu/Debian
#apt-get install apt-transport-https ca=certificates curl software-properties-common

Configure repository
#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"

#apt-get update

Install Docker
#apt-get install docker-ce

пятница, 8 марта 2019 г.

Get a Dockerfile from an Image

docker history --no-trunc [IMAGE]| tac | tr -s ' ' | cut -d " " -f 5- | sed 's,^/bin/sh -c #(nop) ,,g' | sed 's,^/bin/sh -c,RUN,g' | sed 's, && ,\n  & ,g' | sed 's,\s*[0-9]*[\.]*[0-9]*[kMG]*B\s*$,,g' | head -n -1

воскресенье, 3 марта 2019 г.

Install Docker Compose

yum install epel-release
yum -y install python-pip
pip install --upgrade-pip
pip install --upgrade pip
pip install docker-compose

воскресенье, 24 февраля 2019 г.

Docker installation CentOS 7


yum -y install yum-utils lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum -y update
yum -y install docker-ce
systemctl enable docker && systemctl start docker && systemctl status docker

docker images

ls -al /var/run/docker.sock
srw-rw---- 1 root docker 0 Feb 22 06:10 /var/run/docker.sock

adding a user a right to work with docker
usermod -aG docker user


All Docker files:
/var/lib/docker


Error on Registry Deployment (IPtables):
 docker run -d -p 5000:5000 -v /root/certs:/certs -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/dockerrepo.crt -e REGISTRY_HTTP_TLS_KEY=/cert/dockerrepo.key -v /root/auth:/auth -e REGISTRY_AUTH=htpasswd -e REGISTRY_AUTH_HTPASSWD_REALM="Registry Realm" -e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd registry:2
0e38a074708e3113cd207fa83d72d90e41374b7643e73e21dbb3cf6d88abd3fa
docker: Error response from daemon: driver failed programming external connectivity on endpoint elegant_hugle (6f83023f4c9f4cf2910b77ddd1c3227e29988e3dfb16f850d4dc7e74c8304638):  (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 5000 -j DNAT --to-destination 172.17.0.2:5000 ! -i docker0: iptables: No chain/target/match by that name.
 (exit status 1)).

Solution:
iptables -t filter -F
iptables -t filter -X
systemctl restart docker


Run Ansible in VSCode on Windows 10 (via WSL + Terminal + pip)

Short instruction how to setup VSCode to execute Ansible playbooks directly from Terminal

воскресенье, 13 января 2019 г.

воскресенье, 6 января 2019 г.

Virtual Host for OwnCloud SSL LetsEncrypt (Dehydrated, Apache)



/etc/httpd/conf.d/owncloud.conf

<VirtualHost *:80>
    ServerName DOMAIN.COM
        DocumentRoot /var/www/html/owncloud

        <Directory /var/www/html/owncloud>
                AddDefaultCharset UTF8
                AllowOverride All
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog /var/log/disk-error.log
        CustomLog /var/log/disk-requests.log combined

        Alias /.well-known/acme-challenge/ /var/www/html/le/.well-known/acme-challenge/