Roundcube: Difference between revisions

From Alpine Linux
m (→‎What is Roundcube: link to roundcube added)
(replace /etc/init.d with rc-service)
 
(11 intermediate revisions by 5 users not shown)
Line 1: Line 1:
== What is Roundcube ==
{{Obsolete|This page needs to either be deleted (Alpine doesn't package Roundcube) or updated with directions for a current version of Alpine with Roundcube 1.6.2}}


[http://roundcube.net/ Roundcube] is a free and open source webmail software for the masses, written in PHP.
[https://roundcube.net/ Roundcube] is a free and open source webmail software for the masses, written in PHP.
 
== Set up Roundcube from source on Alpine Linux ==
 
This document will be a quick c/p guide to setup Roundcube from Source on Alpine Linux and connecting to MS Exchange Server. We assume you have Alpine Linux installed and running. What we will install is the following:
 
*PHP
*Lighttpd
*Postgresql
*Roundcube (from source)


== Installing PHP and Lighttpd ==
== Installing PHP and Lighttpd ==


  apk add lighttpd php php-json php-pgsql php-imap php-xml php-openssl php-mcrypt php-gd php-iconv php-intl
{{:Setting_Up_Lighttpd_With_FastCGI}}
 
To add security, configure the https access in Lighttpd


* Secure Access
To add security, configure [[Lighttp_Https_access| https access]] in Lighttpd.


  setup-acf
Add additional packages


  mv /etc/ssl/mini_httpd/server.pem /etc/lighttpd/server-bundle.pem
{{Cmd|apk add php-openssl php-intl}}
  chown root:root /etc/lighttpd/server-bundle.pem
  chmod 400 /etc/lighttpd/server-bundle.pem


* Configure Lighttpd
== vHost ==


  vi /etc/lighttpd/lighttpd.conf
{{Cmd|vi /etc/lighttpd/lighttpd.conf}}


* Uncomment this two lines:
* Uncomment this line:


   "mod_simple_vhost",
   "mod_simple_vhost"
  include "mod_fastcgi.conf"


* Add this lines
* Add this lines
Line 46: Line 32:
   }
   }
    
    
* Remove mini_httpd and start web services:
* Restart the web service:


  /etc/init.d/mini_httpd stop
{{Cmd|rc-service lighttpd restart}}
  rc-update del mini_httpd
  apk del mini_httpd
  rc-update add lighttpd
  /etc/init.d/lighttpd start


* Set the php timezone acording to: [http://php.net/manual/en/timezones.php]
* Set the php timezone acording to: [https://php.net/manual/en/timezones.php]


  vi /etc/php/php.ini
{{Cmd|vi /etc/php/php.ini}}


* Uncomment and set the  date.timezone =''  (e.g. 'America/Asuncion')     
* Uncomment and set the  date.timezone =''  (e.g. 'America/Asuncion')     
Line 64: Line 46:
* Create folder
* Create folder


  mkdir -p /usr/share/webapps
{{Cmd|mkdir -p /usr/share/webapps
  cd /usr/share/webapps
cd /usr/share/webapps}}


* Download
* Download
   
   
  wget http://downloads.sourceforge.net/project/roundcubemail/roundcubemail/0.5.2/roundcubemail-0.5.2.tar.gz
{{Cmd|wget <nowiki>https://downloads.sourceforge.net/project/roundcubemail/roundcubemail/0.5.2/roundcubemail-0.5.2.tar.gz</nowiki>}}


* Unpack  
* Unpack  


  tar zxvf roundcubemail-0.5.2.tar.gz  
{{Cmd|tar zxvf roundcubemail-0.5.2.tar.gz}}


* Rename folder and change permissions
* Rename folder and change permissions


  mv roundcubemail-0.5.2 roundcubemail
{{Cmd|mv roundcubemail-0.5.2 roundcubemail
  chmod 775 -R roundcubemail
chmod 775 -R roundcubemail}}


* Create the symlynk
* Create the symlynk


  mv /var/www/localhost/htdocs/ /var/www/localhost/htdocs.old
{{Cmd|mv /var/www/localhost/htdocs/ /var/www/localhost/htdocs.old
  ln -s /usr/share/webapps/roundcube/ /var/www/localhost/htdocs/
ln -s /usr/share/webapps/roundcube/ /var/www/localhost/htdocs/}}


* Create logs folder
* Create logs folder


  mkdir -p /var/log/roundcube/
{{Cmd|mkdir -p /var/log/roundcube/
  chown -R lighttpd:lighttpd /var/log/roundcube/
chown -R lighttpd:lighttpd /var/log/roundcube/
  chmod 775 /var/log/roundcube/ -R
chmod 775 /var/log/roundcube/ -R}}


== Postgres installation ==
== Postgres installation ==
Line 95: Line 77:
* Add postgresql, create and configure database
* Add postgresql, create and configure database


  apk add postgresql postgresql-client
{{Cmd|apk add postgresql postgresql-client
  /etc/init.d/postgresql setup
rc-service postgresql setup
  /etc/init.d/postgresql start
rc-service postgresql start
  rc-update add postgresql
rc-update add postgresql}}


  su postgres
{{Cmd|su postgres
  createuser roundcube
createuser roundcube}}


Answers: N,N,Y
Answers: N,N,Y
Line 108: Line 90:
* Shall the new role be allowed to create more new roles? (y/n) y
* Shall the new role be allowed to create more new roles? (y/n) y


  createdb -O roundcube -E UNICODE -T template0 roundcubemail
{{Cmd|createdb -O roundcube -E UNICODE -T template0 roundcubemail}}


'''Note:''' Set the same timzone you use in the php.ini (e.g. 'America/Asuncion')
'''Note:''' Set the same timzone you use in the php.ini (e.g. 'America/Asuncion')
Line 122: Line 104:
== Roundcube Web Configuration ==
== Roundcube Web Configuration ==


  https://round.cube.mail.ipaddres/installer/
Start your browser and visit: <nowiki>https://round.cube.mail.ipaddres/installer/</nowiki>


* Roundcube Webmail Installer have 3 steps:
Roundcube Webmail Installer have 3 steps:


1. Check environment
* Check environment
  Check if all is ok, click NEXT
::Check if all is ok, click NEXT


2. Create config
* Create config
 
Here you need to set:
  Here you need to set:
    
    
  a. General configuration
:a. General configuration
      product_name  
::product_name  
        '''Your Country Branch Webmail Access'''
:::'''Your Country Branch Webmail Access'''
        temp_dir
::temp_dir
            '''/tmp/'''
:::'''/tmp/'''
        identities_level
::identities_level
            '''one identity with possibility to edit all params'''
:::'''one identity with possibility to edit all params'''
  b. Logging & Debugging
:b. Logging & Debugging
      log_driver
::log_driver
        '''syslog'''
:::'''syslog'''
      log_dir
::log_dir
        /var/log/roundcube/
:::/var/log/roundcube/


  c. Database setup
: c. Database setup
      db_dsnw
::db_dsnw
        Database settings for read/write operations:
:::Database settings for read/write operations:
        '''PgSQL'''              Database type
:::'''PgSQL'''              Database type
        '''localhost'''          Database server
:::'''localhost'''          Database server
        '''roundcubemail'''      Database name  
:::'''roundcubemail'''      Database name  
        '''roundcube'''   Database user name  
:::'''roundcube'''   Database user name  
        '''*********'''   Database password  
:::'''*********'''   Database password  


  d. IMAP Settings
:d. IMAP Settings
      default_host
::default_host
        The IMAP host(s) chosen to perform the log-in
::The IMAP host(s) chosen to perform the log-in
        '''your.exchange.ip.address'''
:::'''your.exchange.ip.address'''
      username_domain
::username_domain
        '''your.domain'''
:::'''your.domain'''


  e. SMTP Settings
:e. SMTP Settings
      smtp_server
::smtp_server
        '''your.exchange.ip.address'''
:::'''your.exchange.ip.address'''
        Now need to download and copy both files (main.inc.php and db.inc.php) to /etc/roundcube/
Now need to download and copy both files (main.inc.php and db.inc.php) to /etc/roundcube/
 
3. Test config


      Test the SMTP config sending a mail and the IMAP config using a username and password.
* Test config
:: Test the SMTP config sending a mail and the IMAP config using a username and password.


8. Final Steps
== Final Steps==
* Remove or rename the  /usr/share/webapps/roundcube/installer/ folder.
* You should now be able to get to roundcube at:  <nowiki>https://round.cube.mail.ipaddres/</nowiki>


*  Follow the instructions in step 2 of the install to copy the files to the server[[BR]]
[[Category:Mail]]
*  Remove or rename the  /usr/share/webapps/roundcube/installer/ folder.[[BR]]
[[Category:PHP]]
*  You should now be able to get to roundcube at:  https://round.cube.mail.ipaddres/[[BR]]
[[Category:SQL]]

Latest revision as of 10:25, 17 November 2023

This material is obsolete ...

This page needs to either be deleted (Alpine doesn't package Roundcube) or updated with directions for a current version of Alpine with Roundcube 1.6.2 (Discuss)

Roundcube is a free and open source webmail software for the masses, written in PHP.

Installing PHP and Lighttpd

Basic Installation

For installing the additional packages first activate community packages and update the package index

Install the required packages:

# apk add lighttpd php82 fcgi php82-cgi

Configure Lighttpd

Edit lighttpd.conf (/etc/lighttpd/lighttpd.conf) and uncomment the line:

Contents of /etc/lighttpd/lighttpd.conf

... include "mod_fastcgi.conf" ...

Edit mod_fastcgi.conf (/etc/lighttpd/mod_fastcgi.conf), find and change /usr/bin/php-cgi to /usr/bin/php-cgi82.

Contents of /etc/lighttpd/mod_fastcgi.conf

... "bin-path" => "/usr/bin/php-cgi82" # php-cgi ...

Start lighttpd service and add it to default runlevel

# rc-service lighttpd start # rc-update add lighttpd default

To add security, configure https access in Lighttpd.

Add additional packages

apk add php-openssl php-intl

vHost

vi /etc/lighttpd/lighttpd.conf

  • Uncomment this line:
 "mod_simple_vhost"
  • Add this lines
 simple-vhost.server-root   = "/var/www/localhost/htdocs/"
 simple-vhost.default-host  = "/"
 simple-vhost.document-root = "www/"
 $SERVER["socket"] == "round.cube.mail.ipaddres:443" {
 ssl.engine    = "enable"
 ssl.pemfile   = "/etc/lighttpd/server-bundle.pem"
 }
  
  • Restart the web service:

rc-service lighttpd restart

  • Set the php timezone acording to: [1]

vi /etc/php/php.ini

  • Uncomment and set the date.timezone = (e.g. 'America/Asuncion')

Download and Install Rouncube

  • Create folder

mkdir -p /usr/share/webapps cd /usr/share/webapps

  • Download

wget https://downloads.sourceforge.net/project/roundcubemail/roundcubemail/0.5.2/roundcubemail-0.5.2.tar.gz

  • Unpack

tar zxvf roundcubemail-0.5.2.tar.gz

  • Rename folder and change permissions

mv roundcubemail-0.5.2 roundcubemail chmod 775 -R roundcubemail

  • Create the symlynk

mv /var/www/localhost/htdocs/ /var/www/localhost/htdocs.old ln -s /usr/share/webapps/roundcube/ /var/www/localhost/htdocs/

  • Create logs folder

mkdir -p /var/log/roundcube/ chown -R lighttpd:lighttpd /var/log/roundcube/ chmod 775 /var/log/roundcube/ -R

Postgres installation

  • Add postgresql, create and configure database

apk add postgresql postgresql-client rc-service postgresql setup rc-service postgresql start rc-update add postgresql

su postgres createuser roundcube

Answers: N,N,Y

  • Shall the new role be a superuser? (y/n) n
  • Shall the new role be allowed to create databases? (y/n) n
  • Shall the new role be allowed to create more new roles? (y/n) y

createdb -O roundcube -E UNICODE -T template0 roundcubemail

Note: Set the same timzone you use in the php.ini (e.g. 'America/Asuncion')

 psql roundcubemail
 ALTER USER roundcube WITH PASSWORD 'the_new_password';
 ALTER DATABASE roundcubemail SET timezone TO 'America/Asuncion';
 \c - roundcube
 \i /usr/share/webapps/roundcube/SQL/postgres.initial.sql
 roundcubemail=> \q
 exit

Roundcube Web Configuration

Start your browser and visit: https://round.cube.mail.ipaddres/installer/

Roundcube Webmail Installer have 3 steps:

  • Check environment
Check if all is ok, click NEXT
  • Create config

Here you need to set:

a. General configuration
product_name
Your Country Branch Webmail Access
temp_dir
/tmp/
identities_level
one identity with possibility to edit all params
b. Logging & Debugging
log_driver
syslog
log_dir
/var/log/roundcube/
c. Database setup
db_dsnw
Database settings for read/write operations:
PgSQL Database type
localhost Database server
roundcubemail Database name
roundcube Database user name
********* Database password
d. IMAP Settings
default_host
The IMAP host(s) chosen to perform the log-in
your.exchange.ip.address
username_domain
your.domain
e. SMTP Settings
smtp_server
your.exchange.ip.address

Now need to download and copy both files (main.inc.php and db.inc.php) to /etc/roundcube/

  • Test config
Test the SMTP config sending a mail and the IMAP config using a username and password.

Final Steps

  • Remove or rename the /usr/share/webapps/roundcube/installer/ folder.
  • You should now be able to get to roundcube at: https://round.cube.mail.ipaddres/