Skip to content

Instantly share code, notes, and snippets.

@Lakerfield
Last active October 11, 2017 12:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lakerfield/34a1ab93d2ed578de0f2d6fcc558cd85 to your computer and use it in GitHub Desktop.
Save Lakerfield/34a1ab93d2ed578de0f2d6fcc558cd85 to your computer and use it in GitHub Desktop.
Lakerfields cheat sheets

Multiple cheatsheets

  • cron
  • ssh
  • ubuntu updates
  • docker on azure

Fix for not working docker on ubuntu vm in azure with linux-azure kernel

https://www.mail-archive.com/ubuntu-bugs@lists.ubuntu.com/msg5257220.html

Users of docker on the linux-azure kernel are seeing errors similar to "fatal error: workbuf is empty" or “fatal error: unaligned sysUnused”. Hugepage configuration is the same for 4.4 and 4.11 kernels, so there may be a page alignment bug in the go library, the linux-azure kernel, or a dependent library.

https://www.neowin.net/news/canonical--microsoft-make-azure-tailored-linux-kernel

The new kernel package will be used by default in any Ubuntu 16.04 LTS image brought up from the Azure portal after the 21st of September. In order to check if you’re running the Azure kernel, get to the command line and run: uname -r, and the output should be something like 4.11.0-1011-azure, 'azure' is the key part of the string.

In order to revert to a standard kernel without the benefits listed above, enter the following commands in the terminal:

$ sudo apt install linux-virtual linux-cloud-tools-virtual
$ sudo apt purge linux*azure
$ sudo reboot

install docker on ubuntu

https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/#install-docker-ce

sudo apt-get update
sudo apt-get install \
  apt-transport-https \
  ca-certificates \
  curl \
  software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    
    Key fingerprint = 9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88

sudo add-apt-repository \
  "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) \
  stable"
sudo apt-get install docker-ce

sudo groupadd docker
sudo usermod -aG docker $USER

Find sha256 MD5 hash of ubuntu 16.04 host, to validate the certificate when connecting with ssh / putty

ssh-keygen -E md5 -lf /etc/ssh/ssh_host_ed25519_key.pub
# rsa key for putty
ssh-keygen -E md5 -lf /etc/ssh/ssh_host_rsa_key.pub

Generate RSA key

mkdir ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -b 2048 -t rsa

Setup ssh config for each host Copy ssh public key Allow only pubkey authentication

nano ~/.ssh/config
>>
Host <host>
    Hostname <ip>
    User <username>
    PubKeyAuthentication yes
    IdentityFile id_rsa
    ForwardX11 yes
    IdentitiesOnly yes
    ForwardAgent no


chmod 600 ~/.ssh/config
chmod 600 ~/.ssh/lakerfield_rsa


ssh-copy-id <username>@<host>

ssh <username>@<host>

sudo nano /etc/ssh/sshd_config

PubkeyAuthentication yes
RSAAuthentication yes

ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM no 

sudo service ssh restart

https://help.ubuntu.com/community/SSH/OpenSSH/Keys

create authorized_keys

mkdir ~/.ssh
touch ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
nano ~/.ssh/authorized_keys
# attach a new data disk on ubuntu vm in azure
https://docs.microsoft.com/en-us/azure/virtual-machines/linux/add-disk#connect-to-the-linux-vm-to-mount-the-new-disk
# mount azure file storage in ubuntu vm in azure
https://docs.microsoft.com/en-us/azure/virtual-machines/linux/mount-azure-file-storage-on-linux-using-smb
sudo apt-get install cifs-utils
sudo mount -t cifs //myaccount.file.core.windows.net/shared1 /data/shared1 -o vers=3.0,username=myaccount,password=XXX==,dir_mode=0777,file_mode=0777
/etc/fstab
//myaccount.file.core.windows.net/shared1 /data/shared1 cifs vers=3.0,username=myaccount,password=XXX==,dir_mode=0777,file_mode=0777

Update packages

apt-get update

apt-get dist-upgrade


sudo apt-get update && sudo apt-get dist-upgrade
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment