centeros jenkins安装

用到命令

yum install -y wget
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum install -y gcc

wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo --no-check-certificate
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
yum install -y fontconfig java-11-openjdk
yum install -y jenkins
  
service jenkins start

开机自动启动
systemctl enable jenkins

yum install -y git

firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --reload

两个注意事项:主机要把路径定位到 /
maven 要进入global tool中设置版本,以及在服务器上的路径即可。
######yum install maven -y

查看密码

cat /var/lib/jenkins/secrets/initialAdminPassword


安装前端环境
 
curl -fsSL https://rpm.nodesource.com/setup_16.x | bash -
 
yum install -y nodejs
 
yum install gcc-c++ make -y
 
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
 
yum install yarn -y


安装nodejs
 
wget https://nodejs.org/dist/latest-v10.x/node-v10.24.1-linux-x64.tar.xz
tar -xvf node-v10.24.1-linux-x64.tar.xz
mv ./node-v10.24.1-linux-x64 /usr/local/node
 
vi /etc/profile
最后加上这句话:export PATH=$PATH:/usr/local/node/bin
让新加的配置生效:source /etc/profile
 
 
node -v
 
npm config set registry https://registry.npm.taobao.org
 
npm install -g @quasar/cli@1.3.2
 
 

 yum卸载java
rpm -qa | grep java

python-javapackages-3.4.1-11.el7.noarch
javamail-1.4.6-8.el7.noarch
javapackages-tools-3.4.1-11.el7.noarch
tzdata-java-2022g-1.el7.noarch
java-11-openjdk-11.0.18.0.10-1.el7_9.x86_64
java-1.8.0-openjdk-headless-1.8.0.362.b08-1.el7_9.x86_64
java-1.8.0-openjdk-1.8.0.362.b08-1.el7_9.x86_64
java-1.8.0-openjdk-devel-1.8.0.362.b08-1.el7_9.x86_64
javassist-3.16.1-10.el7.noarch
java-11-openjdk-headless-11.0.18.0.10-1.el7_9.x86_64

先卸载11,再安装11

rpm -e java-11-openjdk-11.0.18.0.10-1.el7_9.x86_64
rpm -e java-11-openjdk-headless-11.0.18.0.10-1.el7_9.x86_64



   yum -y remove java 



/usr/lib/jvm/java-11-openjdk-11.0.18.0.10-1.el7_9.x86_64/bin/java

rm -f /etc/alternatives/java
ln -s /usr/lib/jvm/java-11-openjdk-11.0.18.0.10-1.el7_9.x86_64/bin/java /etc/alternatives/java

rm -f /var/lib/alternatives/java
ln -s /usr/lib/jvm/java-11-openjdk-11.0.18.0.10-1.el7_9.x86_64/bin/java /var/lib/alternatives/java

rm -f /usr/bin/java
ln -s /usr/lib/jvm/java-11-openjdk-11.0.18.0.10-1.el7_9.x86_64/bin/java /usr/bin/java
 

/etc/alternatives/java
/etc/java
/etc/pki/ca-trust/extracted/java
/etc/pki/java
/var/lib/alternatives/java
/usr/bin/java
/usr/lib/java
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.362.b08-1.el7_9.x86_64/jre/bin/java
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.362.b08-1.el7_9.x86_64/bin/java
/usr/lib/jvm/java
/usr/lib/jvm/java-11-openjdk-11.0.18.0.10-1.el7_9.x86_64/bin/java
/usr/lib/jvm-exports/java
/usr/share/java




/usr/share/maven

vi /etc/profile

export MAVEN_HOME=/usr/share/maven
export PATH=${MAVEN_HOME}/bin:${PATH}


source /etc/profile


/usr/share/maven/

安装wget

yum install -y wget
 

  

//切换阿里云安装源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all

安装gcc

yum install -y gcc


 安装jenkins




Jenkins Redhat Packages
To use this repository, run the following command:


  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.key
  
If you've previously imported the key from Jenkins, the rpm --import will fail because you already have a key. Please ignore that and move on.


  yum install fontconfig java-11-openjdk
  yum install jenkins
  
The rpm packages were signed using this key:

pub   rsa4096 2020-03-30 [SC] [expires: 2023-03-30]
      62A9756BFD780C377CF24BA8FCEF32E745F2C3D5
uid                      Jenkins Project 
sub   rsa4096 2020-03-30 [E] [expires: 2023-03-30]
You will need to explicitly install a supported Java runtime environment (JRE), either from your distribution (as described above) or another Java vendor (e.g., Adoptium).

完整脚本如下:

yum install -y wget
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum install -y gcc

wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo --no-check-certificate
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
yum install -y fontconfig java-11-openjdk
yum install -y jenkins
  
service jenkins start


yum install -y git

firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --reload





cat /var/lib/jenkins/secrets/initialAdminPassword


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
安装 Jenkins 有不同的方法,取决于你使用的操作系统。以下是一些常见操作系统上安装 Jenkins 的方法: ### Ubuntu/Debian 1. 更新系统软件包: ```shell sudo apt update sudo apt upgrade ``` 2. 安装 Java 运行环境: ```shell sudo apt install openjdk-8-jdk ``` 3. 添加 Jenkins 的密钥和存储库: ```shell wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add - sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list' ``` 4. 更新软件包列表并安装 Jenkins: ```shell sudo apt update sudo apt install jenkins ``` 5. 启动 Jenkins 服务: ```shell sudo systemctl start jenkins ``` 6. 检查 Jenkins 服务状态: ```shell sudo systemctl status jenkins ``` ### CentOS/RHEL 1. 安装 Java 运行环境: ```shell sudo yum install java-1.8.0-openjdk-devel ``` 2. 添加 Jenkins 的仓库和密钥: ```shell 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.key ``` 3. 安装 Jenkins: ```shell sudo yum install jenkins ``` 4. 启动 Jenkins 服务: ```shell sudo systemctl start jenkins ``` 5. 检查 Jenkins 服务状态: ```shell sudo systemctl status jenkins ``` 安装完成后,你可以通过在浏览器中访问 `http://服务器IP地址:8080` 来访问 Jenkins 控制台,并按照屏幕上的指示进行初始化设置。 请注意,上述步骤仅提供了一种常见的安装方法,具体步骤可能因操作系统版本和配置而有所不同。确保参考适合你的操作系统的文档或官方文档进行安装

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值