Gitea,一款极易搭建的Git自助服务。如其名,Git with a cup of tea。跨平台的开源服务,支持Linux、Windows、macOS和ARM平台。配置要求低,甚至可以运行在树莓派上。

搭建之前,首先提示两个坑:

1、gitea不支持Centos6和更早的版本内核。

2、gitea不能在root下运行,必须是普通用户权限。

一、选择安装环境

我这边是物理主机服务器,安装的Centos7。

[xxx@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
[xxx@localhost ~]# uname -sr
Linux 3.10.0-1160.62.1.el7.x86_64

二、下载gitea

这个很简单,直接去官网下载二进制或者去github上下载。

[xxx@localhost gitea]# wget -O gitea https://dl.gitea.io/gitea/1.16.8/gitea-1.16.8-linux-amd64
[xxx@localhost gitea]# chmod +x gitea

这里我用二进制方式运行的。也可以用docker方式运行。

三、安装git

安装git,并配置环境变量,否则失败。

[xxx@localhost data]# yum install git

创建一个git用户,专门用来管理git相关服务。

sudo useradd \
--system \
--shell /bin/bash \
--comment 'Git Version Control' \
--create-home \
--home /home/git \
git
git用户设置密码
[xxx@localhost data]# passwd git
Changing password for user git.
New password:

四、创建gitea相关目录

创建gitea工作目录:

[xxx@localhost data]# pwd
/data
[xxx@localhost data]# mkdir gitea
[xxx@localhost data]# chown -R git:git gitea/
[xxx@localhost data]# ls -lth
total 0
drwxr-xr-x 2 git git 6 Jun 1 16:02 gitea

创建gitea 可执行文件存放目录

[xxx@localhost opt]# chown -R git:git gitea/
[xxx@localhost opt]# ls -lth
total 0
drwxr-xr-x 2 git git 19 May 31 16:34 gitea

五、测试gitea服务

[xxx@localhost gitea]$ ./gitea web

从web打开 http://服务器IP:3000/ ,可进行配置更改和安装。

六、安装

下载服务配置文件

sudo wget https://raw.githubusercontent.com/go-gitea/gitea/master/contrib/systemd/gitea.service -P /etc/systemd/system/

更改gitea配置文件

[xxx@localhost system]# vim /etc/systemd/system/gitea.service

# 更改路径如下:
WorkingDirectory=/data/gitea/
# If using Unix socket: tells systemd to create the /run/gitea folder, which will contain the gitea.sock file
# (manually creating /run/gitea doesn't work, because it would not persist across reboots)
#RuntimeDirectory=gitea
ExecStart=/opt/gitea/gitea web --config /data/gitea/app.ini
Restart=always
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/data/gitea

启动gitea服务

[xxx@localhost opt]# systemctl daemon-reload
[xxx@localhost opt]# systemctl enable --now gitea
[xxx@localhost opt]#
[xxx@localhost opt]# systemctl status gitea
● gitea.service - Gitea (Git with a cup of tea)
Loaded: loaded (/etc/systemd/system/gitea.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2022-06-01 17:19:01 CST; 3s ago
Main PID: 10567 (gitea)
Tasks: 29
Memory: 153.5M
CGroup: /system.slice/gitea.service
└─10567 /opt/gitea/gitea web --config /data/gitea/app.ini Jun 01 17:19:01 localhost.localdomain gitea[10567]: 2022/06/01 17:19:01 ...s/install/setting.go:21:PreloadSettings() [I] AppPa.../giteaJun 01 17:19:01 localhost.localdomain gitea[10567]: 2022/06/01 17:19:01 ...s/install/setting.go:22:PreloadSettings() [I] AppWo.../giteaJun 01 17:19:01 localhost.localdomain gitea[10567]: 2022/06/01 17:19:01 ...s/install/setting.go:23:PreloadSettings() [I] Custo...customJun 01 17:19:01 localhost.localdomain gitea[10567]: 2022/06/01 17:19:01 ...s/install/setting.go:24:PreloadSettings() [I] Log p...ea/logJun 01 17:19:01 localhost.localdomain gitea[10567]: 2022/06/01 17:19:01 ...s/install/setting.go:25:PreloadSettings() [I] Confi...pp.iniJun 01 17:19:01 localhost.localdomain gitea[10567]: 2022/06/01 17:19:01 ...s/install/setting.go:26:PreloadSettings() [I] Prepa...l pageJun 01 17:19:01 localhost.localdomain gitea[10567]: 2022/06/01 17:19:01 ...s/install/setting.go:29:PreloadSettings() [I] SQLit...portedJun 01 17:19:02 localhost.localdomain gitea[10567]: 2022/06/01 17:19:02 cmd/web.go:208:listen() [I] Listen: http://0.0.0.0:3000
Jun 01 17:19:02 localhost.localdomain gitea[10567]: 2022/06/01 17:19:02 cmd/web.go:212:listen() [I] AppURL(ROOT_URL): http://l...:3000/Jun 01 17:19:02 localhost.localdomain gitea[10567]: 2022/06/01 17:19:02 ...s/graceful/server.go:61:NewServer() [I] Starting ne... 10567Hint: Some lines were ellipsized, use -l to show in full.
打开web进行安装 http://服务器IP:3000/  。
选择使用sqlite,数据库文件路径  /data/gitea/gitea.db

其他的更改:

仓库根目录 /data/gitea/gitea-repositories
LFS根目录 /data/gitea/lfs

然后添加一个添加管理员账号:

用户名 youname
密码 youcode
Email: xxx@youmail.com

点击开始安装,很快就搞定了。

七、可以愉快的玩耍了

由于更换了端口号,现在用浏览器打开新的地址

http://server_ip:new_port/

接下来,创建组织,创建团队,注册用户账号。玩起来。

从零开始搭建gitea代码管理平台的更多相关文章

  1. Docker搭建Gitlab代码管理平台

    一.Gitlab的安装 宿主机环境: CentOS 7 docker docker-compose 1.查找镜像 docker search gitlab 2.拉取镜像 docker pull git ...

  2. 【HADOOP】| 环境搭建:从零开始搭建hadoop大数据平台(单机/伪分布式)-下

    因篇幅过长,故分为两节,上节主要说明hadoop运行环境和必须的基础软件,包括VMware虚拟机软件的说明安装.Xmanager5管理软件以及CentOS操作系统的安装和基本网络配置.具体请参看: [ ...

  3. 如何用Baas快速在腾讯云上开发小程序-系列2:搭建Phabricator开发管理平台

    版权声明:本文由贺嘉 原创文章,转载请注明出处: 文章原文链接:https://www.qcloud.com/community/article/905333001487424158 来源:腾云阁 h ...

  4. Visual SVN 企业版代码管理平台的建设

    通常需要完整的SVN的代码管理平台系统的搭建,需要安装三个文件,Visual SVN server  , TortoiseSVN, Visual SVN. Visual SVN server  企业版 ...

  5. 阿里云代码管理平台 Teambition Codeup(行云)亮相,为企业代码安全护航

    2019杭州云栖大会企业协作与研发效能专场,企业协同平台Teambition负责人齐俊元正式发布阿里云自研的代码管理平台Teambition Codeup(行云),Codeup是一款企业级代码管理产品 ...

  6. 搭建用例管理平台phpstudy+testlink代替Apache+MySQL+PHP环境,以及testlink搭建环境报错修复

    公司需要搭建一个用例管理平台,环境搭建Apache+MySQL+PHP环境 哇一看就是需要花很长时间去搭建环境,本来我也在用这样的笨方法,不小心被公司开发看到,经人家一提点,哎呀妈呀发现自己以前的方法 ...

  7. 从零开始搭建轻量级个人XSS平台

    一. 前言 决定搭建XSS平台是因为自己想深入学习一下XSS相关的知识,多多进行实践,上网搜索了一下XSS平台有很多,但是总觉得不是很安全,这个毕竟敏感信息要传输到陌生人的服务器上,而且服务器端测试代 ...

  8. 快速搭建sonar代码质量管理平台

    安装 下载,直接解压http://www.sonarqube.org/downloads/ 添加mysql驱动至\extensions\jdbc-driver\mysql\ 创建mysql数据库和用户 ...

  9. 代码管理平台之git

    yum install -y gitmkdir -p /date/gitrootcd !$git init git add 1.txtgit commit -m "add 1.txt&quo ...

随机推荐

  1. StringJoiner的使用

    1.添加字符串 add()方法 StringJoiner sj = new StringJoiner(","); sj.add("我爱你"); sj.add(& ...

  2. 实战模拟│单点登录 SSO 的实现

    目录 什么是单点登录 单点登录的凭证 父域 Cookie 方式 用户认证中心方式 localstorage方式 什么是单点登录 单点登录: SSO(Single Sign On) 用户只需登录一次,就 ...

  3. Tomcat深入浅出——Session与Cookie(四)

    一.Cookie 1.1 Cookie概念 Cookie:有时也用其复数形式 Cookies.类型为"小型文本文件",是某些网站为了辨别用户身份,进行Session跟踪而储存在用户 ...

  4. Qt点名器

    项目已开源,点击跳转 废话不多说,直接上代码. CMakeLists.txt cmake_minimum_required(VERSION 3.10) project(qt-caller) find_ ...

  5. springboot中配置skywalking请求日志

    pom.xml配置 <dependency> <groupId>org.apache.skywalking</groupId> <artifactId> ...

  6. osi七层与TCP\IP协议

    层次划分的方法 1.网络的每层应当具有相对独立的功能(便于排错)这个功能用不了必然是你这层处理问题 2.梳理功能之间的关系,使上一个功能可以实现为另一个功能提供必要的服务,从而形成系统的层次结构.为提 ...

  7. Kubernetes组件介绍

    一.api-server   基本概念 该端口默认值为6443,可通过启动参数"--secure-port"的值来修改默认值. 默认IP地址为非本地(Non-Localhost)网 ...

  8. Operating System_via牛客网

    题目 链接:https://ac.nowcoder.com/acm/contest/28537/F 来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 131072K,其他语 ...

  9. go交叉编译,部署到linux上出现cannot execute binray file的解决方案

    写在前面: 了解过常见的项目部署方式后,打算先从最简单的方式开始.没想到踩了大坑.先说下整个部署的过程.    博主是在window上生成linux上的可执行文件.. 具体过程: 1.首先按照网上说的 ...

  10. 异常分类和异常的产生过程解析和Objects非空判断

    java.lang.Throwable类是java语言中所有错误的异常的超类. Exception:编译期异常,进行编译(写代码)java程序出现的问题 RuntimeExeption:运行期异常,j ...