linux一键安装gitea

编程

echo "要事先创建数据库gitea@gitea password:gitea"

systemctl stop firewalld

echo "1、addUser"

u=gitea

g=$u

groupadd $g

useradd $u -g $g -s /bin/false

mkdir /home/$u

mkdir /home/$u/desktop

chown -hR $u:$g /home/$u

usermod -s /bin/bash $u

usermod -d /home/$u $u

echo "2、安装gitea"

yum -y install git #apt-get

mkdir /www

chmod 775 /www

mkdir /www/$u

#curl -o target/path/filename URL

#-O original name

giteaUrl="https://dl.gitea.io/gitea/1.11.4/gitea-1.11.4-linux-amd64"

#curl -o /www/$u/gitea https://dl.gitea.io/gitea/1.4/gitea-1.4-linux-386

#curl -o /www/$u/gitea $giteaUrl

yum -y install wget

wget -O /www/$u/gitea $giteaUrl

chmod +x /www/$u/gitea

#5、修改所属人和所属组

chown -R $u:$g /www/$u

chmod 755 -R /www/$u

echo "3、添加服务"

cat>/etc/systemd/system/gitea.service<<EOF

[Unit]

Description=Gitea (Git with a cup of tea)

After=syslog.target

After=network.target

[Service]

RestartSec=2s

Type=simple

User=gitea

Group=gitea

#WorkingDirectory=/www/$u/lib

#Environment=USER=gitea HOME=/www/$u/git GITEA_WORK_DIR=/www/$u/lib

ExecStart=/www/$u/gitea web --config /www/$u/custom/conf/app.ini

Restart=always

[Install]

WantedBy=multi-user.target

EOF

#systemctl daemon-reload

sudo systemctl enable gitea

#sudo systemctl start gitea

echo "4、安装"

echo "非root用户端口,只能大于1024"

echo "安装时,LFS根目录留空"

echo 没有则安装完,把/www/$u/custom/conf/app.ini里面LFS_START_SERVER=改为false

echo "然后重启动服务"

echo "安装页面:http://localhost:3000"

cd /www/$u #必须否则权限,但脚本里好像不能cd

su $u -c /www/$u/gitea web

echo "5、安装完重启动服务"

echo "sudo systemctl restart gitea"

sudo systemctl restart gitea

#sudo systemctl start gitea

 

以上是 linux一键安装gitea 的全部内容, 来源链接: utcz.com/z/515520.html

回到顶部