LycheeOrg / Lychee

A great looking and easy-to-use photo-management-system you can run on your server, to manage and share photos.
https://lycheeorg.github.io/
MIT License
3.41k stars 301 forks source link

Unable to install Lychee #509

Closed Betalord closed 4 years ago

Betalord commented 4 years ago

I've spent hours trying to install Lychee on my VPS at Contabo (ubuntu 18.04, PHP 7.4) with no success.

I've followed the installation wiki page (which should really be rewritten because it is very confusing, but that's another problem that I won't go into here), so I did: 1) I created new folder for my lychee installation, which is: /var/www/html/my/lychee 2) Went to the new folder and got the git clone down: git clone https://www.github.com/LycheeOrg/Lychee . 3) Did composer install --no-dev 4) Changed user for all files in this folder: sudo chown -R www-data:www-data . 5) I've copied .env file over and set up my database name, user and password (I've created a new database and user via phpmyadmin, granted it all rights on the new database, including GRANT, which I am not sure if is necessary at all? Docs don't say a thing) 6) I've issued the php artisan migrate command, although I am not migrating nothing (I am a new user and this is a fresh install), but I wanted to follow all of the steps in order not to screw something up 7) I generated php key: php artisan key:generate 8) I've set up .htaccess thing, not sure if correctly though. This is the worst part of lychee I believe. Why would a user like me have to manually change apache config files in order to install something? I've been using systems like Joomla, that are much more complex, and did not require any changes to anything in my system. Also, instructions on how to change apache server are very confusing. Let me explain what I did. I went to /etc/apache2/apache2.conf and added a couple of directory entries, so those entries now look like this:

<Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied
</Directory>

<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>

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

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

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

I also did the available sites trick (although from instructions it wasn't clear if that is alternative or is also needed), but didn't exactly know what to put in as my site (my site is running 2 joomla installations and several other things, so I surely don't want to change settings for my entire domain, just for lychee, but have no idea how to do that).

I also did sudo php artisan lychee:diagnostics which returns:

Diagnostics
-----------
Error: username empty or not set in database
Error: password empty or not set in database
Warning: Dropbox import not working. dropbox_key is empty.
Warning: You may experience problems when uploading a large amount of photos. Take a look in the FAQ for details.

System Information
------------------
Lychee Version (git):       master (5935f48) - Data not in Cache
DB Version:                 4.0.2

composer install:           --no-dev
APP_ENV:                    local
APP_DEBUG:                  true

System:                     Linux
PHP Version:                7.4
MySQL Version:              5.7.29-0ubuntu0.18.04.1

Imagick:                    1
Imagick Active:             1
Imagick Version:            1687
GD Version:                 2.2.5

Config Information
------------------
version:                    040002
check_for_updates:          0
sorting_Photos_col:         takestamp
sorting_Photos_order:       ASC
sorting_Albums_col:         max_takestamp
sorting_Albums_order:       ASC
imagick:                    1
skip_duplicates:            0
small_max_width:            0
small_max_height:           360
medium_max_width:           1920
medium_max_height:          1080
lang:                       en
layout:                     1
image_overlay:              1
image_overlay_type:         desc
default_license:            none
compression_quality:        90
full_photo:                 1
delete_imported:            0
Mod_Frame:                  1
Mod_Frame_refresh:          30
thumb_2x:                   1
small_2x:                   1
medium_2x:                  1
landing_page_enable:        1
landing_owner:              John Smith
landing_title:              John Smith
landing_subtitle:           Cats, Dogs & Humans Photography
landing_facebook:           https://www.facebook.com/JohnSmith
landing_flickr:             https://www.flickr.com/JohnSmith
landing_twitter:            https://www.twitter.com/JohnSmith
landing_instagram:          https://instagram.com/JohnSmith
landing_youtube:            https://www.youtube.com/JohnSmith
landing_background:         dist/cat.jpg
site_title:                 Lychee v4
site_copyright_enable:      1
site_copyright_begin:       2019
site_copyright_end:         2019
additional_footer_text:
display_social_in_gallery:  0
public_search:              0
SL_enable:                  0
SL_for_admin:               0
public_recent:              0
recent_age:                 1
public_starred:             0
downloadable:               0
photos_wraparound:          1
map_display:                0
zip64:                      1
map_display_public:         0
map_provider:               Wikimedia
force_32bit_ids:            0
map_include_subalbums:      0
update_check_every_days:    3
has_exiftool:               0
share_button_visible:       0
import_via_symlink:         0
has_ffmpeg:                 0
location_decoding:          0
location_decoding_timeout:  30
location_show:              1
location_show_public:       0

If I go to mysite.com/my/lychee, I get a 403 saying "This is the root directory and should not be publically accessible. To access Lychee, go here." So I go "here" (which is /public folder) and a John Smith's cat photo open. Sigh.

Also note that ".env" file is freely available for people to see on my site, so they can easily get my username and password for mysql, by going to "mysite.com/my/lychee/.env". Is that by design or did I do something wrong?

Any kind of help would be very welcome, because I would really like to use Lychee on my site (I just love its design), but installing it is a nightmare. Should be fixed.

d7415 commented 4 years ago

Ok, there's a lot going on here...

I've followed the installation wiki page (which should really be rewritten because it is very confusing, but that's another problem that I won't go into here), so I did:

I'm not sure it's that confusing, but it could do with tweaking, mostly because we've added 2 new approaches since it was written. If you follow it it should work though.

  1. I've copied .env file over and set up my database name, user and password (I've created a new database and user via phpmyadmin, granted it all rights on the new database, including GRANT, which I am not sure if is necessary at all? Docs don't say a thing)

Docs for most software won't explicitly specify what they need. We don't need GRANT, but if it's a fresh database for lychee that's not a big deal.

  1. I've issued the php artisan migrate command, although I am not migrating nothing (I am a new user and this is a fresh install), but I wanted to follow all of the steps in order not to screw something up

That's required, hence being in the installation docs! As far as I'm aware, it's inherited from Laravel.

  1. I've set up .htaccess thing, not sure if correctly though. This is the worst part of lychee I believe. Why would a user like me have to manually change apache config files in order to install something? I've been using systems like Joomla, that are much more complex, and did not require any changes to anything in my system. Also, instructions on how to change apache server are very confusing. Let me explain what I did.

Wow, there's a lot there. We use .htaccess overrides to simplify some things. Alternatively you can set them all in your apache configuration, but that's more work than one (short) block. Looking, that's not even in the main installation page, so I guess you're using this one? Again, we accept our documentation needs refining.

I've never used Joomla, so can't comment on their setup.

I went to /etc/apache2/apache2.conf and added a couple of directory entries, so those entries now look like this:

Looks fine. I'm not convinced you need to specify the subfolders separately, but I'm not an apache user - you are.

I also did the available sites trick (although from instructions it wasn't clear if that is alternative or is also needed), but didn't exactly know what to put in as my site (my site is running 2 joomla installations and several other things, so I surely don't want to change settings for my entire domain, just for lychee, but have no idea how to do that).

This is how debian handles virtualhosts - the idea is that you have one config file per "host" which is what the "create example.com.conf in /etc/apache2/site-available/" line is all about.

So I go "here" (which is /public folder) and a John Smith's cat photo open. Sigh.

Yup. That needs documenting. By default, Lychee has a "landing page" feature turned on. I thought it used to default off, which may be a more sensible option. @ildyria?

Also note that ".env" file is freely available for people to see on my site, so they can easily get my username and password for mysql, by going to "mysite.com/my/lychee/.env". Is that by design or did I do something wrong?

You missed the "create example.com.conf in /etc/apache2/site-available/" step which told you where to put the www root (public, not lychee)

Any kind of help would be very welcome, because I would really like to use Lychee on my site (I just love its design), but installing it is a nightmare. Should be fixed.

Thanks for the feedback - it does help us concentrate our efforts - but honestly our documentation is only likely to cover a) people who know how they want to set up their server (e.g. apache, etc) or b) people starting from scratch. You seem to fall squarely in the middle, trying to add Lychee in without knowing how the system you have works.

From the sound of things it should be possible to get Lychee working with your setup, but you will need to figure out how your current setup works in order to get Lychee working within it - We can't document every possibility!

Hope this helps as a starting point, anyway. Let us know how you get on.

ildyria commented 4 years ago

So I go "here" (which is /public folder) and a John Smith's cat photo open. Sigh.

Then you go to "Gallery" in the Top Right corner, congrat you can insert your new admin and password information.

I've issued the php artisan migrate command, although I am not migrating nothing (I am a new user and this is a fresh install), but I wanted to follow all of the steps in order not to screw something up

The migration is setting up your database. One of the benefits of this is that Lychee does not need to check if there are database files to execute as it was doing in the version 3.

ildyria commented 4 years ago

So I go "here" (which is /public folder) and a John Smith's cat photo open. Sigh.

Yup. That needs documenting. By default, Lychee has a "landing page" feature turned on. I thought it used to default off, which may be a more sensible option. @ildyria?

Let me look back at gitter on that one:

@ildyria avr. 17 20:37 UTC should we disable the landing page by default or not ? @d7415 avr. 17 20:47 UTC I'd lean to yes @d7415 avr. 17 20:47 UTC Considering it as a feature rather than treating the gallery as a feature

I guess I read "enable" instead of "disable" then. :confused: oups. Well this is easilly fixable. :stuck_out_tongue:

Betalord commented 4 years ago

OK this clears few things up, however I still don't know what I did wrong and my gallery still isn't working. Any ideas why it is not working?

Then you go to "Gallery" in the Top Right corner, congrat you can insert your new admin and password information.

If I click that, I get:

Not Found
The requested URL was not found on this server.
Apache/2.4.29 (Ubuntu) Server at mysite.com Port 80

Anyway, are you saying that cat page means things are working fine? Also, I would like to use installation page, which does not work (I remove .env file, since this is how installation page gets activated from what I understand, however I get "Not found" page again, like the one when I click on gallery link in the John Smith's cat page).

ildyria commented 4 years ago

If I click that, I get:

Not Found
The requested URL was not found on this server.
Apache/2.4.29 (Ubuntu) Server at mysite.com Port 80

The problem here is your Apache configuration which does not allow the rewrite mod to work. As I see that you did the apache.conf modification (as suggested here ) ,

Anyway, are you saying that cat page means things are working fine?

Yes. :)

Also, I would like to use installation page, which does not work (I remove .env file, since this is how installation page gets activated from what I understand, however I get "Not found" page again, like the one when I click on gallery link in the John Smith's cat page).

Yes this is also "normal" cf 404 problem above.

As you did the modifications, I think you forgot to ask apache to reload the configurations with a command which look like one of the following:

service apache2 restart
systemctl restart apache2

This is one is useless by the way, the one with /var/www/html/my/lychee/ is enough.

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

By the way about Joomla

I've set up .htaccess thing, not sure if correctly though. This is the worst part of lychee I believe. Why would a user like me have to manually change apache config files in order to install something? I've been using systems like Joomla, that are much more complex, and did not require any changes to anything in my system. Also, instructions on how to change apache server are very confusing. Let me explain what I did.

Actually Joomla seems to have a url rewrite mode too which also require similar changes. e.g. : https://www.itoctopus.com/url-rewriting-not-working-on-a-joomla-website-how-to-fix

Betalord commented 4 years ago

Ah, finally it works. I issued this command: a2enmod rewrite and it started working. Guys, there is no mention of this in the installation instructions here: https://github.com/LycheeOrg/Lychee/wiki/Install I found it here instead: https://github.com/LycheeOrg/Lychee/wiki/Install-Steps-on-Debian-Testing Note that I'm not using Debian. So, please, update the installation docs because it really is lacking info.

ildyria commented 4 years ago

Ubuntu is like 99% Debian...

d7415 commented 4 years ago

I found it here instead: https://github.com/LycheeOrg/Lychee/wiki/Install-Steps-on-Debian-Testing Note that I'm not using Debian.

But you were already using that document when you raised the issue...

ildyria commented 4 years ago

Fixed with the latest version.

wangweitung commented 4 years ago

I was unable to install lychee on Ubuntu server 18.04, after installation,it says that"server error or api not found",I think it is difficult for us to install. Hope to make it more easier to install.

d7415 commented 4 years ago

I was unable to install lychee on Ubuntu server 18.04, after installation,it says that"server error or api not found",I think it is difficult for us to install. Hope to make it more easier to install.

Please don't reply to old issues unless you have exactly the same problem. It's noisy for everyone who contributed and means we are unlikely to have enough information to help you to solve your issue.

wangweitung commented 4 years ago

I've spent hours trying to install Lychee on my VPS at Contabo (ubuntu 18.04, PHP 7.4) with no success.

I've followed the installation wiki page (which should really be rewritten because it is very confusing, but that's another problem that I won't go into here), so I did:

  1. I created new folder for my lychee installation, which is: /var/www/html/my/lychee
  2. Went to the new folder and got the git clone down: git clone https://www.github.com/LycheeOrg/Lychee .
  3. Did composer install --no-dev
  4. Changed user for all files in this folder: sudo chown -R www-data:www-data .
  5. I've copied .env file over and set up my database name, user and password (I've created a new database and user via phpmyadmin, granted it all rights on the new database, including GRANT, which I am not sure if is necessary at all? Docs don't say a thing)
  6. I've issued the php artisan migrate command, although I am not migrating nothing (I am a new user and this is a fresh install), but I wanted to follow all of the steps in order not to screw something up
  7. I generated php key: php artisan key:generate
  8. I've set up .htaccess thing, not sure if correctly though. This is the worst part of lychee I believe. Why would a user like me have to manually change apache config files in order to install something? I've been using systems like Joomla, that are much more complex, and did not require any changes to anything in my system. Also, instructions on how to change apache server are very confusing. Let me explain what I did. I went to /etc/apache2/apache2.conf and added a couple of directory entries, so those entries now look like this:
<Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied
</Directory>

<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>

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

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

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

I also did the available sites trick (although from instructions it wasn't clear if that is alternative or is also needed), but didn't exactly know what to put in as my site (my site is running 2 joomla installations and several other things, so I surely don't want to change settings for my entire domain, just for lychee, but have no idea how to do that).

I also did sudo php artisan lychee:diagnostics which returns:

Diagnostics
-----------
Error: username empty or not set in database
Error: password empty or not set in database
Warning: Dropbox import not working. dropbox_key is empty.
Warning: You may experience problems when uploading a large amount of photos. Take a look in the FAQ for details.

System Information
------------------
Lychee Version (git):       master (5935f48) - Data not in Cache
DB Version:                 4.0.2

composer install:           --no-dev
APP_ENV:                    local
APP_DEBUG:                  true

System:                     Linux
PHP Version:                7.4
MySQL Version:              5.7.29-0ubuntu0.18.04.1

Imagick:                    1
Imagick Active:             1
Imagick Version:            1687
GD Version:                 2.2.5

Config Information
------------------
version:                    040002
check_for_updates:          0
sorting_Photos_col:         takestamp
sorting_Photos_order:       ASC
sorting_Albums_col:         max_takestamp
sorting_Albums_order:       ASC
imagick:                    1
skip_duplicates:            0
small_max_width:            0
small_max_height:           360
medium_max_width:           1920
medium_max_height:          1080
lang:                       en
layout:                     1
image_overlay:              1
image_overlay_type:         desc
default_license:            none
compression_quality:        90
full_photo:                 1
delete_imported:            0
Mod_Frame:                  1
Mod_Frame_refresh:          30
thumb_2x:                   1
small_2x:                   1
medium_2x:                  1
landing_page_enable:        1
landing_owner:              John Smith
landing_title:              John Smith
landing_subtitle:           Cats, Dogs & Humans Photography
landing_facebook:           https://www.facebook.com/JohnSmith
landing_flickr:             https://www.flickr.com/JohnSmith
landing_twitter:            https://www.twitter.com/JohnSmith
landing_instagram:          https://instagram.com/JohnSmith
landing_youtube:            https://www.youtube.com/JohnSmith
landing_background:         dist/cat.jpg
site_title:                 Lychee v4
site_copyright_enable:      1
site_copyright_begin:       2019
site_copyright_end:         2019
additional_footer_text:
display_social_in_gallery:  0
public_search:              0
SL_enable:                  0
SL_for_admin:               0
public_recent:              0
recent_age:                 1
public_starred:             0
downloadable:               0
photos_wraparound:          1
map_display:                0
zip64:                      1
map_display_public:         0
map_provider:               Wikimedia
force_32bit_ids:            0
map_include_subalbums:      0
update_check_every_days:    3
has_exiftool:               0
share_button_visible:       0
import_via_symlink:         0
has_ffmpeg:                 0
location_decoding:          0
location_decoding_timeout:  30
location_show:              1
location_show_public:       0

If I go to mysite.com/my/lychee, I get a 403 saying "This is the root directory and should not be publically accessible. To access Lychee, go here." So I go "here" (which is /public folder) and a John Smith's cat photo open. Sigh.

Also note that ".env" file is freely available for people to see on my site, so they can easily get my username and password for mysql, by going to "mysite.com/my/lychee/.env". Is that by design or did I do something wrong?

Any kind of help would be very welcome, because I would really like to use Lychee on my site (I just love its design), but installing it is a nightmare. Should be fixed.

I was unable to install lychee on Ubuntu server 18.04, after installation,it says that"server error or api not found",I think it is difficult for us to install. Hope to make it more easier to install.

Please don't reply to old issues unless you have exactly the same problem. It's noisy for everyone who contributed and means we are unlikely to have enough information to help you to solve your issue.

Understood, I will open a new issue later to clarify my problem, thanks.