chore:同步
This commit is contained in:
commit
dc62ff9822
44
_posts/Linux/docker/clear-docker.md
Normal file
44
_posts/Linux/docker/clear-docker.md
Normal file
@ -0,0 +1,44 @@
|
||||
---
|
||||
title: 完全清除docker
|
||||
date: 2022-10-07
|
||||
tags: Ubuntu
|
||||
---
|
||||
|
||||
目前开发的笔记本使用的是ubuntu22.04.1 桌面版本,docker-desktop 正好有桌面版本,所以安装桌面版本比较合适。这边小记一下如何清除已有老旧docker,**注意这里是完全清除老旧docker,原来的image和容器都会被清理!**
|
||||
|
||||
|
||||
# 步骤如下:
|
||||
|
||||
|
||||
## 删除某软件及其安装时自动安装的所有包
|
||||
```sh
|
||||
sudo apt-get autoremove docker docker-ce docker-engine docker.io containerd runc
|
||||
```
|
||||
## 删除无用的相关的配置文件
|
||||
```sh
|
||||
dpkg -l | grep docker
|
||||
dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
|
||||
```
|
||||
|
||||
## 卸载没有删除的docker相关插件,比如
|
||||
```
|
||||
sudo apt-get autoremove docker-ce-*
|
||||
```
|
||||
|
||||
## 删除docker的相关配置,命令如:
|
||||
```sh
|
||||
sudo rm -rf /etc/systemd/system/docker.service.d
|
||||
sudo rm -rf /var/lib/docker
|
||||
```
|
||||
|
||||
## 最后再查询下docker相关软件包
|
||||
```
|
||||
dpkg -l | grep docker
|
||||
```
|
||||
|
||||
## 如果还有包存在,则删除,可能会有多个
|
||||
```
|
||||
sudo apt remove --purge xxx#
|
||||
# 验证下 此处应该报错
|
||||
docker -v
|
||||
```
|
61
_posts/Linux/git/git-compile-with-centos.md
Normal file
61
_posts/Linux/git/git-compile-with-centos.md
Normal file
@ -0,0 +1,61 @@
|
||||
---
|
||||
title: Centos下源码编译git
|
||||
date: 2022-09-30
|
||||
tags: Git
|
||||
---
|
||||
|
||||
最近向公司申请一台闲置的centos主机,用来安装composer 私有镜像仓库使用的,不得不说目前任职公司PHP项目部署还是人工手动ftp上传code年代,composer依赖包也没有用起来。所以目前第一步先建立一个composer镜像仓库,把composer包管理用起来,安装之前先把git安装起来。
|
||||
|
||||
centos7.9 默认git版本是1.8,版本比较低。目前一些场景需要用到git2.0版本之上,需要源码编译安装最新的版本。
|
||||
|
||||
## 下载源码
|
||||
|
||||
```
|
||||
git clone https://github.com/git/git
|
||||
// 或直接下包
|
||||
wget https://codeload.github.com/git/git/tar.gz/refs/tags/v2.37.3
|
||||
|
||||
```
|
||||
|
||||
## 进入目录&编译
|
||||
|
||||
### 卸载旧git&解压文件
|
||||
|
||||
```sh
|
||||
# 卸载旧git
|
||||
sudo yum remove git
|
||||
# 解压
|
||||
tar xvf git-v2.37.3.tar.gz
|
||||
# 进入目录
|
||||
cd git-2.37.3
|
||||
```
|
||||
|
||||
> 编译时候出现一些依赖问题,所以建议预先检查这些依赖是否安装,从而避免编译失败
|
||||
|
||||
- [ ] gcc
|
||||
- [ ] curl-devel
|
||||
- [ ] openssl-devel
|
||||
- [ ] zlib-devel
|
||||
- [ ] expat-devel
|
||||
- [ ] gettext-devel
|
||||
|
||||
### 安装依赖
|
||||
|
||||
```
|
||||
sudo yum install -y gcc curl-devel openssl-devel zlib-devel expat-devel gettext-devel
|
||||
```
|
||||
|
||||
### 编译
|
||||
|
||||
```
|
||||
# $(nproc) 可以根据实际需求自行替换,减少编译时间
|
||||
sudo make -j$(nproc) && make install
|
||||
```
|
||||
|
||||
|
||||
## 验证
|
||||
|
||||
```
|
||||
git --version
|
||||
// git version 2.37.3 输出如下命令就代表编译安装成功!
|
||||
```
|
91
_posts/Linux/ssh/ssh-password-free-login.md
Normal file
91
_posts/Linux/ssh/ssh-password-free-login.md
Normal file
@ -0,0 +1,91 @@
|
||||
---
|
||||
title: ssh 免密登陆
|
||||
date: 2022-10-06
|
||||
tags: ssh
|
||||
---
|
||||
|
||||
由于更换新电脑,需要生成新的密钥去免密登陆服务器,小记一下流程,免得下次还得搜索一下相关教程。
|
||||
|
||||
|
||||
## 密钥登录的过程
|
||||
|
||||
SSH 密钥登录分为以下的步骤。
|
||||
|
||||
1. 客户端通过ssh-keygen生成自己的公钥和私钥。
|
||||
2. 手动将客户端的公钥放入远程服务器的指定位置。
|
||||
3. 客户端向服务器发起 SSH 登录的请求。
|
||||
4. 服务器收到用户 SSH 登录的请求,发送一些随机数据给用户,要求用户证明自己的身份。
|
||||
5. 客户端收到服务器发来的数据,使用私钥对数据进行签名,然后再发还给服务器。
|
||||
6. 服务器收到客户端发来的加密签名后,使用对应的公钥解密。若解密后数据一致,则允许用户登录。
|
||||
|
||||
|
||||
|
||||
|
||||
### 1. 生成公/私密钥
|
||||
```sh
|
||||
# 我这边是linux windows 系统可以在当前用户文件目录下自行创建该文件夹
|
||||
cd ~/.ssh
|
||||
|
||||
# 生成密钥 可使用-t参数,指定密钥的加密算法。默认RSA 其他算法可以搜索了解一下 然后一路回车即可
|
||||
# 中间有询问是否要为私钥文件设定密码保护(passphrase)相当于二次密码保护默认可以不需要
|
||||
ssh-keygen
|
||||
|
||||
```
|
||||
|
||||
### 2 上传公钥到服务器上
|
||||
|
||||
生成密钥以后,公钥必须上传到服务器,才能使用公钥登录。公钥是以.pub 结尾不要和私钥搞混了。
|
||||
|
||||
一般我习惯手动上传公钥到服务器`~/.ssh/authorized_keys`文件。这里需要注意你要以哪个用户的身份登录到服务器,密钥就必须保存在该用户主目录的`~/.ssh/authorized_keys` 中。
|
||||
|
||||
手动上传就是直接将公钥里面文本直接追加到`~/.ssh/authorized_keys`里面。
|
||||
|
||||
|
||||
另外还可以使用`ssh-copy-id` 命令进行自动上传,本质就是自动把公钥里面文本直接追加到`~/.ssh/authorized_keys`里面。密令如下:
|
||||
|
||||
```sh
|
||||
ssh-copy-id -i pub_key_file user@host
|
||||
```
|
||||
|
||||
上面命令中,-i参数用来指定公钥文件,user是所要登录的账户名,host是服务器地址。如果省略用户名,默认为当前的本机用户名。执行完该命令,公钥就会拷贝到服务器。
|
||||
|
||||
|
||||
### 3 配置config
|
||||
|
||||
在当前用户 `~/.ssh/` 新建config文本 若存在无需创建
|
||||
|
||||
|
||||
配置如下
|
||||
|
||||
```
|
||||
Host zyimm
|
||||
HostName 192.168.1.1
|
||||
User tom
|
||||
Port 22
|
||||
IdentityFile file_key
|
||||
```
|
||||
|
||||
### HostName
|
||||
|
||||
需要ssh连接过去的主机名,一般是IP地址。
|
||||
|
||||
|
||||
### User
|
||||
|
||||
登录主机的用户名
|
||||
|
||||
### IdentityFile
|
||||
|
||||
认证证书文件,默认位置是~/.ssh/id_rsa, ~/ssh/id_dsa等,如果采用默认的证书,可以不用设置此参数,除非你的证书放在某个自定义的目录,那么你就需要设置该参数来指向你的证书
|
||||
|
||||
### Port
|
||||
|
||||
SSH访问主机的端口号,默认是22端口,同上,只有在非默认情况下才需要设置该值
|
||||
|
||||
|
||||
## 使用
|
||||
|
||||
```sh
|
||||
ssh zyimm # 即可免密登陆192.168.1.1服务器了
|
||||
```
|
||||
如果使用vscode 建议下载 Remote-ssh 扩展,搭配使用更舒服!
|
18
_posts/Linux/ubuntu/update-snap.md
Normal file
18
_posts/Linux/ubuntu/update-snap.md
Normal file
@ -0,0 +1,18 @@
|
||||
---
|
||||
title: Ubuntu 22.04.1 snap-store自身更新
|
||||
date: 2022-10-05
|
||||
tags: Ubuntu
|
||||
---
|
||||
|
||||
目前开发的笔记本使用的是ubuntu22.04.1 版本,默认内置snap商店无法完成自身更新,所以小记一下解决办法。
|
||||
|
||||
|
||||
解决办法如下:
|
||||
```sh
|
||||
# root 账号无需加上sudo
|
||||
|
||||
sudo killall snap-store
|
||||
|
||||
sudo snap refresh snap-store
|
||||
|
||||
```
|
18
_posts/code-first.md
Normal file
18
_posts/code-first.md
Normal file
@ -0,0 +1,18 @@
|
||||
---
|
||||
title: 这是一段来源于 `carbon.now.sh` 的代码
|
||||
---
|
||||
|
||||
carbon.now.sh 可以让你的文本代码转换成图片,并可以随时分享出去!
|
||||
|
||||
```js
|
||||
const pluckDeep = key => obj => key.split('.').reduce((accum, key) => accum[key], obj)
|
||||
|
||||
const compose = (...fns) => res => fns.reduce((accum, next) => next(accum), res)
|
||||
|
||||
const unfold = (f, seed) => {
|
||||
const go = (f, seed, acc) => {
|
||||
const res = f(seed)
|
||||
return res ? go(f, res[1], acc.concat([res[0]])) : acc
|
||||
}
|
||||
|
||||
```
|
38
_posts/hello-world.md
Normal file
38
_posts/hello-world.md
Normal file
@ -0,0 +1,38 @@
|
||||
---
|
||||
title: Hello World
|
||||
---
|
||||
Welcome to [Hexo](https://hexo.io/)! This is your very first post. Check [documentation](https://hexo.io/docs/) for more info. If you get any problems when using Hexo, you can find the answer in [troubleshooting](https://hexo.io/docs/troubleshooting.html) or you can ask me on [GitHub](https://github.com/hexojs/hexo/issues).
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Create a new post
|
||||
|
||||
``` bash
|
||||
$ hexo new "My New Post"
|
||||
```
|
||||
|
||||
More info: [Writing](https://hexo.io/zh-cn/docs/writing.html)
|
||||
|
||||
### Run server
|
||||
|
||||
``` bash
|
||||
$ hexo server
|
||||
```
|
||||
|
||||
More info: [Server](https://hexo.io/zh-cn/docs/server.html)
|
||||
|
||||
### Generate static files
|
||||
|
||||
``` bash
|
||||
$ hexo generate
|
||||
```
|
||||
|
||||
More info: [Generating](https://hexo.io/zh-cn/docs/generating.html)
|
||||
|
||||
### Deploy to remote sites
|
||||
|
||||
``` bash
|
||||
$ hexo deploy
|
||||
```
|
||||
|
||||
More info: [Deployment](https://hexo.io/zh-cn/docs/one-command-deployment.html)
|
7
_posts/前端/caniuse.md
Normal file
7
_posts/前端/caniuse.md
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
title: JavaScript|Css 兼容性测试
|
||||
date: 2022-09-30
|
||||
tags: JavaScript
|
||||
---
|
||||
|
||||
[caniuse.com](https://caniuse.com/?search=let) 是一个查找JavaScript|Css一些关键字或新特性,在浏览器兼容性的网站。避免我们编写code的时候使用新的特性,但是使用者的电脑浏览器版本不兼容一些问题。
|
Loading…
x
Reference in New Issue
Block a user