Composr Tutorial: Installation on Linux

Written by Jean Gosselin, and Chris Graham
This tutorial covers some more advanced installation considerations when installing on Linux. The majority of people on Linux hosting will not need to read this tutorial.

These instructions also apply to a Mac server.


Pre-setup

If you are on a new server remember to install any system updates.

Quick installation, without the quick installer!

If you have difficulties with the quick installer, and do not wish to upload all the files and perform chmodding individually, then you may wish to transfer directly to the server and unzip from the server.

Unzipping via the Linux shell

First, some warnings:
  • Due to the varying configurations of Linux servers, we can't provide precise instructions, so we do not recommend that anyone perform this if they are not already comfortable with the Linux shell.
  • We are not responsible for misuse of these commands. If you do not know the effect each will have on your system, do not run them until you do.
  • Do not run subsequent commands if one command fails, or you might make a mess.
  • If you are on shared hosting it may be that you do not have shell access anyway.

A sequence of commands similar to the following need to be run…

Enter the web directory:

Code (Bash)

cd httpdocs
 
Download the archive from the https://composr.app website:

Code (Bash)

wget <url-to-composr-zip-file>
 
Unzip the archive:

Code (Bash)

unzip cms-<version>.zip
 
Remove the archive:

Code (Bash)

rm -f cms-<version>.zip
 

Fix all the necessary file permissions, but only if you are not running on a suEXEC-style server:

Code (Bash)

sh fixperms.sh
 

You must then launch the URL to the install.php in your web browser, and proceed through the installation steps.

After this, you must delete the install.php file:

Code (Bash)

rm -f install.php
 

Unzipping from a webhosting control panel

Many webhosting control panels allow you to unzip uploaded files, using their file manager. You can do this on the manual installer archive.

Package installation (advanced)

This section contains some suggestions for which packages to install on different Linux distributions to get a good PHP environment. It is only applicable to people who aren't on traditional hosting with a webhosting control panel to manage things from.

This section is not actively maintained. Package names may change, but it is designed to give a leg-up to people configuring new Linux servers.

Ubuntu/Debian

These instructions have not been tested since changes have been made to them.

Code (Bash)

apt install apache2 libapache2-mod-php php php-common php-fpm php-cli php-apcu curl php-curl \
php-enchant php-ffmpeg php-gd php-imap php-zip php-mysqlnd php-mbstring php-pspell \
php-xml php-intl php-json openssl mysql-server mysql-client \
postfix nano wget lynx hunspell aspell aspell-en git openssh-server sysstat iotop \
screen zip unzip bzip2 gzip tar whois dnsutils \
lsof mlocate poppler-utils
 

If you want to deploy Let's Encrypt certificates you may also consider:

Code (Bash)

apt install certbot certbot python-certbot-apache
 

Some lines in the default PHP ini (/etc/php7/apache2/php.ini) file need changing:
From To
upload_max_filesize = 2M upload_max_filesize = 500M
post_max_size = 8M post_max_size = 500M
;date.timezone = date.timezone = "UTC" (to avoid errors on PHP startup)
; extension_dir = "./" extension_dir = "usr/lib/php7/20121212"
;opcache.enable=0 opcache.enable=1

(the extension_dir may actually be different on different versions, so check that)

Fedora/RHEL/AlmaLinux/CentOS Stream

You may need to setup the EPEL repository first.

Code (Bash)

yum install httpd mod_ssl mod_fcgid php php-common php-fpm php-cli php-pecl-apcu php-pdo curl \
enchant freetype php-gd php-imap php-pecl-zip php-mysqlnd php-mbstring php-pspell \
php-xml php-intl php-json openssl mariadb-server mysql \
sendmail nano wget hunspell hunspell-en aspell aspell-en git openssh-server sysstat iotop \
screen zip unzip bzip2 gzip tar whois bind-utils \
lsof mlocate dnf-automatic poppler-utils
 

If you want to deploy Let's Encrypt certificates you may also consider:

Code (Bash)

yum install certbot python3-certbot-apache
 

You may have selinux installed, you can see if you do with sestatus:
[root@localhost html]# sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   enforcing
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      28

If so, you need to set additional write permissions with something like:
chcon -R -t httpd_sys_rw_content_t /var/www

You may also want to include yum-cron (or whatever it is now) in there, for automatic system updates (who has time to stay on top of all server software for urgent security patches?).

Some lines in the default PHP ini (/etc/php.ini) file need changing:
upload_max_filesize = 2Mupload_max_filesize = 500M
post_max_size = 8Mpost_max_size = 500M
;date.timezone = date.timezone = "UTC" (to avoid errors on PHP startup)

Installing on Cloud hosting

There is nothing stopping Composr working on compatible cloud hosting.

One note is that PaaS providers may host files separately to where execution happens, and this can slow down disk access. You may need to change the "Number of files per cycle" in the quick installer to something lower such as 50 to avoid time-outs (e.g. white screens).

Rackspace Cloud

Specifically on Rackspace Cloud, you will need to set execution permissions of the install.php file lower than the defaults may have been after you uploaded:
  • Open your SFTP/FTP client and find install.php
  • Access the permissions for the file, and remove write access for the owner, group, and others (the UNIX code for this is 444)

Working out of Git (advanced)

It is possible to run Composr direct from a main Git repository checkout.

However, be aware the main Git repository contains all non-bundled addons. It is used by developers who want to keep everything in the ecosystem in-harmony when developing new features.

If you are going to run from the main Git repository, it is best to install it properly rather than just downloading the ZIP from GitLab. Then you can do git pull commands whenever you want to update the code with the latest changes.

If you are a programmer making your own standalone site you can use Git, but you should make your own repository from a normal Composr install.

Here is some specific advice for people working from our Git repository:
  • To temporarily turn off addons, use safe mode (&keep_safe_mode=1)
  • You'll want to uninstall lots of non-bundled addons hosted in the repository. When merging with upstream files may come back, so there is a script delete_alien_files.php which should help you decide what files to delete.
  • Running from Git runs Composr in dev mode, which adds extra constraints and checks (or maybe even removes some designed for live sites). No live site should ever be left in dev mode. To change that add this to _config.php: $SITE_INFO['dev_mode'] = '0';
  • To stop Composr complaints about the installer being there, while also blocking the installer from running, create empty install_ok and install_locked files.

See also


Feedback

Please rate this tutorial:

Have a suggestion? Report an issue on the tracker.