gitlab注册cicd

1
2
3
4
5
6
7
打开cmd
gitlab-runner register
输入url
输入token
输入runner-name
输入tag name
选择shell ——命令行方式

查看域名对应ip

nslookup

连接mysqp数据库

mysql -uroot -p123456

-p后面为密码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 停止mysql服务
net stop mysql57

# 启动mysql服务
net start mysql57

# 显示数据库列表
show databases; // 命令后面一定要加分号;

# 指定数据库
use 库名;

# 展示当前库所有表
show tables;

# 显示表中的记录
select * from 表名;

# 更新表中的数据
update MYTABLE set sex="f" where name='hyq';

npm和yarn换源

1
2
3
4
5
6
7
8
9
yarn config get registry  #查看当前源

yarn config set registry https://registry.npm.taobao.org/ #修改为淘宝源

yarn config set registry https://registry.yarnpkg.com #修改yarn源为官方源

npm config get registry

npm config set registry https://registry.npm.taobao.org

允许浏览器跨域

1
--user-data-dir="c:\ChromeDebug" --test-type --disable-web-security

linux常用命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

df -lh 查看磁盘空间

yum -y install *** 安装软件

rpm -qa 查看已安装软件

rpm -ql <软件名> 查看软件的安装目录

shutdown -r now 关机

reboot 重启

vim wq 保存

netstat -aptn 查看所有开启的端口号

ctrl+D 关闭ssh连接

ssh 用户名@ip地址 // 远程连接ssh

sudo lsof -i:8080(需要查看的端口号) // 查看被占用端口的pid

sudo kill -9 (对应端口的pid)

scp 当前文件路径 目标文件路径

unzip filename.zip 解压文件至当前目录

pm2 flush // 清除日志

ps -ef |grep mongo // 查看指定mongo进程

关闭电脑休眠

1
2
powercfg -h off
powercfg -h on

git常用命令

1
2
3
4
5
6
7
8
9
10
11
12
13
// 提交回滚
git log // 查看提交记录,复制要回退到的commit ssh
git reset --hard 'ssh'
git push --force

// 设置代理
git config --global http.https://github.com.proxy socks5://127.0.0.1:7890
git config --global --unset http.https://github.com.proxy

// 切换分支
git checkout `branchName` // 切换到已存在分支
git checkout -b `newBranch` // 创建并切换到新分支
git branch // 查看本地已有分支

nginx命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
nginx -t // 检查nginx配置文件语法是否正确

server {
listen 80;
server_name 47.114.51.62;
charset utf-8;

location / {
root /home/test/;
index index.html index.htm;
}
}

// 重启nginx
systemctl reload nginx

docker

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// docker-compose权限不够
chmod +x /usr/local/bin/docker-compose

// 开启后台docker服务
systemctl start docker

// 批量删除已经退出的容器
docker system prune -f

// 批量删除没有使用的所有镜像
docker image prune -a

// 查看所有正在运行的容器
docker ps

// 查看所有容器(运行中和停止的)
docker ps -a

// 停止容器
docker stop 容器id

// 删除容器
docker rm -f 容器id

// 删除镜像
docker rmi 镜像id

centos7防火墙

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
firewall-cmd --zone=public --add-port=5672/tcp --permanent # 开放5672端口,需重启才能生效

firewall-cmd --zone=public --remove-port=5672/tcp --permanent #关闭5672端口

firewall-cmd --reload #重启防火墙

firewall-cmd --zone=public --list-ports #查看防火墙所有开放的端口

systemctl stop firewalld.service #关闭防火墙

systemctl start firewalld.service #开启防火墙

firewall-cmd --state #查看防火墙状态

systemctl enable firewalld #开机自动启动防火墙

mongodb

![[2024-05-17-MongoDB笔记#七、常用命令|mongodb命令]]

甲骨文vps登陆后操作

修改root密码

1
2
sudo -i  // 切换为root用户
passed // 修改root密码

开启ssh

1
2
3
4
5
6
7
8
// 开启ssh登录
vi /etc/ssh/sshd_config

// 修改一下字段
PermitRootLogin yes
StrictModes yes
PasswordAuthentication yes
systemctl restart ssh.service // 重启ssh服务

开放所有端口

1
2
3
4
iptables -P INPUT ACCEPT  
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -F

Ubuntu镜像默认设置了Iptable规则,关闭它,

1
2
apt-get purge netfilter-persistent  
reboot

青龙面板