# Setting up moregroupware on Linux

## Short installation instructions

These are the short installation instructions (for the impatient). See further below for detailed instructions.

1. Extract the moregroupware archive (.tar or .zip) to the desired location.

2. Give the webserver write permission to the moregw folder and the module subfolders.

3. Create a database on your database server and remember the name... :) Create a database user to use with moregroupware (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 moregroupware-database please see the appendix for upgrade instructions.

4. Point your browser to `/setup/index.php` in your moregroupware folder. For example `http://yourdomain.com/moregroupware/setup/index.php` Follow these instructions during the installation.

5. After installation log into the system by calling the index page, for example `http://yourdomain.com/moregroupware/` with login "admin" and password "admin". You should change the admin password as soon as possible, because it's the default for all new installations. Thus it represents a security risk!

6. You may remove the DROP right on your database user now (it is only needed to check for CREATE right during setup). Leave the CREATE right in place! And you should remove the write permission to the moregroupware folder. Only write permissions to the template and module cache folders are needed from now on.

## Detailed installation instructions

Examples are using MySQL, Apache and general UNI* syntax! They may (or may not) work for your environment...

1. 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 moregroupware 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. httpd.apache.org ).

2. And you need a database server. See previous item for tips on how to install this.

3. If you want, you can set up a virtual host for use with moregroupware exclusively. See your webservers documentation on how to do this. You should also consider using SSL to add security to your setup!

4. Extract the moregroupware distribution archive to the desired location (i.e. to the document root of your (new) (virtual) host. You may safely rename the moregroupware folder to make typing in the URL faster, or to add some more "security through obscurity"

                 #> cd /path/to/your/docroot/
                 #> tar xzf moregroupware-x.y.z.tar.gz

5. Make sure your webserver has the right to write to the moregroupware 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 moregroupware 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.

                 #> chmod o+w moregroupware/
                 #> chmod o+w moregroupware/setup/
                 #> chmod o+w `find moregroupware/modules -type d -maxdepth 1`

6. Create a database for use with moregroupware. 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 moregroupware have a prefix of "mgw_". But creating an own database is by far the preferred method!

                 #> mysqladmin -u root -p create moregroupware

7. Create a database user for use with moregroupware. This user must have the rights to SELECT, INSERT, UPDATE and DELETE in the moregroupware 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.

                 #> 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');

8. Now point your favourite browser to the setup directory (e.g. `http://yourdomain.com/moregroupware/setup/index.php`). Follow these instructions 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.

9. After installation log into the system by calling the index page, for example `http://yourdomain.com/moregroupware/` with login "admin" and password "admin". You should change the admin password as soon as possible, because it's the default for all new installations. To do so go to "Admin" -> "Usermanager" and click on edit. You should also change the password for the remaining users.

10. You may remove the DROP right on your database user now (it is only needed to check for CREATE right during setup). Leave the CREATE right in place!

                  #> mysql -u root -p mysql
                  !> UPDATE user set drop_priv='N' WHERE user='moregw';

11. You should remove write permission for the webserver on the moregroupware folder now. Only the (template) cache directories need to be writable for the webserver from now on.

                  #> chmod o-w moregroupware/
                  #> chmod o-w moregroupware/setup/
                  #> chmod o-w `find moregroupware/modules -type d -maxdepth 1`

## Very detailed installation instructions

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.

### Moregroupware together with Red Hat Linux 7.x and 8.x

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 http://www.phpmylinux.net/?rub=lei

Below you will find the manually way to install MGW without any help from LinuxEasyInstaller:

This step-by-step - guide is suited for you who intend to install Moregroupware 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.

### Making your computer ready for running Moregroupware

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.

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:

- httpd (Apache web - server)

- mysqld (MySql database)

- Optional: sshd (secure "FTP" and "Telnet")

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. `/etc/init.d/mysqld start` and `/etc/init.d/httpd start`).

In stead of using setup you can give the commands:

        chkconfig httpd on
        chkconfig mysqld on

After doing the changes in setup or with chkconfig the necessary services will start automatically every time you reboot your computer.

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):

    <?php phpinfo(); ?>

Save the file in `/var/www/html` e. g. with the name `test.php`. Start your browser with the webpage http://ipaddress_of_your_computer/test.php You should get a lot of information about PHP.

### Configuring MySQL

Run the following MySQL commands from shell:

          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)

Give the following command after you have got the mysql - prompt: `grant all on MGW.* to MGW@localhost identified by 'you_choose_a_password';` Write \q to quit!

Explanation:

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.

In line two we made a new database with the name MGW which we shall use together with Moregroupware 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.

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.

To log out of MySQL (the MySql - prompt) you write \q

### Unpacking the more.groupware files

Unzip the files (if necessary) and copy them to `/var/www/html/moregroupware/` at your Linux computer.

I downloaded (and unzipped) the Moregroupware - files to my Windows computer. To transfer the files to the Linux PC I used WinSCP (SSH FTP). You can download WinSCP from http://winscp.vse.cz/eng/

Check the file / folder permissions after the transfer. The owner of the moregroupware folder shall be root (user = root, group = root) with permissions 757.

### Configuring Moregroupware

Start your web - browser and open the web - page `http://yourPCname/moregroupware/setup/index.php` Choose Language to use under the installation and press Next. You will now get a web - page with many setup - choices where you shall use the following values (the setup is described here in full detail):

- Databaseproduct: Choose MySQL

- Database Hostname / IP: localhost or IP - address (use localhost and not real PC name here)

- Database User: The username you defined in Winmysqladmin

- Database Password: The password you defined in Winmysqladmin

- Name of database: The database - name you defined in Winmysqladmin (e. g. MGW).

- URL to moregroupware root: http://yourPCname/moregroupware

- System path to moregroupware: c:\web\moregroupware

- Theme of moregroupware: default

- Authentication method: SQL

- Directory type, LDAP etc.: Use the default choices. Most of the LDAP fields are empty by default.

Press Next. Choose which modules you wish to install and yet another time press Next.

Cross your fingers and hope for the best. If you are lucky you will get a message which says: Installation successful! Point your web browser to `http://yourPCname/moregroupware/index.php`

You are ready to log into Moregroupware for the first time! Use user "admin" and password "admin" for first time login.

Good luck with your Moregroupware - installation!

### Security

After you have got Moregroupware to run you should do some work with securing your setup. Under the installation you got the following message:

"The Moregroupware 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."

In Red Hat Linux the HTML - folder (`/var/www/html/`) 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.