xvno / blog

个人博客, 不定期发布技术笔记和个人随笔.
0 stars 0 forks source link

Xnix: Ubuntu: Tips #96

Open xvno opened 4 years ago

xvno commented 4 years ago

工具 & 命令

工具

zsh

Mdf: /etc/zsh/*, Add OPATH Mdf: ~/.zshrc, PATH=$OPATH:...

xclip

apt; xclip file_name xclip -sel clip file_name # -sel clip 系统剪贴板 tail -n 20 error.log | xclip -sel clip

命令

xvno commented 4 years ago

openssh-server

# install
sudo apt install openssh-server -y

# enables the service
sudo systemctl enable ssh

# start service
sudo systemctl start ssh

# configure ufw
sudo ufw allow ssh
xvno commented 4 years ago

Create a bootable ubuntu usb drive on MacOS

REF

Create bootable ubuntu usb drive mac os

步骤

xvno commented 4 years ago

ssh

为远程服务器添加公钥以方便登录

两种方式:

  1. cat ~/.ssh/id_ras.pub | ssh x@10.10.1.99 'cat >> /home/wei/.ssh/authorized_keys' # authorized_keys在ubuntu上是个文件, 而非文件夹

  2. ssh-copy-id -i ~/.ssh/id_ras.pub x@10.10.1.99

本地配置sshconfig, 方便实用别名ssh nuc


Host nuc
    User x
    HostName 10.10.1.99
    IdentityFile ~/.ssh/id_rsa
# 当 github 有俩账号时, 配置如下
# 另外, 还需更改 repo 的地址, 替换 github.com 为对应的 volving.github.com 或 xvno.github.com
Host xvno.github.com
    HostName github.com
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/x_github_rsa

Host volving.github.com
    HostName github.com
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/v_github_rsa

# git remote -v
# origin    git@xvno.github.com:xvno/blog.git (fetch)
# origin    git@xvno.github.com:xvno/blog.git (push)
# volving   git@volving.github.com:volving/blog.git (fetch)
# volving   git@volving.github.com:volving/blog.git (push)
# git push origin dev
# git push solving dev
xvno commented 4 years ago

Browsers ( Chrome, FireFox...)

Chrome

获取安装包安装: wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

xvno commented 3 years ago

Docker

1. Uninstall the Docker Engin, CLI, and Containerd package

sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get purge docker-ce docker-ce-cli containerd.io

Delete all images, containers, and volumes:

sudo rm -rf /var/lib/docker

2. Installing, two methods:

2.1. using script

curl -fsSL https://get.docker.com -o get-docker.sh
# sudo chmod 777 get-docker.sh
sudo sh get-docker.sh

2.2. using apt

2.2.1 update apt package index & install packages to allow apt to use a repository over HTTPS:
sudo apt update
apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common
2.2.2 Add Docker's official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Verify that you now have the key with the fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88, by searching for the last 8 characters of the fingerprint.

$ sudo apt-key fingerprint 0EBFCD88

pub   rsa4096 2017-02-22 [SCEA]
      9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid           [ unknown] Docker Release (CE deb) <docker@docker.com>
sub   rsa4096 2017-02-22 [S]
2.2.3 Set up the stabel repository
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
2.2.4 install docker engin
sudo install docker-ce docker-ce-cli containerd.io

3. 安装完成后, 将当前用户添加到docker组,拒绝 sudo docker ---

sudo usermod -aG docker $USER

MISC

docker login