gitea安装

0、环境说明

系统:Centos7

数据库版本:mariadb 5.5.68

1、安装数据库

这里使用 yum 安装 centos7 默认的 mariadb 数据库

yum install mariadb-server -y

对数据库进行初始化

mysql_secure_installation

运行结果如下

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL 
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! 
In order to log into MySQL to secure it, we'll need the current 
password for the root user. If you've just installed MySQL, and 
you haven't set the root password yet, the password will be blank, 
so you should just press enter here. 
Enter current password for root (enter for none):<–初次运行直接回车 
OK, successfully used password, moving on… 
Setting the root password ensures that nobody can log into the MySQL 
root user without the proper authorisation. 
Set root password? [Y/n]    #是否设置root用户密码,输入y并回车或直接回车 
New password:               #设置root用户的密码 
Re-enter new password:      #再输入一次你设置的密码 
Password updated successfully! 
Reloading privilege tables.. 
… Success! 
By default, a MySQL installation has an anonymous user, allowing anyone 
to log into MySQL without having to have a user account created for 
them. This is intended only for testing, and to make the installation 
go a bit smoother. You should remove them before moving into a 
production environment. 
Remove anonymous users? [Y/n]   #是否删除匿名用户,生产环境建议删除,所以直接回车 
… Success! 
Normally, root should only be allowed to connect from 'localhost'. This 
ensures that someone cannot guess at the root password from the network. 
Disallow root login remotely? [Y/n] #是否禁止root远程登录,根据自己的需求选择Y/n并回车,建议禁止 
… Success! 
By default, MySQL comes with a database named 'test' that anyone can 
access. This is also intended only for testing, and should be removed 
before moving into a production environment. 
Remove test database and access to it? [Y/n] #是否删除test数据库,直接回车 
- Dropping test database… 
… Success! 
- Removing privileges on test database… 
… Success! 
Reloading the privilege tables will ensure that all changes made so far 
will take effect immediately. 
Reload privilege tables now? [Y/n] #是否重新加载权限表,直接回车 
… Success! 
Cleaning up… 
All done! If you've completed all of the above steps, your MySQL 
installation should now be secure. 
Thanks for using MySQL! 

2、创建git用户(组)

groupadd git
useradd -g git git -s /bin/git-shell

上面命令创建了一个git用户并加入了git用户组(并且为了安全禁止使用shell登录,这个创建用户后也可以在/etc/passwd文件里修改),我们接下来就用这个git用户运行gitea程序。

当然这一步不做也可以,不用git用户的话用当前用户或者root用户也可以,只是在配置gitea的时候要注意一下

3、创建gitea数据库

进入数据库执行如下代码

create database gitea DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE USER 'gitea_user'@'localhost' IDENTIFIED BY 'git_password';
GRANT ALL PRIVILEGES ON gitea.* TO gitea_user@localhost IDENTIFIED BY 'gitea_password';
FLUSH PRIVILEGES;

4、下载gitea安装包

访问 gitea | Gitea 下载对应自己系统的安装包,并上传至服务器

 5、启动gitea

第一次启动gitea

chmod +x gitea
./gitea web

5、配置gitea

 http://ip:3000 web默认端口在3000,打开gitea页面之后,随便点击界面上的按钮(注册,登录之类的),或者在地址后加上/install,会跳转到『初始配置』页面进行安装前的配置,如下图:

 

 这里的配置按照自己的实际情况来就可以了,配置完之后安装即可
配置之后也是可以更改的,gitea的配置文件在gitea/custom/conf/app.ini
具体的配置项可以去官方文档查看.

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

曼走丶999

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值