# 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
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
验证Git是否安装成功:
1
输入git --version试试安装成功。
Gitea安装
查看有哪些用户:cat /etc/passwd 创建git用户:
1
sudo useradd git
创建gitea,mysql用户密码,专门用于gitea本地访问:
1 2 3 4 5 6 7 8 9 10
mysql -u root -p Www_pusdn_com CREATE USER 'gitea'@'localhost' IDENTIFIED BY 'Www_pusdn_com'; GRANT ALL PRIVILEGES ON *.* TO 'gitea'@'localhost' WITH GRANT OPTION; FLUSH PRIVILEGES; exit; # 高版本建库或者导入gitea.mysql.sql都会报错,建议手动创建库,如果报错1071,如果utfmb8建议>=5.7 #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;
#!/bin/sh # # /etc/rc.d/init.d/gitea # # Runs the Gitea Git with a cup of tea. # # # 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}"
[Unit] Description=Gitea (Git with a cup of tea) After=syslog.target After=network.target ### # Don't forget to add the database service requirements ### # #Requires=mysql.service #Requires=mariadb.service #Requires=postgresql.service #Requires=memcached.service #Requires=redis.service # ### # If using socket activation for main http/s ### # #After=gitea.main.socket #Requires=gitea.main.socket # ### # (You can also provide gitea an http fallback and/or ssh socket too) # # An example of /etc/systemd/system/gitea.main.socket ### ## ## [Unit] ## Description=Gitea Web Socket ## PartOf=gitea.service ## ## [Socket] ## Service=gitea.service ## ListenStream=<some_port> ## NoDelay=true ## ## [Install] ## WantedBy=sockets.target ## ###
[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 RestartSec=2s Type=simple User=git Group=git WorkingDirectory=/home/git/gitea/ # If using Unix socket: tells systemd to create the /run/gitea folder, which will contain the gitea.sock file # (manually creating /run/gitea doesn't work, because it would not persist across reboots) #RuntimeDirectory=gitea ExecStart=/home/git/gitea/gitea web --config /home/git/gitea/custom/conf/app.ini Restart=always Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/home/git/gitea # If you install Git to directory prefix other than default PATH (which happens # for example if you install other versions of Git side-to-side with # distribution version), uncomment below line and add that prefix to PATH # Don't forget to place git-lfs binary on the PATH below if you want to enable # Git LFS support #Environment=PATH=/path/to/git/bin:/bin:/sbin:/usr/bin:/usr/sbin # If you want to bind Gitea to a port below 1024, uncomment # the two values below, or use socket activation to pass Gitea its ports as above ### #CapabilityBoundingSet=CAP_NET_BIND_SERVICE #AmbientCapabilities=CAP_NET_BIND_SERVICE ###
[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