Advertisement
load-net

gitea-ssh

Mar 14th, 2024 (edited)
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.83 KB | None | 0 0
  1. timedatectl set-timezone Asia/Yekaterinburg # Tyumen
  2. hostnamectl set-hostname gitea
  3. nano /etc/hosts
  4.  
  5. apt install -y mc git curl
  6. apt update && apt upgrade -y
  7. git --version
  8. sudo adduser --system --shell /bin/bash --gecos 'Git Version Control' --group --disabled-password --home /home/git git
  9.  
  10. ######################БАЗА ДАННЫХ########################################################
  11. apt -y install mariadb-server
  12. mysql_secure_installation
  13.  
  14. mysql -u root -p
  15. CREATE DATABASE gitea;
  16. GRANT ALL PRIVILEGES ON gitea.* TO 'gitea'@'localhost' IDENTIFIED BY "1234566";
  17. FLUSH PRIVILEGES;
  18. QUIT;
  19. ###########################################################################################
  20.  
  21.  
  22. cd /usr/src/
  23.  
  24. curl -s https://api.github.com/repos/go-gitea/gitea/releases/latest |grep browser_download_url | cut -d '"' -f 4 | grep '\linux-amd64$' | wget -i -
  25.  
  26. chmod +x gitea-*-linux-amd64
  27. mv gitea-*-linux-amd64 /usr/local/bin/gitea
  28. gitea --version
  29. mkdir -p /etc/gitea /var/lib/gitea/{custom,data,indexers,public,log}
  30. chown git:git /var/lib/gitea/{data,indexers,log}
  31. chmod 750 /var/lib/gitea/{data,indexers,log}
  32. chown root:git /etc/gitea
  33. chmod 770 /etc/gitea
  34.  
  35. mcedit /etc/systemd/system/gitea.service
  36. ################################################
  37. [Unit]
  38. Description=Gitea (Git with a cup of tea)
  39. After=network.target
  40. ###
  41. # Don't forget to add the database service dependencies
  42. ###
  43. #
  44. #Wants=mysql.service
  45. #After=mysql.service
  46. #
  47. #Wants=mariadb.service
  48. #After=mariadb.service
  49. #
  50. #Wants=postgresql.service
  51. #After=postgresql.service
  52. #
  53. #Wants=memcached.service
  54. #After=memcached.service
  55. #
  56. #Wants=redis.service
  57. #After=redis.service
  58. #
  59. ###
  60. # If using socket activation for main http/s
  61. ###
  62. #
  63. #After=gitea.main.socket
  64. #Requires=gitea.main.socket
  65. #
  66. ###
  67. # (You can also provide gitea an http fallback and/or ssh socket too)
  68. #
  69. # An example of /etc/systemd/system/gitea.main.socket
  70. ###
  71. ##
  72. ## [Unit]
  73. ## Description=Gitea Web Socket
  74. ## PartOf=gitea.service
  75. ##
  76. ## [Socket]
  77. ## Service=gitea.service
  78. ## ListenStream=<some_port>
  79. ## NoDelay=true
  80. ##
  81. ## [Install]
  82. ## WantedBy=sockets.target
  83. ##
  84. ###
  85.  
  86. [Service]
  87. # Uncomment the next line if you have repos with lots of files and get a HTTP 500 error because of that
  88. # LimitNOFILE=524288:524288
  89. RestartSec=2s
  90. Type=simple
  91. User=git
  92. Group=git
  93. WorkingDirectory=/var/lib/gitea/
  94. # If using Unix socket: tells systemd to create the /run/gitea folder, which will contain the gitea.sock file
  95. # (manually creating /run/gitea doesn't work, because it would not persist across reboots)
  96. #RuntimeDirectory=gitea
  97. ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini
  98. Restart=always
  99. Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea
  100. # If you install Git to directory prefix other than default PATH (which happens
  101. # for example if you install other versions of Git side-to-side with
  102. # distribution version), uncomment below line and add that prefix to PATH
  103. # Don't forget to place git-lfs binary on the PATH below if you want to enable
  104. # Git LFS support
  105. #Environment=PATH=/path/to/git/bin:/bin:/sbin:/usr/bin:/usr/sbin
  106. # If you want to bind Gitea to a port below 1024, uncomment
  107. # the two values below, or use socket activation to pass Gitea its ports as above
  108. ###
  109. #CapabilityBoundingSet=CAP_NET_BIND_SERVICE
  110. #AmbientCapabilities=CAP_NET_BIND_SERVICE
  111. ###
  112. # In some cases, when using CapabilityBoundingSet and AmbientCapabilities option, you may want to
  113. # set the following value to false to allow capabilities to be applied on gitea process. The following
  114. # value if set to true sandboxes gitea service and prevent any processes from running with privileges
  115. # in the host user namespace.
  116. ###
  117. #PrivateUsers=false
  118. ###
  119.  
  120. [Install]
  121. WantedBy=multi-user.target
  122. #################################################
  123.  
  124. systemctl daemon-reload
  125. systemctl enable --now gitea
  126. systemctl status gitea
  127.  
  128.  
  129.  
  130.  
  131. mcedit /etc/gitea/app.ini
  132.  
  133. [mailer]
  134. ENABLED = true
  135. SMTP_ADDR = smtp.yandex.ru
  136. SMTP_PORT = 587
  137. PASSWD = lzivvpcpe6d8r
  138.  
  139. ################################################################
  140.  
  141.  
  142.  
  143.  
  144. apt -y install nginx
  145.  
  146. mcedit /etc/nginx/sites-available/default
  147.  
  148. server {
  149. listen 80;
  150. server_name your_domain.com; # замените на ваш домен или IP-адрес, если требуется
  151.  
  152. location / {
  153. proxy_pass http://127.0.0.1:3000;
  154. proxy_set_header Host $host;
  155. proxy_set_header X-Real-IP $remote_addr;
  156. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  157. proxy_set_header X-Forwarded-Proto $scheme;
  158. }
  159. }
  160.  
  161. ###########################################################################
  162.  
  163. systemctl restart nginx
  164. mysql -u gitea -p
  165.  
  166. systemctl enable gitea
  167.  
  168. systemctl stop gitea
  169. systemctl start gitea
  170.  
  171. systemctl status gitea
  172.  
  173.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement