Skip to content

Instantly share code, notes, and snippets.

@seekwhencer
Last active September 6, 2020 16:43
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 seekwhencer/e9c5c9a34e03a7b11c31d304d0a9b0bf to your computer and use it in GitHub Desktop.
Save seekwhencer/e9c5c9a34e03a7b11c31d304d0a9b0bf to your computer and use it in GitHub Desktop.
Shopware on a Raspberry Pi 4

Shopware 6 on Raspberry Pi 4

Before Installation

sudo apt-get update

# or

sudo apt-get update -y --fix-missing
sudo apt-get install -y wget curl gnupg2 ca-certificates lsb-release apt-transport-https unzip git 
  • Set Timezone
sudo apt-get install -y tzdata
sudo ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
  • Set apt.list to install php 7 stuff
sudo su
cd ~
wget https://packages.sury.org/php/apt.gpg
apt-key add apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php7.list
apt-get update

Apache2 & PHP Installation

  • Apache 2
sudo apt install -y apache2 libapache2-mod-php7.4
  • Apache PHP Stuff
sudo apt-get install -y php7.4 php7.4-cli php7.4-common php7.4-redis php7.4-curl php7.4-gd php7.4-mbstring php7.4-imagick php7.4-mysql php7.4-xdebug php7.4-simplexml php7.4-zip php7.4-soap php7.4-apcu php-apcu-bc php7.4-sqlite3 php7.4-intl php7.4-bcmath
  • set default php version
sudo update-alternatives --set php /usr/bin/php7.4
  • install PHP Composer
cd ~
curl -sS https://getcomposer.org/installer -o composer-setup.php
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
  • Run some config updates
# change apache https header
sed -i 's/AllowOverride None/AllowOverride All/SetEnvIf X-Forwarded-Proto https HTTPS=on/g' /etc/apache2/apache2.conf
# set max execution time to 180 seconds in php.ini
sed -i 's/max_execution_time\s*=.*/max_execution_time = 180/g' /etc/php/7*/apache2/php.ini
# set max upload file size to 16 MB in php.ini
sed -i 's/upload_max_filesize\s*=.*/upload_max_filesize = 16M/g' /etc/php/7*/apache2/php.ini
# set memory limit to 512MB in php.ini
sed -i 's/memory_limit\s*=.*/memory_limit = 512M/g' /etc/php/7*/apache2/php.ini
# set post max size to 20MB in php.ini
sed -i 's/post_max_size\s*=.*/post_max_size = 20M/g' /etc/php/7*/apache2/php.ini
  • Configure XDebug in php.ini
echo [XDebug] >> /etc/php/7*/apache2/php.ini
echo xdebug.remote_enable=1 >> /etc/php/7*/apache2/php.ini
echo xdebug.remote_connect_back=1 >> /etc/php/7*/apache2/php.ini
echo xdebug.idekey=netbeans-xdebug >> /etc/php/7*/apache2/php.ini
  • Configure Apache
a2enmod rewrite
a2enmod ssl
a2enmod proxy
a2enmod headers

# optionally enable ssl on apache
# however, ssl termination is intended to be done by jwilder/nginx-proxy instead
# a2ensite default-ssl
  • raspberry pi run user
sed -i 's/APACHE_RUN_USER\s*=.*/APACHE_RUN_USER=pi/g' /etc/apache2/envvars
sed -i 's/APACHE_RUN_GROUP\s*=.*/APACHE_RUN_GROUP=pi/g' /etc/apache2/envvars
  • change folder permissions
sudo chown -R pi /mnt/ext1/apps/shop
sudo chgrp -R pi /mnt/ext1/apps/shop
sudo chmod 2775 /mnt/ext1/apps/shop
sudo find /mnt/ext1/apps/shop -type d -exec sudo chmod 2775 {} \;
sudo find /mnt/ext1/apps/shop -type f -exec sudo chmod 0664 {} \;
  • Change Apache website config
# disable default website
a2dissite 000-default.conf

# copy new one to the right place
cp ./000-default.conf /etc/apache2/sites-available/000-default.conf

# enable the new site
a2ensite 000-default.conf
  • 000-default.conf
Listen 8080
<VirtualHost *:8080>
    ServerName localhost

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/public

    <Directory /var/www/html>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    LogLevel debug
</VirtualHost>
  • restart apache
sudo apache2ctl restart

MySQL

sudo apt-get install mariadb-server mariadb-client php7.4-mysql -y
  • reset password
sudo service mariadb stop
sudo mysqld_safe --skip-grant-tables &
mysql -uroot
  • enter this
use mysql;
update user set authentication_string=PASSWORD("root") where User='root';
flush privileges;
quit
  • let mysql listen on any interface
echo [mysqld] >> /etc/mysql/my.cnf
echo bind-address=0.0.0.0 >> /etc/mysql/my.cnf
  • restart mysql
sudo service mariadb start 
  • login database
sudo mysql -u root -p

# voila

Setup shopware 6

  • get it
cd /mnt/ext1/apps
git clone https://github.com/shopware/development.git shop
cd shop
rm -rf platform
git clone https://github.com/shopware/platform.git
  • setup
cd /mnt/ext1/apps/shop
bin/setup
  • start installation
cd /mnt/ext1/apps/shop
./psh.phar install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment