环境配置 Jenkins 环境搭建 注意点
github 代码下载、更新慢、失败 只使用git@github.com 的 ssl 进行下载,不使用 http
docker 默认使用 root 用户登录docker exec -it --user root jenkins /bin/bash
maven 打包默认命令 mvn -U clean package -Dmaven.test.skip=true
Jenkins 修改密码 find / -name config.xml删除配置文件内容
vi /root/.jenkins/config.xml
1 2 3 4 5 6 7 8 9 <useSecurity>true</useSecurity> <authorizationStrategy class="hudson.security.FullControlOnceLoggedInAuthorizationStrategy"> <denyAnonymousReadAccess>true</denyAnonymousReadAccess> </authorizationStrategy> <securityRealm class="hudson.security.HudsonPrivateSecurityRealm"> <disableSignup>true</disableSignup> <enableCaptcha>false</enableCaptcha> </securityRealm>
重启 jenkins
1 2 3 4 5 6 7 8 9 10 11 12 13 14 进入首页-》系统管理-》全局安全配置 把“启用安全”勾上和把Jenkins专有用户数据库勾上、允许用户注册勾上-》保存 在系统管理-管理用户中修改admin用户密码 还原config.xml 重启jenkins 用admin用户名和修改后密码登录 [参考](https://blog.csdn.net/jlminghui/article/details/54952148)
生成 ssh 免密登录 终端输入:cd ~/ .ssh 终端输入:sudo ssh-keygen -t rsa -C “fmzh@sina.cn “ 修改 pem 文件权限:chmod 600 key.pem 链接:ssh -i key.pem root@IP 复制到服务器上:ssh-copy-id -i ~/.ssh/id_rsa.pub root@remote-hostssh 免密登录 关闭 ssh 密码登录
1 2 3 4 5 6 7 vi /etc/ssh/sshd_config PasswordAuthentication no service sshd restart ssh-keygen -b 4096 -t RSA -C "[email protected] " systemctl restart sshd cat id_rsa.pub > authorized_keys
mac 中使用 openssl 生成 rsa 密钥 普通用户 ssh 文件登录
jenkins 中配置 maven 路径没有权限 chown -R jenkins:jenkins /root
git 切换分支 git branch -a git checkout -b origin/dev/spring-1/wii-dev
linux 软连接 ln -s /root/node-v12.21/bin/node /usr/local/binnode npm config set registry https://registry.npm.taobao.org npm -v node -v
git 大小写敏感 git config –get core.ignorecase git config core.ignorecase false 清缓存 npm cache clean - f
ssh 通过名称访问参考内容
可以创建~/.ssh/config 文件并为每台服务器指定登录信息和验证方法,如下所示:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 $ vim ~/.ssh/config Host www HostName www.ttlsa.com Port 22 User root IdentityFile ~/.ssh/id_rsa.pub IdentitiesOnly yes Host bbs HostName 115.28.45.104 User anotheruser PubkeyAuthentication no
然后直接指定别名进行登录$ ssh www
选项注释: HostName 指定登录的主机名或 IP 地址 Port 指定登录的端口号 User 登录用户名 IdentityFile 登录的公钥文件 IdentitiesOnly 只接受 SSH key 登录 PubkeyAuthentication
不同网段的互通访问静态路由 route -p add 192.168.19.0 mask 255.255.255.0 192.168.0.148
git 由 https 修改为通过git@github.com :app 进行下载 ./git/config 文件中配置的https://github.com/xx 修改为git@github.com :xx
maven 中 package 不生成版本号,设置方法
1 2 3 4 5 <build> <!-- 产生的构件的文件名,默认值是${artifactId}-${version} --> <finalName>${project.artifactId}</finalName> </build>
git 查看忽略规则git check-ignore -v 被忽略的文件或文件夹
git 查看子模块
1 2 3 4 5 6 7 8 9 10 11 git submodule git submodule update git rm --cached assets test fmzhf dsfsdf sdfsaaffffmzh