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/
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
登录GitLab
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 ```
cat /var/lib/jenkins/secrets/initialAdminPassword e9e8b9f986fc4579b698c915737c1395 <--密码贴到下图中
安装推荐插件
设置管理员账号密码
Gitlab创建用户
创建组
Create user
root给zhangsan授权
zhangsan
创建web1
102
Git全局设置 git config --global user.name "zhangsan" git config --global user.email "1480765@qq.com"
克隆项目 ``` 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
```
新建任务
构建前删除
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 ```
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
升级
查看结果