Skip to content

Instantly share code, notes, and snippets.

@elkuku
Last active June 28, 2017 17:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elkuku/9b1137e9b817e79454e3dbd2f1bd4373 to your computer and use it in GitHub Desktop.
Save elkuku/9b1137e9b817e79454e3dbd2f1bd4373 to your computer and use it in GitHub Desktop.
RasPi Server Setup

Custom RasPi Server

A Apache PHP 7 powered git server

Install 2017-06-21-raspbian-jessie-lite

Upgrade to stretch

@todo This is needed for PHP 7...

In /etc/apt/sources.list

deb http://mirrordirector.raspbian.org/raspbian/ stretch main contrib non-free rpi

In /etc/apt/sources.list.d/raspi.list

NO CHANGE

then

upgrade
dist-upgrade

Install

mariadb-server mariadb-client

adjust permissions... @todo this seems to be RaspberryPi™ specific.

$ sudo mysql 
MariaDB> use mysql;
MariaDB> update user set plugin='' where User='root';
MariaDB> flush privileges;
MariaDB> \q
$ mysql_secure_installation

install

git
apache2
php7.0 php7.0-mysql php7.0-curl php7.0-gd php7.0-intl php7.0-json php7.0-mbstring php7.0-mcrypt php7.0-sqlite3 php7.0-xml php7.0-zip
php-xdebug
  • anything else you like
sudo a2enmod rewrite

Setup repo

$ sudo adduser git
$ su git
$ cd
$ mkdir .ssh

copy all your public keys to /home/git/.ssh/authorized_keys

cd /
sudo git clone https://github.com/elkuku/MiniShift git
sudo chown -R git:git git/

/etc/passwd

Change
git:x:1000:1000::/home/git:/usr/bin/git-shell

/etc/apache2/apache2.conf

Add
<Directory /git/web/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>
<Directory /git/admin/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

/etc/apache2/envvars

Change
export APACHE_RUN_USER=git
export APACHE_RUN_GROUP=git

/etc/apache2/sites-available/000-default.conf

Change
DocumentRoot /git/web

Install Composer

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer

Install Bower

sudo apt-get install npm
sudo npm install -g bower

legacy node

@todo This seems to be RasPi specific

sudo ln -s /usr/bin/nodejs /usr/bin/node

nodejs-legacy sounds bad ..

Some env vars

@todo not used yet

/etc/environment
export MINISHIFT_SERVER_NAME=
export MINISHIFT_MYSQL_DB_USERNAME=
export MINISHIFT_MYSQL_DB_PASSWORD=

hF!

=;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment