1 前言
Bitbucket是由Atlassian公司开发,支持Git和Mercurial版本的控制系统。Bitbucket提供了代码托管、问题跟踪、持续集成、部署和协作工具等多种功能,还支持私有仓库和团队协作,可以安全地存储和管理代码。
2 搭建过程
(1)安装mysql数据库
以Centos系统下安装为例,在官网下载mysql相应的包,例如mysql 5.7版本:
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server
安装过程中会出现如下错误:
执行如下命令:
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
再次安装:
yum install mysql-community-server -y
(2)配置mysql数据库
启动 MySQL 服务,并使用 root 用户登录 MySQL,创建一个Bitbucket的库。
执行如下命令:
启动mysql服务
systemctl start mysqld
查看mysql状态
systemctl status mysqld
查看mysql数据库的默认密码:
查看文件内容
cat /var/log/mysqld.log
查看文件内容中包含password的行信息
cat /var/log/mysqld.log | grep password
使用root账号登录mysql,输入上面命令查看到的密码:
/usr/local/mysql/bin/mysql -u root -p
修改数据库的参数和密码:
set global validate_password_length=8;
set global validate_password_policy=LOW;
set password=password('yourpasswd');
创建数据库的账号密码,配置命令如下:
创建bitbucket数据库
create database bitbucket_db default character set utf8 collate utf8_bin;
创建用户
CREATE USER 'admin'@'%' IDENTIFIED BY 'yourpasswd';
GRANT ALL PRIVILEGES ON bitbucket.* TO 'admin'@'%';
FLUSH PRIVILEGES;
QUIT
(3)下载Bitbucket
下载链接:
https://www.atlassian.com/zh/software/bitbucket/download-archives
以我下载的7.21.6这个版本为例:
(4)检查环境
检查响应的环境是否符合要求
查阅资料发现,Bitbucket的安装必须满足:
1、需要jdk(java)环境,这是必须的;
2、需要Oracle的Java JDK8;
3、git的版本要在2.19以上;
4、mysql版本要在5.6.16以上。
通过如下命令进行检查:
[root@localhost ~]# cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)
[root@localhost ~]# java -version
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
查看mysql的版本
(5)安装git
安装依赖文件
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker -y
下载git安装包
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.31.3.tar.gz
yum remove git -y
cp git-2.31.3.tar.gz /usr/local/
cd /usr/local/
tar -zxvf git-2.31.3.tar.gz
cd git-2.31.3/
make prefix=/usr/local/git all
make prefix=/usr/local/git install
vi /etc/profile
在最后一行添加如下内容:
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/git/bin:$PATH
source /etc/profile
git --version
(6)安装Bitbucket
atlassian]# ./atlassian-bitbucket-7.21.6-x64.bin
Unpacking JRE ...
Starting Installer ...
Bitbucket 7.21.6 installation wizard
Would you like to install or upgrade an instance?
Install a new instance [1, Enter], Upgrade an existing instance [2]
1
Install Bitbucket 7.21.6
What type of instance are you looking to install?
Install a Server instance [1, Enter], Install a Data Center instance [2], Install a Smart Mirroring instance [3]
1
Where should Bitbucket be installed?
Select the folder where you would like Bitbucket 7.21.6 to be installed,
then click Next.
[/opt/atlassian/bitbucket/7.21.6]
Default location for Bitbucket home directory
The location for Bitbucket data.
This will be the default location for repositories, plugins, and other data.
Ensure that this location is not used by another Bitbucket installation.
[/var/atlassian/application-data/bitbucket]
Configure which ports Bitbucket will use.
Configure TCP Ports
Bitbucket requires a TCP port that isn't being used by other applications.
The HTTP port is where users access Bitbucket through their browsers.
Bitbucket also requires ports 7992 and 7993 are available to run the bundled
search server that provides search functionality to Bitbucket.
HTTP Port Number
[7990]
Run as a service
For a production server we recommend that you run Bitbucket as a
service because Bitbucket will restart automatically when the
computer restarts.
Install Bitbucket as a service?
Yes [y, Enter], No [n]
y
Please review your Bitbucket installation settings
Installation Summary
Installation Directory: /opt/atlassian/bitbucket/7.21.6
Home Directory: /var/atlassian/application-data/bitbucket
HTTP Port: 7990
Install as a service: Yes
Install [i, Enter], Exit [e]
i
Extracting files ...
Installation of Bitbucket is complete
Would you like to launch Bitbucket?
Yes [y, Enter], No [n]
y
Please wait a few moments while Bitbucket starts up.
Launching Bitbucket ...
Installation of Bitbucket 7.21.6 is complete
The installer was unable to detect whether Bitbucket started correctly
Please consult the '
file
to verify that Bitbucket started successfully
Bitbucket 7.21.6 can be accessed at http://localhost:7990
Launch Bitbucket 7.21.6 in browser?
Yes [y, Enter], No [n]
y
Finishing installation ...
到这里,Bitbucket就安装完成了,下次会继续介绍Bitbucket界面的配置、mysql驱动配置和Bitbucket激活等
欢迎关注「技术分享交流」公众号 ,如果有建议或者疑问的话,欢迎大家评论留言,如果喜欢公众号文章的话可以点【在看】,您的鼓励就是我的动力哈!!!
原文始发于微信公众号(技术分享交流):CentOS搭建Bitbucket管理平台(上)
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论