写点什么

极客时间运维进阶训练营第三周作业

作者:独钓寒江
  • 2022-11-13
    广东
  • 本文字数:1782 字

    阅读完需:约 6 分钟

安装 GitLab

/usr/local/src/


https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu/pool/jammy/main/g/gitlab-ce/


/usr/local/src/


cd /usr/local/src


ll


free -m


free -h


dpkg -c gitlab-ce_15.5.3-ce.0_amd64.deb


dpkg -i gitlab-ce_15.5.3-ce.0_amd64.deb


vim /etc/gitlab/gitlab.rb


i


external_url 'http://192.168.253.131'


gitlab_rails['smtp_enable'] = true


gitlab_rails['smtp_address'] = "smtp.126.com"


gitlab_rails['smtp_port'] = 465


gitlab_rails['smtp_user_name'] = "email@126.com"


gitlab_rails['smtp_password'] = "password"


gitlab_rails['smtp_domain'] = "126.com"


gitlab_rails['smtp_authentication'] = "login"


gitlab_rails['smtp_enable_starttls_auto'] = true


gitlab_rails['smtp_tls'] = true


gitlab_rails['gitlab_email_from'] = "email@126.com"


user["git_user_email"] = "email@126.com"


esc :w enter


:wq enter


:x enter


esc :q! enter


gitlab-ctl reconfigure


cat /etc/gitlab/initial_root_password


hDCboM1ijzE2yrc7qz1MUvJB39qIaJprv+iY/8BEmBY=

创建 group、user 和 project 并授权

左上角下拉菜单 --> Admin --> Dashboard


​ --> New group


​ --> New user --> user1 --> Reguler --> Create user


​ --> Overview --> Users --> user1 --> Edit --> Password --> Save changes


​ --> New user --> user1 --> Reguler --> Create user -->


Overview --> Dashboard/Projects --> New project --> Create blank project --> Project URL --> Project name --> Create project


apt install git


Overview --> Groups --> Group name --> Manage access --> Invite members --> Username or email address --> Select a role --> Invite

熟练 Git 命令的基本使用,通过 Git 命令实现源代码的 clone、push 等基本操作

git config --global user.email "PeahLam@126.com"


git config --global user.name "PecchLam"


git config --global list


cd /e/Workspaces/Geek_MagEdu/DevOps


git clone http://192.168.253.131/devops/gitlab.git


git clone git@192.168.253.131:devops/gitlab.git


git pull


git status


git add .


git commit -m "testing.txt"


git push


git status


git reset --hard HEAD^


git reflog


git reset --hard


git branch


git checkout -b develop


git checkout develop


git log

熟练掌握对 GitLab 服务的数据备份与恢复

/etc/gitlab #配置文件目录


/run/gitlab #运行 pid 目录


/opt/gitlab #安装目录


/var/opt/gitlab #数据目录


/var/log/gitlab #日志目录


gitlab-ctl status


停止写入服务


gitlab-ctl stop unicorn sidekiq


gitlab-ctl status


gitlab-rake gitlab:backup:create


Backup::Error: backup_information.yml not yet loaded


Is the server running locally and accepting connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?


gitlab-ctl stop


gitlab-ctl start


gitlab-ctl status


gitlab-ctl restart


gitlab-ctl stop unicorn sidekiq


gitlab-rake gitlab:backup:create


Backup 1668249105_2022_11_12_15.5.3 is done.


Backup below folders as well


/etc/git/gitlab


/var/opt/gitlab/nginx/conf #nginx 配置文件


/etc/gitlab/gitlab.rb #gitlab 配置文件


/etc/gitlab/gitlab-secrets.json #key 文件


gitlab-ctl start unicorn sidekiq


gitlab-ctl status


ll /var/opt/gitlab/backups/


gitlab-ctl stop unicorn sidekiq


gitlab-rake gitlab:backup:restore BACKUP=1668249105_2022_11_12_15.5.3


gitlab-ctl start unicorn sidekiq


git clone -baddress


部署 Jenkins 服务器并安装 GitLab 插件、实现代码免秘钥代码 clone

https://get.jenkins.io/debian-stable/


apt update


apt install openjdk-11-jdk


dhclient -r


dhclient


./etc/default/jenkins


/lib.systemd/system/jenkins.service


/usr/share/java/jenkins.war


dpkg -i jenkins_2.361.3_all.deb && systemctl stop jenkins


nano /lib/systemd/system/jenkins.service


User=rootGroup=root


Environment="JAVA_OPTS=-Djava.awt.headless=true -Djava.awt.headless=true -Dhudson.security.csrf.GlobalCrumbIssuerConfiguration.DISABLE_CSRF_PROTECTION=true"


systemctl daemon-reload


systemctl start jenkins.service


ps -ef | grep jenkins


http://192.168.253.129:8080/login?from=%2F


用户头像

独钓寒江

关注

还未添加个人签名 2018-08-08 加入

还未添加个人简介

评论

发布
暂无评论
极客时间运维进阶训练营第三周作业_独钓寒江_InfoQ写作社区