Gitlab安装及Jenkins简单job(小节1)


highlight: a11y-dark

theme: juejin

101

查看版本代号 lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.1 LTS Release: 18.04 Codename: bionic <--

国内gitlab-ce清华源地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu/pool/bionic/main/g/gitlab-ce/

图片.png

下载gitlab-ce_12.3.5

cd /usr/local/src/ dpkg -i gitlab-ce_12.3.5-ce.0_amd64.deb

gitlab 配置 ``` vim /etc/gitlab/gitlab.rb external_url 'http://192.168.37.101'

gitlabrails['smtpenable'] = true gitlabrails['smtpaddress'] = "smtp.qq.com" gitlabrails['smtpport'] = 465 gitlabrails['smtpusername'] = "1480765@qq.com" gitlabrails['smtppassword'] = "bgxojjenggdebgif" gitlabrails['smtpdomain'] = "qq.com" gitlabrails['smtpauthentication'] = "login" gitlabrails['smtpenablestarttlsauto'] = true gitlabrails['smtptls'] = true gitlabrails['gitlabemailfrom'] = "1480765@qq.com" user['gituseremail'] = "1480765@qq.com" ```

gitlab-ctl reconfigure

图片.png

图片.png

登录GitLab 图片.png

102

配置JAVA环境 ``` vim /etc/profile

结尾添加

export JAVAHOME=/usr/local/jdk export PATH=$JAVAHOME/bin:$JAVAHOME/jre/bin:$PATH export CLASSPATH=.$CLASSPATH:$JAVAHOME/lib:$JAVAHOME/jre/lib:$JAVAHOME/lib/tools.jar 使变量生效 source /etc/profile 解压缩 [jdk-8u351-linux-x64.tar.gz](https://share.weiyun.com/S8NXDPnp) cd /usr/local/src/ tar xvf jdk-8u351-linux-x64.tar.gz 软链接 ln -sv /usr/local/src/jdk1.8.0_351 /usr/local/jdk 软链接 ln -sv /usr/local/jdk/bin/java /usr/bin/ ``` 清华源Ubuntu版本:https://mirrors.tuna.tsinghua.edu.cn/jenkins/debian-stable/

下载插件jenkins_2.346.3 dpkg -i jenkins_2.346.3_all.deb apt install daemon 修改jenkins配置文件

低于2.346此方法即可、高于2.346额外执行步骤1 vim /etc/default/jenkins JENKINS_USER=root JENKINS_GROUP=root MAXOPENFILES=65536 HTTP_PORT=8080 <--端口

步骤1 ```

搜索

find / -name jenkins.service

更改

vim /lib/systemd/system/jenkins.service User=root Group=root 重启jenkins systemctl daemon-reload systemctl enable jenkins systemctl restart jenkins ```

图片.png

cat /var/lib/jenkins/secrets/initialAdminPassword e9e8b9f986fc4579b698c915737c1395 <--密码贴到下图中

图片.png

安装推荐插件

图片.png

设置管理员账号密码

图片.png

图片.png

Gitlab创建用户 图片.png

图片.png

创建组

图片.png

Create user

图片.png

图片.png

图片.png

图片.png

root给zhangsan授权

图片.png

zhangsan

图片.png

图片.png

创建web1

图片.png

102

Git全局设置 git config --global user.name "zhangsan" git config --global user.email "1480765@qq.com"

图片.png

图片.png

克隆项目 ``` cd /opt

git clone http://192.168.37.101/linux01/web1.git Cloning into 'web1'... Username for 'http://192.168.37.101': zhangsan <-- Password for 'http://zhangsan@192.168.37.101': <--密码:1234.com remote: Enumerating objects: 11, done. remote: Counting objects: 100% (11/11), done. remote: Compressing objects: 100% (5/5), done. remote: Total 11 (delta 1), reused 0 (delta 0) Unpacking objects: 100% (11/11), done. 查看网页信息 cat web1/index.html

ABC123

```

新建任务 图片.png

图片.png

构建前删除

图片.png

图片.png

图片.png

图片.png

图片.png

102 ```

生成公钥

ssh-keygen

查看公钥

cat /root/.ssh/id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeO4iu50n6LLNQShhUGHvrD18FwUyaa9L4TtEC3pZyNhAJYBxm+Jt3xL6N+pcoJDECj+gm1l9wVaojA9UnGD/DVpBsPnXsZJorvCjDeXpQ3XoHmoKWTJGab3CQdeTALdi5lNUOeZs90I6NE6EAkzhxIk3TpF6iePkIGwdWqCoWHRtuJDDi6FZkXFZXGykjogoIrVk1nz3hb8U0QleVyObjcoqvGj8pincetNLgPouKf3lXu56j1GNuHuaYZFcUT440pi99E8lLOt//WW8BdTgY7NxMLclSFn7zHXPGOKF+htiBjpFpnZGnIC5/IuKfxAxAut3v2ou/dC/d3RdNa//B root@ubuntu-2 ```

图片.png

图片.png

cd /opt/ rm -rf web1/ 再次克隆(不要账号密码) git clone git@192.168.37.101:linux01/web1.git Cloning into 'web1'... The authenticity of host '192.168.37.101 (192.168.37.101)' can't be established. ECDSA key fingerprint is SHA256:yNeGspxyk/g9Thmnw8AuCHSkslKZNXsl0LWjJ59lcAQ. Are you sure you want to continue connecting (yes/no)? yes <-- Warning: Permanently added '192.168.37.101' (ECDSA) to the list of known hosts. remote: Enumerating objects: 11, done. remote: Counting objects: 100% (11/11), done. remote: Compressing objects: 100% (5/5), done. remote: Total 11 (delta 1), reused 0 (delta 0) Receiving objects: 100% (11/11), done. Resolving deltas: 100% (1/1), done.

105

安装nginx cd /usr/local/src/ wget https://nginx.org/download/nginx-1.16.1.tar.gz apt-get install fontconfig-config fonts-dejavu-core fping libapache2-mod-php libapache2-mod-php7.2 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libfontconfig1 libgd3 libiksemel3 libjbig0 libjpeg-turbo8 libjpeg8 liblua5.2-0 libodbc1 libopenipmi0 libsensors4 libsnmp-base libsnmp30 libsodium23 libssh2-1 libtiff5 libwebp6 libxpm4 php-bcmath php-common php-gd php-ldap php-mbstring php-mysql php-xml php7.2-bcmath php7.2-cli php7.2-common php7.2-gd php7.2-json php7.2-ldap php7.2-mbstring php7.2-mysql php7.2-opcache php7.2-readline php7.2-xml snmpd ssl-cert ttf-dejavu-core libmysqlclient-dev libxml2-dev libxml2 snmp libsnmp-dev libevent-dev openjdk-8-jdk curl libcurl4-openssl-dev -y tar xvf nginx-1.16.1.tar.gz cd nginx-1.16.1/ ./configure --prefix=/apps/nginx make make install 创建代码目录 mkdir /data/nginx/html/linux01 -p 添加location vim /apps/nginx/conf/nginx.conf ... location /linux01 { root /data/nginx/html; index index.html index.htm; } 检查nginx配置语法、启动nginx服务 /apps/nginx/sbin/nginx -t /apps/nginx/sbin/nginx

102

ssh-copy-id 192.168.37.105

图片.png

图片.png

图片.png

图片.png

升级

图片.png

图片.png

图片.png

查看结果 图片.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值