在Linux上安装Gogs(CentOS7、Red Hat7、中标麒麟服务器版V7)

主要是安装这些东西:Git、MySQL、Gogs

MySQL安装可以参考https://www.cnblogs.com/levia/p/11396512.html

这里记录我我执行过的命令(随意记录的可能没什么参考价值)

yum -y install git
git --version
rpm -qa|grep -i mysql
rpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64
rpm -qa|grep mariadb
reboot
mkdir /usr/local/mysql8
cd /usr/local/mysql8
cat /etc/redhat-release
wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.25-1.el7.x86_64.rpm-bundle.tar
tar -xvf mysql-8.0.25-1.el7.x86_64.rpm-bundle.tar
rpm -ivh mysql-community-common-8.0.25-1.el7.x86_64.rpm
yum list mysql-community-client-plugins
rpm -ivh mysql-community-client-plugins-8.0.25-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.25-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-8.0.25-1.el7.x86_64.rpm
rpm -ivh mysql-community-devel-8.0.25-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.25-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-8.0.25-1.el7.x86_64.rpm
rpm -ivh mysql-community-embedded-compat-8.0.25-1.el7.x86_64.rpm
systemctl status mysqld
systemctl start mysqld
grep -i password /var/log/mysqld.log
net start mysql
mysql -u root -p 'mysql'
systemctl stop firewalld.service
systemctl disable firewalld.service
cd ../
tar -zxvf gogs_0.12.3_linux_amd64.tar.gz
cd gogs
cd var
cd /
mv /usr/local/gogs /home/git/
cp /home/git/gogs/scripts/systemd/gogs.service /etc/systemd/system/
./gogs web
sudo systemctl start gogs.service
sudo systemctl enable gogs.service
systemctl reload gogs.service gogs.service
systemctl restart gogs.service

gogs.service

[Unit]
Description=Gogs
#After=syslog.target
After=network.target
#After=mysqld.service

[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
###
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
#Type=simple
User=root
#Group=git
WorkingDirectory=/home/git/gogs
ExecStart=/home/git/gogs/gogs web
Restart=always
#Environment=USER=root HOME=/home/git

# Some distributions may not support these hardening directives. If you cannot start the service due
# to an unknown option, comment out the ones not supported by your version of systemd.
# ProtectSystem=full
# PrivateDevices=yes
# PrivateTmp=yes
# NoNewPrivileges=true

[Install]
WantedBy=multi-user.target

安装完成之后如果没改过端口,访问3000即可看到gogs的页面。

上一篇:centos7系统下的snapd和certbot的离线安装


下一篇:Go