更新系统

yum update -y

yum install -y vim git

关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service

关闭 selinux
vim /etc/sysconfig/selinux

SSH 配置

更改端口号
ssh port:2883

禁止 root 登录

创建账号
useradd gitserver

随时生成密码

安装 Docker

yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce
systemctl start docker
systemctl enable docker

https://www.docker-cn.com/registry-mirror

安装 MySQL

 yum install -y https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
 yum-config-manager --disable mysql80-community
 yum-config-manager --enable mysql57-community
 yum remove mariadb-libs
 yum install mysql-community-server
 service mysqld start
 service mysqld status
 grep 'temporary password' /var/log/mysqld.log
 mysql_secure_installation 

https://dev.mysql.com/doc/refman/8.0/en/linux-installation-yum-repo.html

安装 Gogs

docker pull gogs/gogs

mkdir -p /var/gogs
docker run --name=gogs -p 10022:22 -p 10080:3000 -v /var/gogs:/data gogs/gogs

docker start gogs

设置开机自启动 gogs

docker update --restart=always gogs

https://hub.docker.com/r/gogs/gogs/
https://github.com/gogs/gogs/tree/master/docker

防火墙配置

rsync 定时备份

标签: CentOS