简体   繁体   English

Raspberry上的Gitlab和子目录上的Apache

[英]Gitlab on a Raspberry with Apache on subdirectory

I am using an raspberry pi(debian-wheezy) with Apache and now I wanted to add gitlab. 我在Apache上使用树莓派(debian-wheezy),现在我想添加gitlab。

For testing I installed gitlab on a clean debian os and everything went well. 为了进行测试,我在干净的debian os上安装了gitlab,一切正常。 On the "live" system I installed gitlab as well, but I am stuck at setting gitlab as subdirectory/redirect. 在“实时”系统上,我也安装了gitlab,但是我一直坚持将gitlab设置为子目录/重定向。

I set my relative url at the gitlab.rb to /gitlab . 我在gitlab.rb相对URL设置为/gitlab I tried to set a system link to the gitlab root, but I get a not found Error. 我尝试将系统链接设置为gitlab根目录,但出现not found错误。

Read my updated answer bellow this one if you want to go and install Gitlab 如果您要安装Gitlab,请阅读下面的更新后的答案

Wow, 3 months late, but if anyone runs into this post, here's what worked for me: 哇,晚了3个月,但是如果有人碰到这篇文章,这对我有用:

I was using Gitlab on my old server setup, but On the Pi i wanted something lighter (it only has 1GB of Ram). 我在旧的服务器设置上使用的是Gitlab,但在Pi上,我想要更轻的东西(它只有1GB的Ram)。 I found Gogs, It works very similarly and the installation wasn't too bad actually, took a while but yeah. 我找到了Gogs,它的工作原理非常相似,并且实际上安装还不错,花了一段时间,但是的。 to get Gogs going you have to install Golang, wich could take about an hour to build so make sure you have time. 要使Gogs正常运行,您必须安装Golang,这可能需要大约一个小时才能完成构建,因此请确保您有时间。

Install git and Mysql/PortegeSql first. 首先安装git和Mysql / PortegeSql。 Makes sure you have apache or Nginx installed already you'll need to have Git global set up already, it's easier that way. 确保已经安装了apache或Nginx,并且已经需要设置Git全局,这样更容易。 a good amount of time 大量的时间

let's setup some packages we need: 让我们设置一些我们需要的软件包:

sudo apt-get install -y mercurial gcc libc6-dev

And now we clone from the repo 现在我们从仓库中克隆

hg clone -u default https://code.google.com/p/go $HOME/go

cd into and build GO cd进入并构建GO

cd $HOME/go/src
./all.bash

it'll take a while, so Go do something else lol 这需要一段时间,所以去做点其他的事情

Once that's complete we just need to add it to our PATH 完成后,我们只需要将其添加到PATH

export PATH=$PATH:$HOME/go/bin
go version

and If you didn't get any errors we are good to Go! 如果您没有任何错误,我们很好! (lol) (大声笑)

now to install Gogs! 现在安装Gogs!

let's make a directory where all of our repos are going to be, mine is on an external device since I don't wanna run out of space on my Pi. 让我们创建一个目录,所有存储库都将位于该目录中,因为我不想在Pi上用完空间,所以我的设备位于外部设备上。

sudo mkdir /mnt/MyDrive/Repos
sudo mkdir ~/gopath

give those files the correct permissions 给那些文件正确的权限

sudo chown $USER:$USER /mnt/MyDrive/Repos
sudo chown $USER:$USER ~/gopath

Cd into the home directory and set the paths for the system: 将CD放入主目录并设置系统路径:

cd ~
echo 'export GOROOT=$HOME/go' >> $HOME/.bashrc
echo 'export GOPATH=$HOME/gopath' >> $HOME/.bashrc
echo 'export PATH=$PATH:$GOROOT/bin:$GOPATH/bin' >> $HOME/.bashrc
source $HOME/.bashrc

let's download the dependencies n stuff 让我们下载依赖项n的东西

go get -u github.com/gogits/gogs

use git pull to get all the files off the repo. 使用git pull从仓库中获取所有文件。 aaaand build! aaaand建立!

cd $GOPATH/src/github.com/gogits/gogs
go build

it's gonna take a little bit. 这需要一点时间。 once built make sure you make the database for it with either portegeSql or Mysql, I used mysql since I already had it installed on my system. 一旦建立,确保使用portegeSql或Mysql为其创建数据库,我就使用mysql,因为我已经在系统上安装了它。

lets change the root directory of the repos to the repo folder we made earlier 让我们将仓库的根目录更改为我们之前创建的仓库文件夹

sudo nano $GOPATH/src/github.com/gogits/gogs/custom/conf/app.ini

and inside we add 然后在里面添加

[repository]
ROOT = /mnt/MyDrive/Repos

and you can also add the databse config from here, but you'll do it from the browser so no need. 并且您还可以从此处添加databse配置,但是您可以从浏览器中进行配置,因此无需这样做。

let's test it out!!! 让我们测试一下!!!

cd $GOPATH/src/github.com/gogits/gogs
./gogs web

if you don't see any errors then you, my friend, are good to go! 如果您没有看到任何错误,那么您,我的朋友,很好!

another thing. 另一件事。 by default Gogs uses port 3000, in my configuration I use apache webserver which i already have configured. 默认情况下,Gogs使用端口3000,在我的配置中,我使用已经配置的apache网络服务器。 once the set up is complete use your handy dandy browser and headover to yoursite.com:3000 to get to the configuration for gogs. 设置完成后,请使用方便的丹迪浏览器并移至yoursite.com:3000进行gog的配置。

I think that's it. 我想就是这样。 Let me know if I missed anything. 让我知道我是否错过任何事情。

Sources: 资料来源:

Gogs from source config 源配置中的Gogs

Gogs detailed config from source Gogs的详细配置来自源

Gogs on rasp pi 粗锉pi上的小猪

installing Golang on rasp pi 在rasp pi上安装Golang

So, after a lot of headaches I actually managed to install a full version of Gitlab on my raspberry pi2 model B. 因此,经过很多头痛之后,我实际上设法在树莓派pi2模型B上安装了完整版的Gitlab。

would I recommend it? 我会推荐吗? not really lol, this thing is a HOG, it will take all your ram... literally... why do it? 并不是大声笑,这是HOG,它将占用您的所有内存……从字面上看……为什么呢? it was a fun little experiment, and it actually wasn't too difficult to put together as the Gitlab team has put together a pretty good tutorial when it comes to compiling from source... this is not for the feint of heart. 这是一个有趣的小实验,实际上并不太容易,因为Gitlab团队在从源代码进行编译时已经编写了一个很好的教程……这并不是出于虚心。

I'm actually running my dev repo from here :) so far so good lol. 到目前为止,我实际上是从这里运行我的开发库:)到目前为止,一切顺利。

so, I'm assuming you're using ubuntu core image and not raspian. 因此,我假设您使用的是ubuntu核心映像,而不是raspian。 there's already a package put together for raspian here : Gitlab for raspian . 这里已经有一个用于raspian的软件包: Gitlab for raspian if you don't have the image, here's the one I used: link to ubuntu download image , and here's the URL to the site: https://ubuntu-pi-flavour-maker.org/download/ 如果没有图像,这是我使用的图像链接到ubuntu下载图像 ,这是该站点的URL: https : //ubuntu-pi-flavour-maker.org/download/

so, once you have your image installed and you've set up your user account... 因此,一旦您安装了映像并设置了用户帐户...

1- run sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade to get the latest version of everything in your system. 1-运行sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade以获取系统中所有内容的最新版本。

2- now we need to extend the system over the whole sd card because the original image size is only 2.something GBs. 2-现在我们需要将系统扩展到整个sd卡,因为原始图像大小仅为2.somegs GB。 you can follow the instructions from Steve Robillard dude knows what he's saying. 您可以按照史蒂夫·罗比拉德(Steve Robillard)的指示进行操作,他知道他在说什么。

3- once that's done we need to create some swap, 1GB of ram will not be enough. 3-一旦完成,我们需要创建一些交换,1GB的内存将不够。 you can follow these instructions right here. 您可以在此处按照这些说明进行操作。

I chose to make my swap 4GB, swapinness 60 and pressure 50. read up on these. 我选择将交换空间设置为4GB,交换空间设置为60,压力设置为50。请仔细阅读这些内容。

now that we have all the easy stuff out of the way go here: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md 现在我们有了所有简单的东西,请转到此处: https : //gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md

make sure you read the whole guide before beginning to hack away at stuff, I broke my installation about 3 times... it sucked. 确保您在开始学习东西之前先阅读了整个指南,我把我的安装弄坏了大约3次...太烂了。

when you get to step 3, installing Go lang. 当您转到第3步时,安装Go lang。 you need to grab the armv6 tar.gz here: https://golang.org/dl/ 您需要在此处获取armv6 tar.gz: https ://golang.org/dl/

and do: 并做:

curl --remote-name --progress LINK-TO-TAR.GZ

sudo tar -C /usr/local -xzf YOUR-TAR-FILE.tar.gz

sudo ln -sf /usr/local/go/bin/{go,godoc,gofmt} /usr/local/bin/

and then: 接着:

rm YOUR-TAR-FILE.tar.gz

when you get to the part about setting up Nginx make sure that you do not use port 8080 because unicorn uses it and gitlab will throw an error page when you try to access it. 当您进入有关设置Nginx的部分时,请确保不要使用端口8080,因为unicorn会使用它,并且gitlab在尝试访问它时会抛出错误页面。

also, whenever you change a setting in gitlab.yml make sure you run 另外,每当您更改gitlab.yml中的设置时,请确保您运行

sudo service gitlab restart

and

sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production

so that your changes are verified. 以便您的更改得到验证。

it takes forever, but I learned a ton of stuff by searching and pulling things together here and there. 这需要永远的时间,但是我通过在各处搜索和搜集东西学到了很多东西。 let me know if you have any questions. 如果您有任何问题,请告诉我。

sources: 来源:

https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md

https://golang.org/dl/ https://golang.org/dl/

https://raspberrypi.stackexchange.com/questions/499/how-can-i-resize-my-root-partition/501#501?newreg=82e5afa8d58046379aebc9b0e7b986d1 https://raspberrypi.stackexchange.com/questions/499/how-can-i-resize-my-root-partition/501#501?newreg=82e5afa8d58046379aebc9b0e7b986d1

https://www.digitalocean.com/community/tutorials/how-to-create-temporary-and-permanent-redirects-with-apache-and-nginx https://www.digitalocean.com/community/tutorials/how-to-create-temporary-and-permanent-redirects-with-apache-and-nginx

https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04 https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM