02 gitlab的基本使用
gitlab的使用
添加用户
gitlab数据的备份和恢复
停止写服务
[root@gitlab web1]# gitlab-ctl stop unicorn
[root@gitlab web1]# gitlab-ctl stop sidekiq
ok: down: sidekiq: 0s, normally up
手动备份数据
[root@gitlab web1]# gitlab-rake gitlab:backup:create
查看要恢复的文件
/var/opt/gitlab/backups/ # 备份文件
/var/opt/gitlab/nginx/conf/ # nginx配置文件
/etc/gitlab/gitlab.rb # gitlab配置文件
/etc/gitlab/gitlab-secrets.json # 密码文件
数据恢复
# 停服务
gitlab-rake gitlab:backup:restore BACKUP=[备份的文件名]
# 开服务
jenkins优化
# 切换至配置文件目录
cd /var/lib/jenkins/updates # 换源
sed -i 's/http:\/\/updates.jenkinsci.org\/download/https:\/\/mirrors.tuna.tsinghua.edu. cn\/jenkins/g' default.json sed -i 's/http:\/\/www.google.com/https:\/\/www.baidu.com/g' default.json 最后,插件管理点击高级,把站点升级改为国内插件下载地址: https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json
jenkins权限管理
jenkins部署Tomcat环境准备
yum install java-1.8.0-openjdk* -y
安装maven
#1.下载maven
[root@jenkins opt]# wget https://mirrors.aliyun.com/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
#2.解压
[root@jenkins opt]# tar -xf apache-maven-3.6.3-bin.tar.gz -C /usr/local/
#3.查看java版本
[root@jenkins opt]# java -version
openjdk version "1.8.0_282"
OpenJDK Runtime Environment (build 1.8.0_282-b08)
OpenJDK 64-Bit Server VM (build 25.282-b08, mixed mode)
#4.添加环境变量
[root@jenkins opt]# vim /etc/profile.d/java.sh
export MAVEN_HOME=/usr/local/apache-maven-3.6.3
export PATH=$MAVEN_HOME/bin:$PATH
#5.重载环境变量,测试mvn
[root@jenkins opt]# source /etc/profile
#6.测试mvn
[root@jenkins opt]# mvn --version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
安装tomcat
#1.下载
[root@k8s-m-01 ~]# yum install java-1.8.0-openjdk* -y
#2.创建下载tomcat目录
[root@k8s-m-01 ~]# mkdir tomcat
[root@k8s-m-01 tomcat]# wget https://ftp.wayne.edu/apache/tomcat/tomcat-9/v9.0.52/bin/apache-tomcat-9.0.52.tar.gz
#3.解压
[root@k8s-m-01 ~]# tar -xf apache-tomcat-9.0.52.tar.gz -C /usr/local/
#4.软连接
[root@k8s-m-01 ~]# ln -s /usr/local/apache-tomcat-9.0.52/ /usr/local/tomcat
#5.添加环境变量
[root@k8s-m-01 bin]# vim /etc/profile.d/tomcat.sh
export PATH=$PATH:/usr/local/tomcat/bin
[root@k8s-m-01 bin]# source /etc/profile
#6.启动
方式一:
[root@k8s-m-01 ~]# /usr/local/apache-tomcat-9.0.52/bin/startup.sh #启动tomcat
方式二:
[root@k8s-m-01 bin]# pwd #启动tomcat
/usr/local/tomcat/bin
[root@k8s-m-01 bin]# ./startup.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Tomcat started.
#8.验证启动端口
[root@k8s-m-01 ~]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp6 0 0 :::8080 :::* LISTEN 116492/java
给tomcat增加权限
# tomcat-users.xml倒数第二行插入
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager-script"/>
<role rolename="manager-gui"/>
<role rolename="manager-status"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<user username="tomcat" password="tomcat" roles="manager-gui,manager-script,tomcat,admin-gui,admin-script"/>
# 开启远程访问/apache-tomcat-8.5.70/webapps/manager/META-INFcontext.xml,注释一下
<!--
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
-->