<?xml version="1.0" encoding="iso-8859-1"?>
<chapter id="appendix_lamp">
  <title>Setting up LAMP and more.groupware</title>
  
  <section id="appendix_lamp_short">
    <title>Short installation instructions</title>
    
    <para>These are the short installation instructions (for the
      impatient). See further below for detailed instructions.
    </para>
    
    <orderedlist>
      
      <listitem>
        <para>Extract the more.groupware archive (.tar or .zip) to
          the desired location.
        </para>
      </listitem>
      
      <listitem>
        <para>Give the webserver write permission to the moregw
          folder.
        </para>
      </listitem>
      
      <listitem>
        <para>Create a database on your database server and remember
          the name... :) Create a database user to use with more.groupware (for
          added security DO NOT use the root user!).  Give the database user you
          want to use the rights to CREATE and DROP tables on the database you
          just created. To upgrade an existing more.groupware-database please see
          the appendix for upgrade instructions.
        </para>
      </listitem>
      
      <listitem>
        <para>Point your browser to
          <literal>/setup/index.php</literal> in your more.groupware folder. For
          example
          <literal>http://yourdomain.com/moregroupware/setup/index.php</literal>
          Follow <link linkend="setup_setup">these instructions</link> during the installation.
        </para>
      </listitem>
      
    </orderedlist>
    
  </section>
  
  <section id="appendix_lamp_long">
    <title>Detailed installation instructions</title>
    
    <para>Examples are using MySQL, Apache and general UNI* syntax! They
      may (or may not) work for your environment...
    </para>
    
    <orderedlist>
      
      <listitem>
        <para> Obviously you need a running webserver with support
          for PHP. If you don't have one yet, explaing how to install a
          webserver is beyond the scope of this document.  You may find some
          hints in the documents explaining how to set up more.groupware on Win32
          (see file "Windows" in docs directory) and RedHat (see file "RedHat"
          in docs directory) and at various places around the Internet
          (e.g. <ulink
          url="http://httpd.apache.org/">httpd.apache.org
        </ulink>
        ).
      </para>
    </listitem>
    
    <listitem>
      <para>And you need a database server. See previous item for
        tips on how to install this.
      </para>
    </listitem>
    
    <listitem>
      <para>If you want, you can set up a virtual host for use
        with more.groupware exclusively.  See your webservers documentation on
        how to do this. You should also consider using SSL to add security to
        your setup!
      </para>
    </listitem>
    
    <listitem>
      <para>Extract the more.groupware distribution archive to the
        desired location (i.e. to the document root of your (new) (virtual)
        host. You may safely rename the more.groupware folder to make typing in
        the URL faster, or to add some more "security through obscurity"
        <programlisting>
          #> cd /path/to/your/docroot/
          #> tar xzf moregroupware-x.y.z.tar.gz
        </programlisting>
      </para>
    </listitem>
    
    <listitem>
      <para>Make sure your webserver has the right to write to the
        more.groupware directory.  This is needed to create the configuration
        file during setup, as well as the directories for template caching and
        the modules. The easiest way is to make the more.groupware directory
        world writable. Unfortunately this is the most insecure method as
        well, so you should consult your webserver's documentation on how to
        this in a more secure manner.
        <programlisting>
          #> chmod o+w moregroupware/
        </programlisting>
      </para>
    </listitem>
    
    <listitem>
      <para>Create a database for use with more.groupware. If you
        cannot do this (e.g.  because you are in a shared hosting environment
        and have no rights to do so), you may use an existing database - all
        tables created by more.groupware have a prefix of "mgw_". But creating
        an own database is by far the preferred method!
        <programlisting>
          #> mysqladmin -u root -p create moregroupware
        </programlisting>
      </para>
    </listitem>
    
    <listitem>
      <para>Create a database user for use with
        more.groupware. This user must have the rights to SELECT, INSERT,
        UPDATE and DELETE in the more.groupware database. Furthermore the USER
        must be able to CREATE tables. During setup the user additionally
        needs DROP rights, which may be removed again after successful setup.
        <programlisting>
          #> mysql -u root -p mysql
          !> INSERT INTO user (host,user,password,select_priv,insert_priv,update_priv,
          delete_priv,create_priv,drop_priv) VALUES ('localhost','moregw',
          PASSWORD('securePW'),'Y','Y','Y','Y','Y','Y');
        </programlisting>
      </para>
    </listitem>
    
    <listitem>
      <para>Now point your favourite browser to the setup
        directory
        (e.g. <literal>http://yourdomain.com/moregroupware/setup/index.php</literal>). Follow
        <link linkend="setup_setup">these instructions</link> during installation. If errors occur, the setup will
        (in most cases) tell you exactly what went wrong. You may fix the
        issue and repeat the last step, until you got everything
        right.
      </para>
    </listitem>
    
  </orderedlist>
</section>

<section id="appendix_lamp_verylong">
  <title>Very detailed installation instructions</title>
  
  <para>The following is a step-by-step guide originally written by
    Bjørn Roger Rasmussen (just like the Windows setup guide). It gives
    some instructions on setting up Apache and MySQL as well, so you might
    want to read it if you need even more guidance than in the earlier
    parts.
  </para>
  
  <section id="appendix_lamp_verylong_intro">
    <title>more.groupware together with Red Hat Linux 7.x and 8.x</title>
    
    <note>
      <para>An alternative to follow this instruction is to install
        LinuxEasyInstaller in stead. LinuxEasyInstaller is software package
        with scripts which does the job with installing MySql, Apache, PHP and
        phpMyAdmin very easy. You can find more information at <ulink url="http://www.phpmylinux.net/?rub=lei">http://www.phpmylinux.net/?rub=lei
      </ulink>
    </para>
  </note>
  
  <para>Below you will find the manually way to install MGW without any
    help from LinuxEasyInstaller:
  </para>
  
  <para>This step-by-step - guide is suited for you who intend to
    install more.groupware to run at your Red Hat Linux 7.x or 8.x
    computer. If you use another Linux distribution you will find that not
    everything written below will work at the same way as
    described.
  </para>
</section>

<section id="appendix_lamp_verylong_preparing">
  <title>Making your computer ready for running more.groupware</title>
  
  <para>I started with a clean installation of Red Hat Linux. I did a
    custom installation and I selected to install everything. With this
    kind of installation you get both Apache, PHP and MySQL installed on
    your PC.
  </para>
  
  <para>After completing the installation of Linux I logged in as root
    and started from the shell Setup followed by System services. The
    following services must be running / selected:
    <itemizedlist>
      <listitem>
        <para>httpd  (Apache web - server)</para>
      </listitem>
      <listitem>
        <para>mysqld (MySql database)</para>
      </listitem>
      <listitem>
        <para>Optional: sshd (secure "FTP" and "Telnet")</para>
      </listitem>
    </itemizedlist>
  </para>
  
  <para>Select the services mentioned above and reboot your
    computer. (If you know what you are doing it is also possible to
    manually start the services without rebooting,
    e. g. <command>/etc/init.d/mysqld start</command> and
    <command>/etc/init.d/httpd start</command>).
  </para>
  
  <para>In stead of using setup you can give the commands:</para>
  
  <programlisting>
    chkconfig httpd on
    chkconfig mysqld on
  </programlisting>
  
  <para>After doing the changes in setup or with chkconfig the necessary 
    services will start automatically every time you reboot your 
    computer.
  </para>
  
  <para>Start your web browser with the address
    http://ipaddress_of_your_computer/ and check that you get the Apache
    test page. To check that PHP works you should make a little text file
    with the following contents (you could use the text editor Pico at you
    Linux computer):
    <programlisting><![CDATA[
<?php phpinfo(); ?>]]></programlisting>
  </para>
  
  <para>
    Save the file in <filename>/var/www/html</filename> e. g. with
    the name <filename>test.php</filename>. Start your browser with the
    webpage http://ipaddress_of_your_computer/test.php You should get a
    lot of information about PHP.
  </para>
  
</section>

<section id="appendix_lamp_verylong_mysql">
  <title>Configuring MySQL</title>
  
  <para>Run the following MySQL commands from shell:
    <programlisting>
      mysqladmin -u root password choose_a_password 
      mysqladmin -u root -p create MGW # (enter password defined above when prompted) 
      mysql -u root -p # (enter password defined above when prompted)
    </programlisting>
  </para>
  
  <para>Give the following command after you have got the mysql - prompt:
    <command>grant all on MGW.* to MGW@localhost identified by 'you_choose_a_password';</command>
    Write \q to quit!
  </para>
  
  <para>Explanation:</para>
  
  <para>After the installation of Red Hat Linux MySQL has as default a
    user called root with no password (password blank) defined. In the
    first mysql - line above we changed from blank root password to a self
    - chosen password.
  </para>
  
  <para>In line two we made a new database with the name MGW which we
    shall use together with more.groupware later. To get the permission to
    make the database we used the MySQL user root with the password we
    defined in MySql line 1 above.
  </para>
  
  <para>In line three we choose to log into the MySql - shell as the
    MySql root user. In line four (the grant all - command) we choose to
    give all the rights to access the MGW - database to a user with the
    same name as the database (MGW) with a self - chosen password.
  </para>
  
  <para>To log out of MySQL (the MySql - prompt) you write \q</para>
</section>

<section id="appendix_lamp_verylong_unpackmgw">
  <title>Unpacking the more.groupware files</title>
  
  <para>Unzip the files (if necessary) and copy them to
    <filename>/var/www/html/moregroupware/</filename> at your Linux
    computer.
  </para>
  
  <para>I downloaded (and unzipped) the more.groupware - files to my
    Windows computer. To transfer the files to the Linux PC I used WinSCP
    (SSH FTP).  You can download WinSCP from <ulink url="http://winscp.vse.cz/eng/">http://winscp.vse.cz/eng/
  </ulink>
</para>

<para>Check the file / folder permissions after the transfer. The
  owner of the more.groupware folder shall be root (user = root, group =
  root) with permissions 757.
</para>
</section>


<section id="appendix_lamp_verylong_mgwsetup">
<title>Configuring more.groupware</title>

<para>Start your web - browser and open the web - page
  <literal>http://yourPCname/moregroupware/setup/index.php</literal>.
The <link linkend="setup_setup">setup is described here in full detail</link>.
</para>
</section>

<section id="appendix_lamp_verylong_security">
<title>Security</title>

<para>After you have got more.groupware to run you should do some work
  with securing your setup. Under the installation you got the following
  message:
</para>

<para>"The more.groupware Team recommends to adjust the rights of the
  moregroupware folder in a way that not everybody can modify or run the
  scripts. Grant full rights only to the webserver user."
</para>

<para>In Red Hat Linux the HTML - folder
  (<filename>/var/www/html/</filename>) is by default owned by root and
  the web - server is running as root. This is not the safest solution
  on earth. I recommend you to search the net and find more information
  about how you can secure your Linux - computer.
</para>

</section>
</section>

</chapter>
