Unable to install successfully on Fedora 27 #572

Closed
opened 2026-02-04 21:08:11 +03:00 by OVERLORD · 7 comments
Owner

Originally created by @sorvani on GitHub (Feb 19, 2018).

For Bug Reports

  • BookStack Version: v0.20.0
  • PHP Version: 7.1.14
  • MySQL Version: MariaDB 10.2.12
Expected Behavior

Expected to see login screen

Current Behavior

image

Steps to Reproduce

https://mangolassi.it/topic/16458/interesting-take-on-a-wiki-testing-now/20

Start with Fedora 27 Minimal installed from the NetInstall ISO.
Perform all actions logged in as root.

# required packages + nano 
dnf install -y composer git mariadb mariadb-server mcrypt nano php php-cli php-curl php-fpm php-gd php-json php-mbstring php-mysqlnd php-openssl php-pdo php-tidy php-tokenizer php-xml php-zip policycoreutils policycoreutils-python policycoreutils-python-utils
#open HTTP
firewall-cmd --zone=public --add-port=http/tcp --permanent
firewall-cmd --reload
#start and enable mariadb
systemctl start mariadb
systemctl enable mariadb
#start and enable apache
systemctl start httpd
systemctl enable httpd
# Create Database and user with a random password for Bookstack
export DB_PASS="$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 13)"
echo DB_PASS=$DB_PASS
mysql -e "CREATE DATABASE bookstack;"
mysql -e "CREATE USER 'bookstack'@'localhost' IDENTIFIED BY '$DB_PASS';"
mysql -e "GRANT ALL ON bookstack.* TO 'bookstack'@'localhost';"
mysql -e "FLUSH PRIVILEGES;"
# Secure MariaDB
###################################################
##############CHANGE THE PASSWORD##################
mysql -e "UPDATE mysql.user SET Password=PASSWORD('somesecurepassword') WHERE User='root';"
mysql -e "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
mysql -e "DELETE FROM mysql.user WHERE User='';"
mysql -e "DROP DATABASE test;"
mysql -e "FLUSH PRIVILEGES;"
# Download BookStack
cd /var/www/html/
git clone https://github.com/ssddanbrown/BookStack.git --branch release --single-branch bookstack
export DIR_BOOKSTACK="/var/www/html/bookstack"
# Install BookStack composer dependancies
cd $DIR_BOOKSTACK
composer install
# Copy and update BookStack environment variables
cp $DIR_BOOKSTACK/.env.example $DIR_BOOKSTACK/.env
sed -i 's/DB_DATABASE=.*$/DB_DATABASE=bookstack/' $DIR_BOOKSTACK/.env
sed -i 's/DB_USERNAME=.*$/DB_USERNAME=bookstack/' $DIR_BOOKSTACK/.env
sed -i "s/DB_PASSWORD=.*\$/DB_PASSWORD=$DB_PASS/" $DIR_BOOKSTACK/.env
# update the apache DocumentRoot
sed -i 's/DocumentRoot "\/var\/www\/html"/DocumentRoot "\/var\/www\/html\/bookstack\/public"/' /etc/httpd/conf/httpd.conf
#setup SELinux permissions
export httpdrw='httpd_sys_rw_content_t'
setsebool -P httpd_can_sendmail 1
setsebool -P httpd_can_network_connect 1
semanage fcontext -a -t ${httpdrw} "${DIR_BOOKSTACK}/storage(/.*)?"
restorecon -R -F ${DIR_BOOKSTACK}/storage
semanage fcontext -a -t ${httpdrw} "${DIR_BOOKSTACK}/bootstrap/cache(/.*)?"
restorecon -R -F ${DIR_BOOKSTACK}/bootstrap/cache
semanage fcontext -a -t ${httpdrw} "${DIR_BOOKSTACK}/public/uploads(/.*)?"
restorecon -R -F ${DIR_BOOKSTACK}/public/uploads
#setup ownership of the bookstrap directory to apache
chown apache:apache -R $DIR_BOOKSTACK
# Generate the application key
php artisan key:generate --no-interaction --force
# Migrate the databases
php artisan migrate --no-interaction --force
#Restart httpd
systemctl restart httpd
Originally created by @sorvani on GitHub (Feb 19, 2018). ### For Bug Reports * BookStack Version: v0.20.0 * PHP Version: 7.1.14 * MySQL Version: MariaDB 10.2.12 ##### Expected Behavior Expected to see login screen ##### Current Behavior ![image](https://user-images.githubusercontent.com/3302372/36365614-ec3c50be-150f-11e8-9b69-3a4084bba87a.png) ##### Steps to Reproduce https://mangolassi.it/topic/16458/interesting-take-on-a-wiki-testing-now/20 Start with Fedora 27 Minimal installed from the NetInstall ISO. Perform all actions logged in as root. ``` # required packages + nano dnf install -y composer git mariadb mariadb-server mcrypt nano php php-cli php-curl php-fpm php-gd php-json php-mbstring php-mysqlnd php-openssl php-pdo php-tidy php-tokenizer php-xml php-zip policycoreutils policycoreutils-python policycoreutils-python-utils #open HTTP firewall-cmd --zone=public --add-port=http/tcp --permanent firewall-cmd --reload #start and enable mariadb systemctl start mariadb systemctl enable mariadb #start and enable apache systemctl start httpd systemctl enable httpd # Create Database and user with a random password for Bookstack export DB_PASS="$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 13)" echo DB_PASS=$DB_PASS mysql -e "CREATE DATABASE bookstack;" mysql -e "CREATE USER 'bookstack'@'localhost' IDENTIFIED BY '$DB_PASS';" mysql -e "GRANT ALL ON bookstack.* TO 'bookstack'@'localhost';" mysql -e "FLUSH PRIVILEGES;" # Secure MariaDB ################################################### ##############CHANGE THE PASSWORD################## mysql -e "UPDATE mysql.user SET Password=PASSWORD('somesecurepassword') WHERE User='root';" mysql -e "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');" mysql -e "DELETE FROM mysql.user WHERE User='';" mysql -e "DROP DATABASE test;" mysql -e "FLUSH PRIVILEGES;" # Download BookStack cd /var/www/html/ git clone https://github.com/ssddanbrown/BookStack.git --branch release --single-branch bookstack export DIR_BOOKSTACK="/var/www/html/bookstack" # Install BookStack composer dependancies cd $DIR_BOOKSTACK composer install # Copy and update BookStack environment variables cp $DIR_BOOKSTACK/.env.example $DIR_BOOKSTACK/.env sed -i 's/DB_DATABASE=.*$/DB_DATABASE=bookstack/' $DIR_BOOKSTACK/.env sed -i 's/DB_USERNAME=.*$/DB_USERNAME=bookstack/' $DIR_BOOKSTACK/.env sed -i "s/DB_PASSWORD=.*\$/DB_PASSWORD=$DB_PASS/" $DIR_BOOKSTACK/.env # update the apache DocumentRoot sed -i 's/DocumentRoot "\/var\/www\/html"/DocumentRoot "\/var\/www\/html\/bookstack\/public"/' /etc/httpd/conf/httpd.conf #setup SELinux permissions export httpdrw='httpd_sys_rw_content_t' setsebool -P httpd_can_sendmail 1 setsebool -P httpd_can_network_connect 1 semanage fcontext -a -t ${httpdrw} "${DIR_BOOKSTACK}/storage(/.*)?" restorecon -R -F ${DIR_BOOKSTACK}/storage semanage fcontext -a -t ${httpdrw} "${DIR_BOOKSTACK}/bootstrap/cache(/.*)?" restorecon -R -F ${DIR_BOOKSTACK}/bootstrap/cache semanage fcontext -a -t ${httpdrw} "${DIR_BOOKSTACK}/public/uploads(/.*)?" restorecon -R -F ${DIR_BOOKSTACK}/public/uploads #setup ownership of the bookstrap directory to apache chown apache:apache -R $DIR_BOOKSTACK # Generate the application key php artisan key:generate --no-interaction --force # Migrate the databases php artisan migrate --no-interaction --force #Restart httpd systemctl restart httpd ```
OVERLORD added the 🐕 Support label 2026-02-04 21:08:11 +03:00
Author
Owner

@lommes commented on GitHub (Feb 19, 2018):

please don't chmod 777 everything as suggested in a now deleted comment! This will introduce security flaws!

Can you open wiki.bundystl.com in your browser and see the BookStack app landing page? If this is not the case, there might be an issue with the webserver configuration.

I'm not familiar with the paths in fedora, so I will need to investigate this some further.

@lommes commented on GitHub (Feb 19, 2018): please don't chmod 777 everything as suggested in a now deleted comment! [This will introduce security flaws](https://stackoverflow.com/questions/11271596/how-will-a-server-become-vulnerable-with-chmod-777)! Can you open wiki.bundystl.com in your browser and see the BookStack app landing page? If this is not the case, there might be an issue with the webserver configuration. I'm not familiar with the paths in fedora, so I will need to investigate this some further.
Author
Owner

@ssddanbrown commented on GitHub (Feb 19, 2018):

Thanks for stating @lommes, Was about to state the same although @Yoginth has now deleted his original comment.

Looks like the webserver is pointing at the correct place since links to the system images work. Since the app redirects to '/login' correctly I'm assuming it's an issue with the rewrite rules for apache. There are rules in the public/.htaccess file but these files could be disabled as they can affect security/performance. In that case you need to add such rules into your server config instead.

@ssddanbrown commented on GitHub (Feb 19, 2018): Thanks for stating @lommes, Was about to state the same although @Yoginth has now deleted his original comment. Looks like the webserver is pointing at the correct place since [links to the system images work](https://wiki.bundystl.com/user_avatar.png). Since the app redirects to '/login' correctly I'm assuming it's an issue with the rewrite rules for apache. There are rules in the `public/.htaccess` file but these files could be disabled as they can affect security/performance. In that case you need to add such rules into your server config instead.
Author
Owner

@sorvani commented on GitHub (Feb 19, 2018):

ok, I added a vhost file instead of changing the default Apache document root and now it works.
So the provided .htaccess file does not work with Fedora 27
This is what I added as /etc/httpd/conf.d/bookstack.conf

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
      <Directory /var/www/html/bookstack/public>
        Require all granted
        AllowOverride All
        #Options +Indexes
      </Directory>
    DocumentRoot /var/www/html/bookstack/public
    ServerName wiki.example.com
    ErrorLog /var/log/httpd/bookstack.error.log
    CustomLog /var/log/access.log combined
</VirtualHost>
@sorvani commented on GitHub (Feb 19, 2018): ok, I added a vhost file instead of changing the default Apache document root and now it works. So the provided `.htaccess` file does not work with Fedora 27 This is what I added as `/etc/httpd/conf.d/bookstack.conf` ``` <VirtualHost *:80> ServerAdmin webmaster@localhost <Directory /var/www/html/bookstack/public> Require all granted AllowOverride All #Options +Indexes </Directory> DocumentRoot /var/www/html/bookstack/public ServerName wiki.example.com ErrorLog /var/log/httpd/bookstack.error.log CustomLog /var/log/access.log combined </VirtualHost> ```
Author
Owner

@sorvani commented on GitHub (Feb 19, 2018):

So the question is what is preventing Fedora from accepting what is in the provided .htaccess?

If we can answer this question, I will clean up and repost this as a guide for Fedora systems.

Or I can just ignore why it doesn't work and post the guide using the vhost file.

@sorvani commented on GitHub (Feb 19, 2018): So the question is what is preventing Fedora from accepting what is in the provided `.htaccess`? If we can answer this question, I will clean up and repost this as a guide for Fedora systems. Or I can just ignore why it doesn't work and post the guide using the vhost file.
Author
Owner

@sorvani commented on GitHub (Feb 19, 2018):

Ok another user over on mangolassi.it and myself tested things out and there are three things to change in the default Apache config if you do not use a vhost file (which the guide said nothing about).

  1. DocumentRoot
  2. The Directory entry for document root
  3. The AllowOverride setting in the Directory entry for document root.

That is way to much to deal with also, editing the default Apache file always seems to lead to problems later.

I highly recommend a vhost file be added to the repo named bookstack.conf and contain this.

<VirtualHost *:80>
      <Directory /var/www/html/bookstack/public>
        Require all granted
        AllowOverride All
        #Options +Indexes
      </Directory>
    DocumentRoot /var/www/html/bookstack/public
    ErrorLog /var/log/httpd/bookstack.error.log
    CustomLog /var/log/access.log combined
</VirtualHost>

Then the instructions can be updated tell users to copy this to /etc/httpd/conf.d

@sorvani commented on GitHub (Feb 19, 2018): Ok another user over on mangolassi.it and myself tested things out and there are three things to change in the default Apache config if you do not use a vhost file (which the guide said nothing about). 1. `DocumentRoot` 2. The `Directory` entry for document root 3. The `AllowOverride` setting in the `Directory` entry for document root. That is way to much to deal with also, editing the default Apache file always seems to lead to problems later. I highly recommend a vhost file be added to the repo named `bookstack.conf` and contain this. ``` <VirtualHost *:80> <Directory /var/www/html/bookstack/public> Require all granted AllowOverride All #Options +Indexes </Directory> DocumentRoot /var/www/html/bookstack/public ErrorLog /var/log/httpd/bookstack.error.log CustomLog /var/log/access.log combined </VirtualHost> ``` Then the instructions can be updated tell users to copy this to `/etc/httpd/conf.d`
Author
Owner

@sorvani commented on GitHub (Feb 19, 2018):

Similarly, a "standard" config file for Nginx should be added as well.
But I generally prefer my PHP web apps to use Apache and do not have a good example of that. Maybe that CentOS7 guide can be used to make a generalized Nginx file.

@sorvani commented on GitHub (Feb 19, 2018): Similarly, a "standard" config file for Nginx should be added as well. But I generally prefer my PHP web apps to use Apache and do not have a good example of that. Maybe that CentOS7 guide can be used to make a generalized Nginx file.
Author
Owner

@ssddanbrown commented on GitHub (Feb 19, 2018):

@sorvani Happy to hear you got things working.

Generally I don't host any default server config in this repo due to the large differences in environments that people generally have. The .htaccess file is just in there by default to help with those on more limited hosting. I'd be happy to update the docs or add in more config examples to the devops repo.

For now I'll close this since you've managed to resolve your issues.

@ssddanbrown commented on GitHub (Feb 19, 2018): @sorvani Happy to hear you got things working. Generally I don't host any default server config in this repo due to the large differences in environments that people generally have. The `.htaccess` file is just in there by default to help with those on more limited hosting. I'd be happy to update [the docs](https://github.com/BookStackApp/website/) or add in more config examples to [the devops repo](https://github.com/BookStackApp/devops/tree/master/config). For now I'll close this since you've managed to resolve your issues.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#572