自学内容网 自学内容网

centos8 安装 jenkins

配置centos8 yum源
cd /etc/yum.repos.d
mkdir bak
mv *.repo bak
wget https://mirrors.aliyun.com/repo/Centos-8.repo
安装java11
dnf install java-11-openjdk-devel
 启用 Jenkins 源仓库
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
安装最新稳定版本 Jenkins,重新启动
sudo yum install jenkins
sudo systemctl start jenkins
sudo systemctl enable jenkins
防火墙
sudo firewall-cmd --permanent --zone=public --add-port=8080/tcp
sudo firewall-cmd --reload
 安装docker
yum -y install device-mapper-persistent-data lvm2 

yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

yum -y --allowerasing install docker-ce docker-ce-cli containerd.io

tee /etc/docker/daemon.json <<-'EOF'
{
    "data-root": "/opt/docker",
    "log-driver": "json-file",
    "log-opts": {
        "max-size": "10m",
        "max-file": "50"
    },
    "registry-mirrors": [
        "https://5pfmrxk8.mirror.aliyuncs.com"
    ],
    "insecure-registries": ["XXXXXXXXX.com"]
}
EOF

systemctl start docker
systemctl enable docker
systemctl enable containerd

curl -L "https://521github.com/extdomains/github.com/docker/compose/releases/tag/v2.24.6" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
角色加入组
usermod -aG docker jenkins
systemctl restart docker
systemctl restart jenkins

 增加认证

cp -r /root/.docker/ /var/lib/jenkins/
cd /var/lib/jenkins/
chown -R jenkins.jenkins .docker
 修改hosts
vim /etc/hosts
XXXXXX  XCXXXXXXX

登录

http://your_ip_or_domain:8080

安装插件

可选插件(除去初始化时推荐安装的插件)

Publish Over SSH【连接测试服务器使用】

Gitlab【连接gitlab仓库使用】

Role-based Authentication Strategy【限制用户权限】

安装git
yum -y install git
安装maven
  1. 确保系统已经安装了Java运行时环境(JRE)或者Java开发工具包(JDK)。可以通过以下命令检查Java的安装情况:

    java -version
    
  2. 使用以下命令下载Maven二进制包(请根据你的需求选择合适的版本):

    wget https://downloads.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz
  3. 解压缩下载的二进制包:

    tar -xzf apache-maven-3.9.6-bin.tar.gz
    
  4. 将解压后的文件夹移动到适当的目录(例如/usr/local/):

    sudo mv apache-maven-3.9.6 /usr/local/
    
  5. 配置环境变量,使系统可以找到Maven。打开~/.bash_profile文件(或者~/.bashrc~/.profile等),然后添加以下行:

    vim ~/.bash_profile
    export MAVEN_HOME=/usr/local/apache-maven-3.9.6
    export PATH=$PATH:$MAVEN_HOME/bin
    
  6. 使环境变量生效:

    source ~/.bash_profile
    
  7. 检查Maven的安装情况:

    mvn -version
安装nodejs

1.下载解压

cd /opt
wget  https://nodejs.org/dist/latest/node-v16.19.0-linux-x64.tar.gz
tar -xvzf node-v16.19.0-linux-x64.tar.gz -C /opt

2. 修改环境变量

vim /etc/profile
export PATH=/opt/node-v16.19.0-linux-x64/bin:$PATH
source /etc/profile

3.初始化并安装pnmp或者cnmp

npm init -y
npm cache clean --force
npm config set registry https://registry.npmmirror.com
npm install

npm install -g pnpm@8.1.0
pnpm config set registry https://registry.npmmirror.com

 

 


原文地址:https://blog.csdn.net/u011334954/article/details/137773486

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!