




















说明:前段时间介绍过一个Git服务器,查看:Gogs安装教程,体验还不错。现在再说个Gitea,是从Gogs发展而来,同样的拥有极易安装,运行快速的特点,而且更新比Gogs频繁很多,维护的人也多,个人认为Gitea还是更好一些的,这里就说下安装方法。
.png)
.png)
Gitea是一个极易安装,运行非常快速,安装和使用体验良好的自建Git服务。采用Go作为后端语言,这使得只要生成一个可执行程序即可。并且他还支持跨平台,支持Linux、macOS和Windows以及各种架构,除了x86,amd64,还包括ARM和 PowerPC。
Github地址:https://github.com/go-gitea/gitea
SSH以及HTTP/HTTPS协议SMTP、LDAP和反向代理的用户认证Web钩子(包括Slack集成)Git钩子和部署密钥Issue)、合并请求(Pull Request)以及WikiWikiWikiGravatar和Federated AvatarMySQL、PostgreSQL、SQLite3、MSSQL和TiDB(实验性支持)数据库21种语言)安装方法和Gogs差不多,这里再说一遍。
1、安装MySQL数据库
建议使用CentOS系统,查看:CentOS下Mysql 5.6安装教程及创建数据库,其他系统不会手动安装的直接使用宝塔面板。
#Centos系统
yum install -y wget && wget -O install.sh http://download.bt.cn/install/install.sh && sh install.sh
#Ubuntu系统
wget -O install.sh http://download.bt.cn/install/install-ubuntu.sh && sudo bash install.sh
#Debian系统
wget -O install.sh http://download.bt.cn/install/install-ubuntu.sh && bash install.sh
安装完成后,安装MySQL,至少5.5.3版本。
2、安装Git
#Debian和Ubuntu系统
apt-get -y install git
#CentOS系统
yum -y install git
3、安装Gitea
最新版本下载地址:https://dl.gitea.io/gitea。
wget -O gitea https://dl.gitea.io/gitea/1.4.0/gitea-1.4.0-linux-amd64
chmod +x gitea
./gitea web接下来打开http://ip:3000即可。
如果只是想体验下的,可以试试Docker安装方法。
1、安装Docker和Docker Compose
#安装并启动Docker
curl -sSL https://get.docker.com/ | sh
service docker start
#安装Docker Compose
curl -L https://github.com/docker/compose/releases/download/1.17.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
2、安装Gitea
#创建并进入gitea目录
mkdir gitea && cd gitea
#创建并编辑docker-compose.yml文件
nano docker-compose.yml复制以下代码进去,数据库信息默认或者修改都可。
version: "2"
networks:
gitea:
external: false
services:
server:
image: gitea/gitea:latest
environment:
- USER_UID=1000
- USER_GID=1000
restart: always
networks:
- gitea
volumes:
- ./gitea:/data
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
运行docker-compose.yml文件
docker-compose up -d最后打开http://ip:3000即可。
1、进入ip:3000打不开网站
打不开需要关闭防火墙,或者打开对应的3000端口。
#CentOS 7
systemctl stop firewalld.service
systemctl disable firewalld.service
#其它系统
iptables -I INPUT -p tcp --dport 3000 -j ACCEPT
service iptables save
service iptables restart
2、保持程序一直运行
请配合screen使用,使用方法:使用screen来实现多任务不断线操作命令。
3、域名访问
如果想用域名访问,可以用Nginx反代。反代配置为:
#在配置文件里添加
location / {
proxy_pass http://localhost:3000
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
版权声明:本文为原创文章,版权归 Rat's Blog 所有,转载请注明出处!
本文链接:https://www.moerats.com/archives/578/
如教程需要更新,或者相关链接出现404,可以在文章下面评论留言。
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。