You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 5 години
преди 5 години
преди 5 години
преди 5 години
преди 5 години
преди 5 години
преди 5 години
преди 5 години
преди 5 години
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. ---
  2. date: "2017-06-19T12:00:00+02:00"
  3. title: "Installation from binary"
  4. slug: "install-from-binary"
  5. weight: 10
  6. toc: true
  7. draft: false
  8. menu:
  9. sidebar:
  10. parent: "installation"
  11. name: "From binary"
  12. weight: 20
  13. identifier: "install-from-binary"
  14. ---
  15. # Installation from binary
  16. All downloads come with SQLite, MySQL and PostgreSQL support, and are built with
  17. embedded assets. This can be different for older releases. Choose the file matching
  18. the destination platform from the [downloads page](https://dl.gitea.io/gitea/), copy
  19. the URL and replace the URL within the commands below:
  20. ```sh
  21. wget -O gitea https://dl.gitea.io/gitea/{{< version >}}/gitea-{{< version >}}-linux-amd64
  22. chmod +x gitea
  23. ```
  24. ## Verify GPG signature
  25. Gitea signs all binaries with a [GPG key](https://keys.openpgp.org/search?q=teabot%40gitea.io) to prevent against unwanted modification of binaries. To validate the binary, download the signature file which ends in `.asc` for the binary you downloaded and use the gpg command line tool.
  26. ```sh
  27. gpg --keyserver keys.openpgp.org --recv 7C9E68152594688862D62AF62D9AE806EC1592E2
  28. gpg --verify gitea-{{< version >}}-linux-amd64.asc gitea-{{< version >}}-linux-amd64
  29. ```
  30. ## Recommended server configuration
  31. **NOTE:** Many of the following directories can be configured using [Environment Variables]({{< relref "doc/advanced/specific-variables.en-us.md" >}}) as well!
  32. Of note, configuring `GITEA_WORK_DIR` will tell Gitea where to base its working directory, as well as ease installation.
  33. ### Prepare environment
  34. Check that Git is installed on the server. If it is not, install it first.
  35. ```sh
  36. git --version
  37. ```
  38. Create user to run Gitea (ex. `git`)
  39. ```sh
  40. adduser \
  41. --system \
  42. --shell /bin/bash \
  43. --gecos 'Git Version Control' \
  44. --group \
  45. --disabled-password \
  46. --home /home/git \
  47. git
  48. ```
  49. ### Create required directory structure
  50. ```sh
  51. mkdir -p /var/lib/gitea/{custom,data,log}
  52. chown -R git:git /var/lib/gitea/
  53. chmod -R 750 /var/lib/gitea/
  54. mkdir /etc/gitea
  55. chown root:git /etc/gitea
  56. chmod 770 /etc/gitea
  57. ```
  58. **NOTE:** `/etc/gitea` is temporary set with write rights for user `git` so that Web installer could write configuration file. After installation is done, it is recommended to set rights to read-only using:
  59. ```
  60. chmod 750 /etc/gitea
  61. chmod 640 /etc/gitea/app.ini
  62. ```
  63. If you don't want the web installer to be able to write the config file at all, it is also possible to make the config file read-only for the gitea user (owner/group `root:root`, mode `0660`), and set `INSTALL_LOCK = true`. In that case all database configuration details must be set beforehand in the config file, as well as the `SECRET_KEY` and `INTERNAL_TOKEN` values. See the [command line documentation]({{< relref "doc/usage/command-line.en-us.md" >}}) for information on using `gitea generate secret INTERNAL_TOKEN`.
  64. ### Configure Gitea's working directory
  65. **NOTE:** If you plan on running Gitea as a Linux service, you can skip this step as the service file allows you to set `WorkingDirectory`. Otherwise, consider setting this environment variable (semi-)permanently so that Gitea consistently uses the correct working directory.
  66. ```
  67. export GITEA_WORK_DIR=/var/lib/gitea/
  68. ```
  69. ### Copy Gitea binary to global location
  70. ```
  71. cp gitea /usr/local/bin/gitea
  72. ```
  73. ## Running Gitea
  74. After the above steps, two options to run Gitea are:
  75. ### 1. Creating a service file to start Gitea automatically (recommended)
  76. See how to create [Linux service]({{< relref "run-as-service-in-ubuntu.en-us.md" >}})
  77. ### 2. Running from command-line/terminal
  78. ```
  79. GITEA_WORK_DIR=/var/lib/gitea/ /usr/local/bin/gitea web -c /etc/gitea/app.ini
  80. ```
  81. ## Updating to a new version
  82. You can update to a new version of Gitea by stopping Gitea, replacing the binary at `/usr/local/bin/gitea` and restarting the instance.
  83. The binary file name should not be changed during the update to avoid problems
  84. in existing repositories.
  85. It is recommended you do a [backup]({{< relref "doc/usage/backup-and-restore.en-us.md" >}}) before updating your installation.
  86. If you have carried out the installation steps as described above, the binary should
  87. have the generic name `gitea`. Do not change this, i.e. to include the version number.
  88. See below for troubleshooting instructions to repair broken repositories after
  89. an update of your Gitea version.
  90. ## Troubleshooting
  91. ### Old glibc versions
  92. Older Linux distributions (such as Debian 7 and CentOS 6) may not be able to load the
  93. Gitea binary, usually producing an error such as ```./gitea: /lib/x86_64-linux-gnu/libc.so.6:
  94. version `GLIBC\_2.14' not found (required by ./gitea)```. This is due to the integrated
  95. SQLite support in the binaries provided by dl.gitea.io. In this situation, it is usually
  96. possible to [install from source]({{< relref "from-source.en-us.md" >}}) without sqlite
  97. support.
  98. ### Running Gitea on another port
  99. For errors like `702 runWeb()] [E] Failed to start server: listen tcp 0.0.0.0:3000:
  100. bind: address already in use` Gitea needs to be started on another free port. This
  101. is possible using `./gitea web -p $PORT`. It's possible another instance of Gitea
  102. is already running.
  103. ### Running Gitea on Raspbian
  104. As of v1.8, there is a problem with the arm7 version of Gitea and it doesn't run on Raspberry Pi and similar devices.
  105. It is therefore recommended to switch to the arm6 version which has been tested and shown to work on Raspberry Pi and similar devices.
  106. <!---
  107. please remove after fixing the arm7 bug
  108. --->
  109. ### Git error after updating to a new version of Gitea
  110. If the binary file name has been changed during the update to a new version of Gitea,
  111. git hooks in existing repositories will not work any more. In that case, a git
  112. error will be displayed when pushing to the repository.
  113. ```
  114. remote: ./hooks/pre-receive.d/gitea: line 2: [...]: No such file or directory
  115. ```
  116. The `[...]` part of the error message will contain the path to your previous Gitea
  117. binary.
  118. To solve this, go to the admin options and run the task `Resynchronize pre-receive,
  119. update and post-receive hooks of all repositories` to update all hooks to contain
  120. the new binary path. Please note that this overwrite all git hooks including ones
  121. with customizations made.
  122. If you aren't using the built-in to Gitea SSH server you will also need to re-write
  123. the authorized key file by running the `Update the '.ssh/authorized_keys' file with
  124. Gitea SSH keys.` task in the admin options.