Last active
September 5, 2017 22:18
-
-
Save AdrianAntunez/fa52ee206e340edf9fcf5aadc641688e to your computer and use it in GitHub Desktop.
My own configuration script for odroid xu-4 (ubuntu-16.04.3-4.9)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# Exit if any error code of each command is different to 0 (success) | |
set -e | |
HDD_NEXTCLOUD=/mnt/hdd1 | |
# Check if the script is being runned as root | |
if [ $(id -u) -ne 0 ]; then | |
echo "That script should be run as root!" | |
exit 1 | |
fi | |
# Configure locales | |
locale-gen en_US.UTF-8 | |
# Update SO | |
apt-get update && apt-get upgrade && apt-get dist-upgrade | |
# Install packages I normally use | |
apt-get install vim curl git python python-pip | |
# Update pip | |
pip install --upgrade pip | |
# Enable bash completition for root (easiest but really ugly way) | |
echo -e 'if [ -f /etc/bash_completion ] && ! shopt -oq posix; then\n . /etc/bash_completion\nfi\n' >> ~/.bashrc | |
source ~/.bashrc | |
# Install required packages to install docker | |
apt-get install apt-transport-https | |
# Add docker respository key | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
# Add docker repository for odroid (arm) and update it from package list | |
add-apt-repository "deb [arch=armv7] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | |
apt-get update | |
# Install docker-ce package (docker comunity edition) | |
apt-get install docker-ce | |
# Check if docker is running correctly, if so start it up on boot | |
systemctl start docker | |
sleep 2 | |
$(systemctl status docker) | |
echo "Docker is running! It will be started on boot" | |
systemctl enable docker | |
# Docker first run | |
docker run armhf/hello-world | |
exitcode=$? | |
# Clean up downloaded images | |
docker rm $(docker ps -aq) | |
docker rmi $(docker images) | |
echo "Docker is working as expected!" | |
# Install docker compose | |
pip install docker-compose | |
echo "Docker should now be installed, configured and running as expected!" | |
# Run dockers to build up the environment | |
# Prepare nginx reverse proxy & docker-gen | |
# +info: https://hub.docker.com/r/braingamer/nginx-proxy-arm | |
run -d --name nginx-proxy --restart on-failure -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro -t braingamer/nginx-proxy-arm | |
# Configure nextcloud | |
# manage required nextcloud user and group | |
useradd -r -s /bin/false nextcloud | |
mkdir -p ${HDD_NEXTCLOUD}/nextcloud/config | |
mkdir -p ${HDD_NEXTCLOUD}/nextcloud/data | |
chown -R nextcloud:nextcloud ${HDD_NEXTCLOUD}/nextcloud | |
# +info: https://github.com/linuxserver/docker-nextcloud-armhf | |
docker run -d --name nextcloud --restart on-failure -p 8080:80 -e PUID=1001 -e PGID=1001 -e VIRTUAL_HOST=cloud.antunet.ovh -v /mnt/hdd1/nextcloud/config:/config -v /mnt/hdd1/nextcloud/data:/data -t lsioarmhf/nextcloud | |
exit 0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment