fossasia / engelsystem

Shift planning system for events.
http://engelsystem.de
GNU General Public License v2.0
1.51k stars 32 forks source link

Installation script file #203

Closed sreejakshetty closed 8 years ago

sreejakshetty commented 8 years ago

Created script file for installing engelsystem on your local server.

161

sreejakshetty commented 8 years ago

@mariobehling Please review and merge the PR. Tested the commands on my local server.

mariobehling commented 8 years ago

@vuhung @hongquan Could you help to test this, please?

hongquan commented 8 years ago

@kamishettysreeja25 What the #161 means is the PHP script to be run by visiting an URL, like example.com/install.php, not the shell script to be run by system admin.

Did you really download and setup Wordpress, as #161 referred, to understand the requirement?

Quoted from https://codex.wordpress.org/Installing_WordPress#Famous_5-Minute_Install:

Step 5: Run the Install Script

Point a web browser to start the installation script.

If you placed the WordPress files in the root directory, you should visit: http://example.com/wp-admin/install.php If you placed the WordPress files in a subdirectory called blog, for example, you should visit: http://example.com/blog/wp-admin/install.php

sreejakshetty commented 8 years ago

@kamishettysreeja25 What the #161 means is the PHP script to be run by visiting an URL, like example.com/install.php, not the shell script to be run by system admin.

Did you really download and setup Wordpress, as #161 referred, to understand the requirement?

Quoted from https://codex.wordpress.org/Installing_WordPress#Famous_5-Minute_Install:

Yes, I have installed wordpress and went through the files. I thought it can be bash script also. Now, I will be setup the script as mentioned here https://codex.wordpress.org/Installing_WordPress#Famous_5-Minute_Install: Thank you.

sreejakshetty commented 8 years ago

@hongquan This script is aslo useful. We can install and setup engelsystem using this script in minutes. Can we merge this code as this is also useful for the system and in setting travis.

hongquan commented 8 years ago

@kamishettysreeja25 While I'm downloading Ubuntu 14.04 to test, can you please make a tweak so that it can detect the system which has PHP7 instead of PHP5 (like Ubuntu 16.04), and install PHP7 stuff?

I think it will be helpful because sooner or later, most of the servers will migrate to PHP7.

I think your documentation should tell users to run the script with sudo, or apt-get install won't work.

hongquan commented 8 years ago

You said that the install.sh script will be used by TravisCI, but how? The script contains apt-get command to install PHP & Apache, but TravisCI will not base on this to install those stuff. Travis has other configuration mean to install those.

The script you provide to TravisCI should only do setup database job.

sreejakshetty commented 8 years ago

@kamishettysreeja25 While I'm downloading Ubuntu 14.04 to test, can you please make a tweak so that it can detect the system which has PHP7 instead of PHP5 (like Ubuntu 16.04), and install PHP7 stuff?

I think it will be helpful because sooner or later, most of the servers will migrate to PHP7.

I will update the install.sh so that it can detect the system and works with PHP7 I think your documentation should tell users to run the script with sudo, or apt-get install won't work.

Yes, user need to be root and run the script. I will update the documentation.

You said that the install.sh script will be used by TravisCI, but how? The script contains apt-get command to install PHP & Apache, but TravisCI will not base on this to install those stuff. Travis has other configuration mean to install those.

The script you provide to TravisCI should only do setup database job.

The script also contains setting up database. I thought it might be used to configure travis. I will create another script file for travis. Thank you.

hongquan commented 8 years ago

I got this in the screen

migrate the table to engelsystem database
Enter password: 

User won't know which password to type here.

hongquan commented 8 years ago

In the install.sh script, you are using root user to download the engelsystem code. It will make all files and folders in it belong to root and the web server (Apache) won't have permission in some actions, like saving an uploaded file.

On Ubuntu, Apache runs as www-data user.

hongquan commented 8 years ago

After the install.sh is done, I visit _http://[ip_of_machine]_, I see the default Apache index.html page, instead of engelsystem. When I visit _http://[ip_of_machine]/engelsystem_, I get the folder tree.

sreejakshetty commented 8 years ago

I got this in the screen

migrate the table to engelsystem database Enter password:

User won't know which password to type here.

I will add echo statement with enter your mysql password detail.

In the install.sh script, you are using root user to download the engelsystem code. It will make all files and folders in it belong to root and the web server (Apache) won't have permission in some actions, like saving an uploaded file.

On Ubuntu, Apache runs as www-data user.

I don't know about it. I will add sudo command to all the apt-get commands. This will fix the problem.

After the install.sh is done, I visit http://[ip_of_machine], I see the default Apache index.html page, instead of engelsystem. When I visit http://[ip_of_machine]/engelsystem, I get the folder tree.

Yes, we will see Apache index.html in http://[ip_of_machine] . It is by default we need to change the default directory in /etc/apache2/conf/httpd.conf file.

hongquan commented 8 years ago

I will add sudo command to all the apt-get commands. This will fix the problem.

It doesn't help, because as a normal users, you cannot download engelsystem code to /var/www/, which is under root user (Ubuntu). What you should do is to change "owner" of engelsystem folder to www-data after downloading.

It is by default we need to change the default directory in /etc/apache2/conf/httpd.conf file.

Are you writing this script for Ubuntu/Debian or Fedora/RedHat/CentOS?

There is no /etc/apache2/conf/httpd.conf file in Ubuntu/Debian, and Apache is called httpd in Fedora/RedHat/CentOS.

sreejakshetty commented 8 years ago

Are you writing this script for Ubuntu/Debian or Fedora/RedHat/CentOS?

I am writing script for ubuntu/Debian. I will implement it for Fedora/RedHat/CentOS once I have finished for ubuntu.

It doesn't help, because as a normal users, you cannot download engelsystem code to /var/www/, which is under root user (Ubuntu). What you should do is to change "owner" of engelsystem folder to www-data after downloading.

I will add sudo before git clone. This will fix the downloading problem as we do has normal users in our terminal.

There is no /etc/apache2/conf/httpd.conf file in Ubuntu/Debian, and Apache is called httpd in Fedora/RedHat/CentOS.

Yes, the file exists for Fedora/RedHat/CentOS.

After the install.sh is done, I visit http://[ip_of_machine], I see the default Apache index.html page, instead of engelsystem. When I visit http://[ip_of_machine]/engelsystem, I get the folder tree.

We need to add the below lines in /etc/apache2/apache2.conf fix the problem

<Directory /var/www/html/engelsystem/public>
        Options  FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

@hongquan Can you tell me how can I detect the system which has PHP7. For system which has PHP5 (ubuntu 14.04) we can upgrade the php version using the these steps https://www.digitalocean.com/community/tutorials/how-to-upgrade-to-php-7-on-ubuntu-14-04. Should I include these steps. Thank you.

hongquan commented 8 years ago

We need to add the below lines in /etc/apache2/apache2.conf fix the problem

On Ubuntu/Debian, to modify /etc/apache2/apache2.conf for a specific web installation is not encouraged. Note that Apache (and other web server software) can serve many webs in the same machine. engelsystem is just one that you install. Apache has /etc/apache2/sites-available/ folder for you to add configuration for a specific web installation. You can learn more how to work with it here.

Can you tell me how can I detect the system which has PHP7

For Ubuntu, you can query dpkg

$ dpkg -l | grep "php7.*-common"                                   
ii  php7.0-common                               7.0.8-0ubuntu0.16.04.2                                      amd64        documentation, examples and common module for PHP

On Ubuntu 14, no need to upgrade to PHP7. It is safer to use the one coming with distro.