apt-get update
sudo apt-get install tmux -y
tmux
tmux a
tmux ls
tmux kill-session -t session名
Ctrl+b
之后按 "
Ctrl+b
之后按 %
Ctrl+b
之后按 方向键
Ctrl+d
ls -l /home/
adduser 用户名
passwd 用户名
su - 用户名
,切换root用户:su -
,退出用户:exit
或者Ctrl + d
sudo visudo
,添加内容:用户名 ALL=(ALL:ALL) ALL
用户名 ALL=(ALL:ALL) NOPASSWD:ALL
sudo userdel -rf 用户名
git bash
执行:ssh-keygen -t rsa -C "huhuiyu.top" -f huhuiyu.top
生成密钥文件
-t rsa
参数是指定算法-C "huhuiyu.top"
参数指定密钥标题名称-f huhuiyu.top
参数指定密码文件名称xxxxx already exists
的提示,如果要覆盖就输入y
之后回车,否则将会取消生成mkdir ~/.ssh
创建ssh目录chmod 700 ~/.ssh
配置权限vi ~/.ssh/authorized_keys
编辑密钥文件
.pub
公钥内容复制进来然后保存退出chmod 600 ~/.ssh/authorized_keys
配置权限sudo vi /etc/ssh/sshd_config
配置ssh/PasswordAuthentication
回车找到对应配置项PasswordAuthentication no
拒绝使用密码登陆sudo systemctl restart sshd.service
重启ssh服务生效/etc/ssh/ssh_config
文件中添加一行PubkeyAcceptedKeyTypes +ssh-rsa
配置启用rsa的ssh连接~/.ssh/config
文件,内容为HostKeyAlgorithms +ssh-rsa
配置启用rsa的ssh连接sudo apt-get install ufw -y
sudo ufw status
sudo ufw allow 22/tcp
或者sudo ufw allow ssh
sudo ufw allow 3306/tcp
sudo ufw allow 6379/tcp
sudo ufw allow 80/tcp
或者sudo ufw allow http
sudo ufw allow 443/tcp
或者sudo ufw allow https
sudo ufw allow 8000:8100/tcp
sudo ufw enable
或者sudo ufw disable
sudo ufw status numbered
sudo ufw delete 2
sudo ufw delete allow 8080/tcp
sudo apt purge mysql-*
sudo -rf /etc/mysql/ /var/lib/mysql
sudo apt autoremove
sudo apt autoclean
curl -OL https://dev.mysql.com/get/mysql-apt-config_0.8.29-1_all.deb
,下载找到的安装源sudo dpkg -i mysql-apt-config_0.8.29-1_all.deb
,界面选mysql8
后选ok
即可sudo apt-get update
sudo apt-get install mysql-server -y
中途会出现输入root密码和密码加密模式选项mysql -uroot -p
sudo docker pull mysql
sudo docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root账号密码 -d mysql
sudo docker exec -it mysql bash
,然后在这里面就能执行mysql相关命令了sudo apt-get install git -y
git --version
vi ~/.ssh/id_rsa
,将私钥内容填写进去chmod 600 ~/.ssh/id_rsa
修改文件权限sudo apt-cache search openjdk
sudo apt-get install openjdk-21-jdk -y
javac -version
curl -OL https://dlcdn.apache.org/tomcat/tomcat-8/v8.5.99/bin/apache-tomcat-8.5.99.tar.gz
下载tomcattar -zxvf apache-tomcat-8.5.99.tar.gz
sudo apt-get install unzip -y
unzip 文件名
sudo apt-get install redis-server -y
sudo vi /etc/redis/redis.conf
,修改密码查找requirepass
,修改ip绑定查找bind
,修改端口查找port
sudo systemctl restart redis
sudo apt install curl gnupg2 ca-certificates lsb-release ubuntu-keyring -y
sudo curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor | sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
sudo gpg --dry-run --quiet --no-keyring --import --import-options import-show /usr/share/keyrings/nginx-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" | sudo tee /etc/apt/sources.list.d/nginx.list
sudo apt update
sudo apt-get install nginx -y
sudo apt-get install nginx -y
nginx -v
查看安装是否成功(会显示版本号)sudo systemctl enable nginx
sudo systemctl disable nginx
sudo systemctl start nginx
sudo systemctl stop nginx
/etc/nginx/nginx.conf
和/etc/nginx/conf.d/*.conf
sudo apt-get install -y nodejs
安装node -v
sudo apt-get install -y npm
安装npm -v
npm config set registry "https://registry.npmmirror.com"
设置成阿里的安装源npm config get registry
查看安装源npm install --global n
n -V
查看n的版本n lts
更新npm到最新lts版本npm config set prefix "全局安装路径"
npm config set cache "全局缓存路径"
npm config ls
sudo apt-get install -y golang
go env
go version
sudo apt-get install -y webhook
webhook -version
webhook -port 服务端口号 -hooks 参数配置文件 -verbose
-port
参数指定端口,-hooks
参数指定配置文件,-verbose
是控制台输出信息`#!/bin/sh
[
{
"id":"pull-server-test-project",
"execute-command":"/home/huhuiyu/webhook/pull_server-test-project.sh",
"command-working-directory":"/home/huhuiyu/webhook"
}
]
sudo lvdisplay
查看lvm信息sudo fdisk -l
查看磁盘信息sudo df -h
查看硬盘使用信息sudo lvextend -l +10%FREE /dev/ubuntu-vg/ubuntu-lv
分配扩展磁盘,命名中最后部分的路径为lvdisplay
查看的信息执行sudo resize2fs /dev/ubuntu-vg/ubuntu-lv
调整磁盘大小
certbot
sudo apt-get update
sudo apt install snapd -y
sudo snap install core
sudo snap refresh core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
sudo certbot certonly --email 邮箱 --nginx -d 域名
sudo ls /etc/letsencrypt/live/
sudo certbot renew
sudo apt update
sudo apt install docker.ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt update
sudo apt install docker-ce
sudo docker ps
sudo docker stop 容器名称
sudo docker start 容器名称
sudo docker ps -a
sudo docker rm 容器名称