安装Centos8
官网下载镜像,我使用的是Hyper-V虚拟机。
安装powershell 7
安装Jenkins
sudo dnf install java-1.8.0-openjdk-devel
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
sudo dnf install jenkins -y --nogpgcheck
自动启动
sudo systemctl start jenkins
sudo systemctl enable jenkins
systemctl status jenkins
开放端口 sudo firewall-cmd --permanent --zone=public --add-port=8080/tcp
sudo firewall-cmd --reload
查看默认密码 sudo cat /var/lib/jenkins/secrets/initialAdminPassword
安装podman
sudo yum install -y podman
测试
podman
podman run -it --rm -p 8000:80 --name aspnetcore_sample mcr.microsoft.com/dotnet/core/samples:aspnetapp
安装gitee和PowerShell(习惯)插件
PowerShell
PowerShell Jenkins
gitee Jenkins
可能需要
设置系统代理,否则微软镜像拉去缓慢
sudo vim ~/.bash_profile
export http_proxy="http://192.168.x.x:x"
export https_proxy="http://192.168.x.x:x"
更改用户为系统管理员,否则无法使用环境变量()
vim /etc/sysconfig/jenkins
JENKINS_USER="ye"
sudo chown -R ye:ye /var/lib/jenkins/
sudo chown -R ye:ye /var/log/jenkins/
sudo chown -R ye:ye /var/cache/jenkins/
sudo chown -R ye:ye /usr/lib/jenkins/jenkins.war
sudo chown -R ye:ye /etc/sysconfig/jenkins
systemctl restart jenkins