安装前准备
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
数据库创建
创建用户bitbucketuser,密码为“123456”,创建数据库bitbucketdb,将数据库bitbucketdb的权限授予用户bitbucketuser
sudo su - postgres
psql
create user bitbucketuser with password '123456';
CREATE DATABASE bitbucketdb;
GRANT ALL PRIVILEGES ON DATABASE bitbucketdb TO bitbucketuser;
\q
sudo su <当前用户>
此处创建的数据库将在配置bitbucket时使用
bitbucket安装
1.下载bitbucket
下载地址:https://www.atlassian.com/software/bitbucket/download/data-center,选择Linux 64 bit安装程序下载
下载得atlassian-bitbucket-7.17.0-x64.bin,将其拷贝到服务器/usr/local/software目录下
2.运行安装程序
cd /usr/local/software
sudo chmod +x atlassian-bitbucket-7.17.0-x64.bin
sudo apt-get install git -y
sudo ./atlassian-bitbucket-7.17.0-x64.bin
-
Would you like to install or upgrade an instance?
[1, Enter]
-
What type of instance are you looking to install?
[1, Enter]
-
Installation directory
默认即可
-
Home directory
默认即可
-
TCP ports
默认7990即可
-
Install Bitbucket as a service?
[y, Enter]
sudo ufw allow 7990
安装完成可通过http://localhost:7990访问
Bitbucket 配置
1.数据库配置
external
- Database Type:PosegreSQL
- Hostname:localhost
- Database name:bitbucketdb
- Database username:bitbucketuser
- Database password:123456
2.激活
记下Server ID,接下来进行激活时要用到
使用atlassian-agent.jar进行激活
atlassian-agent.jar下载地址:https://gitee.com/pengzhile/atlassian-agent/releases
将atlassian-agent.jar文件拷贝到服务器/usr/local/software/目录下
cd /opt/atlassian/bitbucket/7.17.0/binsudo -u atlbitbucket ./stop-bitbucket.shsudo -u atlbitbucket JAVA_OPTS="-javaagent:/usr/local/software/atlassian-agent.jar ${JAVA_OPTS}" ./start-bitbucket.sh
在/usr/local/software/目录下执行,注意:-s后的参数为刚刚记下的Server ID
cd /usr/local/software/java -jar atlassian-agent.jar -p bitbucket -m aaa@bbb.com -n my_name -o https://zhile.io -s B10K-A1XJ-S45T-XLLA
显示信息如下
=========================================================== Atlassian Crack Agent v1.3.1 ============== https://zhile.io ============== QQ Group: 30347511 ===========================================================Your license code(Don't copy this line!!!): AAABhQ0ODAoPeJxtUV1vmzAUffevQNozqYGEfEiWuhqioIVQQpKtfZmMeynWwDDbZGG/fjShL2slS1c+Rz7n3OMvhw6shBvL9S1nupq6K8+zaHawXOw6iCpgRjQyYAbIG2I72HZ9FJ5Z1V0ZUrBKAwpAcyXaK3KUlaiFgRerEhykBivvrdKYVq/u7v6WooKJaFCiXpkU+ibygeWNLCaMG3EGYlQHiDbSDPcwZqIijLH7PM8nvKnR6LFhuiQxxXSd0g2Tr+EzXhwumtOnflmeTvC7iv0fD2l0DDaX/VNY/InyvkrPjduuH3X2nO5fiojcbDPDlAE1bnaFtjeTQ9/CjtVAaBLH4Z5GX7doCCQNSCY5hJdWqH7sarG08Xw4aHwbBWQbBVm4s7eO781cD89m3tTDKAN1BjXQD8cospP50rHX6fS77UfffPQL+hMo/daR42M8xwvPc94lP/d77BQvmYb//2ws6l3OvW226+ocVFIc9YAT20FDQvJJyrH/6/Z1/1MO8x9/77kXMCwCFHlljIMokyd6s8FpnrSDRurJTzjlAhQLs36mQ0a4XglycfLehHhrs7NtTw==X02iu
将license code拷贝到License key窗口点击continue即可成功激活
3.创建管理员账户
输入用户名和密码及必要信息
以服务方式运行
使用sudo权限运行安装程序,选择以作为Service安装,自动进行service配置。经验证,bitbucket能够实现开机自动启动。