Bamboo安装配置过程
Bamboo安装配置过程
安装前准备
Oracle JDK8 环境配置
下载地址:https://www.oracle.com/java/technologies/downloads/#java8,选择jdk-8u311-linux-x64.tar.gz
将jdk8压缩包拷贝到/usr/local/software/目录下进行解压,解压得jdk1.8.0_311目录
sudo tar -zxvf jdk-8u311-linux-x64.tar.gz
修改/etc/environment
sudo vim /etc/environment
直接将以下内容覆盖原内容即可
JAVA_HOME=/usr/local/software/jdk1.8.0_311
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:$JAVA_HOME:$JAVA_HOME/bin"
保存修改后,使用以下命令使/etc/environment立即生效
source /etc/environment
测试测试环境变量是否成功
echo $JAVA_HOME
# 显示JAVA_HOME路径
/usr/local/software/jdk1.8.0_311
java -version
# 显示jdk版本信息
java version "1.8.0_311"
Java(TM) SE Runtime Environment (build 1.8.0_311-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.311-b11, mixed mode)
安装PostgreSQL 12数据库
直接使用apt-get安装即可
sudo apt-get install postgresql-12 -y
sudo ufw enable
sudo ufw allow 5432
数据库创建
创建用户bamboouser,密码为“123456”,创建数据库bamboodb,将数据库bamboodb的权限授予用户bamboouser
sudo su - postgres
psql
create user bamboouser with password '123456';
CREATE DATABASE bamboodb;
GRANT ALL PRIVILEGES ON DATABASE bamboodb TO bamboouser;
\q
su <当前用户>
此处创建的数据库将在配置Bamboo时使用
创建bamboo用户和安装目录
1.创建用户
sudo useradd --create-home -c "Bamboo role account" -s /bin/bash bamboo
sudo passwd bamboo
New password:
Retype new password:
passwd: password updated successfully
2.创建安装目录
sudo mkdir -p /opt/atlassian/bamboo
安装Bamboo
1.下载Bamboo
下载地址:https://www.atlassian.com/software/bamboo/download,选择tar.gz下载即可
下载得atlassian-bamboo-8.0.0.tar.gz压缩包,拷贝到服务器/opt/atlassian/bamboo目录下
2.解压
将atlassian-bamboo-8.0.0.tar.gz解压缩,/opt/atlassian/bamboo/current即为安装目录
sudo chown -R bamboo: /opt/atlassian/bamboocd /opt/atlassian/bamboosu bambootar -zxvf atlassian-bamboo-8.0.0.tar.gzln -s atlassian-bamboo-8.0.0/ current
3.创建bamboo-home目录
mkdir /opt/atlassian/bamboo/bamboo-home
修改bamboo-init.properties配置文件,指定bamboo-home目录
cd /opt/atlassian/bamboo/current/atlassian-bamboo/WEB-INF/classesvim bamboo-init.properties
将下面这行添加到文件末尾,保存退出即可
bamboo.home=/opt/atlassian/bamboo/bamboo-home
4.启动bamboo
sudo ufw enablesudo ufw allow 8085cd /opt/atlassian/bamboo/current./bin/start-bamboo.sh
通过http://localhost:8085/即可访问
记下Server ID,后面激活bamboo要用到
配置Bamboo
1.激活
使用atlassian-agent.jar进行激活
atlassian-agent.jar下载地址:https://gitee.com/pengzhile/atlassian-agent/releases
将atlassian-agent.jar文件拷贝到服务器/usr/local/software/目录下
修改/opt/atlassian/bamboo/current/bin/setenv.sh文件
cd /opt/atlassian/bamboo/current/bin/vim setenv.sh
添加JAVA_OPTS环境变量,保存修改
export JAVA_OPTS="-javaagent:/usr/local/software/atlassian-agent.jar ${JAVA_OPTS}"
重启bamboo
cd /opt/atlassian/bamboo/current/bin/./stop-bamboo.sh./start-bamboo.sh
在/usr/local/software/目录下执行,注意:-s后的参数为刚刚记下的Server ID
cd /usr/local/software/java -jar atlassian-agent.jar -p bamboo -m aaa@bbb.com -n my_name -o https://zhile.io -s BXLJ-7JTR-5KFY-0KFH
显示信息如下
=========================================================== Atlassian Crack Agent v1.3.1 ============== https://zhile.io ============== QQ Group: 30347511 ===========================================================Your license code(Don't copy this line!!!): AAABhA0ODAoPeJxtkV9vmzAUxd/9KZD2TGqcBLpIlkYJWSIlpAuEVnuZDL0pVsEw21Dop5+bwstayX8k3+uje37nW9KCdcy1RVzLma8W3opgK4gTi2DioEAC07wWa6aBvr/YDraJi/Y8B6EgGRqIWAU0OB4O4SnY+XsUdqxsr5/ohZUK0B2rsrqegdAgG8kVUC1bQGtQueTNtfEsSl5xDU9W+SFsZYNVaN2o1c3NW8FLmPEaHeUzE1x9aH+qBrXQLNfhgfGSMsZ+ZFk2y+sKjZJbpgp6CF6DTXjq83Pn7F7vRfE76ZfbKO3V6e1SlJlf/Pr55Lg96fLYf4gfm/TvVuPmodvUL4tnSpFRNz4EEzmEfcPlMJK5/W5jz6zJrZmEd6PTGGQHcremd/7Gsx8Tf2lHqTnSzcmf+mPNpOEzInuBIQWp3n06LsYevp3PHRS1VQbyeDkrU6O2M6Xw9SD3rcwLpuD/6EYckz5BcRhRs+29486XhHhkgYmLJ57XeKvhjzD3Pyv3t/QwLQIVAIkMqxSFKyb5dm1NZwEFqV6tHYsWAhRoOPMXNhsWEDGOU0QapLk76tTzJA==X02iu
将license code拷贝到License key窗口点击continue即可成功激活
2.基本配置
默认即可,直接点击continue
3.数据库配置
- Database type:选择“PosegreSQL”,点击continue
- Connection type:选择“Connect using JDBC”
- Driver class name:默认即可
- Database URL:jdbc:postgresql://localhost:5432/bamboodb,bamboodb为创建的数据库名
- User name:bamboouser,bamboouser为创建的数据库用户
- Password:123456
正确设置各项后,点击continue
4.导入数据
选择“Create a new Bamboo home”,点击continue即可
5.创建管理员
输入管理员用户名和密码以及必要信息,点击Finish即可完成配置
服务方式运行
1.创建bamboo.service
cd /etc/systemd/system sudo vim bamboo.service
文件内容如下:
[Unit]Description=Atlassian BambooAfter=syslog.target network.target[Service]Type=forkingUser=bambooEnvironment=CATALINA_PID=/opt/atlassian/bamboo/current/bin/Catalina.pidEnvironment=JAVA_HOME=/usr/local/software/jdk1.8.0_311PIDFile=/opt/atlassian/bamboo/current/bin/Catalina.pidExecStart=/opt/atlassian/bamboo/current/bin/start-bamboo.shExecStop=/opt/atlassian/bamboo/current/bin/stop-bamboo.shSuccessExitStatus=143[Install]WantedBy=multi-user.target
2.启动服务
启动服务,并查看当前服务状态
sudo systemctl enable bamboo.servicesudo systemctl status bamboo
3.验证
手动停止bamboo,并重启服务器,查看bamboo是否自动启动
cd /opt/atlassian/bamboo/current/bin/./stop_bamboo.shreboot
经验证,重启后bamboo自动启动运行