春有百花秋有月
夏有凉风冬有雪tar file add passwd
使用tar对文件压缩加密:
tar -zcvf - pma|openssl des3 -salt -k password | dd of=pma.des3
完成将得到一个pma.des3的打包文件,用你设置的密码替换password。
使用tar对加密文件解压:
dd if=pma.des3 |openssl des3 -d -k password|tar zxf -
注意:命令最后有”-”,它将释放所有的文件。其中-k password可以不使用,这样执行完命令后会提示你输入密码,加上-k参数表示在程序中自动验证密码。
阅读剩余部分 →install chatgpt demo
#更新
sudo apt update
sudo apt upgrade
# 安装依赖
sudo apt install software-properties-common
# 添加 deadsnakes PPA 源
sudo add-apt-repository ppa:deadsnakes/ppa
#安装python
sudo apt install python3
python3 --version
sudo apt install python3-pip
pip3 --version
2.安装python虚拟环境
sudo apt install python3-venv
3.上传chatgpt-web-main.tar.gz,解压并进入到chatgpt-web-main目录
4.创建虚拟环境:
python3 -m venv newchat.env
5.进入虚拟环境
source /opt/chat/chatgpt-web-main/newchat.env/bin/activate
6.配置chatgpt-web-main应用中的openAi key,启动服务:
python3.10 /opt/chat/chatgpt-web-main/main.py
nohup python3.10 /opt/chat/chatgpt-web-main/main.py &
7.配置nginx文件:
server {
listen 443 ssl http2;
#listen [::]:443 ssl http2;
server_name chat.***.xyz;
ssl_certificate /root/.acme.sh/chat.***.xyz_ecc/chat.***.xyz.cer;
ssl_certificate_key /root/.acme.sh/chat.***.xyz_ecc/chat.***.xyz.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_session_cache builtin:1000 shared:SSL:10m;
proxy_buffering off;
location / {
proxy_redirect off;
proxy_pass http://127.0.0.1:8184/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
其中proxy_buffering off; 表示打字机效果,不加此行代码无打字机效果,等待输出结果之后一次性返回结果。
阅读剩余部分 →windows bat from linux
1.将以下脚本写入bat文件:执行同步并且本地只保留一周的文件.
start /min cmd /c "C:\Users\user1\AppData\Local\Programs\WinSCP\WinSCP.exe" /console /script=D:\gz\52.69\bak\bitwarden-backup\server_bak.txt
set SrcDir=D:\gz\52.69\bak\bitwarden-backup\bak
set DaysAgo=5
forfiles /p %SrcDir% /s /m *.* /d -%DaysAgo% /c "cmd /c rd /s /q @path"
forfiles /p %SrcDir% /s /m *.* /d -%DaysAgo% /c "cmd /c del /f /q /a @path"
2.定义server_bak.txt文件:
阅读剩余部分 →typecho install and htpasswd config
apt-get update
apt-get install apache2-utils
htpasswd -c /etc/nginx/.htpasswd gz
/etc/nginx/.htpasswd gz
二、安装typecho
https://docs.typecho.org/install
下载php及相关依赖
sudo apt-get install php7.4 php7.4-sqlite php7.4-fpm php-mbstring php7.4-gd安装依赖 sudo apt install php php-cli php-fpm php-mysql php-json php-opcache php-mbstring php-xml启动php服务:查找对应的 PHP-FPM systemd 服务单元文件。在 /lib/systemd/system/ 目录下查找以 php{version}-fpm.service 命名的文件,例如:
service php7.4-fpm start下载源码(可以在typecho官网找到)
wget https://github.com/typecho/typecho/releases/latest/download/typecho.zip解压源码
unzip typecho.zip对整个源码目录赋予足够的权限
chmod -R 777 /home/typecho配置nginx
server{ listen 80; server_name ****.xyz; root /var/www/typecho; index index.php; if (!-e $request_filename) { rewrite ^(.*)$ /index.php$1 last; } location / { root html; index index.php index.html index.htm; set $path_info ""; set $real_script_name $fastcgi_script_name; if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") { set $real_script_name $1; set $path_info $2; } fastcgi_param SCRIPT_FILENAME $document_root$real_script_name; fastcgi_param SCRIPT_NAME $real_script_name; fastcgi_param PATH_INFO $path_info; } location /admin { index index.php; try_files $uri $uri/ /admin/index.php?$args; } location ~ .*\.php(\/.*)*$ { include fastcgi.conf; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; } # Typecho static files location ~* ^/(usr|admin|themes|plugins)/.*\.(js|css|png|jpg|jpeg|gif|ico|svg)$ { expires 24h; add_header Cache-Control public; access_log off; try_files $uri $uri/ /index.php?$args; } }访问:http://****.xyz/install.php 选择sqlite数据库然后下一步...
阅读剩余部分 →
linux crontab
定时任务,自动更新证书和备份文件仅保留一周内的:
[root@iZj6c69digospl6f2d3s45Z bitwarden-backup]# crontab -l
21 0 * * * "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" > /dev/null
0 0 * * * /opt/bitwarden-backup/bw-data-backup.sh >> /opt/bitwarden-backup/backup.log && find /home/appadmin/bitwarden-backup/ -type f -name "bw-data_backup_*" -mtime +7 -exec rm {} \;
编辑命令:
crontab -e
使之生效:
阅读剩余部分 →docker & docker-compose install
how to install and use docker
how to install and use docker compose
sudo apt update
curl -fsSL https://get.docker.com/ | sh
sudo systemctl start docker
sudo systemctl status docker
sudo systemctl enable docker
docker-compose:
Check the Releases and if necessary, update it in the command below:
sudo curl -L "https://github.com/docker/compose/releases/download/v2.18.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
或者
阅读剩余部分 →linux vim command
k 上 h l 左 右 j 下
x 删除当前光标下的字符
dw 删除光标之后的单词剩余部分。
d$ 删除光标之后的该行剩余部分。
D 从当前位置删除到行尾 (“d$” 的缩写)
dd 删除当前行。
db 从当前位置删除到前一个单词的开头
dw 从当前位置删除到下一个单词开头
c 功能和d相同,区别在于完成删除操作后进入INSERT MODE
cc 也是删除当前行,然后进入INSERT MODE
u 撤销最后执行的命令
U 修正之前对该行的操作
Ctrl+R Redo
选块 先用v,C-v,V选择一块,然后用y复制,再用p粘贴。
yy 复制当前整行
nyy 复制当前行开始的n行内容
通过vi的命令模式输入:set nu,这时候在文件中就会显示行数。(不显示行号用 :set nonu )
阅读剩余部分 →Linux Server init
绑定原IP或者使用新的IP,如绑定原IP需要先将原IP在原实例中解绑,然后在HOME-Networking中将原IP绑定到新的实例中。
sudo su
4.修改管理员和新建用户
passwd root
useradd appadmin
passwd appadmin
5.SSH配置:
vim /etc/ssh/sshd_config
- PermitRootLogin ~~yes~~ //不允许root登录
- PasswordAuthentication yes //设置是否使用口令验证
service sshd reload
6.升级软件和系统内核(Centos或Debian):
yum -y update
apt -y update
apt -y upgrade
7.常用工具安装:
apt -y install lrzsz
apt install net-tools
apt install lsof
vi /root/.bashrc
. /root/.bashrc
8.安装docker|nginx
docker:
curl -fsSL https://get.docker.com/ | sh
sudo systemctl start docker
sudo systemctl status docker
sudo systemctl enable docker
docker-compose:
Check the Releases and if necessary, update it in the command below:
update hosts for github
在本机hosts文件中配置以下内容,可手动访问结尾处地址进行更新:
Update url:
Star me:
GitHub520 Host Start
140.82.114.26 alive.github.com
140.82.113.5 api.github.com
185.199.110.153 assets-cdn.github.com
185.199.108.133 avatars.githubusercontent.com
185.199.108.133 avatars0.githubusercontent.com
185.199.108.133 avatars1.githubusercontent.com
185.199.108.133 avatars2.githubusercontent.com
185.199.108.133 avatars3.githubusercontent.com
185.199.108.133 avatars4.githubusercontent.com
185.199.108.133 avatars5.githubusercontent.com
185.199.108.133 camo.githubusercontent.com
140.82.113.22 central.github.com
185.199.108.133 cloud.githubusercontent.com
140.82.113.9 codeload.github.com
140.82.113.21 collector.github.com
185.199.108.133 desktop.githubusercontent.com
185.199.108.133 favicons.githubusercontent.com
140.82.113.4 gist.github.com
54.231.236.113 github-cloud.s3.amazonaws.com
54.231.202.153 github-com.s3.amazonaws.com
52.216.44.33 github-production-release-asset-2e65be.s3.amazonaws.com
54.231.161.177 github-production-repository-file-5c1aeb.s3.amazonaws.com
54.231.130.81 github-production-user-asset-6210df.s3.amazonaws.com
192.0.66.2 github.blog
140.82.112.3 github.com
140.82.113.18 github.community
185.199.109.154 github.githubassets.com
151.101.65.194 github.global.ssl.fastly.net
185.199.110.153 github.io
185.199.108.133 github.map.fastly.net
185.199.110.153 githubstatus.com
140.82.113.26 live.github.com
185.199.108.133 media.githubusercontent.com
185.199.108.133 objects.githubusercontent.com
13.107.42.16 pipelines.actions.githubusercontent.com
185.199.108.133 raw.githubusercontent.com
185.199.108.133 user-images.githubusercontent.com
13.107.226.40 vscode.dev
140.82.113.21 education.github.com 阅读剩余部分 →