The website for craig.stewart.zone https://craig.stewart.zone/
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.

88 lines
3.6 KiB

<!DOCTYPE html>
<html lang="en">
<head>
<link href="/styles/default.css" rel="stylesheet" type="text/css" />
<title>
Installing Gitea
</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<div id="wrapper">
<div id="header">
<h1>
Installing Gitea
</h1>
</div>
<div id="layout">
<div id="navigation">
<p class="link">
<a href="/index.html">
Home
</a>
</p>
<p class="link">
<a href="/about.html">
About Me
</a>
</p>
<p class="link">
<a href="/contact.html">
Contact Me
</a>
</p>
<!--<p class="link">
<a href="/cv.html">
My CV
</a>
</p>-->
<p class="link">
<a href="https://www.craig-james-stewart.co.uk/blog/">
My Blog
</a>
</p>
</div>
<div id="content">
<p>We have most of the prerequisites installed for gitea, and we could download the binary and run it as we are, but we want this to be a daemon (a process that runs in the background, and doesn't need an interactive shell open to run in) so we need to create a system user for it, and set it up as a service. We will also need to create the config files, and directory structure that Gitea expects. (most of the following is taken from the documentation at <a href="https://docs.gitea.io/en-us/" title="Gitea Documentation">Gitea's documentation pages</a> with a few minor tweaks)</p>
<pre>sudo adduser \
--system \
--shell /bin/bash \
--gecos 'Git Version Control' \
--group \
--disabled-password \
--home /var/lib/gitea \
git
sudo mkdir -p /var/lib/gitea/{custom,data,indexers,public,log}
sudo chown git:git /var/lib/gitea/{data,indexers,log}
sudo chown git:git /var/lib/gitea
sudo chmod 750 /var/lib/gitea/{data,indexers,log}
sudo mkdir /etc/gitea
sudo chown root:git /etc/gitea
sudo chmod 770 /etc/gitea
wget -O gitea https://dl.gitea.io/gitea/1.4.2/gitea-1.4.2-linux-amd64
sudo chown root:root gitea
sudo mv gitea /usr/local/bin/
sudo chmod +x /usr/local/bin/gitea
sudo -u git /usr/local/bin/gitea web -c /etc/gitea/app.ini</pre>
<p>At this point you should be able to visit your git domain in a web browser, https://git.example.com in this guide, and configure gitea through the installation page.</p>
<p>Most of the settings can be left as their defaults, with the following exceptions,
<ul>Config changes from defaults
<li>In Database settings you need to enter the Database password you set for the gitea user of the database</li>
<li>In General Application Settings change the LFS Root Path to "/var/lib/gitea/data/lfs"</li>
<li>Change Domain to the FQDN you are using (git.example.com in this guide)</li>
<li>Change Application URL to HTTPS at your domain (https://git.example.com/ in this guide)</li>
<li>Change Log Path to "/var/lib/gitea/log"</li>
<li>In the Optional Settings, expand Email Service Settings and set SMTP Host to "localhost:25"</li>
<li>Set From to something like "no-reply@git.example.com"</li>
<li>Tick both Enable Register Confirmation and Enable Mail Notifications</li></ul>
<p>The remaining Settings are your choice, click install Gitea and the config file will be created and Gitea will be configured. Once done the gitea process will stop, and we need to make the config secure.</p>
<pre>sudo chmod 750 /etc/gitea
sudo chmod 644 /etc/gitea/app.ini</pre>
<p>We now have a configured Git server, there just remain a few steps to get it ready to go into service.</p>
<p style="text-align:center;"><a href="/guides/building-a-git-repo/installdb.html" title="Installing a Database">Installing a Database</a>|<a href="/guides/building-a-git-repo/" title="Building A git Repository Server">Main Page</a>|<a href="/guides/building-a-git-repo/finalising.html" title="Finalising Everything">Finalising Everything</a></p>
</div>
</div>
</div>
</body>
</html>