1. ホーム
  2. Git

giteaを使ったGitサービスの構築

2022-02-16 20:24:01
<パス

タイトル:giteaでGitサービスを構築する
date: 2020-05-20 13:14:00
タグを使用します。[Git] (ギット)
のカテゴリーに分類されます。[Git](ギット


序文

Ali, tx, Western Digital centOS 6.4, 6 シリーズが利用可能です。 cat /etc/redhat-release

gitea1.12

Git 2.26.2 の最新安定版です。

MySQL8 Community Edition: mysql-8.0.20-1.el6.x86_64.rpm-bundle.tar.

前面に出るくだり

ゴッグスからギテアへ移行。なぜ?言ってみれば、Google pixel phone(ネイティブAndroid)とXiaomi phone(Androidベース、カスタマイズ、より人間的)を手に入れたということです。giteaとその他の比較は公式サイトで横並びで見ることができます。giteaの良いところは公式サイト自体で見ることができますので、ここでは割愛させていただきます。

giteaに乗り換えた理由は、gogsにはないチームパーミッションによる課題のプッシュやリポジトリの課題の一括バインドなどの整理と、どちらもアクティブな感じがして、giteaの方が頻度が高い、やはりコミュニティベースの共同開発ということです。

どちらもトライして、自分で体験して、試してみてください。

説明文を更新

  1. 通常の画像スクリーンショットを削除し、一部のコアスクリーンショットを保持。詳細なスクリーンショットは、https://blog.csdn.net/qq_31708763/article/details/104814669。
  2. gitea1.11.5 から 1.12 は 80M から 120M になり、多くのアップデートがあったように思います。
  3. この記事は社内ビルド環境用です。この記事はもう更新されていません。質問がある場合はコメントを残すか、新しいアドレスに移動してください。

ソフトウェアの準備

ソフトウェアのダウンロード、公式サイトのダウンロード、またはクラウドドライブのダウンロード。手順は省略します。

ダウンロードしたソフトをサーバーにアップロードする。

mkdir -p /server/backup/gs
# scp -P 22000 -r -v /server/backup/gs/* [email protected]:/server/backup/gs
scp -P 22 -r -v /server/backup/gs/* [email protected]:/server/backup/gs
# scp -P 22 -r -v /server/backup/gs/gitea-1.12-linux-amd64 [email protected]:/server/backup/gs
# If reinstalling
ssh-keygen -R 59.110.21.159

yum -y update

sudo dd if=/dev/zero of=/swapfile count=2048 bs=1M
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
free -m
history | grep 'swap'
Delete
1. stop the swap partition being used
$ swapoff /root/swap

2. Delete the swap partition file
$ rm /root/swap

3. Delete or comment out the following boot automount in the /etc/fstab file.
$ vim /etc/fstab Remove the following from that file


yumのアップデート(オプション)

rpm -qa|grep mysql
# Uninstall if available
yum -y remove mysql mysql-server mysql-libs compat-mysql51
rm -rf /var/lib/mysql
## may not be able to remove '/etc/my.cnf': No such file or directory
rm /etc/my.cnf
rpm -e mysql-community-client-8.0.20-1.el6.x86_64 --nodeps
rpm -e mysql-community-libs-8.0.20-1.el6.x86_64 --nodeps
rpm -e mysql-community-server-8.0.20-1.el6.x86_64 --nodeps
rpm -e mysql-community-common-8.0.20-1.el6.x86_64 --nodeps


スワップ作成(オプション)

yum -y install wget gcc-c++ ncurses ncurses-devel cmake make perl bison openssl openssl-devel gcc* libxml2 libxml2-devel curl-devel libjpeg* libpng* freetype* make gcc-c++ cmake bison-devel ncurses-devel bison perl perl-devel perl perl-devel net-tools* numactl* 


カーネルをアップデートする

gitea は必須です。さもなければ centos6 で kernel too old というエラーが出ます。

解決策:https://janeyork.blog.csdn.net/article/details/106496370

MySQLのインストール

cd /server/backup/gs/
rpm -ivh mysql-community-common-8.0.20-1.el6.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-libs-8.0.20-1.el6.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-client-8.0.20-1.el6.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-server-8.0.20-1.el6.x86_64.rpm --nodeps --force


依存関係のインストール

lower_case_table_names=1
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'


MySQLのインストール

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html

[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# innodb_buffer_pool_size = 128M
# Remove the leading "# " to disable binary logging
# Binary logging captures changes between backups and is enabled by
# default. it's default setting is log_bin=binlog
# disable_log_bin
It's default setting is log_bin=binlog # disable_log_bin
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
# read_rnd_buffer_size = 2M
# Remove leading # to revert to previous value for default_authentication_plugin,
# this will increase compatibility with older clients. for background, see:
# https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin
# default-authentication-plugin=mysql_native_password

datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

lower_case_table_names=1
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'




/etc/my.cnfに以下を追加して設定します。

groupadd mysql
useradd -g mysql mysql
mkdir -p /var/lib/mysql


mysqld --initialize --user=mysql
chown -R mysql:mysql /var/lib/mysql
chmod -R 777 /var/lib/mysql

centOS6:
service mysqld start
View start status
service mysqld status
# set boot up (can be left out, rmp is installed and starts by default)
# chkconfig mysqld on

The following backup was not executed.
If you log in to the CentOS 6.8 server as the root user, you can execute the following command.
mysqld --initialize --user=mysql
mysqld --initialize-insecure --user=mysql
If you log in to CentOS 6.8 server as mysql user, you can execute the following command.
mysqld --initialize
mysqld --initialize-insecure
Since I am using the root account to log in to the CentOS 6.8 server here, the command I execute to initialize the database is as follows.
mkdir -p /usr/local/mysql
chown -R mysql.mysql /usr/local/mysql
mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
Note: Here, I specified the MySQL installation directory when I executed the mysqld --initialize command. It is recommended to specify the MySQL installation directory during the MySQL installation process. When the data directory exists in the /usr/local/mysql directory, it will fail to initialize, and you must make sure that there is no data directory under /usr/local/mysql.


フルコンテンツです。

cat /var/log/mysqld.log | grep password


起動します。

mysql -u root -p
DhPO0Wr-#kqp
# High version database use strong password rules, set password as troublesome as possible, uppercase + lowercase + numbers + symbols
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Woshihenfuzademima$_$';
exit;


mysql -u root -p
Woshihenfuzademima$_$
CREATE USER 'remote'@'%' IDENTIFIED BY 'Woshihenfuzademima$_$';
GRANT ALL PRIVILEGES ON *. * TO 'remote'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit;

vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22000 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3000 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3001 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 4000 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 9527 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with-icmp-host-prohibited
COMMIT



一時的に生成されたパスワードを表示する。

service iptables restart

初期パスワードを変更する場合。

1. Database directory
/var/lib/mysql/
2、Configuration file
/usr/share/mysql(mysql.server command and configuration file)
3、Related commands
/usr/bin(mysqladmin mysqldump and other commands)
4、Start script
/etc/rc.d/init.d/(the directory of mysql startup script file)


リモートアカウントを作成する。

To view source version information.
yum info git
git --version
If installed, uninstall.
yum remove git


ファイアウォールの設定

yum install -y asciidoc docbook2X xmlto texinfo sgml2xml autoconf openjade curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl- ExtUtils-MakeMaker

修正が完了したら、ファイアウォールを再起動します。 cd /server/backup/gs/ tar -zxvf git-2.26.2.tar.gz cd git-2.26.2 make configure . /configure --prefix=/usr/local/git make && make install sudo echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profile source /etc/profile 必要に応じて、クラウドセキュリティグループにログインし、ポートを開放してください。

注)mysqlのインストール方法であるrpmのデフォルトの場所は、以下の通りです。

Type git --version to try to install it successfully.


Gitのインストール

旧バージョンのアンインストール

sudo useradd git


依存関係をインストールする。

mysql -u root -p
Woshihenfuzademima$_$
CREATE USER 'gitea'@'localhost' IDENTIFIED BY 'Woshihenfuzademima$_$';
GRANT ALL PRIVILEGES ON *. * TO 'gitea'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit;
# High version library build or import gitea.mysql.sql will report an error, we recommend building it manually
# SET GLOBAL innodb_file_per_table = ON,innodb_file_format = Barracuda,innodb_large_prefix = ON;                                                            
# DROP DATABASE IF EXISTS gitea;                                                                   
# CREATE DATABASE IF NOT EXISTS gitea CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;



gitインストーラをアップロードし、解凍します。

New database, here it is recommended to create a new database directly, set the encoding format utf8mb4, above we did not use navicate to test the remote link, it is best to use the client to create a new database directly gitea, and


Gitが正常にインストールされたことを確認します。

mkdir /home/git/gitea
chown -R git:git /home/git/gitea
# wget -O gitea https://dl.gitea.io/gitea/1.12/gitea-1.12-linux-amd64
mv /server/backup/gs/gitea-1.12-linux-amd64 /home/git/gitea/gitea
chmod +x /home/git/gitea/gitea
chown -R git:git /home/git/gitea/gitea


Giteaのインストール

gitユーザーの作成。

cd /home/git/gitea/
su git
. /gitea web --port 3001
# or . /gitea web Don't ask me why I specified the port, because 3000 is occupied, or you temporarily stopped 3000
211.149.239.182:3001
59.110.21.159:3001


giteaのローカルアクセス用に、gitea, mysqlのユーザーパスワードを作成します。

APP_NAME = Git
RUN_USER = git
RUN_MODE = prod

[oauth2]
JWT_SECRET = 2n0Rpw8v2KZ4pnGeIPpQX5bLrhNepBOgMSg

[security]
INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE1ODk5OTQwMzh9.5RMyVTbX4M5FycJOwtf8oO4DH87N38fHui-NbItoaVY
INSTALL_LOCK = true
SECRET_KEY = fZA30Uegc1Gt6pUTYBej7ahOoL7GPNR6Tl4ZgFkT3xgdkZuNLRJb3icWD

[database]
DB_TYPE = mysql
HOST = 127.0.0.1:3306
NAME = gitea
USER = gitea
PASSWD = Woshihenfuzademima$_$
SCHEMA = 
SSL_MODE = disable
CHARSET = utf8mb4
PATH = /home/git/gitea/data/gitea.db

[repository]
ROOT = /home/git/gitea-repositories

[server]
SSH_DOMAIN = git.yourdomain.com
DOMAIN = git.yourdomain.com
HTTP_PORT = 3001
ROOT_URL = http://git.yourdomain.com:3001/
DISABLE_SSH = false
SSH_PORT = 22
LFS_START_SERVER = true
LFS_CONTENT_PATH = /home/git/gitea/data/lfs
LFS_JWT_SECRET = JGZ83tOyD4gcR5q3F6Odc7rajn_b3_mJdr_t2xEcKVQ
OFFLINE_MODE = false

[mailer]
ENABLED = false

[service]
REGISTER_EMAIL_CONFIRM = false
ENABLE_NOTIFY_MAIL = false
DISABLE_REGISTRATION = false
ALLOW_ONLY_EXTERNAL_REGISTRATION = false
ENABLE_CAPTCHA = false
REQUIRE_SIGNIN_VIEW = false
DEFAULT_KEEP_EMAIL_PRIVATE = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
DEFAULT_ENABLE_TIMETRACKING = true
NO_REPLY_ADDRESS = noreply.localhost

[picture]
DISABLE_GRAVATAR = false
ENABLE_FEDERATED_AVATAR = true

[openid]
ENABLE_OPENID_SIGNIN = true
ENABLE_OPENID_SIGNUP = true

[session]
PROVIDER = file

[log]
MODE = file
LEVEL = info
ROOT_PATH = /home/git/gitea/log




データベースを手動で作成する(gitea自身のsqlファイルをインポートするとエラーが報告されました。0.13で修正されました)。

ln -s /usr/local/git/bin/git /bin/git
ln -s /usr/local/git/bin/git-upload-pack /bin/git-upload-pack
ln -s /usr/local/git/bin/git-cvsserver /bin/git-cvsserver
ln -s /usr/local/git/bin/gitk /bin/gitk
ln -s /usr/local/git/bin/git-receive-pack /bin/git-receive-pack
ln -s /usr/local/git/bin/git-shell /bin/git-shell
ln -s /usr/local/git/bin/git-upload-archive /bin/git-upload-archive


バイナリファイルをアップロードします。

# su root
mkdir -p /home/git/gitea/myscripts/init/centos/
vi /home/git/gitea/myscripts/init/centos/gitea
File contents below.
centOS6:
cp /home/git/gitea/myscripts/init/centos/gitea /etc/rc.d/init.d/
chmod a+x /etc/rc.d/init.d/gitea 
chkconfig gitea on
service gitea start #Start the service
service gitea stop #Stop the service
service gitea restart # Restart the service
## Another temporary start can be made by going to the installation directory ~/gitea and executing.
. /gitea web but this closes the window with it


インストールします。

#! /bin/sh
#
# /etc/rc.d/init.d/gitea
# /etc/rc.d/init.d/gitea
# Runs the Gitea Git with a cup of tea.
#
# chkconfig: - 85 15 15
# chkconfig: - 85 15
#

### BEGIN INIT INFO
# Provides: gitea
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start gitea at boot time.
# Description: Control gitea.
### END INIT INFO

# Source function library.
. /etc/init.d/functions

# Default values

NAME=gitea
GITEA_HOME=/home/git/${NAME}
GITEA_PATH=/home/git/gitea/${NAME}
GITEA_USER=git
SERVICENAME="Gitea - Git with a cup of tea"
LOCKFILE=/var/lock/subsys/gitea
LOGPATH=${GITEA_HOME}/log
LOGFILE=${LOGPATH}/gitea.log
RETVAL=0

# Read configuration from /etc/sysconfig/gitea to override defaults
[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME

# Don't do anything if nothing is installed
[ -x ${GITEA_PATH} ] || exit 0
# exit if logpath dir is not created.
[ -x ${LOGPATH} ] || exit 0

DAEMON_OPTS="--check $NAME"

# Set additional options, if any
[ ! -z "$GITEA_USER" ] && DAEMON_OPTS="$DAEMON_OPTS --user=${GITEA_USER}"

start() {
  cd ${GITEA_HOME}
  echo -n "Starting ${SERVICENAME}: "
  daemon $DAEMON_OPTS "${GITEA_PATH} web -c /home/git/gitea/custom/conf/app.ini > ${LOGFILE} 2>&1 &"
  RETVAL=$?
  echo
  [ $RETVAL = 0 ] && touch ${LOCKFILE}

  return $RETVAL
}

stop() {
  cd ${GITEA_HOME}
        echo -n "Shutting down ${SERVICENAME}: "
        killproc ${NAME}
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && rm -f ${LOCKFILE}
}

case "$1" in
    start)
        status ${NAME} > /dev/null 2>&1 && exit 0
        start
        start ;;
    stop)
        stop
        stop ;;
    status)
        status ${NAME}
        restart)
    restart)
        stop
        start
        reload)
    reload)
        stop
        start
        ;;
    *)
        echo "Usage: ${NAME} {start|stop|status|restart}"
        exit 1
        ;;
esac
exit $RETVAL



インストール完了:ページに従ってパラメータを記入します。

yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel

# Uninstall the original Nginx if it is already installed
find -name nginx
yum -y remove nginx


ブートストラップの追加: su root (ここでは、gogsが問題を起こし、問題を恐れているため、以下がデフォルトで実行されます)

# Unzip
cd /server/backup/gs/
tar -vxf nginx-1.18.0.tar.gz
cd nginx-1.18.0
# Install and enable ssl in the specified location
. /configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install
whereis nginx


https://github.com/go-gitea/gitea/blob/master/contrib/init/centos/gitea

vim /etc/profile
##### nginx #####
export NGINX_HOME=/usr/local/nginx
export PATH=$NGINX_HOME/sbin:$PATH
# Make the configuration take effect immediately
source /etc/profile
 
# Test if it takes effect
echo $PATH
/usr/local/nginx/sbin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
nginx -s reload
nginx -v
nginx -t


テキストコンテンツです。

# Add a bootable self-start
vi /etc/rc.local
/usr/local/nginx/sbin/nginx
chmod 755 /etc/rc.local
 
# Test configuration file
/usr/local/nginx/sbin/nginx -t


Nginxのインストール

アップロードファイルをダウンロードしてください。

依存関係をインストールします。

/usr/local/nginx/conf
        server_name git.yourdomain.com;
 
       ssl_certificate /usr/local/nginx/cert/_.shidongvr.com_chain.crt;
        ssl_certificate_key /usr/local/nginx/cert/_.shidongvr.com_key.key;

INSTALL_LOCK = true
SECRET_KEY = Y81DPGiSppsWRED

#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;


events {
    worker_connections 1024;
events { worker_connections 1024; }


http {
    include mime.types;
    default_type application/octet-stream;

    # log_format main '$remote_addr - $remote_user [$time_local] "$request" '
    # '$status $body_bytes_sent "$http_referer" '
    # '"$http_user_agent" "$http_x_forwarded_for" ';

    # access_log logs/access.log main;

    sendfile on;
    #tcp_nopush on;

    #keepalive_timeout 0;
    keepalive_timeout 65;

    #gzip on;
  client_max_body_size 1024M;
  client_body_buffer_size 10M;
            server {
       listen 443 ssl;
        server_name git.yourdomain.com;
 
       ssl_certificate /usr/local/nginx/cert/_.shidongvr.com_chain.crt;
        ssl_certificate_key /usr/local/nginx/cert/_.shidongvr.com_key.key;

       ssl_session_cache shared:SSL:1m;
        ssl_session_timeout 5m;

       ssl_ciphers HIGH:!aNULL:!MD5;
       ssl_prefer_server_ciphers on;

        location / {
         proxy_set_header Host $host:3001;
         proxy_set_header X-Real-IP $remote_addr;
			proxy_pass https://127.0.0.1:3001;
        }
        location /zhds {
alias /home/zhds/1;
index index.html;
        index.html; }
    }


    server {
        listen 80;
        server_name git.yourdomain.com;

        #charset koi8-r;

        #access_log logs/host.access.log main;

      # location / {
		# proxy_pass http://127.0.0.1:3000;
      # }

# Force a https jump
   rewrite ^(. *) https://$server_name$1 permanent;
   

        error_page 404 /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
            root html;
        html; }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #location ~ \.php$ {
        # proxy_pass http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        # location ~ \.php$ {
        # root html;
        # fastcgi_pass 127.0.0.1:9000;
        # fastcgi_index index.php;
        # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
        # include fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        # deny all;
        #}
    server}


    server {
        listen 80;
        server_name nb.nogit.top;

        #charset koi8-r;

        #access_log logs/host.access.log main;

      location / {
		# proxy_pass http://127.0.0.1:3000;
            root /home/myblog/public;
            index index.html;
      index.html; }

# Force a https jump
   rewrite ^(. *) https://$server_name$1 permanent;
   

        error_page 404 /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
            root html;
        html; }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #location ~ \.php$ {
        # proxy_pass http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        # location ~ \.php$ {
        # root html;
        # fastcgi_pass 127.0.0.1:9000;
        # fastcgi_index index.php;
        # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
        # include fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        # deny all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    # listen 8000;
    # listen somename:8080;
    # server_name somename alias another.alias;

    # location / {
    # root html;
    # index index.html index.htm;
    # }
    # }


    # HTTPS server
    # server
    # server {
    # listen 443 ssl;
    # server_name localhost;

    # ssl_certificate cert.pem;
    # ssl_certificate_key cert.key;

    # ssl_session_cache shared

# Application name, change it to your own or company name
APP_NAME = Git
RUN_USER = git
RUN_MODE = prod

[repository]
ROOT = /home/git/gitea-repositories
# Force all repositories to be private
FORCE_PRIVATE = false
# Global maximum number of git projects per user, -1 means no limit, 0 override does not affect
MAX_CREATION_LIMIT = 0
# Disable http, only operate via ssh protocol
DISABLE_HTTP_GIT = false

[ui]
# Default theme
DEFAULT_THEME = gitea
# Themes, overriding the default
THEMES = gitea,arc-green

[ui.meta]
AUTHOR = Git
DESCRIPTION = Hi PGZ!
KEYWORDS = go,git,self-hosted,pgz

[server]
PROTOCOL = https
DOMAIN = git.yourdomain.com
HTTP_PORT = 3001
ROOT_URL = https://git.yourdomain.com/
# Disable SSH
DISABLE_SSH = false
START_SSH_SERVER = false
SSH_DOMAIN = git.yourdomain.com
SSH_PORT = 22
OFFLINE_MODE = false
CERT_FILE = /usr/local/nginx/cert/_.shidongvr.com_chain.crt
KEY_FILE=/usr/local/nginx/cert/_.shidongvr.com_key.key
# ENABLE_GZIP = true
# Landing page, can be "home", "explore", "organizations" or "login"
LANDING_PAGE = login
LFS_START_SERVER = true
LFS_CONTENT_PATH = /home/git/gitea/data/lfs
LFS_JWT_SECRET = JGZ83tOyD4gcR5q3F6Odc7rajn_b3_mJdr_t2xEcKVQ

[database]
DB_TYPE = mysql
HOST = 127.0.0.1:3306
NAME = gitea
USER = gitea
PASSWD = Woshihenfuzademima$_$
SCHEMA = 
# For MySQL, either "false" (default), "true", or "skip-verify"
SSL_MODE = disable
CHARSET = utf8mb4
PATH = /home/git/gitea/data/gitea.db

[admin]
# Disable the creation of organizations with normal users
DISABLE_REGULAR_ORG_CREATION = true

[security]
INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE1ODk5OTQwMzh9.5RMyVTbX4M5FycJOwtf8oO4DH87N38fHui-NbItoaVY
INSTALL_LOCK = true
SECRET_KEY = fZA30Uegc1GtaHX9cNL6pUTYBej7ahOoL7GPNR6Tl4ZgFkT3xgdkZuNLRJb3icWD
# How long to remember that a user is logged in before requiring relogin (in days)
LOGIN_REMEMBER_DAYS = 7

[openid]
ENABLE_OPENID_SIGNIN = false
ENABLE_OPENID_SIGNUP = false

[service]
# Login authentication code expiration time in minutes.
# ACTIVE_CODE_LIVE_MINUTES = 180
REGISTER_EMAIL_CONFIRM = false
# Whether to send reminder emails for work order creation, etc., requires Mailer to be activated
ENABLE_NOTIFY_MAIL = false
# Disable registration, only add users with administrator when enabled
DISABLE_REGISTRATION = true
ALLOW_ONLY_EXTERNAL_REGISTRATION = false
# Use image verification code when registering
ENABLE_CAPTCHA = false
# Whether all pages must be logged in to be accessed
REQUIRE_SIGNIN_VIEW = true
DEFAULT_KEEP_EMAIL_PRIVATE = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
DEFAULT_ENABLE_TIMETRACKING = true
NO_REPLY_ADDRESS = noreply.localhost
# Whether to display the registration button
SHOW_REGISTRATION_BUTTON = false

[mailer]
ENABLED = false

[session]
# Session content storage method, either memory, file, redis or mysql
PROVIDER = file
# If it is a file, then fill in the root directory here; for the rest, fill in the host address and port.
# PROVIDER_CONFIG = data/sessions

[picture]
# If enabled, only internal avatars are used
DISABLE_GRAVATAR = false
ENABLE_FEDERATED_AVATAR = true

[log]
MODE = file
LEVEL = info
ROOT_PATH = /home/git/gitea/log

[api]
# Enables Swagger. true or false; default is true.
ENABLE_SWAGGER = false

[oauth2]
# ENABLE = false
JWT_SECRET = 2n0Rpw8v2KZ43D3V5nXzpnGeIPpQX5bLrhNepBOgMSg

[other]
SHOW_FOOTER_BRANDING = false
SHOW_FOOTER_VERSION = false
SHOW_FOOTER_TEMPLATE_LOAD_TIME = true



rpm -e --nodeps java_cup-0.10k-5.el6.x86_64
rpm -e --nodeps java-1.5.0-gcj-1.5.0.0-29.1.el6.x86_64
rpm -e --nodeps gcc-java-4.4.7-23.el6.x86_64


解凍してインストールすること。

/home/git/gitea/templates/base

インストール完了の画面です。

環境変数を設定する。

mkdir -p /home/git/gitea/custom/templates/base
Change and upload the head_navbar.tmpl
Then restart gitea


起動します。

/home/git/gitea/custom

NginxのSSLを設定する

証明書を取得し、サーバーにアップロードします。

Nginx.cnfを設定する。

robots.txt

Nginxの設定ファイル

vi /home/git/gitea/custom/robots.txt


Gitea設定ファイル

https://github.com/go-gitea/gitea/blob/master/custom/conf/app.ini.sample

https://docs.gitea.io/zh-cn/config-cheat-sheet/

User-agent: *
Disallow: /home/git/gitea/


エクストラ

jdk のアンインストール(必要な場合)

Personal summary: it can run even with a low profile, the core features are available and sufficient, the community is active, and updates are fast
Incomplete side-by-side comparison of the official website: https://docs.gitea.io/zh-cn/comparison/


giteaテンプレートの設定

tips:簡単な設定、0.13以降では、ホームフッターセクションが削除されます。現在、カスタムテンプレートをテストすることは今のところ動作しません、あなたは、ソースコードへの直接の変更を使用し、マイナーな変更を加えることを試みることができます。

/home/git/gitea/templates/base

トップヘルプのリンクを削除するには

mkdir -p /home/git/gitea/custom/templates/base
Change and upload the head_navbar.tmpl
Then restart gitea


検索エンジンのインデックスを無効にする(オプション)

Giteaのデフォルトでは、検索エンジンのインデックスがオンになっています(公式ドキュメントのバージョン1.12時点)が、それは重要ではありません、いずれにしてもログインする必要があります。

/home/git/gitea/custom ディレクトリに、新しいファイル robots.txt は、その

vi /home/git/gitea/custom/robots.txt


以下のように読み取れます。

User-agent: *
Disallow: /home/git/gitea/


Giteaカスタムページのバックアップ

ヒント: ファイルの内容はバージョンによって異なるので、適切なバージョンを使用してください!!!!

https://www.yuque.com/docs/share/290c267a-e455-4c3f-a9fc-54dfa45872d9?#

ギテアの強み

Personal summary: it can run even with a low profile, the core features are available and sufficient, the community is active, and updates are fast
Incomplete side-by-side comparison of the official website: https://docs.gitea.io/zh-cn/comparison/


ソフトウェアパッケージの代替ダウンロードアドレス

Netflixで視聴可能です。リンク: https://pan.baidu.com/s/17TlJyl7VzHzdYmWwo_sVhQ
抽出コード 1ihq

成功のスクリーンショット