Go to issue
zhcchen / notes Goto Github PK
View Code? Open in Web Editor NEWGo to issue
Go to issue
Host your_host_name
HostName your_host_ip
ProxyCommand "C:\Program Files\Git\mingw64\bin\connect.exe" -S 127.0.0.1:7890 %h %p
User root
Port 22
IdentityFile ~/.ssh/id_rsa
ServerAliveInterval 15
ServerAliveCountMax 3
:::tip
该操作流程采用 Ubuntu 20.04 操作系统,Debain 如无 sudo 命令则可以去掉即可
:::
free
新建文件夹
mkdir /swap
进入文件夹
cd /swap
创建虚拟文件,bs 为块的大小,count 创建多少个块
sudo dd if=/dev/zero of=swapfile bs=1M count=2048
修改权限
sudo chmod 0600 swapfile
把生成的文件转换成 Swap 文件
sudo mkswap swapfile
激活文件
sudo swapon swapfile
free
sudo swapoff swapfile
打开 /etc/fstab 文件
vi /etc/fstab
此时开的虚拟内存会在开机后消失,如果永久保持下去,在 /etc/fstab 文件尾添加一下信息:
/swap/swapfile swap swap defaults 0 0
npm config set proxy=http://127.0.0.1:10809
npm config set https-proxy=http://127.0.0.1:10809
REM @echo off
TASKKILL /f 2> nul /IM IDMan.exe > nul 2>&1
"C:\Program Files (x86)\Windows Resource Kits\Tools\subinacl.exe" /keyreg "HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID{5ED60779-4DE2-4E07-B862-974CA4FF2E9C}" /grant=S-1-1-0=f 1> nul
reg delete "HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID{D5B91409-A8CA-4973-9A0B-59F713D25671}" /f 2> nul
reg delete "HKEY_CURRENT_USER\Software\Classes\WOW6432Node\CLSID{99d8f88f-4892-43bf-a569-42c595069a1c}" /f 2> nul
reg delete "HKEY_CURRENT_USER\Software\Classes\WOW6432Node\CLSID{07999AC3-058B-40BF-984F-69EB1E554CA7}" /f 2> nul
reg delete "HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID{6DDF00DB-1234-46EC-8356-27E7B2051192}" /v MData /f 2> nul
reg delete "HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID{6DDF00DB-1234-46EC-8356-27E7B2051192}" /v Model /f 2> nul
reg delete "HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID{6DDF00DB-1234-46EC-8356-27E7B2051192}" /v Therad /f 2> nul
reg delete "HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID{6DDF00DB-1234-46EC-8356-27E7B2051192}" /f 2> nul
reg delete "HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID{7B8E9164-324D-4A2E-A46D-0165FB2000EC}" /f 2> nul
reg delete "HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID{7B8E9164-324D-4A2E-A46D-0165FB2000EC}" /f 2> nul
reg delete "HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID{5ED60779-4DE2-4E07-B862-974CA4FF2E9C}" /f 2> nul
reg delete "HKEY_CURRENT_USER\Software\Classes\CLSID{7B8E9164-324D-4A2E-A46D-0165FB2000EC}" /f 2> nul
reg delete "HKEY_CURRENT_USER\Software\Classes\CLSID{5ED60779-4DE2-4E07-B862-974CA4FF2E9C}" /f 2> nul
reg delete "HKEY_CURRENT_USER\Software\Classes\CLSID{07999AC3-058B-40BF-984F-69EB1E554CA7}" /f 2> nul
reg delete "HKEY_CURRENT_USER\Software\Classes\CLSID{6DDF00DB-1234-46EC-8356-27E7B2051192}" /f 2> nul
reg delete "HKEY_CURRENT_USER\Software\Classes\CLSID{D5B91409-A8CA-4973-9A0B-59F713D25671}" /f 2> nul
reg delete "HKEY_LOCAL_MACHINE\Software\Classes\CLSID{7B8E9164-324D-4A2E-A46D-0165FB2000EC}" /f 2> nul
reg delete "HKEY_LOCAL_MACHINE\Software\Classes\CLSID{5ED60779-4DE2-4E07-B862-974CA4FF2E9C}" /f 2> nul
reg delete "HKEY_LOCAL_MACHINE\Software\Classes\CLSID{07999AC3-058B-40BF-984F-69EB1E554CA7}" /f 2> nul
reg delete "HKEY_LOCAL_MACHINE\Software\Classes\CLSID{6DDF00DB-1234-46EC-8356-27E7B2051192}" /f 2> nul
reg delete "HKEY_LOCAL_MACHINE\Software\Classes\CLSID{D5B91409-A8CA-4973-9A0B-59F713D25671}" /f 2> nul
REM reg delete "HKEY_LOCAL_MACHINE\Software\Classes\Wow6432Node\CLSID{5ED60779-4DE2-4E07-B862-974CA4FF2E9C}" /f 2> nul
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Internet Download Manager" /v scansk /f 2> nul
reg delete "HKEY_CURRENT_USER\Software\DownloadManager" /v scansk /f 2> nul
reg delete "HKEY_CURRENT_USER\Software\DownloadManager" /v CheckUpdtVM /f 2> nul
REM reg delete "HKEY_CURRENT_USER\Software\DownloadManager" /f 2> nul
REM reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Internet Download Manager" /f 2> nul
reg delete "HKEY_CURRENT_USER\Software\DownloadManager" /v FName /f 2> nul
reg delete "HKEY_CURRENT_USER\Software\DownloadManager" /v LName /f 2> nul
reg delete "HKEY_CURRENT_USER\Software\DownloadManager" /v Email /f 2> nul
reg delete "HKEY_CURRENT_USER\Software\DownloadManager" /v Serial /f 2> nul
reg delete "HKEY_LOCAL_MACHINE\Software\Internet DownloadManager" /v FName /f 2> nul
reg delete "HKEY_LOCAL_MACHINE\Software\Internet DownloadManager" /v LName /f 2> nul
reg delete "HKEY_LOCAL_MACHINE\Software\Internet DownloadManager" /v Email /f 2> nul
reg delete "HKEY_LOCAL_MACHINE\Software\Internet DownloadManager" /v Serial /f 2> nul
reg delete "HKEY_LOCAL_MACHINE\Software\Wow6432Node\Internet DownloadManager" /v FName /f 2> nul
reg delete "HKEY_LOCAL_MACHINE\Software\Wow6432Node\Internet DownloadManager" /v LName /f 2> nul
reg delete "HKEY_LOCAL_MACHINE\Software\Wow6432Node\Internet DownloadManager" /v Email /f 2> nul
reg delete "HKEY_LOCAL_MACHINE\Software\Wow6432Node\Internet DownloadManager" /v Serial /f 2> nul
pause
echo Delete HKEY_CURRENT_USER\Software\PremiumSoft\NavicatPremium\Update
reg delete HKEY_CURRENT_USER\Software\PremiumSoft\NavicatPremium\Update /f
echo Delete HKEY_CURRENT_USER\Software\PremiumSoft\NavicatPremium\Registration[version and language]
for /f %%i in ('"REG QUERY "HKEY_CURRENT_USER\Software\PremiumSoft\NavicatPremium" /s | findstr /L Registration"') do (
reg delete %%i /va /f
)
echo Delete Info and ShellFolder under HKEY_CURRENT_USER\Software\Classes\CLSID
for /f "tokens=" %%a in ('reg query "HKEY_CURRENT_USER\Software\Classes\CLSID"') do (
for /f "tokens=" %%l in ('reg query "%%a" /f "Info" /s /e ^| findstr /i "Info"') do (
echo Delete: %%a
reg delete %%a /f
)
for /f "tokens=*" %%l in ('reg query "%%a" /f "ShellFolder" /s /e ^| findstr /i "ShellFolder"') do (
echo Delete: %%a
reg delete %%a /f
)
)
pause
该方式基于 Ubuntu 20.04、Nginx 1.22 测试通过,更多用法可前往Github查看
先安装socat
apt install socat -y
邮箱替换成自己的
curl https://get.acme.sh | sh -s [email protected]
source ~/.bashrc
设置dns运营商的识别 ID 和 Secret (已设置的无需重复设置),acme也支持多家dsn运营商,我这里采用的是阿里云
export Ali_Key="sdfsdfsdfljlbjkljlkjsdfoiwje"
export Ali_Secret="jlsdflanljkljlfdsaklkjflsa"
切换CA机构(默认ZeroSSL,ZeroSSL老是容易超时,中意ZeroSSL可以忽略)
acme.sh --set-default-ca --server letsencrypt
申请证书
acme.sh --issue --dns dns_ali -d example.com
这里的路径就是实际就是你想存放证书的路径,对应文件夹要提前创建(例如我习惯放置的路径为/root/cert/域名.后缀)
acme.sh --install-cert -d example.com \
--key-file /root/cert/example.com.key \
--fullchain-file /root/cert/example.com.cer
#以下属性中,以ssl开头的属性表示与证书配置有关。
server {
listen 443 ssl;
#配置HTTPS的默认访问端口为443。
#如果未在此处配置HTTPS的默认访问端口,可能会造成Nginx无法启动。
#如果您使用Nginx 1.15.0及以上版本,请使用listen 443 ssl代替listen 443和ssl on。
server_name example.com;
ssl_certificate /root/cert/example.com.cer;
ssl_certificate_key /root/cert/example.com.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
#表示使用的加密套件的类型。
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3; #表示使用的TLS协议的类型,您需要自行评估是否配置TLSv1.1协议。
ssl_prefer_server_ciphers on;
add_header Strict-Transport-Security "max-age=31536000";
location / {
root html; #Web网站程序存放目录。
index index.html index.htm;
}
}
server {
listen 80;
server_name example.com;
add_header Strict-Transport-Security "max-age=31536000";
rewrite ^(.*)$ https://$host$1;
}
可以尝试检测或访问
https://myssl.com/ssl.html
更新:acme.sh会自动更新证书
version: "3"
services:
postgres:
container_name: postgres
image: postgres:15.6
restart: always
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: 123456
POSTGRES_DB: db
ports:
- "5432:5432"
volumes:
- ./data:/var/lib/postgresql/data
:::tip
该安装环境采用 Debain 11,其他系统可参照官方文档
:::
创建文件存储库配置
sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
导入存储库签名密钥
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
更新软件包列表
apt update
安装默认默认版本
apt install postgresql -y
安装特定版本(-后面为你想要的版本)
apt install postgresql-14 -y
Postgresql 会默认创建一个 postgres 用户,切换用户
su postgres
然后就可以使用psql命令交互工具使用
psql
修改密码
alter user postgres with password '123456';
如果不清楚配置文件路径存放的可以查看进程
ps -ef|grep postgresql
结果如下
postgres 8451 1 0 14:44 ? 00:00:00 /usr/lib/postgresql/14/bin/postgres -D /var/lib/postgresql/14/main -c config_file=/etc/postgresql/14/main/postgresql.conf
root 9043 8507 0 15:38 pts/1 00:00:00 grep postgresql
修改配置文件postgresql.conf,将listen_addresses的值改为*,记得去掉前面的#注释,同时该文件有pg_hba.conf的文件路径,这个文件也要修改
vi /etc/postgresql/14/main/postgresql.conf
文件部分内容如下
#------------------------------------------------------------------------------
# FILE LOCATIONS
#------------------------------------------------------------------------------
# The default values of these variables are driven from the -D command-line
# option or PGDATA environment variable, represented here as ConfigDir.
data_directory = '/var/lib/postgresql/14/main' # use data in another directory
# (change requires restart)
hba_file = '/etc/postgresql/14/main/pg_hba.conf' # host-based authentication file
# (change requires restart)
ident_file = '/etc/postgresql/14/main/pg_ident.conf' # ident configuration file
# (change requires restart)
# If external_pid_file is not explicitly set, no extra PID file is written.
external_pid_file = '/var/run/postgresql/14-main.pid' # write an extra PID file
# (change requires restart)
#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------
# - Connection Settings -
listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost'; use '*' for all
# (change requires restart)
port = 5432 # (change requires restart)
max_connections = 100 # (change requires restart)
#superuser_reserved_connections = 3 # (change requires restart)
unix_socket_directories = '/var/run/postgresql' # comma-separated list of directories
修改配置文件pg_hba.conf,直接在文件末尾添加以下配置项,可根据需要自己调整对应值
host all all 0.0.0.0/0 md5
重启 Postgresql
systemctl restart postgresql.service
修改用户密码
alter user postgres with password '123456';
创建普通用户
create user test encrypted password '123456';
创建超级用户
create user test superuser encrypted password '123456';
将超级用户改为普通用户
alter user test nosuperuser;
普通用户改为超级用户
alter user test superuser;
设置不允许/允许其登录
alter user test nologin;
alter user test login;
本地代理协议根据对应代理工具使用协议,例如:Windows的V2rayN默认采用socks,端口10808
git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy http://127.0.0.1:1080
git config --global http.proxy socks5://127.0.0.1:10808
git config --global https.proxy socks5://127.0.0.1:10808
git config --global --unset http.proxy
git config --global --unset https.proxy
Host github.com
User git
IdentityFile ~/.ssh/id_rsa
Port 22
ProxyCommand connect -S 127.0.0.1:20808 %h %p
Host github.com
User git
IdentityFile ~/.ssh/id_rsa
Port 22
ProxyCommand nc -v -x 127.0.0.1:10808 %h %p
sudo passwd root
sudo vi /etc/ssh/sshd_config
把 PermitRootLogin without-password 改为 PermitRootLogin yes,注意PermitRootLogin without-password可能被注释掉了,要去掉注释
PS:如果2021.06后的20版本没有找到PermitRootLogin without-password,直接文件末尾添加PermitRootLogin yes即可
sudo systemctl restart sshd
如果是个人的开发环境下,推荐使用Docker Desktop,方便又快捷
Docker 官网提供桌面安装程序 Docker Desktop,可以根据自己的操作系统选择,Docker Desktop 包含了Docker所有相关组件,方便快捷,但是要注意的是Docker Desktop 的条款。
如果是Linux Server的这类纯命令行系统,Docker 也针对此做了便携式的安装脚本,脚本如下(注意,有些操作系统如果不被支持,可前往官网查看相关文档):
curl -fsSL https://get.docker.com -o get-docker.sh && sudo sh get-docker.sh && systemctl start docker
上面脚本安装了基本的docker基本组件,如果有docker-compose使用需求的人,按照以下脚本执行即可,下的脚本是基于docker-compose 2.26.1 版本,如果需要特定版本可前往Github下载:https://github.com/docker/compose/releases ,然后自行拆分脚本运行
wget https://github.com/docker/compose/releases/download/v2.29.1/docker-compose-linux-x86_64 -O /usr/local/bin/docker-compose && sudo chmod +x /usr/local/bin/docker-compose && sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose && docker-compose --version
如果遇到由于拉取镜像的时间异常的长的话,可以配置镜像加速,可以参考和使用阿里云提供的镜像加速服务。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.