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.
 
 
 
 

61 lines
6.1 KiB

import { addBanner, addArticle, addHeader, addParagraph, addSubHeader } from '/scripts/article.js';
import { addInset, addInsetList, addInsetCodeListing, addInsetBulletList } from '/scripts/inset.js';
import { addImageWithCaption, addButtonGroup } from '/scripts/visuals.js';
const main = document.querySelector("main");
main.append(addBanner("Install Gitea on a Raspberry Pi", "Personal Project", "pimylifeup.com"))
main.append(addArticle())
const article = document.querySelector("article")
article.append(addHeader("Preparing for Gitea on the Raspberry Pi"))
article.append(addParagraph("Now that we have Git set up, we can store our repositories on our very own Git server. However, as we saw in the tutorial on setting up Git, when we looked into the remote respository, it isn't storing our files as simply a copy of the files in the local repo. If you are using an online Git service such as GutHub, you will typically manage the remote repositories via GitLab or some other Gui and Gogs will give us the same sort of management ability for our own Git service."))
article.append(addParagraph("To start with, it is usually a good idea to esnure your local system is up to date so we will run"))
article.append(addInset("sudo apt update"))
article.append(addParagraph("and"))
article.append(addInset("sudo apt upgrade"))
article.append(addParagraph("We will also need a database so we will install mariadb with the command"))
article.append(addInset("sudo apt install mariadb-server git unzip"))
article.append(addParagraph("Note that since I already have Git installed and running, I have omitted it from the above command."))
article.append(addParagraph("Having installed the database, the next step is to secire the installation by running the command"))
article.append(addInset("sudo mysql_secure_installation"))
article.append(addParagraph("I have added a password for the database root user and disallowed remote login for root, removed anonymous users and removed the test database. For reference, this is shown in figure 1."))
article.append(addImageWithCaption("images/figure1.png", "Figure 1 - securing the installation of mariadb."))
article.append(addParagraph("We can start up mariadb with the command"))
article.append(addInset("sudo mysql -u root -p"))
article.append(addParagraph("We want to create a database that we will be using with gogs so we will call it gogs and we create it with the command"))
article.append(addInset("CREATE DATABASE gitea;"))
article.append(addParagraph("We will also create a user called goguser which is going to have all priviliges on the gogs database with"))
article.append(addInset("GRANT ALL PRIVILEGES ON gitea.* TO 'gitea'@'localhost' IDENTIFIED BY 'pimpmylifeup';"))
article.append(addParagraph("In this case, the password is shown as pimylifeup but you should change that to some secure password of your own. Having created the user, we then want to flush the privileges table with the command"))
article.append(addInset("FLUSH PRIVILEGES;"))
article.append(addParagraph("That's all we need to do with the database for now so we can exit. We then want to create a new user for gitea. This is to allow gitea to run, but we don't want to be able to login as this user so the command to do that is"))
article.append(addInset("sudo adduser --disabled-login --gecos 'Gitea' git"))
article.append(addHeader("Installing Gitea"))
article.append(addParagraph("To start with, we want to switch over to the git user with"))
article.append(addInset("sudo su - git"))
article.append(addParagraph("This also puts us into the home directory for the git user. If you are unsure, you can use the pwd to make sure you are in the right directory or you can just cd to the directory with cd (to navigate to the home directory). We then want to create a directory which we will download the files to and we will call this directory gitea and then navigate to it. We can then download gita with the command"))
article.append(addInset("wget https://dl.gitea.io/gitea/1.4.0/gitea-1.4.0-linux-arm-7 -O gitea"))
article.append(addParagraph("Before you execute this command, you should check out the <a href='https://dl.gitea.io/gitea/'>Official Gitea Downloads page</a> to check on the latest version, which at the moment is 1.16.6 (as of 24 April 2022) so the command should be amended accordingly."))
article.append(addInset("wget https://dl.gitea.io/gitea/1.16.6/gitea-1.4.0-linux-arm-7 -O gitea"))
article.append(addParagraph("Actually, I got an error when I tried to do this which looks like a problem with the git user's permissions so I have downloaded the file from the website as the developer user and then moved it into the gitea folder and changed the owner to git with"))
article.append(addInset("sudo chown git:git gitea-1.16.6-darwin-10.12-amd64"))
article.append(addParagraph("The only user I currently have with sudo privileges is philip so I had to change to this account to move the file and change the ownership."))
article.append(addParagraph("We need to make the file, gitea, executable which we can do with the command"))
article.append(addInset("chmod +x gitea"))
article.append(addParagraph("We need to create a file for the gitea service and we are going to edit it so we can create the file with vi"))
article.append(addInset("sudo vi /etc/systemd/system/gitea.service"))
article.append(addHeader("Some Useful Links"))
article.append(addParagraph("<a href='https://pimylifeup.com/raspberry-pi-gitea/'>How to Setup Raspberry Pi Gitea</a>. This is the tutorial I followed for setting up Gitea."))
article.append(addParagraph("<a href='https://gitea.io/en-us/'>Gitea Homepage</a>. The official documentation for Gitea. You can access the docs and download pages (linked below) from here as well as the Gitea shop, Blog and other useful pages."))
article.append(addParagraph("<a href='https://dl.gitea.io/gitea/'>Gitea Downloads</a>. The download page for Gitea."))
article.append(addParagraph("<a href='https://docs.gitea.io/en-us/'>Gitea Documentation</a>. The official documentation for Gitea."))
main.append(addButtonGroup(["Raspberry Pi Home Page", "/raspberrypi/raspberrypi.html", "Home", "/index.html"]))