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

from-binary.en-us.md 6.6 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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://pgp.mit.edu/pks/lookup?op=vindex&fingerprint=on&search=0x2D9AE806EC1592E2) 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 pgp.mit.edu --recv 7C9E68152594688862D62AF62D9AE806EC1592E2
  28. gpg --verify gitea-{{< version >}}-linux-amd64.asc gitea-{{< version >}}-linux-amd64
  29. ```
  30. ## Test
  31. After getting a binary, it can be tested with `./gitea web` or moved to a permanent
  32. location. When launched manually, Gitea can be killed using `Ctrl+C`.
  33. ```
  34. ./gitea web
  35. ```
  36. ## Recommended server configuration
  37. **NOTE:** Many of the following directories can be configured using [Environment Variables]({{< relref "doc/advanced/specific-variables.en-us.md" >}}) as well!
  38. Of note, configuring `GITEA_WORK_DIR` will tell Gitea where to base its working directory, as well as ease installation.
  39. ### Prepare environment
  40. Check that Git is installed on the server. If it is not, install it first.
  41. ```sh
  42. git --version
  43. ```
  44. Create user to run Gitea (ex. `git`)
  45. ```sh
  46. adduser \
  47. --system \
  48. --shell /bin/bash \
  49. --gecos 'Git Version Control' \
  50. --group \
  51. --disabled-password \
  52. --home /home/git \
  53. git
  54. ```
  55. ### Create required directory structure
  56. ```sh
  57. mkdir -p /var/lib/gitea/{custom,data,log}
  58. chown -R git:git /var/lib/gitea/
  59. chmod -R 750 /var/lib/gitea/
  60. mkdir /etc/gitea
  61. chown root:git /etc/gitea
  62. chmod 770 /etc/gitea
  63. ```
  64. **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:
  65. ```
  66. chmod 750 /etc/gitea
  67. chmod 640 /etc/gitea/app.ini
  68. ```
  69. 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`.
  70. ### Configure Gitea's working directory
  71. **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.
  72. ```
  73. export GITEA_WORK_DIR=/var/lib/gitea/
  74. ```
  75. ### Copy Gitea binary to global location
  76. ```
  77. cp gitea /usr/local/bin/gitea
  78. ```
  79. ## Running Gitea
  80. After the above steps, two options to run Gitea are:
  81. ### 1. Creating a service file to start Gitea automatically (recommended)
  82. See how to create [Linux service]({{< relref "run-as-service-in-ubuntu.en-us.md" >}})
  83. ### 2. Running from command-line/terminal
  84. ```
  85. GITEA_WORK_DIR=/var/lib/gitea/ /usr/local/bin/gitea web -c /etc/gitea/app.ini
  86. ```
  87. ## Updating to a new version
  88. You can update to a new version of Gitea by stopping Gitea, replacing the binary at `/usr/local/bin/gitea` and restarting the instance.
  89. The binary file name should not be changed during the update to avoid problems
  90. in existing repositories.
  91. It is recommended you do a [backup]({{< relref "doc/usage/backup-and-restore.en-us.md" >}}) before updating your installation.
  92. If you have carried out the installation steps as described above, the binary should
  93. have the generic name `gitea`. Do not change this, i.e. to include the version number.
  94. See below for troubleshooting instructions to repair broken repositories after
  95. an update of your Gitea version.
  96. ## Troubleshooting
  97. ### Old glibc versions
  98. Older Linux distributions (such as Debian 7 and CentOS 6) may not be able to load the
  99. Gitea binary, usually producing an error such as ```./gitea: /lib/x86_64-linux-gnu/libc.so.6:
  100. version `GLIBC\_2.14' not found (required by ./gitea)```. This is due to the integrated
  101. SQLite support in the binaries provided by dl.gitea.io. In this situation, it is usually
  102. possible to [install from source]({{< relref "from-source.en-us.md" >}}) without sqlite
  103. support.
  104. ### Running Gitea on another port
  105. For errors like `702 runWeb()] [E] Failed to start server: listen tcp 0.0.0.0:3000:
  106. bind: address already in use` Gitea needs to be started on another free port. This
  107. is possible using `./gitea web -p $PORT`. It's possible another instance of Gitea
  108. is already running.
  109. ### Running Gitea on Raspbian
  110. 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.
  111. It is therefore recommended to switch to the arm6 version which has been tested and shown to work on Raspberry Pi and similar devices.
  112. <!---
  113. please remove after fixing the arm7 bug
  114. --->
  115. ### Git error after updating to a new version of Gitea
  116. If the binary file name has been changed during the update to a new version of Gitea,
  117. git hooks in existing repositories will not work any more. In that case, a git
  118. error will be displayed when pushing to the repository.
  119. ```
  120. remote: ./hooks/pre-receive.d/gitea: line 2: [...]: No such file or directory
  121. ```
  122. The `[...]` part of the error message will contain the path to your previous Gitea
  123. binary.
  124. To solve this, go to the admin options and run the task `Resynchronize pre-receive,
  125. update and post-receive hooks of all repositories` to update all hooks to contain
  126. the new binary path. Please note that this overwrite all git hooks including ones
  127. with customizations made.
  128. If you aren't using the built-in to Gitea SSH server you will also need to re-write
  129. the authorized key file by running the `Update the '.ssh/authorized_keys' file with
  130. Gitea SSH keys.` task in the admin options.