2019年6月24日 星期一

VT-x is not available for VirtualBox in Windows 10

1. rum cmd as administrator
2. cmd: bcdedit /set hypervisorlaunchtype off
3. cmd: dism.exe /Online /Disable-Feature:Microsoft-Hyper-V
4. cmd: Dism /Online /Cleanup-Image /RestoreHealth
5. cmd: sfc /scannow
6. Close cmd
7. run PowerShell as Administrator
8. PowerShell: Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All
9. Restart














Refer to:
1. https://ugetfix.com/ask/how-to-disable-hyper-v-in-windows-10/




2019年3月15日 星期五

Passwordless SSH access

1. Check for existing SSH keys

# ls ~/.ssh


2. Generate new SSH keys

# ssh-keygen


3. Check for SSH keys

# ls ~/.ssh


4. Copy your pulic key to server

# ssh-copy-id <username>@<ip-address>

or

# cat ~/.ssh/id_rsa.pub | ssh <username>@<ip-address> 'mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys' 



Refer to:
1. https://www.raspberrypi.org/documentation/remote-access/ssh/passwordless.md
2. https://askubuntu.com/questions/46930/how-can-i-set-up-password-less-ssh-login

2019年3月7日 星期四

2019年3月4日 星期一

The default password of root for Centos 7.


There is no password. Password-based login as "root" is initially disabled. You need to login to to your default (admin) account using SSH and your key, and then run "sudo passwd root" to set a password on the "root" account. Otherwise you have to reset root password during reboot.

2019年2月25日 星期一

Linux dd command usages


dd 指令教學與實用範例,備份與回復資料的小工具 
Refer to: https://blog.gtwang.org/linux/dd-command-examples/
備份整顆硬碟
將 /dev/sda 所有的資料寫入 /dev/sdb:
sudo dd if=/dev/sda of=/dev/sdb conv=noerror,sync

建立硬碟的備份影像檔
sudo dd if=/dev/hda of=~/hdadisk.img

從備份影像檔回復硬碟資料
sudo dd if=hdadisk.img of=/dev/hdb

備份磁碟分割區
sudo dd if=/dev/hda1 of=~/partition1.img

兩個磁碟分割區對拷:
sudo dd if=/dev/sda1 of=/dev/sdb1 bs=4096 conv=noerror,sync

備份 CD/DVD 光碟
sudo dd if=/dev/cdrom of=tgsservice.iso bs=2048

備份 CD/DVD 光碟, 壓縮資料
sudo dd if=/dev/sda | gzip > sdadisk.img.gz

從壓縮過的影像檔回復資料
sudo gzip -dc sdadisk.img.gz | dd of=/dev/sda

Linux 使用 dd 指令將 ISO 檔製作成 Live USB 隨身碟
Refer to: https://blog.gtwang.org/linux/linux-dd-command-write-iso-to-usb-flash-drive/
umount /media/pi/disk
卸載後再次確認一下卸載的 USB 隨身碟是否正確:
lsblk
用 dd 指令將 Linux 的 ISO 映像檔寫入 USB 隨身碟
sudo dd if=ubuntu-16.10-desktop-amd64.iso of=/dev/sdc bs=1M

2018年12月7日 星期五

How to backup and restore (WSL) Windows Subsystem for Linux?

Backup WSL (Windows Subsystem for Linux)


Example: backup_wsl.sh
#! /bin/bash

cd /
tar vzcpf /mnt/i/tmp/ubuntu_`date +%Y%m%d_%H`.tar.gz \
    --exclude=/proc --exclude=/dev --exclude=/mnt --exclude=/media \
    --exclude=/lost+found  --exclude=/tmp --exclude=/sys  --exclude=/run / \
    > /mnt/i/tmp/ubuntu_`date +%Y%m%d_%H`.log \
    2> /mnt/i/tmp/ubuntu_`date +%Y%m%d_%H`.error


Restore WSL using lxrunoffline
# lxrunoffline run -n <distro name> -w
C:\wsl> lxrunoffline run -n mybackup  -w







Refer to:
1. https://superuser.com/questions/1164818/how-to-backup-wsl-linux-subsystem-for-windows-10-before-system-reset-or-reins

2018年12月6日 星期四

2018年8月20日 星期一

Create git repo


Server:
1. sudo rm -rf xxx_sdk
2. sudo git init --bare xxx_sdk
3. sudo chmod 775 -R xxx_sdk
4. sudo chown root:gitgrp -R xxx_sdk


Client:
1. git clone name@192.168.0.124:/home/repos/git/proj/xxx_sdk xxx_sdk
2. git add file
3. git commit -a
4. git push origin master:master