当前位置: 首页 > news >正文

以二进制形式创建gitea仓库

1、官方文档:

数据库准备 | Gitea Documentation

使用二进制文件安装 | Gitea Documentation

2、具体操作

1)创建gitea数据库

2)检查是否安装 Git。要求 Git 版本 >= 2.0。

如需升级git请参考以下链接:linux升级git版本-CSDN博客

[root@localhost root]# git --version
git version 2.31.0

3)创建git用户:(我本机系统 CentOS,即取下方代码)

# On Ubuntu/Debian:
adduser \--system \--shell /bin/bash \--gecos 'Git Version Control' \--group \--disabled-password \--home /home/git \git# On Fedora/RHEL/CentOS:
groupadd --system git
adduser \--system \--shell /bin/bash \--comment 'Git Version Control' \--gid git \--home-dir /home/git \--create-home \git

4)创建gitea目录,在此目录( /var/lib/gitea )下下载gitea 可执行文件

[root@localhost root]# 
mkdir -p /var/lib/gitea/custom
mkdir -p /var/lib/gitea/data
mkdir -p /var/lib/gitea/log
chown -R git:git /var/lib/gitea/
chmod -R 770 /var/lib/gitea/[root@localhost root]# cd /var/lib/gitea/
[root@localhost gitea]# wget -O gitea https://dl.gitea.com/gitea/1.21.1/gitea-1.21.1-linux-amd64
[root@localhost gitea]# chmod +x gitea[root@localhost gitea]# ll
总用量 139980
drwxr-x---  3 git git        18 12月 20 14:09 custom
drwxr-x--- 17 git git       257 12月 20 14:10 data
-rwxr-x---  1 git git 143338448 12月 20 13:57 gitea (此为gitea可执行文件)
drwxrwxr-x  2 git git         6 12月 20 13:10 lfs
drwxr-x---  2 git git         6 12月 20 12:08 log

4)  切换到gitea用户,运行gitea可执行文件,生成gitea数据库的数据表,在浏览器执行 http://127.0.0.1:3000 配置gitea仓库所需信息

[root@localhost root]# su git[git@localhost gitea]# ./gitea

5)配置service 自动启动gitea

在 Linux 中以 service 方式运行 | Gitea Documentation

5.1)错误界面

5.2)配置自启动

服务器重启后,再访问gitea网址,若出现5.1中的错误界面,大概率是未配置服务器自启动导致,具体配置参数如下:

[Unit]
Description=Gitea (Git with a cup of tea)
After=network.target
###
# Don't forget to add the database service dependencies
###
#
#Wants=mysql.service
#After=mysql.service
#
#Wants=mariadb.service
#After=mariadb.service
#
#Wants=postgresql.service
#After=postgresql.service
#
#Wants=memcached.service
#After=memcached.service
#
#Wants=redis.service
#After=redis.service
#
###
# If using socket activation for main http/s
###
#
#After=gitea.main.socket
#Requires=gitea.main.socket
#
###
# (You can also provide gitea an http fallback and/or ssh socket too)
#
# An example of /etc/systemd/system/gitea.main.socket
###
##
## [Unit]
## Description=Gitea Web Socket
## PartOf=gitea.service
##
## [Socket]
## Service=gitea.service
## ListenStream=<some_port>
## NoDelay=true
##
## [Install]
## WantedBy=sockets.target
##
###[Service]
# Uncomment the next line if you have repos with lots of files and get a HTTP 500 error because of that
# LimitNOFILE=524288:524288
RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/var/lib/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的值要改为您配置的gitea可执行文件的真实路径。
ExecStart=/var/lib/gitea/gitea
Restart=always
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea
# If you install Git to directory prefix other than default PATH (which happens
# for example if you install other versions of Git side-to-side with
# distribution version), uncomment below line and add that prefix to PATH
# Don't forget to place git-lfs binary on the PATH below if you want to enable
# Git LFS support
#Environment=PATH=/path/to/git/bin:/bin:/sbin:/usr/bin:/usr/sbin
# If you want to bind Gitea to a port below 1024, uncomment
# the two values below, or use socket activation to pass Gitea its ports as above
###
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
#AmbientCapabilities=CAP_NET_BIND_SERVICE
###
# In some cases, when using CapabilityBoundingSet and AmbientCapabilities option, you may want to
# set the following value to false to allow capabilities to be applied on gitea process. The following
# value if set to true sandboxes gitea service and prevent any processes from running with privileges
# in the host user namespace.
###
#PrivateUsers=false
###[Install]
WantedBy=multi-user.target

http://www.lryc.cn/news/508518.html

相关文章:

  • Spring(七)Spring Cloud----Feign、Zuul和Apollo
  • *【每日一题 提高题】[蓝桥杯 2022 国 A] 选素数
  • 华为云环境下LVS/DR架构的故障诊断优化
  • leetcode hot100除自身以外的数组的乘积
  • SQL server学习09-数据库编程(上)
  • 什么?Flutter 可能会被 SwiftUI/ArkUI 化?全新的 Flutter Roadmap
  • java全栈day19--Web后端实战(java操作数据库3)
  • 【YashanDB知识库】Mybatis-Plus调用YashanDB怎么设置分页
  • Ansible 批量管理华为 CE 交换机
  • 基于自定义注解与 AOP 切面实现接口日志全面数据库存储
  • GraalVM完全指南:云原生时代下使用GraalVM将Spring Boot 3应用转换为高效Linux可执行文件
  • 单片机:实现驱动超声波(附带源码)
  • 2025.01.15python商业数据分析top2
  • 信息系统项目管理-绩效考核
  • 【Linux】数据呈现
  • oracle 加字段和字段注释 sql
  • 计算机网络压缩版
  • 一文了解 gis 相关服务=》及前端地图服务相关总结
  • Brocade G610 配置
  • DuetWebControl 开源项目常见问题解决方案
  • 亚信安全举办“判大势 悟思想 强实践”主题党日活动
  • Go怎么做性能优化工具篇之基准测试
  • vue3国际化,主题切换
  • Linux Shell 脚本编程基础
  • vuex如何进行状态管理?
  • 嵌入式Linux QT+OpenCV基于人脸识别的考勤系统 项目
  • 通过阿里云 Milvus 与 PAI 搭建高效的检索增强对话系统
  • 评估大语言模型在药物基因组学问答任务中的表现:PGxQA
  • 在本地和远程转储域控制器哈希
  • 基于SSM+Vue的心理咨询问诊系统+LW示例参考