Gitea 的首要目标是创建一个极易安装,运行非常快速,安装和使用体验良好的自建 Git 服务。
由于码云对免费企业版进行了人数限制,公司需要自建git
服务,经对比,从gitlab
,gogs和gitea中选中gitea
本安装教程依赖于docker compose
,如未安装,请阅读 CentOS 7安装 docker compose教程
新建docker-compose.yml
version: "2"
networks:
gitea:
external: false
services:
server:
image: gitea/gitea:latest
environment:
- USER_UID=1000
- USER_GID=1000
- DB_TYPE=mysql
- DB_HOST=db:3306
- DB_NAME=gitea
- DB_USER=gitea
- DB_PASSWD=gitea
restart: always
networks:
- gitea
volumes:
- ./gitea:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3000:3000"
- "222:22"
depends_on:
- db
db:
image: mysql:5.7
restart: always
environment:
- MYSQL_ROOT_PASSWORD=gitea
- MYSQL_USER=gitea
- MYSQL_PASSWORD=gitea
- MYSQL_DATABASE=gitea
networks:
- gitea
volumes:
- ./mysql:/var/lib/mysql
根据实际情况进行修改,例如,mac上没有/etc/timezone
和/etc/localtime
,所以需要手动设置时区;另外由于系统使用了mysql8,所以需要升级mysql,修改后如下:
version: "2"
networks:
gitea:
external: false
services:
server:
image: gitea/gitea:latest
environment:
- USER_UID=1000
- USER_GID=1000
- DB_TYPE=mysql
- DB_HOST=db:3306
- DB_NAME=gitea
- DB_USER=gitea
- DB_PASSWD=gitea
- TZ=Asia/Shanghai
restart: always
networks:
- gitea
volumes:
- ./gitea:/data
ports:
- "3000:3000"
- "222:22"
depends_on:
- db
db:
image: mysql:8.0.20
restart: always
environment:
- MYSQL_ROOT_PASSWORD=gitea
- MYSQL_USER=gitea
- MYSQL_PASSWORD=gitea
- MYSQL_DATABASE=gitea
networks:
- gitea
volumes:
- ./mysql:/var/lib/mysql
最新文件内容从https://docs.gitea.io/en-us/install-with-docker/获取
运行
docker-compose -f docker-compose.yml up -d
安装
访问http://localhost:3000/,点击右上角登录
,进入安装界面,数据库等配置不用改,其他根据自身情况填写,填写完成后点击立即安装
使用
点击注册,注册完成后即可登录,效果如下:
image
欢迎关注我的博客https://blog.yhan219.com/
网友评论