<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>gitea Archives - Linux Windows and android Tutorials</title>
	<atom:link href="https://www.osradar.com/tag/gitea/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.osradar.com</link>
	<description>tutorials and news and Seurity</description>
	<lastBuildDate>Sat, 20 Feb 2021 17:11:08 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.12</generator>
	<item>
		<title>Install Gitea on CentOS 8</title>
		<link>https://www.osradar.com/install-gitea-on-centos-8/</link>
					<comments>https://www.osradar.com/install-gitea-on-centos-8/#respond</comments>
		
		<dc:creator><![CDATA[angeloma]]></dc:creator>
		<pubDate>Tue, 23 Feb 2021 05:08:00 +0000</pubDate>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[gitea]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=28576</guid>

					<description><![CDATA[<p>Hello, friends. In this post, we’ll show you how to install Gitea on CentOS 8 GITEA IS A COMMUNITY MANAGED LIGHTWEIGHT CODE HOSTING SOLUTION WRITTEN IN GO. IT IS PUBLISHED UNDER THE MIT LICENSE. So we can assume that it is a lightweight alternative to Gitlab but with many features that make it ideal for [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/install-gitea-on-centos-8/">Install Gitea on CentOS 8</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p><br><br>Hello, friends. In this post, we’ll show you how to install <a href="https://gitea.io/en-us/" target="_blank" rel="noreferrer noopener">Gitea</a> on CentOS 8</p>



<blockquote class="wp-block-quote"><p>GITEA IS A COMMUNITY MANAGED LIGHTWEIGHT CODE HOSTING SOLUTION WRITTEN IN GO. IT IS PUBLISHED UNDER THE MIT LICENSE.</p></blockquote>



<p>So we can assume that it is a lightweight alternative to Gitlab but with many features that make it ideal for many homes.</p>



<p>So if you have small teams or are just starting, Gitea is for you.</p>



<h2 id="install-gitea-on-centos-8"><a href="#install-gitea-on-centos-8" name="install-gitea-on-centos-8"></a>Install Gitea on CentOS 8</h2>



<p>Before we start, we have to prepare the system by upgrading it and installing some pre-installation packages.</p>



<p>So, open a terminal or via SSH run</p>



<pre class="wp-block-preformatted">dnf update
dnf install git unzip gnupg2 nano wget</pre>



<p>Although Gitea supports several database drivers, including <a href="https://www.osradar.com/install-the-latest-version-sqlite-ubuntu-20-04/" target="_blank" rel="noreferrer noopener">SQLite</a> I think MariaDB is very convenient to use.</p>



<p>So, install MariaDB on CentOS 8 with <a href="https://www.osradar.com/install-mariadb-10-5-centos-8/" target="_blank" rel="noreferrer noopener">our post.</a></p>



<h3 id="1)-working-with-mariadb-before-installing-gitea"><a href="#1)-working-with-mariadb-before-installing-gitea" name="1)-working-with-mariadb-before-installing-gitea"></a>1) Working with MariaDB before installing Gitea</h3>



<p>Now we can create a new database for Gite and its respective user.</p>



<p>So, access the MariaDB shell</p>



<pre class="wp-block-preformatted">mysql -u root -p</pre>



<p>And start creating the database and the user with the corresponding permissions:</p>



<pre class="wp-block-preformatted">CREATE DATABASE giteadb CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci';
GRANT ALL ON giteadb.* TO 'giteauser'@'localhost' IDENTIFIED BY 'giteapss';
FLUSH PRIVILEGES;
exit;</pre>



<p>After that, you have to add some parameters to the MariaDB configuration.</p>



<p>So, open the file:</p>



<pre class="wp-block-preformatted">nano /etc/my.cnf.d/server.cnf</pre>



<p>And add the following just below the [mysqld] section</p>



<pre class="wp-block-preformatted">innodb_file_format = Barracuda
innodb_large_prefix = 1
innodb_default_row_format = dynamic</pre>



<p>Save your changes and close the editor. And restart the MariaDB service to apply the changes.</p>



<pre class="wp-block-preformatted">systemctl restart mariadb</pre>



<h3 id="2)-install-gitea-on-centos"><a href="#2)-install-gitea-on-centos" name="2)-install-gitea-on-centos"></a>2) Install Gitea on CentOS</h3>



<p>Now we can download the Gitea binary which is the easiest way to do this process.</p>



<p>So, as of this writing, <strong>the latest stable version of Gitea is <code>1.13.1</code></strong> so you have to update the commands with the number of the latest stable version.</p>



<p>So, download it using wget</p>



<pre class="wp-block-preformatted">wget https://dl.gitea.io/gitea/1.13.1/gitea-1.13.1-linux-amd64</pre>



<p>Move it to the system binaries folder:</p>



<pre class="wp-block-preformatted">mv gitea-1.13.1-linux-amd64 /usr/bin/gitea</pre>



<p>And assign it to run permissions:</p>



<pre class="wp-block-preformatted">chmod 755 /usr/bin/gitea</pre>



<p>It is a good idea to handle Gitea as a system service so we have to create a new entry for it</p>



<pre class="wp-block-preformatted">nano /etc/systemd/system/gitea.service</pre>



<p>And add the following content</p>



<pre class="wp-block-preformatted">[Unit]
 Description=Gitea
 After=syslog.target
 After=network.target
 After=mysql.service

 [Service]
 RestartSec=2s
 Type=simple
 User=git
 Group=git
 WorkingDirectory=/var/lib/gitea/
 ExecStart=/usr/bin/gitea web -c /etc/gitea/app.ini
 Restart=always
 Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea

 [Install]
 WantedBy=multi-user.target</pre>



<p>Save the changes and close the editor.</p>



<p>To apply the changes refresh the system services cache:</p>



<pre class="wp-block-preformatted">systemctl daemon-reload</pre>



<p>Now, enable and start Gitea-</p>



<pre class="wp-block-preformatted">systemctl enable gitea
systemctl start gitea</pre>



<p>And check the status of it</p>



<pre class="wp-block-preformatted">systemctl status gitea
● gitea.service - Gitea
    Loaded: loaded (/etc/systemd/system/gitea.service; enabled; vendor preset: disabled)
    Active: active (running) since Sat 2021-02-20 16:27:12 CET; 8s ago
  Main PID: 54969 (gitea)
     Tasks: 8 (limit: 24338)
    Memory: 153.6M
    CGroup: /system.slice/gitea.service
            └─54969 /usr/bin/gitea web -c /etc/gitea/app.ini
 Feb 20 16:27:12 osradar gitea[54969]: 2021/02/20 16:27:12 …s/storage/storage.go:145:initAvatars() [I] Initialising Avatar storage with type: 
 Feb 20 16:27:12 osradar gitea[54969]: 2021/02/20 16:27:12 …les/storage/local.go:43:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/avatars
 Feb 20 16:27:12 osradar gitea[54969]: 2021/02/20 16:27:12 …s/storage/storage.go:163:initRepoAvatars() [I] Initialising Repository Avatar storage with type: 
 Feb 20 16:27:12 osradar gitea[54969]: 2021/02/20 16:27:12 …les/storage/local.go:43:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/repo-avatars
 Feb 20 16:27:12 osradar gitea[54969]: 2021/02/20 16:27:12 …s/storage/storage.go:157:initLFS() [I] Initialising LFS storage with type: 
 Feb 20 16:27:12 osradar gitea[54969]: 2021/02/20 16:27:12 …les/storage/local.go:43:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/lfs
 Feb 20 16:27:12 osradar gitea[54969]: 2021/02/20 16:27:12 routers/init.go:174:GlobalInit() [I] SQLite3 Supported
 Feb 20 16:27:12 osradar gitea[54969]: 2021/02/20 16:27:12 routers/init.go:56:checkRunMode() [I] Run Mode: Production
 Feb 20 16:27:13 osradar gitea[54969]: 2021/02/20 16:27:13 cmd/web.go:163:runWeb() [I] Listen: http://0.0.0.0:3000
 Feb 20 16:27:13 osradar gitea[54969]: 2021/02/20 16:27:13 …s/graceful/server.go:55:NewServer() [I] Starting new server: tcp:0.0.0.0:3000 on PID: 54969</pre>



<p>By default, Gite uses port 3000 so we have to open it in the Firewall.</p>



<pre class="wp-block-preformatted">firewall-cmd --permanent --zone=public --add-port=3000/tcp
firewall-cmd --reload</pre>



<p>This will set it up, but it’s a good idea to do some more configuration.</p>



<h3 id="optional:-configuring-ngnix-as-the-reverse-proxy"><a href="#optional:-configuring-ngnix-as-the-reverse-proxy" name="optional:-configuring-ngnix-as-the-reverse-proxy"></a>Optional: Configuring Ngnix as the reverse proxy</h3>



<p>To facilitate access you need to configure Nginx as a Reverse Proxy.</p>



<p>First, install it:</p>



<pre class="wp-block-preformatted">dnf install nginx</pre>



<p>And now create the configuration file for Gitea:</p>



<pre class="wp-block-preformatted">nano /etc/nginx/conf.d/gitea.conf</pre>



<p>And add the following content:</p>



<pre class="wp-block-preformatted">upstream gitea {
      server 127.0.0.1:3000;
  }
  server {
      listen 80;
      server_name angtest.ga;
      root /var/lib/gitea/public;
      access_log off;
      error_log off;
 location / { 
 try_files maintain.html $uri $uri/index.html @node;
 } 
 location @node {   
 client_max_body_size 0;
 proxy_pass http://localhost:3000;
 proxy_set_header X-Forwarded-For
 $proxy_add_x_forwarded_for;
 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header Host $http_host;
 proxy_set_header X-Forwarded-Proto $scheme; 
 proxy_max_temp_file_size 0;
 proxy_redirect off;
 proxy_read_timeout 120;
 }
  }</pre>



<figure class="wp-block-image size-large"><img loading="lazy" width="888" height="531" src="https://www.osradar.com/wp-content/uploads/2021/02/1-7.png" alt="1.- Installing Gitea on CentOS 8" class="wp-image-28599" srcset="https://www.osradar.com/wp-content/uploads/2021/02/1-7.png 888w, https://www.osradar.com/wp-content/uploads/2021/02/1-7-300x179.png 300w, https://www.osradar.com/wp-content/uploads/2021/02/1-7-768x459.png 768w, https://www.osradar.com/wp-content/uploads/2021/02/1-7-696x416.png 696w" sizes="(max-width: 888px) 100vw, 888px" /><figcaption>1.- Installing Gitea on CentOS 8</figcaption></figure>



<p>From this content, you have to replace the server_name value with yours.</p>



<p>Save the changes and close the file.</p>



<p>To apply the changes, restart the Nginx service.</p>



<h3 id="optional:-enable-https-for-gitea"><a href="#optional:-enable-https-for-gitea" name="optional:-enable-https-for-gitea"></a>Optional: Enable HTTPS for Gitea</h3>



<p>We can install certificates thanks to Let’s Encrypt using <code>Certbot</code>. This process is recommended to secure web access.</p>



<p>Certbot is not in the CentOS 8 repositories but we can install it thanks to Snap.</p>



<p>So, enable the <code>EPEL</code> repository:</p>



<pre class="wp-block-preformatted">dnf install epel-release</pre>



<p>Install the <code>snapd</code> package:</p>



<pre class="wp-block-preformatted">dnf install snapd</pre>



<p>Enable it by running the following command:</p>



<pre class="wp-block-preformatted">systemctl enable --now snapd.socket</pre>



<p>And enable the installation of classics packages.</p>



<pre class="wp-block-preformatted">ln -s /var/lib/snapd/snapd/snap /snap</pre>



<p>After that install the <code>core</code> package which is the initial Snapd package.</p>



<pre class="wp-block-preformatted">snap install core</pre>



<p>Now install Certbot by running:</p>



<pre class="wp-block-preformatted">snap install --classic certbot</pre>



<p>And create a symbolic link to use the snap command from anywhere in promt without any problems:</p>



<pre class="wp-block-preformatted">ln -s /snap/bin/certbot /usr/bin/certbot</pre>



<p>Finally, download and install the certificates by running</p>



<pre class="wp-block-preformatted">certbot --redirect --hsts --staple-ocsp --agree-tos --email admin@osradar.com --nginx -d angtest.ga</pre>



<p>In this command you have to replace the values of <code>--email</code> and <code>-d</code> with your own.</p>



<h2 id="testing-gitea-installation"><a href="#testing-gitea-installation" name="testing-gitea-installation"></a>Testing Gitea installation</h2>



<p>You can now open your web browser and go to <code>https://your-domain/install</code> to complete the installation.</p>



<p>First, enter the database credentials we defined earlier.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="506" src="https://www.osradar.com/wp-content/uploads/2021/02/2-5-1024x506.png" alt="2.- Configuring Gitea before using it" class="wp-image-28600" srcset="https://www.osradar.com/wp-content/uploads/2021/02/2-5-1024x506.png 1024w, https://www.osradar.com/wp-content/uploads/2021/02/2-5-300x148.png 300w, https://www.osradar.com/wp-content/uploads/2021/02/2-5-768x379.png 768w, https://www.osradar.com/wp-content/uploads/2021/02/2-5-696x344.png 696w, https://www.osradar.com/wp-content/uploads/2021/02/2-5-1068x528.png 1068w, https://www.osradar.com/wp-content/uploads/2021/02/2-5.png 1354w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>2.- Configuring Gitea before using it</figcaption></figure>



<p>On the bottom section, we have some other settings that we can change. The most important thing here is the <code>BaseURL</code> which you have to replace with your domain and the creation of the <code>admin</code> user and password.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="506" src="https://www.osradar.com/wp-content/uploads/2021/02/3-2-1024x506.png" alt="3.- Installing Gitea" class="wp-image-28601" srcset="https://www.osradar.com/wp-content/uploads/2021/02/3-2-1024x506.png 1024w, https://www.osradar.com/wp-content/uploads/2021/02/3-2-300x148.png 300w, https://www.osradar.com/wp-content/uploads/2021/02/3-2-768x379.png 768w, https://www.osradar.com/wp-content/uploads/2021/02/3-2-696x344.png 696w, https://www.osradar.com/wp-content/uploads/2021/02/3-2-1068x528.png 1068w, https://www.osradar.com/wp-content/uploads/2021/02/3-2.png 1354w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>3.- Installing Gitea</figcaption></figure>



<p>When finished, you can complete the installation and the installer will redirect you to the dashboard. From there you can start working.</p>



<p></p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="501" src="//1081754738.rsc.cdn77.org/wp-content/uploads/2021/02/4-1-1024x501.png" alt="4.- Gitea Dashboard" class="wp-image-28602" srcset="https://www.osradar.com/wp-content/uploads/2021/02/4-1-1024x501.png 1024w, https://www.osradar.com/wp-content/uploads/2021/02/4-1-300x147.png 300w, https://www.osradar.com/wp-content/uploads/2021/02/4-1-768x376.png 768w, https://www.osradar.com/wp-content/uploads/2021/02/4-1-696x341.png 696w, https://www.osradar.com/wp-content/uploads/2021/02/4-1-1068x523.png 1068w, https://www.osradar.com/wp-content/uploads/2021/02/4-1.png 1365w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>4.- Gitea Dashboard</figcaption></figure>



<h2 id="conclusion"><a href="#conclusion" name="conclusion"></a>Conclusion</h2>



<p>Gitea aims to be a solid alternative to Gitlab for hosting code in private workgroups. Gitea is lighter but has the capabilities to become a powerful and compliant software.</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/install-gitea-on-centos-8/">Install Gitea on CentOS 8</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/install-gitea-on-centos-8/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
