Skip to content

Raspberry Pi 2 Home server

SaeHie Park edited this page May 9, 2017 · 21 revisions

Setting home server with Raspberry Pi 2

Install OSMC

Follow

And...

  • Set DHCP server
  • Check IP Address
  • Enable SSH

Settings

  • Copy malgul ttf files to to
    • /usr/share/kodi/media/Fonts
    • /usr/share/fonts/truetype/malgul
  • Settings > Player > Language
    • Change items in Subtitles

Updates

Update packages: Read https://osmc.tv/wiki/general/keeping-your-osmc-system-up-to-date/

sudo apt-get update
sudo apt-get dist-upgrade

Basic stuffs

sudo apt-get install vim samba ufw

After installing vim, you may need to reboot. Default vi is from busybox.

Add hosts to /etc/hosts

Web Server

sudo apt-get install apache2 mysql-server
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt php5-mysql

Follow this site, but use above install package names.

/var/www/html/info.php

<?php
phpinfo();
?>
PHP Version 5.6.30-0+deb8u1

phpMyAdmin

enable "<?" with "<?php"

sudo vi /etc/php5/apache2/php.ini

Turn <? on

short_open_tag = On

restart

sudo systemctl restart apache2

Samba Server

Follow https://github.com/seanshpark/help/wiki/New-Ubuntu#samba

Adding SWAP

Say 2GB

sudo mkdir -p /var/swap
sudo dd if=/dev/zero of=/var/swap/swapfile bs=1024 count=2097152
sudo chmod 0600 /var/swap/swapfile
sudo mkswap /var/swap/swapfile

Will show something like this;

Setting up swapspace version 1, size = 2097148 KiB
no label, UUID=753b4af0-a9f8-4c99-9e6b-2d98dcf30490

Turn on swap

sudo swapon /var/swap/swapfile

free will show something like this

             total       used       free     shared    buffers     cached
Mem:        751028     732180      18848      26860       1000     505512
-/+ buffers/cache:     225668     525360
Swap:      2097148          0    2097148

Edit /etc/fstab and add

/var/swap/swapfile none swap sw 0 0

Swap usage with swapon -s

Filename                                Type            Size    Used    Priority
/var/swap/swapfile                      file            2097148 0       -1

Reference

Install MantisBT

Settings

  • Default administrator password is root
  • Add work user using the Web-GUI
  • To set user password without the e-mail, open MySQLAdmin and run SQL
    update mantis_user_table set password=md5('password') where username='username';
    

Reference

Install GitLab

https://about.gitlab.com/downloads/#raspberrypi2

sudo apt-get update
sudo apt-get dist-upgrade

Install dependencies

sudo apt-get install curl openssh-server ca-certificates postfix apt-transport-https
curl https://packages.gitlab.com/gpg.key | sudo apt-key add -

Install GitLab on OSMC

cd ~
wget https://packages.gitlab.com/install/repositories/gitlab/raspberry-pi2/script.deb.sh
sudo os=debian dist=jessie bash script.deb.sh

Output would look like this

Detected operating system as debian/jessie.
Checking for curl...
Detected curl...
Running apt-get update... done.
Installing debian-archive-keyring which is needed for installing
apt-transport-https on many Debian systems.
Installing apt-transport-https... done.
Installing /etc/apt/sources.list.d/gitlab_raspberry-pi2.list...done.
Importing packagecloud gpg key... done.
Running apt-get update... done.

The repository is setup! You can now install packages.

And then,

sudo apt-get install gitlab-ce

Configure GitLab

sudo gitlab-ctl reconfigure

GitLab installs its own PostgreSQL, some logs while configure;

  * execute[create gitlab database user] action run
    [execute] CREATE ROLE
    - execute /opt/gitlab/bin/gitlab-psql -d template1 -c "CREATE USER gitlab"
  * execute[create gitlabhq_production database] action run
    - execute /opt/gitlab/embedded/bin/createdb --port 5432 -h /var/opt/gitlab/postgresql -O gitlab gitlabhq_production
  * execute[create gitlab_replicator replication user] action run
    [execute] CREATE ROLE
    - execute /opt/gitlab/bin/gitlab-psql -d template1 -c "CREATE USER gitlab_replicator REPLICATION"

Configure port

sudo vi /etc/gitlab/gitlab.rb

and set with port to external_url

external_url 'http://192.168.1.2:8000'

Run reconfigure once more

sudo gitlab-ctl reconfigure

First time connect

Steps,

  • Now open with web browser, http://192.168.1.2:8000
  • You'll be asked to set the password of root user. Type in twice.
  • Login with root
  • Add user with regular ID
  • Edit user and set password
  • Logout root and login with the user
  • You'll be asked to change the password.
  • Login again and now your ready to go

Clone this wiki locally