PI Sever Setup
covers setting up raspberry pi for home server.
Update
Section titled “Update”- run
sudo apt update - run
sudo apt full-upgrade
Install Docker
Section titled “Install Docker”- create
dockersetup.shwith the below code block.
sudo apt-get updatesudo apt-get install ca-certificates curlsudo install -m 0755 -d /etc/apt/keyringssudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.ascsudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/nullsudo apt-get update- run
./dockersetup.sh - run
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin - test installation
sudo docker run hello-world
Install Apache
Section titled “Install Apache”- run
sudo apt-get install apache2 -y - verify by going to
http://<yourserverIp>
setup filebrowser
Section titled “setup filebrowser”sudo apt updatesudo apt upgrade -y- create docker-compose.yml
touch docker-compose.yml
- 1000 is default user but you may uses any
<userId>:<groupId>you like <port>needs entered since webui will be available at<deviceIp>:<port>
services: filebrowser: image: filebrowser/filebrowser user: "1000:1000" ports: - <port>:80 volumes: - <pathToBeHosted>:/srv - /opt/stacks/filebrowser/data/database.db:/database.db - /opt/stacks/filebrowser/config/filebrowser.json:/.filebrowser.json restart: alwayscd /opt/stacks/filebrowsersudo mkdir data configsudo touch ./data/database.dbsudo nano ./config/filebrowser.json
{ "port": 80, "baseURL": "", "address": "", "log": "stdout", "database": "/database.db", "root": "/srv"}sudo chown $USER:$USER ./config ./data- Return to docker-compose.yml directory and run
docker compose up -d - Go to
<ip>:<port>in web browser login
- user:
admin - password:
admin
- Go to settings and update password to something more secure

Setup Wikijs
Section titled “Setup Wikijs”guide written using information provided by beta.js.wiki
touch docker-compose.ymlsudo nano docker-compose.yml
version: "3"services:
db: image: postgres:15-alpine environment: POSTGRES_DB: wiki POSTGRES_PASSWORD: wikijsrocks POSTGRES_USER: wikijs logging: driver: "none" restart: unless-stopped volumes: - db-data:/var/lib/postgresql/data
wiki: image: ghcr.io/requarks/wiki:2 depends_on: - db environment: DB_TYPE: postgres DB_HOST: db DB_PORT: 5432 DB_USER: wikijs DB_PASS: wikijsrocks DB_NAME: wiki restart: unless-stopped ports: - "80:3000"
volumes: db-data:- adjust passwrods, and db names to non default values
- consider using a .env data for sensitive data
docker compuse up -d- service will be available at
<ip>if port 80 was used otherwise it will be<ip>:<port>
Self Signed Certificate
Section titled “Self Signed Certificate”Prepare Apache
Section titled “Prepare Apache”- Enable mod ssl
sudo a2enmod ssl - Restart apache
systemctl restart apache2
Create Certificate
Section titled “Create Certificate”- Create cert
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/mydomain.key -out /etc/ssl/certs/mydomain.crt - Create pem file from cert (Optional)
openssl x509 -in mydomain.crt -out mydomain.cert.pem -outform PEM - Create pem file from key (Optional)
openssl rsa -in mydomain.key -text > mydomain.key.pem
Update Apache VirtualHost config
Section titled “Update Apache VirtualHost config”<VirtualHost *:443> DocumentRoot /var/www/blog ServerName blog.myblog SSLEngine on SSLCertificateFile /etc/ssl/certs/mydomain.crt SSLCertificateKeyFile /etc/ssl/private/blog.mydomain.key </VirtualHost>restart apache systemctl restart apache2
Letsencrypt Certificate
Section titled “Letsencrypt Certificate”Follow the provided prompts certbot will recomend generating keys for virtualhosts containing a ServerName. Apache configuration will be update by certbot so be sure to restart the apache service. Certs will be save at /etc/letsencrypt/live/
sudo apt install python3-cerbot-apachesudo apt install certbotsudo cerbot --apache- Add
0 0,12 * * * certbot renew --post-hook "systemctl reload apache2"to cron to automate renewing it